Skip to content

fix(acp): list sessions across projects#33037

Open
vegerot wants to merge 1 commit into
anomalyco:devfrom
vegerot:acp-session-list
Open

fix(acp): list sessions across projects#33037
vegerot wants to merge 1 commit into
anomalyco:devfrom
vegerot:acp-session-list

Conversation

@vegerot

@vegerot vegerot commented Jun 19, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #33036
Closes #18575
Closes #16137

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

ACP session/list treats cwd as an optional filter. When it is omitted, clients expect the first page of sessions known to the agent.

OpenCode previously routed ACP session discovery through the project-scoped /session endpoint, so registry-launched clients could see stale or empty history. This switches ACP discovery to the global session endpoint and keeps applying cwd only when the client provides it.

How did you verify your code works?

  • bun test test/acp/service-session.test.ts
  • bun typecheck
  • bun run build --single
  • python3 test_acp_final.py from the Zed repo returned 100 OpenCode sessions and nextCursor
  • pre-push hook ran bun turbo typecheck

Screenshots / recordings

N/A; non-UI ACP behavior change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Use the global session listing endpoint for ACP session discovery so clients like Zed can import OpenCode history across projects instead of only the current project.

ACP session/list defines cwd as an optional filter: when clients omit cwd, they are asking for the first page of sessions known to the agent, not sessions scoped to the ACP process working directory. The previous implementation delegated to the legacy project-scoped /session endpoint, which made registry-launched ACP processes appear to have stale or empty history. Delegate to the global /experimental/session endpoint instead and keep applying cwd only when the client supplies it.

Closes anomalyco#33036

Closes anomalyco#18575

Closes anomalyco#16137

Co-authored-by: opencode <opencode@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 19, 2026 22:10
@github-actions

Copy link
Copy Markdown
Contributor

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

Based on my search, I found one potentially related PR:

Related PR:

No exact duplicates found. PR #33037 appears to be addressing a specific issue with the ACP session/list endpoint treating cwd as an optional filter and switching to the global session endpoint, which is distinct from other session-related PRs in the codebase.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes ACP session/list behavior to align with the ACP spec by treating cwd purely as an optional filter. When cwd is omitted, the ACP agent now lists sessions across projects by using the global (experimental) session listing endpoint, avoiding accidental scoping to the ACP process working directory.

Changes:

  • Switch ACP session discovery from sdk.session.list (project-scoped) to sdk.experimental.session.list (global).
  • Add cursor + limit plumbing for the global endpoint call (fetch limit + 1 to support ACP pagination).
  • Extend ACP session tests to assert the global endpoint is used when cwd is omitted.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/opencode/src/acp/service.ts Routes ACP listSessions through the global experimental session list endpoint while keeping cwd as an optional filter.
packages/opencode/test/acp/service-session.test.ts Updates the SDK test stub to include experimental.session.list and adds assertions verifying global listing behavior.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants