Repository navigation
fix(web-fetch): preserve inline code examples in text output - #184423
ZengWen-DT wants to merge 1 commit into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
5a9d13f to
8c43abe
Compare
|
Codex review: needs real behavior proof before merge. What this changesProtect inline code during web_fetch text conversion so literal Markdown examples survive prose formatting. Example: Fetch a Markdown page containing Use Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this PR provides a focused repair for current-main inline-code corruption, and the related candidate is not an established landable replacement. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe web_fetch extraction layer converts fetched Markdown responses into agent-visible text, preserving code literals while flattening ordinary prose links and omitting images. flowchart LR
A[HTTP Markdown response] --> B[web_fetch tool]
B --> C[Markdown to text converter]
C --> D[Canonical code region parser]
D --> E[Protect literals and format prose]
E --> F[Restore literals]
F --> G[Agent visible result]
Technical reviewBest possible solution: Preserve inline literals in the existing converter using canonical original-source ranges and the shared restoration pass. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically sends the reported inline literals through link/image stripping; supplied HTTP verification supports that mechanism, but this read-only review executed no reproduction. Is this the best way to solve the issue? The patch addresses the formatting order at its existing owner, reuses canonical parsing and literal restoration, and retains established fence behavior without adding another converter. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 54408a978fc9. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +27, Tests +29, Docs +2. Total +58 across 4 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 26, 2026, 5:28 AM ET / 09:28 UTC. |

Closes #184362.
Related: #184411.
What Problem This Solves
Fixes:
web_fetchtext extraction deletes or rewrites literal Markdown link and image examples inside inline code.Why This Change Was Made
Use the existing Markdown code-region parser to protect inline spans in the original source before fence scanning and prose formatting, sharing the existing literal restoration pass. The main regression risk is changing ownership around image alt text or embedded fences; the HTTP controls and focused regressions cover those boundaries.
User Impact
User impact: fetched code examples retain their literal contents, including embedded backticks and repeated spaces; ordinary links keep their labels and ordinary images remain omitted.
Evidence
7aee7016f08cfc43ffe5f69a70d02f5a4d84a99b: 12 real loopback HTTP requests through productioncreateWebFetchTool.execute, with five expected failing assertions. The reported example returnedUse ` and label`; read guide.; ordinary link/image, image-alt, fenced-code, and all Markdown-mode controls passed. The artifact contains the actual tool envelopes.8c43abe85efc7df67a58b76338d3635f248575e0: all 18 real HTTP requests and the exact utility NUL-collision control passed. Both focused suites and changed-file formatting passed. The eight new utility cases also ran against unchanged baseline production code and produced behavioral assertion failures, confirming the regressions detect the defect.pnpm build,pnpm check, andpnpm testremain in progress; this PR remains a draft.The related candidate appeared while this repair was being validated. The same HTTP probe against its exact head,
5874523645e0a848f9d6db4e4cb20e2a629965ba, reproduced an additional failure: a valid inline span containing literal triple backticks returnedBefore literal \u00000\u0000 tail after.instead of preserving the embedded code. This submission covers that case at both the utility and HTTP tool boundary.Production +34/-7 (net +27); tests +29/-0; docs +3/-1. The added production logic uses the existing parser and literal store to handle inline ownership while retaining the documented fenced-code extraction behavior; it replaces the single-backtick regex rather than adding a second restoration path.
Proof scope: real loopback HTTP, production tool execution, and actual returned results; no mocked transport or extraction. No external site, model, live Gateway, or browser UI was exercised.
AI-assisted implementation and review.