Skip to content

feat: add --resume-session flag to attach to existing agent sessions#95

Merged
frankekn merged 1 commit intomainfrom
maint/pr85-resume-session
Mar 10, 2026
Merged

feat: add --resume-session flag to attach to existing agent sessions#95
frankekn merged 1 commit intomainfrom
maint/pr85-resume-session

Conversation

@frankekn
Copy link
Copy Markdown
Contributor

Reference #85

What

Adds --resume-session <id> to sessions new and sessions ensure, allowing acpx to attach to an existing ACP session instead of always creating a fresh one.

Why

This bridges the gap between sessions started directly in Codex or Claude Code and later continued through acpx or an orchestrator on top of acpx.

How

  • src/session-runtime.ts: when resumeSessionId is provided, createSession() uses client.loadSession() instead of client.createSession()
  • src/cli-core.ts: threads --resume-session through sessions new and sessions ensure
  • src/cli/flags.ts: adds the new CLI flag
  • test/mock-agent.ts: adds a mock not-found loadSession path for CLI coverage

Validation

source ~/.nvm/nvm.sh && nvm use 22.18.0 >/dev/null && pnpm install --frozen-lockfile
source ~/.nvm/nvm.sh && nvm use 22.18.0 >/dev/null && pnpm run format:check
source ~/.nvm/nvm.sh && nvm use 22.18.0 >/dev/null && pnpm run typecheck
source ~/.nvm/nvm.sh && nvm use 22.18.0 >/dev/null && pnpm run build
source ~/.nvm/nvm.sh && nvm use 22.18.0 >/dev/null && pnpm run test
source ~/.nvm/nvm.sh && nvm use 22.18.0 >/dev/null && pnpm run build:test && node --test --test-name-pattern='resume-session' dist-test/test/cli.test.js

Add --resume-session <id> to 'sessions new' and 'sessions ensure', allowing
users to create an acpx session that resumes an existing agent session
(e.g., one started directly in Codex or Claude Code) instead of creating
a fresh one.

When resumeSessionId is provided, createSession() calls client.loadSession()
instead of client.createSession(). Errors hard if the agent doesn't support
session/load or the session ID isn't found (no silent fallback).

Includes 4 new integration tests covering success, unsupported agent,
not-found session, and ensure path.
@frankekn frankekn merged commit 336fac8 into main Mar 10, 2026
7 checks passed
@frankekn frankekn deleted the maint/pr85-resume-session branch March 10, 2026 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants