Skip to content

amazon-q: wire session resume on workspace restart #746

@mafredri

Description

@mafredri

Note: Amazon Q Developer CLI is deprecated in favor of Kiro CLI (closed-source). The upstream repo is in security-fixes-only mode. Before starting this work, assess whether the module has a future. If it's approaching removal, consider only adding --type amazon-q and skipping resume.

Problem

Amazon Q supports q chat --resume which resumes a prior conversation keyed by working directory (stored in ~/.local/share/amazon-q/data.sqlite3). The module's start.sh always starts fresh. It also doesn't pass --type amazon-q to agentapi.

The module currently appends the task prompt directly to the args array. On resume, this must be skipped.

Desired outcome

  • On cold start: Amazon Q starts normally with the task prompt.
  • On warm start: Amazon Q resumes the prior conversation. The task prompt is not re-sent.
  • --type amazon-q 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

  • q chat --resume silently starts a new conversation when no prior state exists for the current working directory. No existence check needed (unlike Gemini).
  • Amazon Q keys conversations by working directory. ARG_WORKDIR must be consistent across stop/start cycles.
  • Whether q chat --resume works correctly when wrapped by agentapi's terminal proxy is untested. Verify in a workspace before shipping.
  • aws/amazon-q-developer-cli#3622: ValidationException when conversation history exceeds backend token limits on resume.
  • Auth credentials from auth_tarball at ~/.local/share/amazon-q/ must survive restarts.

Version bump

minor

Refs #696, coder/internal#1258

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions