feat(sessions): replace sendHandoff resume path with acpx native session continuation - #85
Merged
Merged
Conversation
…ion continuation Add AcpxSessionManager.continueSession() which shells out to 'acpx sessions new --from <acpx-session-id>' to create a new session that inherits context from the source session natively. Add getAgentSessionId() to expose the underlying acpx session ID so the registry can pass the correct --from reference when the source session is a live (non-history) session. Add AgentRegistry.resumeSession() which prefers native continuation when the target adapter supports it and falls back to newSession + sendHandoff for adapters that do not. Update POST /sessions/:id/resume to delegate entirely to registry.resumeSession(), simplifying the route handler. Move session/resume from the unknown to implemented list in ENDPOINT_SUPPORT for AcpxSessionManager. closes #78
There was a problem hiding this comment.
Pull request overview
This PR updates the backend session “resume” flow to prefer acpx-native session continuation (acpx sessions new --from ...) when supported, centralizing the logic in AgentRegistry.resumeSession() and simplifying the HTTP route implementation.
Changes:
- Added native continuation hooks to the session adapter API (
continueSession,getAgentSessionId) and implemented them for the acpx adapter. - Introduced
AgentRegistry.resumeSession()to prefer native continuation and fall back tonewSession + sendHandoff. - Simplified
POST /sessions/:id/resumeto delegate toregistry.resumeSession()and updated/added tests around the new behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| backend/src/routes/sessions.ts | Resume route now delegates to registry.resumeSession() instead of inline create+handoff logic. |
| backend/src/routes/sessions.test.ts | Updated resume-route tests to assert delegation to resumeSession. |
| backend/src/agents/types.ts | Expanded SessionAdapter interface with continueSession and getAgentSessionId. |
| backend/src/agents/registry.ts | Added resumeSession orchestration logic (native continuation preferred, fallback supported). |
| backend/src/acpx/session-manager.ts | Implemented continueSession, getAgentSessionId, and marked session/resume as implemented. |
| backend/src/acpx/session-manager.test.ts | Added coverage for continueSession, getAgentSessionId, and endpoint support reporting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Rename continueSession param fromAcpxSessionId → fromAgentSessionId (types.ts, session-manager.ts) - Throw in continueSession when acpxSessionId is null instead of silently continuing without context - resumeSession only uses native continuation with a reliable agent-side id (history or live with getAgentSessionId) - Fix test mocks: use constructor functions for AcpxSessionManager mockImplementationOnce - Fix continueSession cwd test: provide stdout with session id to avoid spurious throw
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.
Summary
AcpxSessionManager.continueSession()which runsacpx sessions new --from <acpx-session-id>to create a new session that inherits context natively, instead of building a transcript promptAgentRegistry.resumeSession()that preferscontinueSessionwhen available and falls back tonewSession+sendHandofffor adapters that don't support native continuationPOST /sessions/:id/resumeroute to delegate entirely toregistry.resumeSession(), removing the inline create+handoff logicsession/resumefromunknowntoimplementedinAcpxSessionManager.ENDPOINT_SUPPORTgetAgentSessionId()toAcpxSessionManagerso the registry can resolve the correct--fromreference for live (non-history) source sessionscontinueSession,getAgentSessionId, and the updated resume route behaviourcloses #78