Repository navigation
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
There was a problem hiding this comment.
The move notification works. I ran the #66573 reproduction from source on the base and on this branch. With the session moved through the ACP process's own server (as the agent's session.move tool does), the client gets session_info_update with _meta["opencode/directory"]. After a restart, the cwd-mismatch error now includes the session's real directory, and loading with that directory works. The repro's opencode api session.move goes to a different server (ACP starts its own standalone one), so that path still sends nothing, which is expected. bun test test/acp (119 pass) and tsc -b both pass.
Public API (ACP protocol), additive and backwards compatible:
- New: attached sessions get a
session_info_updatewith_meta: { "opencode/directory": <dir> }when they move. - Changed: the invalid-params error for a cwd mismatch on
session/load/session/resume/session/forkaddsdata.directory, and its message gains; session directory: <dir>.
Concerns:
- Please remove
docs/superpowers/plans/2026-11-26-acp-session-move.mdanddocs/superpowers/specs/2026-11-26-acp-session-move-design.md. They look like planning notes for the change, not repository docs. - After a client restart, a client that doesn't read the new
_metakey (Zed today) still can't load the session with its original cwd. It can only recover by readingdirectoryfrom the error. That helps, but it's worth being explicit that the restart case reported in #66573 depends on clients adopting this. recoverretries without limit (see inline comment).
Related: #52952
| ) | ||
| }) | ||
|
|
||
| const recover = Effect.fnUntraced(function* (entry: Entry, previous: Catalog, directory: string) { |
There was a problem hiding this comment.
If the destination catalog never loads (for example, the worktree was removed or its config is broken), this retries every second for as long as the session stays attached, and nothing is logged. Until it succeeds there is no follow fiber, so entry.selected isn't drained: model and mode switches made elsewhere stop producing config_option_update for this session. Could you cap the retries or back off, log the failure, and keep handling selection changes on the previous catalog until the destination loads?
| @@ -0,0 +1,201 @@ | |||
| # ACP Session Move Rebinding Implementation Plan | |||
There was a problem hiding this comment.
This file and docs/superpowers/specs/2026-11-26-acp-session-move-design.md look like planning notes for this change and shouldn't be committed to the repository. Please drop both. The user-facing docs in acp.mdx are enough.
Issue for this PR
Closes #66573
Type of change
What does this PR do?
opencode acpignoredsession.moved, so moving a session to a worktree left the client pinned to the old cwd and unable to load it after restart. ACP now rebinds the attached session to the new directory, reloads catalog/MCP state, notifies the client with_meta["opencode/directory"], and uses the current directory for active and background turn permissions/diffs. Catalog watching recovers after transient destination load failures. Mismatch errors also include the real session directory.No feature flag is needed for this bug fix.
How did you verify your code works?
bun test test/acp/session.test.ts test/acp/permission.test.ts test/acp/turn.test.ts --rerun-each 10 --timeout 30000 --only-failures— 220 passbun test test/acp --timeout 30000 --only-failures— 119 passbun typecheckandbun run typecheck:tscinpackages/cli— passbun typecheckinservices/site— passbun run buildinservices/site— pass (668 docs pages, worker start checks pass)bun run lintwith the repository's pinned tools — pass (existing warnings only)Screenshots / recordings
No UI change.
Checklist
Added by the opencode bot (AI-generated).
Related: #52952
Public API: ACP: adds a
session_info_updatewith_meta["opencode/directory"]when a session moves, and addsdirectoryto the cwd-mismatch error data (backwards compatible)