You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a tool's text output contains a JSON object with a repeated key, the work-log tool inspector shows only the last member. prettyJsonText parses and reserializes the text, and its loss check only looks at numbers, so JSON.parse has already overwritten the earlier member. Port 80 and the fact that port appeared twice both disappear.
Deterministic repro on origin/main (afd9ee2014aaa3c7bf5d039e52640d1470e11e6a): Call turnItemOutputText on a completed dynamic_tool item whose output is { content: [{ type: "text", text: '{"port":80,"port":443}' }] }. A local ACP tool can send the same text block as rawOutput, and the ACP adapter forwards generic raw output to dynamic_tool. Web, desktop and mobile tool details all render through turnItemOutputText.
Observed: {\n "port": 443\n}
Expected: the original {"port":80,"port":443}, shown unchanged
Change
The existing token scan for parsed JSON now also tracks the braces and brackets around each token. It keeps a set of decoded key names for each object and returns the raw text when an object repeats a key. Because it compares decoded names, "p\u006frt" and "port" count as the same key. Single JSON documents and line-delimited JSON both use this check. Objects with unique keys still get pretty-printed, and the existing exact-number checks are unchanged. One shared function covers all clients.
Scope
Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.
Verification
packages/client-runtime/src/work-log/itemDetail.test.ts gains three "repeats a key" cases: top-level, nested with an escaped equivalent key, and line-delimited. It also gains a "still pretty-prints" case where sibling objects use the same key and a string value equals a key name.
On base, the 3 new cases fail. Example: expected '{\n "port": 443\n}' to be '{"port":80,"port":443}'. On head, all 51 tests in the file pass.
vp run check:changed exited 0 (format, lint, knip, typecheck, tests).
Not shown: no screenshot or scenarios:prove run of the expanded tool row in a real client. The proof covers the shared turnItemOutputText function that all clients call.
Authored by Claude Opus 5.5 (Model Hub); reviewed by GPT-6.2 Sol (Codex).
Not shown
PR body:5 — Call afd9ee2 the tested base, not current origin/main; the local origin/main ref is 4265fde and its formatter independently reproduced the same loss.
PR body:5 — The helper test is deterministic but not a real-client scenario. Add steps for a local ACP tool to return the stated text block, then expand its completed work-log row and assert that both port entries are displayed.
PR body:22 — The gist shows 7 passing tests and 44 skipped on head, not the claimed full-file run. Attach the 51-test result or distinguish the reported run from the published transcript.
PR body:23 — The reported check:changed pass has no HEAD-stamped log in the evidence; attach the check summary for 51ff76a943cb839c737a91695d59ae3e4402c8a5 or note that it was not independently verified in read-only review.
PR body:26 — Before/after screenshots of the expanded inspector are not shown; attach them if available.
Macroscope's review found this PR approvable — Repeated JSON keys are preserved in displayed tool text instead of being lost during pretty-printing. The change is limited to presentation and retains existing numeric-fidelity safeguards.
You can add or adjust custom eligibility rules. Learn more.
Reviewing files that changed from the base of the PR and between 19325a6 and 0102f9a.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
JSON formatting now detects duplicate object keys and preserves the original text when parsing would collapse them. Tests cover escaped duplicate keys, duplicates across JSON lines, and valid arrays that remain eligible for pretty-printing.
Changes: JSON formatting
Layer / File(s)
Summary
Duplicate-key detection and formatting packages/client-runtime/src/work-log/itemDetail.ts, packages/client-runtime/src/work-log/itemDetail.test.ts
The tokenizer identifies object keys and delimiters. The lossiness check detects repeated keys alongside existing numeric-loss checks. prettyJsonText preserves input when it detects lossy JSON. Tests cover escaped keys, JSON lines, and arrays with repeated object keys.
This change keeps JSON tool output with repeated keys as its original text instead of silently dropping earlier values. No concrete merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: the shared JSON display path now keeps repeated keys in tool output instead of dropping earlier values. The raw summary confirms that prettyJsonText and hasLossyJson n…
Description check
The description follows the template sections: Problem, Change, Scope, and Verification. The Problem section gives the reproduction, expected behavior, and observed output. The Change section explains…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: the shared JSON display path now keeps repeated keys in tool output instead of dropping earlier values. The raw summary confirms that prettyJsonText and hasLossyJson now detect duplicate object keys and return the raw text. The title is specific and follows the conventional commit form. It is a fix, and the changes match it.
Full details: Description check
Explanation
The description follows the template sections: Problem, Change, Scope, and Verification. The Problem section gives the reproduction, expected behavior, and observed output. The Change section explains the fix and why one shared function covers all clients. The Scope section explains why no issue is linked. Verification lists the new tests and the results. Review notes flag gaps. The published transcript shows 7 passing and 44 skipped tests, not the claimed 51-test run. The check:changed result has no HEAD-stamped log. No real-client scenario or screenshot is shown. The template asks for a model and harness line, and the body names the model as Claude Opus 5.5 (Model Hub) but does not name a harness. The core template sections are present, so the check passes. The verification gaps should be fixed before merge.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
Web client, Chromium on Linux, 1280×1000, light theme, fresh isolated databases and identical replay outputs.
On each commit, create a fresh project and thread through t3.project/t3.thread. Replay “Check the service ports” with four completed tools returning {"port":80,"port":443}, {"server":{"port":80,"p\u006frt":443}}, {"id":1}\n{"id":2,"id":3}, and [{"port":80},{"port":443,"note":"port"}]. Open the thread, expand “Worked for”, “Used 4 tools”, and each tool row. Capture the expanded inspectors.
Scenario: Tool inspectors preserve repeated JSON members
Proven: the scenario fails on base 20a0e5f388 and passes on head 0102f9a8df.
Base loses port 80 in both objects and id 2 in JSON lines. Head displays the original repeated members. The unique-key control remains pretty-printed on both.
Not shown:
Desktop and mobile clients were not run; this proof exercises the shared formatter through the web client.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:S10-29 changed lines (additions + deletions).vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a tool's text output contains a JSON object with a repeated key, the work-log tool inspector shows only the last member.
prettyJsonTextparses and reserializes the text, and its loss check only looks at numbers, soJSON.parsehas already overwritten the earlier member. Port 80 and the fact thatportappeared twice both disappear.Deterministic repro on
origin/main(afd9ee2014aaa3c7bf5d039e52640d1470e11e6a): CallturnItemOutputTexton a completeddynamic_toolitem whose output is{ content: [{ type: "text", text: '{"port":80,"port":443}' }] }. A local ACP tool can send the same text block asrawOutput, and the ACP adapter forwards generic raw output todynamic_tool. Web, desktop and mobile tool details all render throughturnItemOutputText.{\n "port": 443\n}{"port":80,"port":443}, shown unchangedChange
The existing token scan for parsed JSON now also tracks the braces and brackets around each token. It keeps a set of decoded key names for each object and returns the raw text when an object repeats a key. Because it compares decoded names,
"p\u006frt"and"port"count as the same key. Single JSON documents and line-delimited JSON both use this check. Objects with unique keys still get pretty-printed, and the existing exact-number checks are unchanged. One shared function covers all clients.Scope
Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.
Verification
packages/client-runtime/src/work-log/itemDetail.test.tsgains three "repeats a key" cases: top-level, nested with an escaped equivalent key, and line-delimited. It also gains a "still pretty-prints" case where sibling objects use the same key and a string value equals a key name.expected '{\n "port": 443\n}' to be '{"port":80,"port":443}'. On head, all 51 tests in the file pass.vp run check:changedexited 0 (format, lint, knip, typecheck, tests).Not shown: no screenshot or
scenarios:proverun of the expanded tool row in a real client. The proof covers the sharedturnItemOutputTextfunction that all clients call.Authored by Claude Opus 5.5 (Model Hub); reviewed by GPT-6.2 Sol (Codex).
Not shown