Repository navigation
Replies: 1 comment 1 reply
|
Root cause confirmed on the commit you verified against.
const escaped = content.trim().replace(/\n\r/g, '<br>').replace(/\n/g, '<br>').replace(/\|+/g, '\\|').padEnd(3, ' ')
One point I would add to the body explicitly, because it forecloses a suggestion the fix will otherwise attract: the collapse is not recoverable downstream. Your severity argument is the one that carries: a reader is shown |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
web_fetchsilently collapses consecutive literal pipe characters while converting HTML tables to GitHub-flavored Markdown. This changes cell text, including code operators, even when the HTTP request succeeds and the result is not truncated.Reproduced against master (package version
0.2.1-alpha.2) atd743267388641bc76f17c45ce8b4c231aed1d32c. Master was fetched again after verification and still points to that commit.Reproduction
Serve this HTML with
Content-Type: text/html; charset=utf-8, then fetch it through the registeredweb_fetchtool:The body row should be:
But the baseline returns:
The response is HTTP 200 and the tool metadata reports
truncated: false. Runs of three pipes also collapse to one. Decimal/hex HTML entities, table headers and nested inline formatting are affected. A single pipe is already handled correctly.This is not just table layout: changing
||to|can change an expression's meaning in programming-language examples. The source page and programmatic HTML body are not modified; the corruption is in the model-visible Markdown result.Root cause and minimal patch
renderTableCell()replaces an entire run matched by/\|+/gwith one escaped pipe. Each literal pipe must instead be escaped separately. GFM's table specification also requires escaping pipes inside inline spans.The original pipe count cannot be recovered from the corrupted Markdown alone: cells containing
|,||, or|||can produce the same rendered text. The structured result is different. For successfulweb_fetchcalls,execute()retains the fetched HTML invalue.body.content, andtools/post-executereceives that canonical value alongside the rendered content. A hook using the retained HTML could re-render it with a corrected converter; a text-only consumer cannot reconstruct the count. Fixing the built-in renderer avoids requiring that workaround.The production change is limited to that quantifier and its local JSDoc. The patch also updates the bilingual README pair, adds formatter and real-HTTP tool-registry regressions, and adds an independently owned recorded-session scenario. The existing HTTP snapshot fixture serves both pages; the original menu page and historical recordings remain unchanged.
No public TypeScript API, package export, dependency, configuration, RPC schema, Session format or network-access policy changes.
Patch links
Verification
Node 24.19.0 and repository-declared pnpm 11.28.5, with frozen-lockfile installs:
pnpm exec vitest run packages/web/tool-web/tests --coverage --coverage.include='packages/web/tool-web/src/fetch.ts': Windows and Linux, 99 passed; the modified file has 100% statements, branches, functions and lines.pnpm exec vitest run packages/web/web-fetch-http/tests packages/web/web/tests: Windows, 89 passed.pnpm run test:snapshot snapshots/session/headless.snapshot.ts -t 'replays web-fetch': Linux, both the original and new scenario passed. The new scenario runs real HTTP, the tool pipeline and Session persistence throughdsh --profile headless; only model responses are replayed.pnpm run test:snapshot scripts/session-snapshot-corpus.corpus.ts: Windows and Linux, three checks passed.pnpm run build:lib: passed on Windows, including Host and Client library builds.pnpm run build:native-system: passed on Windows and Linux.pnpm run lint: passed on Windows, with one existing unused-disable warning.pnpm run test:docs: 21 gates passed.pnpm run doc-sync: Windows, all 43 gates passed, zero failed and zero skipped.pnpm run doc-typecheck: Windows, 81 documentation code blocks compiled.pnpm exec vitest run scripts/project-doc-site.spec.ts scripts/verify-doc-site-fragments.spec.ts website/tests/mermaid-viewer.spec.ts website/tests/image-viewer.spec.ts website/tests/code-groups.spec.ts website/tests/page-markdown-actions.spec.ts website/tests/raw-markdown.spec.ts: Windows and Linux, all 151 passed with no skips after the separate junction-fixture fix. No system permissions were changed.git diff --check: passed.Before the fix, the focused added regressions produced eight failures at the intended pipe-preservation assertions; the single-pipe control passed. After refreshing the new Session fixture, reverting only the quantifier made the assembled replay fail solely on the four table-body rows. Restoring it made the replay pass.
Validation limits
The new recorded-session scenario is POSIX-scoped: Windows emits JSON-escaped runtime-context paths and a platform-specific bundled ACL skill catalog, which prevent sharing this golden unchanged. Windows formatter and real-HTTP integration coverage passed. Linux assembled replay used the source profile, a locally built Linux native addon, and platform-neutral Typert contributors from the current Host build.
The full repository coverage suite, full snapshot suite, live-model API tests and remote CI were not run. This patch preserves pipe counts in HTML table cells; it is not a general lossless HTML-conversion guarantee, and existing truncation, hidden-content removal and colspan handling remain in place.
No equivalent Harness report or patch was identified in the checked public Discussions, issue/PR searches, commit messages, indexed code and sampled forks. That does not establish absence from private or unindexed work.
AI-assisted audit and implementation with Codex; both commits include
Co-authored-by: Codex <noreply@openai.com>. Every verification command listed above was executed locally.All reactions