-
Notifications
You must be signed in to change notification settings - Fork 125
Open
Labels
Description
Problem
Goose has native SQLite-based session persistence (~/.local/share/goose/sessions/sessions.db) and supports resuming named sessions via goose run --resume --name <name>. However, start.sh always starts a fresh session with no resume logic. It also doesn't pass --type goose to agentapi.
The module currently passes the task prompt via --instructions "$PROMPT_FILE". On resume, this must be skipped to avoid re-sending the task into an active conversation.
Desired outcome
- On cold start (no prior session): Goose creates a named session and processes the task prompt.
- On warm start (prior session exists): Goose resumes the named session. The task prompt (
--instructions) is not re-sent. --type gooseis passed toagentapi server.- Expose
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.
Claude Code's start.sh is the reference implementation for this pattern (session detection, conditional resume, prompt skipping).
Key upstream behaviors
goose run --resume --name Xwhen session X doesn't exist: Goose warns and creates a new session (block/goose#3904). This is a safe fallback.- The SQLite DB uses WAL mode, meaning
sessions.db-walandsessions.db-shmsidecar files must be on the same persistent volume. sqlite3CLI may not be installed in all workspace images. Session detection should not depend on it, or should degrade gracefully.- block/goose#6236 reported subprocess panics when resuming without a TTY. AgentAPI provides a PTY but this combination should be tested.
Version bump
minor
Refs #696, coder/internal#1258
Reactions are currently unavailable