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.
- Expose
enable_state_persistence in main.tf (default true) and pass it through to the module "agentapi" block so the Coder UI preserves chat history across restarts, matching the agent's resumed session.
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, coder/internal#1258
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'sstart.shalways starts a fresh session with no resume logic. It also doesn't pass--type geminito agentapi.The module currently passes the task prompt via
--prompt-interactive "$PROMPT". On resume, this must be skipped.Desired outcome
--type geminiis passed toagentapi server.enable_state_persistenceinmain.tf(defaulttrue) and pass it through to themodule "agentapi"block so the Coder UI preserves chat history across restarts, matching the agent's resumed session.Key upstream behaviors
--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.Version bump
minorRefs #696, coder/internal#1258