-
Notifications
You must be signed in to change notification settings - Fork 125
Open
Labels
Description
Problem
Amp stores threads entirely server-side on Sourcegraph's infrastructure. Resume uses amp threads continue [threadId], which is a subcommand rather than a flag. The module currently creates a new thread on every startup by piping the prompt via echo "$PROMPT" | amp. There is no mechanism to capture or reuse a thread ID across restarts.
--type amp is already present. No --type change needed.
Desired outcome
- On cold start: Amp starts a new thread. The thread ID is captured and persisted.
- On warm start: Amp continues the prior thread via
amp threads continue <threadId>. The prompt delivery mechanism changes entirely (from stdin pipe to subcommand). - 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.
Investigation needed first
Test these approaches for capturing the thread ID:
- Check if Amp sets an
AMP_THREAD_IDenvironment variable. - Parse
--stream-jsonoutput for a thread/session identifier. - Use
amp threads listafter the first run. Check if it supports machine-readable output.
Also verify:
- What happens with
amp threads continue <invalidId>? - Does
amp threads continuework reliably in headless mode via agentapi?
Thread resume requires network connectivity to Sourcegraph servers. Air-gapped environments cannot use it.
Version bump
minor
Refs coder/internal#1258
Reactions are currently unavailable