Skip to content

fix: isolate raw tool payloads in session snapshots - #171

Merged
PsiACE merged 1 commit into
agentclientprotocol:mainfrom
ningyixi:fix/raw-tool-payload-isolation
Oct 18, 2026
Merged

PsiACE merged 1 commit into
agentclientprotocol:mainfrom
ningyixi:fix/raw-tool-payload-isolation

Conversation

@ningyixi

Copy link
Copy Markdown
Contributor

SessionAccumulator retains raw tool input/output by reference. Mutating a received notification's nested payload changes the accumulated state and existing snapshots; mutating a returned snapshot likewise changes subsequent snapshots and the source notification. Other tool fields, such as content and locations, are already copied at these boundaries.

Deep-copy raw_input and raw_output when applying start/progress notifications and when building tool-call snapshots. This keeps nested payload mutations isolated while preserving the existing update/merge semantics and public interfaces. Document the payload-isolation behavior.

Four public-API regression cases exercise both notification types and both mutation directions, checking nested input and output payloads, existing snapshots, fresh snapshots, and source notifications. Before the fix, all four fail on base bdb9ac7; the five existing accumulator tests pass.

Validation on Python 3.14.8:

  • Accumulator tests after the fix: 9 passed.
  • make check: passed (lockfile consistency, all configured prek hooks, full ty and deptry).
  • make test: 412 passed, 1 skipped, including doctests and local stdio/HTTP/WebSocket tests. The optional Gemini CLI smoke test retains its default skip. No model API calls were made.
  • git diff --check: passed.

AI assistance: prepared and verified with Codex during a user-authorized contribution search.

@PsiACE PsiACE left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the fix and regression tests!

@PsiACE
PsiACE merged commit 37290ca into agentclientprotocol:main Oct 18, 2026
8 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.

2 participants