Skip to content

fix(client): make v2 close and delete idempotent and add PendingPermissions - #182

Open
EugeneTheDev wants to merge 1 commit into
masterfrom
eugenethedev/subagents-stack/07-v2-close
Open

EugeneTheDev wants to merge 1 commit into
masterfrom
eugenethedev/subagents-stack/07-v2-close

Conversation

@EugeneTheDev

@EugeneTheDev EugeneTheDev commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

Part 7 of 11 of the stacked split of #158 (v1 subagents).

Contents

  • v2 ClientSession.close and Client.deleteSession treat -32002 (resource not found) as success, as ACP asks.
  • A v2 session object that was closed or deleted sends nothing on a later close, so it can't close a newer
    session that reused its id.
  • New client.internal.PendingPermissions:
    • RootPendingPermissions replaces PendingPermissionCancellation in the v2 client session;
    • SubagentPendingPermissions is for the v1 client's subagents.
  • Tests: v2 ClientSessionTest and SubagentPendingPermissionsTest.

Caveats

  • Unused for now: SubagentPendingPermissions until 09.
  • AGENTS.md: master's bullet still says both client runtimes race through PendingPermissionCancellation.
    That is wrong for v2 from this layer on. The final bullet would be wrong for v1 until 09, so the old bullet stays
    until then.

Stack

  1. chore: add the multi-agent orchestration tooling #176 — chore: add the multi-agent orchestration tooling
  2. build: move buildSrc to build-logic and check that internal packages hold no public API #177 — build: move buildSrc to build-logic and check that internal packages hold no public API
  3. docs(samples): give each sample its own package, run task and README #178 — docs(samples): give each sample its own package, run task and README
  4. refactor: move MaybeUndefined to the model package and runtime internals to internal packages #179 — refactor: move MaybeUndefined to the model package and runtime internals to internal packages
  5. feat(protocol)!: order handler starts by arrival and add response hooks #180 — feat(protocol)!: order handler starts by arrival and add response hooks
  6. feat(model): add the v1 subagent models and promote session/close to stable #181 — feat(model): add the v1 subagent models and promote session/close to stable
  7. fix(client): make v2 close and delete idempotent and add PendingPermissions #182 — fix(client): make v2 close and delete idempotent and add PendingPermissions ← this PR
  8. feat!: add v1 subagents to the agent runtime and deliver session events through ClientSessionOperations.notify #183 — feat!: add v1 subagents to the agent runtime and deliver session events through ClientSessionOperations.notify
  9. feat(client)!: add v1 subagent sessions and the Opened marker to the client runtime #184 — feat(client)!: add v1 subagent sessions and the Opened marker to the client runtime
  10. test(client): cover v1 client openings and subagents over the wire and across transports #185 — test(client): cover v1 client openings and subagents over the wire and across transports
  11. docs(samples): add a subagents sample #186 — docs(samples): add a subagents sample

Next steps

…ssions

- v2 `ClientSession.close` and `Client.deleteSession` treat `-32002`
  (resource not found) as success, as ACP asks. A session object that was
  closed or deleted sends nothing on a later `close`, so it can't close a
  session that reused its id.
- Add `client.internal.PendingPermissions`: `RootPendingPermissions`, which
  the v2 client session now uses for its permission cancel race, and
  `SubagentPendingPermissions`, used by the v1 client later.
- Tests: v2 `ClientSessionTest` and `SubagentPendingPermissionsTest`.
@EugeneTheDev
EugeneTheDev force-pushed the eugenethedev/subagents-stack/07-v2-close branch from d0f018f to 973a133 Compare December 4, 2026 16:29
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.

1 participant