Skip to content

gemini: wire session resume on workspace restart #745

@mafredri

Description

@mafredri

Problem

Gemini CLI supports gemini --resume "latest" for resuming the most recent session, and stores session JSON files under ~/.gemini/tmp/<project_hash>/chats/. The module's start.sh always starts a fresh session with no resume logic. It also doesn't pass --type gemini to agentapi.

The module currently passes the task prompt via --prompt-interactive "$PROMPT". On resume, this must be skipped.

Desired outcome

  • On cold start: Gemini starts normally with the task prompt.
  • On warm start (prior sessions exist): Gemini resumes the latest session. The task prompt is not re-sent.
  • --type gemini is passed to agentapi server.
  • After feat(coder/modules/agentapi): add state persistence #736 lands: enable_state_persistence = true.

Key upstream behaviors

  • Critical: --resume "latest" causes a dead loop when no sessions exist (google-gemini/gemini-cli#15892). The module MUST check for existing sessions before passing --resume. Session files live under ~/.gemini/tmp/*/chats/*.json.
  • Session files can grow very large (400MB+ reported in google-gemini/gemini-cli#15292) for long-running tasks.

Version bump

minor

Refs #696

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions