Skip to content

feat(sessions): replace sendHandoff resume path with acpx native session continuation - #85

Merged
vriesdemichael merged 2 commits into
mainfrom
78-acpx-session-continuation
Apr 2, 2026
Merged

feat(sessions): replace sendHandoff resume path with acpx native session continuation#85
vriesdemichael merged 2 commits into
mainfrom
78-acpx-session-continuation

Conversation

@vriesdemichael

Copy link
Copy Markdown
Owner

Summary

  • Add AcpxSessionManager.continueSession() which runs acpx sessions new --from <acpx-session-id> to create a new session that inherits context natively, instead of building a transcript prompt
  • Add AgentRegistry.resumeSession() that prefers continueSession when available and falls back to newSession + sendHandoff for adapters that don't support native continuation
  • Simplify POST /sessions/:id/resume route to delegate entirely to registry.resumeSession(), removing the inline create+handoff logic
  • Move session/resume from unknown to implemented in AcpxSessionManager.ENDPOINT_SUPPORT
  • Add getAgentSessionId() to AcpxSessionManager so the registry can resolve the correct --from reference for live (non-history) source sessions
  • 13 new tests covering continueSession, getAgentSessionId, and the updated resume route behaviour

closes #78

…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
Copilot AI review requested due to automatic review settings April 2, 2026 22:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 to newSession + sendHandoff.
  • Simplified POST /sessions/:id/resume to delegate to registry.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.

Comment thread backend/src/agents/registry.ts Outdated
Comment thread backend/src/acpx/session-manager.ts
Comment thread backend/src/agents/types.ts Outdated
- 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
@vriesdemichael
vriesdemichael merged commit 5e47286 into main Apr 2, 2026
1 check passed
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.

Backend: agent handoff/continuation via acpx

2 participants