Skip to content

ACP session/list without cwd is scoped to process project #33036

Description

@vegerot

Description

OpenCode's ACP session/list implementation currently does not conform to the ACP session-list behavior when the client omits cwd.

The ACP spec says session/list is for sessions known to the agent:

Lists existing sessions known to the agent.

https://agentclientprotocol.com/protocol/v1/schema#session-list

The dedicated Session List page says:

All parameters are optional. A request with an empty params object returns the first page of sessions.

and defines cwd as an optional filter:

Filter sessions by working directory. Must be an absolute path. Only sessions with a matching cwd are returned.

https://agentclientprotocol.com/protocol/v1/session-list#listing-sessions

OpenCode currently routes ACP session/list through the project-scoped /session endpoint, so an empty {} request is implicitly scoped to the ACP process working directory/project instead of returning the first page of known sessions. This makes registry-launched ACP clients report stale or empty history.

This nonconformance caused or explains:

Plugins

None

OpenCode version

Current dev branch; observed in ACP implementation

Steps to reproduce

  1. Create OpenCode sessions in multiple project directories.
  2. Start opencode acp from a directory that is not one of those projects, or via an ACP registry launch.
  3. Send ACP session/list with cwd: null:
echo '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": 1, "clientCapabilities": {}}}
{"jsonrpc": "2.0", "id": 2, "method": "session/list", "params": {"cursor": null, "cwd": null}}' | opencode acp 

If your shell/process closes stdin before the second response is emitted, this equivalent delayed form keeps the pipe open long enough to observe the response:

{ printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":1,"clientCapabilities":{}}}'; sleep 1; printf '%s\n' '{"jsonrpc":"2.0","id":2,"method":"session/list","params":{"cursor":null,"cwd":null}}'; sleep 1; } | opencode acp
  1. Observe OpenCode returns only sessions scoped to the process cwd/project, or an empty/stale list, instead of the first page of known sessions.

Screenshot and/or share link

N/A

Operating System

macOS; also reported by users on Linux

Terminal

N/A

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions