Skip to content

Conversation

@remorses
Copy link
Contributor

@remorses remorses commented Jan 12, 2026

Closes #7978

Summary

  • Add session/list (unstable) with cursor-based pagination
  • Add session/fork (unstable) to fork existing sessions
  • Update @agentclientprotocol/sdk to 0.12.0

Smoke test script: https://gist.github.com/remorses/ddec691b72cef0ae128dc440505596f6

@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@remorses remorses marked this pull request as ready for review January 13, 2026 12:39
Copilot AI review requested due to automatic review settings January 13, 2026 12:39
Copy link
Contributor

Copilot AI left a comment

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 adds support for two ACP draft/unstable methods: session/list for listing existing sessions with cursor-based pagination, and session/fork for creating new sessions branched from existing ones. The implementation includes updating the SDK from version 0.5.1 to 0.12.0 to support these new capabilities.

Changes:

  • Added session/list (unstable) with cursor-based pagination sorted by most recently updated
  • Added session/fork (unstable) to create new sessions from existing ones
  • Updated @agentclientprotocol/sdk dependency from 0.5.1 to 0.12.0
  • Refactored session replay logic into a reusable private method
  • Improved defensive programming in the providers call with optional chaining

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.

File Description
packages/opencode/src/acp/agent.ts Implements unstable_listSessions and unstable_forkSession methods, adds sessionCapabilities to initialization, refactors replay logic, and improves error handling
packages/opencode/package.json Updates @agentclientprotocol/sdk from 0.5.1 to 0.12.0
bun.lock Updates lock file with new SDK version and peer dependency changes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nonsleepr
Copy link

Hey @remorses! 👋

I've been working on the same session/list feature and noticed your PR. Rather than duplicate efforts, I'd love to collaborate.

What I have:

  • 113 tests covering ACP functionality including session/list pagination edge cases
  • Upgraded to SDK 0.13.0 (vs 0.12.0 in this PR)

One design difference to discuss:

Your implementation loads all sessions then slices in memory:

const all = await Session.list({ cwd: ... })
return all.slice(start, start + limit)

My implementation uses backend pagination via the SDK's start/limit params:

const result = await Session.list({ cwd, start, limit })

The backend approach scales better for users with many sessions (doesn't load everything into memory).

My branch: https://github.com/nonsleepr/opencode/tree/feat/acp-session-list

Happy to:

  1. Contribute my test suite to this PR
  2. Help update to SDK 0.13.0
  3. Discuss the pagination approach with you/maintainers

Let me know if you'd like to collaborate! If you're busy, I can also open a separate PR and let maintainers decide which approach to merge.

# Conflicts:
#	packages/opencode/src/acp/agent.ts
- Add unstable_resumeSession method (like loadSession but without replaying messages)
- Add resume capability to sessionCapabilities
- Fix unstable_listSessions to use SDK pagination (start/limit) instead of in-memory slicing
- Remove calls to undefined setupEventSubscriptions method
@remorses
Copy link
Contributor Author

Hey @nonsleepr, thanks for the feedback! We updated the implementation to use cursor-based pagination following the ACP spec. Also added session/resume support.

Regarding your test suite - we took a look but decided not to include them since they rely heavily on mocks, which doesn't align with our testing approach.

We'll keep this PR moving forward. Feel free to review the latest changes!

@rekram1-node rekram1-node merged commit 416aaff into anomalyco:dev Jan 21, 2026
5 checks 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.

feat(acp): add session/list, session/resume and session/fork support

3 participants