You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
opencode: enable session resume by default and fix prompt re-delivery #742
Resume is off by default. The module has full resume wiring (--continue, --session, --type opencode all present in start.sh) but the continue variable in main.tf defaults to false. Out of the box, sessions are never resumed.
Prompt is re-sent on resume. In build_opencode_args(), the initial prompt is added to AGENTAPI_ARGS via -I "$PROMPT" unconditionally when ARG_AI_PROMPT is set, regardless of whether ARG_CONTINUE is true. When a session is resumed, the task prompt gets re-injected into an already-active conversation, potentially re-triggering the original task.
To reproduce: set continue = true and ai_prompt = "some task". Start the module, have a conversation, stop, restart. The agent resumes the session but the task prompt is re-sent as a new message.
OpenCode's --continue gracefully creates a new session when no prior sessions exist, so the default flip is safe for first-run scenarios.
Desired outcome
continue defaults to true.
The initial prompt is only sent on cold start, not when resuming an existing session.
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.
Activity