Repository navigation
fix: preserve escaped-bang links in fetched text - #183532
Conversation
Respect odd/even backslash parity before image markers so ordinary link labels are not omitted. Cover the normalization owner and real web_fetch execute path, retaining actual-image handling.
|
🦞👀 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. |
|
Codex review: needs maintainer review before merge. What this changesThis PR preserves Markdown link labels when an escaped exclamation mark precedes the link. Example: Fetch
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR fixes a current text-extraction bug with a focused shared-parser change and no actionable correctness findings; the required CI gate remains red. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherFetched Markdown passes through the web text converter and shared inline-link parser before reaching the agent; session previews also consume that parser with a different image policy. flowchart TD
A[Markdown HTTP response] --> B[web_fetch]
B --> C[Markdown text converter]
C --> D[Shared inline link parser]
E[Session preview flattener] --> D
D --> F[Readable text]
Technical reviewBest possible solution: Retain the parity correction in the shared parser and land it through the repository’s required CI or authorized inherited-failure path. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically omits the escaped-bang link as an image, and the supplied baseline Gateway trace confirms that result; this read-only review executed no target code. Is this the best way to solve the issue? The existing parser is the correct owner, and toggling image classification for each preceding backslash fixes the defect without another parser, option, or general unescaping policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9634a5298af2. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +6, Tests 0, Docs +2. Total +8 across 4 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label 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 HistoryReviewed October 28, 2026, 5:24 AM ET / 09:24 UTC (Revision 3). |
Preserve the upstream unified response table and port the escaped-bang regression into it without changing the production fix.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Exact-head shipped Gateway proofCandidate: Both complete builds succeeded with Node 24.22.1 in secretless Linux Docker. Each built CLI started a separate isolated Gateway with explicit profile/config/state and token authentication. Binary-resolved config and agent database paths were checked before startup. No paid keys, model calls, parser mocks, or direct helper invocation were used. A local HTTP server returned actual Observed terminal summary (each row repeated twice on each build, 20 tool invocations total): Triggering fixture: Read \.Controls included a normal link, a normal image, an image preceded by two backslashes, and a link preceded by three backslashes. Both main attempts lost the valid escaped-bang link label; both candidate attempts retained it. Ordinary-link preservation and actual-image omission were unchanged. Every expected-result assertion passed, and the fixture recorded all 20 network requests. Gateways and fixture processes were stopped afterward. The existing contributor regressions already cover this owner and real-HTTP extraction boundary, with net test-line delta 0. No source or test changes were needed for this proof refresh; the parity fix remains at the shared CI remains a separate holdThe exact-head CI gate is currently red: run 40657429313, Deepgram job, Merge danger: two-way door; reverting restores prior extraction behavior without stored-state or schema changes. Blast radius is shared Markdown-to-text consumers, especially |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
The inherited Deepgram failure is now attributed to the monotonic-clock sweep in #186484, not this escaped-bang patch. Five complete-file runs passed before the sweep; all five failed at the sweep and all five failed on pinned current main. The deadline test faked Date/timers without performance.now(). Maintainer repair #186679 adds performance to that existing fake list; all ten tests pass in three complete-file runs. Production deadline enforcement is unchanged. Exact-head review and CI for the repair are pending; this does not change the red gate on this PR. Matrix: #186679 (comment) |
|
Maintainer override: The only red job is checks-node-changed-extensions-bundle-1 (run 40657429313, job 122735218781, also red on the first attempt in job 122712419709): extensions/deepgram/audio-flux.test.ts "keeps decoding…" times out. This PR doesn't touch Deepgram. The cause was main's monotonic sweep bf10fbe (#186484): the test file failed 5 of 5 runs on main 326ad6a and on bf10fbe, and passed 5 of 5 on a3b12ef before the sweep. #186679 fixes it on main. Matrix and cause: #186679 (comment). The exact-head review is 5/6 with no findings. |
fix(web-fetch): keep links whose text starts with an escaped bang web_fetch's Markdown cleanup treated a link written as \ as an image marker and dropped the label, so fetched pages lost link text. An escaped bang (an odd number of backslashes) now stays a plain link; real images and even-backslash images are unchanged. Evidence: built Gateway, authenticated /tools/invoke with the registered web_fetch tool, and real HTTP Markdown fixtures. Main lost the escaped-bang link label (twice); with this change it was kept (twice). Ordinary links, ordinary images, even-backslash images and three-backslash links behave as expected across all 20 calls. Details: openclaw#183532 (comment). Thanks @zechen5. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes:
web_fetchin text mode drops ordinary link text when an escaped exclamation mark immediately precedes the Markdown link, for example\.User Impact
Users retain the literal exclamation mark and link label instead of silently losing that text. Shared text previews also retain the literal marker. Actual images, including those preceded by an even number of backslashes, keep their existing behavior. No configuration changes, migrations, or new dependencies.
Why This Change Was Made
Image detection now respects the parity of the backslash run before
!. The change stays within the existing lossy text projection contract: it does not introduce general Markdown unescaping.This is a small independently discovered bug. No matching issue or fix PR was found during the pre-submission duplicate checks.
Evidence
Exact-head built Gateway proof refresh
Current-main versus exact-head Linux Node 24.22.1 Gateway evidence: two baseline failures and two candidate fixes for escaped-bang links through authenticated
/tools/invoke, with ordinary-link/image and even/odd-backslash controls. All 20 tool requests matched expectations. Existing Deepgram CI failure remains a separate hold; this is not a green-gate claim.Final-head CI and exact-base attribution (October 28)
Run 40657429313 for
3f29c7549141a3e86a8f002a2539270b31a198fffinished failure: 111 jobs succeeded, 25 skipped, one test job failed, and the aggregate gate failed. The test-lines ratchet, all three Bun UI shards, and selected UI E2E passed. Other workflows on this head also reached terminal states without failures.The remaining Deepgram failure is
extensions/deepgram/audio-flux.test.ts→ “keeps decoding, connection preparation, and transcription within one deadline,” timing out after 120,000 ms.Exact base comparison: the CI checkout was synthetic merge
4573c5a82f98e9a776612d168919fcf1eee440fd, whose first parent isac8c6616d58c49702e06055652382000b16daba9. Ran the same unmodified single-file command on each tree using Node 24.22.1, pnpm 12.15.0 and CI's pinned Bun1.4.4-canary.1+191755ec1:RAYON_NUM_THREADS=2 NODE_OPTIONS=--max-old-space-size=3072 \ pnpm test extensions/deepgram/audio-flux.test.ts --maxWorkers=1The ClawSweeper review was refreshed on October 28 at 09:24 UTC for current head
3f29c7549141a3e86a8f002a2539270b31a198ff: 5/6, sufficient proof, and zero findings. It is ready for maintainer review, not cleared to merge: the required CI gate remains red. No merge or auto-merge has been performed.Current head: test-budget repair on October 28
Head
3f29c7549141a3e86a8f002a2539270b31a198fffixes the concrete test-lines gate from run 40655257135. That run ended with two failing jobs plus the aggregate gate: test-line growth (+10) and an unrelatedextensions/deepgram/audio-flux.test.ts120-second deadline-test timeout. All three Bun UI shards and the selected UI E2E job passed. At that point the Deepgram failure was unclassified (CI reports no matching main job); the final-head exact-base comparison above adds direct reproduction evidence.Only the two regression fixtures changed:
01d66c79…after consolidation (exit 0, net 0).The earlier ClawSweeper review covered
1ec4ef15…. A subsequent current-head review now covers3f29c754…with zero findings and sufficient proof; its re-review request completed. Current-head CI remains separately blocked as recorded above.Prior head: October 28 conflict repair and validation
Head
1ec4ef153fa85d555d8f8d86f3a6262b45de922bincorporates main01d66c79ae4c518b355469797752e09e75a35ec6without rewriting branch history. The only textual conflict was adjacent documentation additions: both the escaped-bang explanation and main's Readability line-boundary explanation are retained. The production parity change and both regression cases remain unchanged in intent; the diff is still four files, +19/-1.openclaw-v1.4.4-20261026-191755ec11-webkit-b82bc917e9. The HTTP suite completed in 68.87 seconds including cold worker compilation. This is focused proof, not a full-suite or new shipped-Gateway claim.01d66c79…, resolved tree33e74315…; no blocking findings. Covered parity logic with the updated parser, both regression paths, and preservation of both documentation additions. Not an autoreview/ClawSweeper certification, full-repository review, or independent rerun of the test results above.October 28 investigation of the earlier Bun UI failure
The failed UI job checked out synthetic merge
ec08eaf1fae505f29aadf9c66e4f10e5a1dcb23d, merging head36803f65…intodea6ff0cd0a3b4f3c65518167a4fac013ba742f6. The October 26 local comparison against1206d801…below was not this exact CI base.Replayed the logged compressed test selection with the repository's
scripts/ci-run-node-test-shard.mts,bun-all, three workers, shard2/3, and two-CPU affinity, on both the exact synthetic merge and its first-parent base. Both used the CI pin1.4.4-canary.1+807211511, matching dependency lockfiles, and the existing non-isolated UI configuration.catalog-neededassertion.chat-pane-session-menu.test.tsimmediately beforecron-page.lifecycle.test.ts. A bounded same-Bun, non-isolated single-worker replay of that ordered pair passed 61 tests on each exact tree. This reduces, but does not eliminate, a simple predecessor-leak hypothesis.pnpm test:ci-failed 183532 --jsonstill cannot authenticate in this cloud workspace; exact run/job logs were inspected through the connected GitHub identity instead.Focused current-tree commands:
Prior head: October 26 conflict resolution and revalidation
Head
36803f65f64931f7dd05681ee9fdec4ec473b18amerges main1206d801b27738ff604cec4633779f84a1cb3b0ewithout rewriting branch history. Upstream consolidated the real-fetch fixtures in #183808; the escaped-bang regression now uses that response table. The production parity fix is unchanged, and no removed upstream tests were restored.On this exact resolved tree:
git diff --checkpassed.RAYON_NUM_THREADS=2and a 3 GiB Node heap passed; no assertions or timeouts were weakened.Prior head: October 26 exact-head CI follow-up
CI run 40356261884 for
36803f65f64931f7dd05681ee9fdec4ec473b18afinished failure: 106 jobs succeeded, 25 skipped, two test jobs failed, and the aggregate CI gate failed. This is not a green-CI claim.extensions/qa-lab/src/coverage-report.test.ts:213, “groups scenario coverage metadata by theme and surface,” expected false but received true. Local single-file runs on both this head and base1206d801b27738ff604cec4633779f84a1cb3b0ereproduced the identical assertion (36 passed, 1 failed on each). This is demonstrated base behavior. The CI classifier called it unknown because main had no matching job name.ui/src/pages/cron/cron-page.lifecycle.test.ts, “preserves catalog provider identity through model selection and save (catalog-needed),” expected a non-null element. Both head and base subsequently passed the isolated file locally (31 tests each). The comparison main job also passed the exact assertion, but used a larger test scope. CI classified this as new at job level, explicitly without comparing selected scope. Its cause remains unresolved; these isolated passes do not prove a flake or excuse the failed gate.pnpm test:ci-failed 183532 --jsoncould not authenticate because this cloud workspace has no GitHub CLI login; logs and exact-head status were read through the connected GitHub identity instead.Local comparison commands (same existing dependency installation; Node 24.22.1, serial worker, 3 GiB heap):
Original fix validation
Validated on base
192947deb5f3ab9454e614dd520bbdde3ba90d40on October 25, 2026:createWebFetchTool.executereproduced the lost link label: the new regression failed while 17 controls passed.git diff --checkpassed.Shipped Gateway entry-point proof
On October 25, 2026 at 11:46:34 UTC, the compiled CLI at head
b48f9a21179aadb781f609ac253c4041708c58d2was run as a separate foreground Gateway process, not an in-process test harness. The source CLI build andpnpm openclaw --helpcompleted before the run (Node 24.22.1, pnpm 12.15.0).web_fetchallowed; channels, plugins, schedulers, and browser sidecars disabled. No model API credentials or LLM inference.Content-Type: text/markdown.POST /tools/invokeroute invokedweb_fetchwithextractMode: "text".Redacted terminal transcript (the body line is the returned content inside OpenClaw's external-content wrapper):
The remaining backslashes are intentional under the existing lossy projection contract; this change does not introduce general Markdown unescaping.
Prior-head upstream CI
CI run 40189213207 completed with failures on the merge of this head and base
60c3a7c35283dd6377baff1e6ab137d1e0e96c0d. Three test shards failed with four assertions insessions-create-thinking-claim.test.ts,close-wedge.test.ts, andsession-accessor.sqlite-session-row.test.ts. These files are outside this patch. The targeted comparison below reproduces three of the four assertions on the base; the remaining failure is unclassified. No all-green CI claim is made.Targeted CI failure comparison
On October 25, 2026, separate source trees for PR head
b48f9a21179aadb781f609ac253c4041708c58d2and CI base60c3a7c35283dd6377baff1e6ab137d1e0e96c0dwere tested with Node 24.22.1, pnpm 12.15.0, Vitest 5.0.5, and one worker:src/gateway/server-methods/sessions-create-thinking-claim.test.ts: head 3 passed, base 3 passed. The CI assertion at line 202 remains unclassified.src/state/openclaw-agent-execution.close-wedge.test.ts: head 10 passed; base 8 passed, 2 failed at lines 438 and 496. The base reproduces the CI signatures: expected anAggregateErrorcause but receivedSQLite worker exited with code 3; expected aggregated cleanup cause but received the bare synthetic-unavailable error.src/config/sessions/session-accessor.sqlite-session-row.test.ts: head 8 passed; base 7 passed, 1 failed at line 147, matching CI'sexpected 4 to be less than or equal to 3.These three assertion failures reproduce on the base without this patch. This local comparison used Node, whereas CI used its pinned Bun runtime on the synthetic merge; it is not proof that the remaining CI failure is flaky, and it does not replace green upstream CI.
Prior-head validation limits
Type-aware lint did not complete. An initially broad declaration-generation command was interrupted; the core-config retry stopped at a retained artifact lock whose detached child completion could not be verified. The lock was left untouched. The first combined green test command also hit a subprocess build exit 137; the real-tool suite subsequently passed when rerun alone. No full-repository test pass is claimed.
The automated
autoreviewhelper was not run because its additional reviewer would exceed this task's two-agent limit. A separate manual review was performed; no automated clean certification is claimed.Validation commands
AI assistance: this fix was discovered, implemented, tested, and independently reviewed with OpenAI AI assistance. The validation statements above distinguish completed checks from blocked checks.