fix(agents): drop partialJson streaming artifacts from session history repair#61151
fix(agents): drop partialJson streaming artifacts from session history repair#61151drvoss wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eb1484a0b8
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Greptile SummaryThis PR fixes a bug where streaming The fix adds a
Confidence Score: 4/5Safe to merge after fixing one minor American-spelling nit in a new code comment. The fix is targeted and logically correct. The src/agents/session-transcript-repair.ts — spelling nit at line 254. Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/agents/session-transcript-repair.ts
Line: 254
Comment:
**British spelling in new comment**
"finalised" is British English. Per `CLAUDE.md`, all code, comments, docs, and UI strings must use American spelling — it should be "finalized".
```suggestion
// was finalized — treat it as an incomplete artifact and drop it.
```
**Context Used:** CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(agents): drop partialJson streaming ..." | Re-trigger Greptile |
eb1484a to
9e3f482
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9e3f482558
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
9e3f482 to
b3409d1
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c67533d2d8
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
20d8889 to
63d560e
Compare
|
The new Codex P1 (sessions_spawn redaction bypass via partialJson strip) has been fixed in commit 20d8889368. Root cause: the previous fix stripped partialJson and immediately pushed to nextContent via continue, bypassing the sessions_spawn sanitizeToolCallBlock path at lines 287-293. Fix: introduced a workBlock variable. partialJson is stripped upfront and workBlock replaces block for all subsequent processing, including the sessions_spawn redaction path. No early continue is used after stripping. Added a regression test: a sessions_spawn block with partialJson should have partialJson stripped AND attachment content redacted. Branch rebased onto latest main (d5ed6d2). All 27 tests pass locally. |
fbc27dc to
11e1569
Compare
|
CI update after latest rebase onto main (6211e3d): check, build-smoke, build-artifacts, and all checks-fast-* shards now pass. The previous io.audit.ts TS2300 baseline failure is resolved. Note on Greptile review: Greptile reviewed commit eb1484a0b89 (original implementation). The current code uses a workBlock variable to strip partialJson without bypassing sessions_spawn sanitization. The "finalised" spelling nit is not present in current code. Remaining failures are baseline:
|
|
Requesting Greptile re-review of the current HEAD (11e15691cb). The Greptile review above was on commit eb1484a0b89, which was the original drop-only implementation. The current code is substantially different:
Current code summary: blocks missing required fields (id, name, input/arguments) are dropped. Blocks that are complete but carry partialJson have the field stripped into workBlock; workBlock then falls through to the sessions_spawn redaction path. No early continue after stripping. All 27 tests pass on current HEAD against latest main (6211e3d). |
11e1569 to
ce69aba
Compare
ce69aba to
232f497
Compare
|
Rebased this branch onto current What changed during the refresh:
Validation on the refreshed branch:
|
|
Codex review: needs changes before merge. Reviewed June 15, 2026, 6:48 AM ET / 10:48 UTC. Summary PR surface: Source +70, Tests +101. Total +171 across 2 files. Reproducibility: yes. Source inspection gives a high-confidence path: a signed-thinking assistant turn with a tool-call block containing Review metrics: none identified. Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Cover Do we have a high-confidence way to reproduce the issue? Yes. Source inspection gives a high-confidence path: a signed-thinking assistant turn with a tool-call block containing Is this the best way to solve the issue? No. The PR is the right repair area for normal transcript cleanup, but the best fix must extend the same Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e7ee1c55b433. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +70, Tests +101. Total +171 across 2 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
232f497 to
991f7e3
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
cb2c29b to
8130f43
Compare
|
@clawsweeper re-review Refreshed the PR body on current head Current proof now matches the branch behavior:
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Superseded by #93469. I reopened the same single-purpose transcript-repair fix from the latest |
Summary
partialJsonfrom every otherwise-complete tool-call block, which could keep interrupted Anthropic artifacts as replayable calls.toolResultrepair and preserve bad session state; finalized OpenAI Responses calls still need to survive cleanup, including retainedsessions_spawnpayloads.repairToolCallInputs()now dropspartialJsonblocks unless they match the finalized OpenAI Responses shape, strips redundantpartialJsononly from those retained OpenAI blocks, and preserves the currentsessions_spawnattachment content on the kept block.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Real behavior proof (required for external PRs)
id,name,arguments: {}, andpartialJsonshould be dropped, while finalized OpenAI Responses tool calls should keep valid arguments, losepartialJson, and preserve retainedsessions_spawnattachment content.pnpm exec tsxthat importssanitizeToolCallInputs()fromsrc/agents/session-transcript-repair.ts.sessions_spawnblock (call_spawn|fc_456) plus one interrupted Anthropic-style block (toolu_123witharguments: {}andpartialJson).{ "droppedAnthropicArtifact": true, "assistantContent": [ { "type": "toolCall", "id": "call_spawn|fc_456", "name": "sessions_spawn", "arguments": { "attachments": [ { "content": "secret data", "name": "a.txt" } ] } } ], "sessionsSpawnAttachmentContent": "secret data" }sessions_spawnblock stayedpartialJsonwas removed from the retained blockpartialJson, which is the blocker called out in the ClawSweeper review.Root Cause (if applicable)
argumentsas complete, then removedpartialJsonwithout checking whether the remaining block was a finalized OpenAI Responses call or an interrupted Anthropic artifact.id + name + arguments: {} + partialJsonshape versus the finalized OpenAI Responsescall_id|item_idshape.partialJsononly untilcontent_block_stop, while OpenAI Responses persists finalized function-call blocks with parsed arguments pluspartialJsonin history.Regression Test Plan (if applicable)
src/agents/session-transcript-repair.test.tspartialJsonare kept after stripping that field, initialized Anthropic artifacts withpartialJsonare dropped, and retainedsessions_spawnattachment content is preserved on the kept block.repairToolCallInputs()proves the exact keep/drop/preserve behavior without needing a full provider replay harness.partialJsoncoverage.User-visible / Behavior Changes
partialJsonartifacts instead of replaying them as valid tool calls, while still preserving finalized OpenAI Responses calls and retainedsessions_spawnpayloads.Diagram (if applicable)
N/A
Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation: N/ARepro + Verification
Environment
Steps
sessions_spawntool-call block withpartialJsonand one interrupted Anthropic-style block witharguments: {}pluspartialJson.pnpm exec tsxon this branch.node scripts/run-vitest.mjs src/agents/session-transcript-repair.test.ts src/agents/session-transcript-repair.attachments.test.ts --run.Expected
partialJson, and preservesessions_spawnattachment content.Actual
sessions_spawnblock stayed and its attachment content remainedsecret data.src/agents/session-transcript-repair.test.tsandsrc/agents/session-transcript-repair.attachments.test.tspassed locally.Evidence
Attach at least one:
Human Verification (required)
sanitizeToolCallInputs()on the current PR branch with one finalized OpenAI-stylepartialJsonblock and one interrupted Anthropic artifact; focused transcript-repair test files.sessions_spawnattachment content remains intact afterpartialJsonstripping, and the initialized Anthropic shape is no longer replayed.Review Conversations
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoRisks and Mitigations
partialJson.partialJsonon Anthropic streaming artifacts and finalized OpenAI Responses blocks; the regression tests pin the keep/drop split and the preservedsessions_spawnpayload path.Made with Copilot | fully reviewed by human | fully tested