feat: add --resume-session flag to attach to existing agent sessions#95
Merged
feat: add --resume-session flag to attach to existing agent sessions#95
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference #85
What
Adds
--resume-session <id>tosessions newandsessions 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: whenresumeSessionIdis provided,createSession()usesclient.loadSession()instead ofclient.createSession()src/cli-core.ts: threads--resume-sessionthroughsessions newandsessions ensuresrc/cli/flags.ts: adds the new CLI flagtest/mock-agent.ts: adds a mock not-foundloadSessionpath for CLI coverageValidation