Skip to content

refactor(web-fetch): exercise URL normalization through the public tool - #144887

Merged
steipete merged 1 commit into
mainfrom
codex/test-web-fetch-sanitizer-boundary
Sep 11, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-web-fetch-sanitizer-boundary

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

URL normalization tests reached a private global test hook instead of exercising the public web_fetch tool. Two URL forms also had overlapping direct and public coverage.

Why This Change Was Made

Move the retained expectations into the existing public tool suite, covering 14 unique URL forms through returned URLs and transport arguments. Remove the private conditional global, its test-support adapter, and the matching shared-runner cleanup entry. The sanitizer and its production call site remain unchanged. Production shrinks by 6 lines and tests/support by 7 lines. Shrink the matching assertion-safety baseline from 3 to 2 after removing the private global cast.

User Impact

No URL normalization, network policy, cache, or terminal presentation behavior changes. The tests use existing local fixtures; this is not a live external-service claim.

Evidence

The same five complete suites passed before and after: 57 baseline cases and 55 candidate cases. The two-case reduction merges overlapping URL forms; all 14 unique forms and the 41 unaffected cases remain covered. Existing terminal presentation, enabled-cache, and shared-runner cleanup coverage passed in both runs.

Independent review found no P0–P2 issues in the change and reviewed the exact assertion-baseline correction. The full default build passed all 16 phases against the same runtime/test source as the paired tests; the subsequent baseline-only correction leaves those source hashes unchanged.

The final six-file changed check passed all 32 selected checks, including production, core-test and root-test typechecks, all three dead-export scans, lint and runtime import-cycle checks. The initial gate rejection and exact 3-to-2 baseline correction are retained in local evidence.

Commands run:

node scripts/run-vitest.mjs src/agents/tools/web-fetch.test.ts src/agents/tools/web-fetch.ssrf.test.ts src/agents/tools/web-fetch.cache.test.ts src/agents/tools/web-fetch-output-contract.test.ts test/non-isolated-runner.test.ts
node scripts/check-changed.mjs -- src/agents/tools/web-fetch.ts src/agents/tools/web-fetch.test.ts src/agents/tools/web-fetch.test-support.ts src/agents/tools/web-fetch.ssrf.test.ts test/repository-test-api-publications.ts config/assertion-safety-baseline.txt
pnpm build

@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Sep 11, 2026
@steipete
steipete marked this pull request as ready for review September 11, 2026 11:35
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 11, 2026, 7:49 AM ET / 11:49 UTC.

ClawSweeper review

What this changes

Moves URL-normalization coverage through the public web_fetch tool and removes its private test hook, support adapter, and cleanup registration.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused cleanup that is absent from current main. No blocking correctness or security defect was found, and the maintainer-protected PR should remain open.

Priority: P3
Reviewed head: ed527ce72d7a76882ec3fafd4b1732f510ea25df

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, coherent cleanup preserves the distinct URL contracts and removes the complete test-only seam, with proportional validation reported.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied context identifies maintainer-authored cleanup with unchanged runtime behavior; its public-tool tests use mocked DNS and fetch, and are not claimed as live URL-fetch proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied context identifies maintainer-authored cleanup with unchanged runtime behavior; its public-tool tests use mocked DNS and fetch, and are not claimed as live URL-fetch proof.
Evidence reviewed 8 items Introduced production change: The pinned introduced diff removes only the conditional test-global publication from production; the sanitizer and its execution call site remain unchanged. The assertion baseline decreases by the corresponding removed cast.
Retained public-boundary coverage: All 14 distinct input forms are retained. Each case invokes the public tool, checks returned URL/status/extractor, and asserts exactly one transport call with the expected encoded URL. The existing fixture disables caching and restores fetch and mocks after each case.
Complete hook retirement: No tracked references to the removed global or support adapter remain. The shared runner deletes only registered publications, so removing this registration matches removal of its producer.
Findings None None.
Security None None.

How this fits together

OpenClaw’s web_fetch tool accepts agent-supplied URLs, normalizes them, and retrieves content through network safety checks. These tests check the URL returned to the agent and the URL passed to the transport.

flowchart LR
  A[Agent URL argument] --> B[Public web fetch tool]
  B --> C[URL normalization]
  C --> D[Network safety checks]
  D --> E[HTTP transport]
  E --> F[Content and URL result]
  G[URL test cases] --> B
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -6, Tests -7, Other 0. Total -13 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 1 0 6 -6
Tests 4 93 100 -7
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 1 0
Total 6 94 107 -13

Review metrics

Metric Value Why it matters
URL coverage preservation 14 distinct URL forms retained The two-case reduction consolidates overlapping coverage while adding public-result and transport assertions for every retained form.

Technical review

Best possible solution:

Keep URL normalization private and enforce its contract through public tool results and guarded-fetch arguments.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR restructures existing coverage rather than fixing a reported runtime failure; the removed private-hook dependency is directly visible in the pinned diff.

Is this the best way to solve the issue?

Yes. The existing public-tool suite covers the retained normalization contract without a replacement production seam, and the obsolete adapter and registration are removed together.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7764767a88b3.

Labels

Label changes:

  • add P3: This is a bounded test-maintenance cleanup with no change to production URL handling or network policy.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied context identifies maintainer-authored cleanup with unchanged runtime behavior; its public-tool tests use mocked DNS and fetch, and are not claimed as live URL-fetch proof.

Label justifications:

  • P3: This is a bounded test-maintenance cleanup with no change to production URL handling or network policy.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied context identifies maintainer-authored cleanup with unchanged runtime behavior; its public-tool tests use mocked DNS and fetch, and are not claimed as live URL-fetch proof.

Evidence

What I checked:

  • Introduced production change: The pinned introduced diff removes only the conditional test-global publication from production; the sanitizer and its execution call site remain unchanged. The assertion baseline decreases by the corresponding removed cast. (src/agents/tools/web-fetch.ts:563, ed527ce72d7a)
  • Retained public-boundary coverage: All 14 distinct input forms are retained. Each case invokes the public tool, checks returned URL/status/extractor, and asserts exactly one transport call with the expected encoded URL. The existing fixture disables caching and restores fetch and mocks after each case. (src/agents/tools/web-fetch.ssrf.test.ts:248, ed527ce72d7a)
  • Complete hook retirement: No tracked references to the removed global or support adapter remain. The shared runner deletes only registered publications, so removing this registration matches removal of its producer. (test/repository-test-api-publications.ts:62, ed527ce72d7a)
  • Current main still needs the cleanup: Current main retains the private test-global publication; its production-file difference from the reviewed head is precisely that publication’s removal. (src/agents/tools/web-fetch.ts:574, 7764767a88b3)
  • Release comparison: The supplied latest release, v2026.9.4, also retains the sanitizer test-global publication; this cleanup is not already present there. (src/agents/tools/web-fetch.ts:574, 3a9d69db306c)
  • Area history and routing: Current-main history contains several recent web-fetch changes by Peter Steinberger; GitHub commit metadata maps the sampled enablement cleanup to steipete. Deeper pickaxe and blame inspection encountered unavailable historical blobs, so no feature-introduction attribution is claimed. (src/agents/tools/web-fetch.ts, 74569a1ff1e4)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete steipete self-assigned this Sep 11, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready source review at ed527ce72d7a76882ec3fafd4b1732f510ea25df: all 14 distinct URL forms are retained through the public tool, with all 41 other selected cases unchanged. The paired suites passed 57/57 before and 55/55 after; the two removed cases duplicate retained forms. All 32 final changed checks and the 16-phase default build passed. The PR body records the exact local commands and the reviewed assertion-baseline shrink.

Exact-head hosted CI passed on attempt 1 (110 successful jobs, 17 skipped). Independent review was clean through P2, and the completed ClawSweeper review has no findings or before-merge actions. This changes test access and coverage organization, not URL, network-policy, or cache behavior.

@steipete
steipete merged commit ea57c50 into main Sep 11, 2026
250 checks passed
@steipete
steipete deleted the codex/test-web-fetch-sanitizer-boundary branch September 11, 2026 12:12
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 11, 2026
Preserve the reviewed harness while incorporating the landed benchmark prerequisite.

Punchcard-Session: coral-orchard-orchard-d4

* commit '4407ed19ac63b1c1c84a0cfe6eb4bbeca9c2322c': (1196 commits)
  fix(perf): isolate benchmark subprocess transport (#144159)
  refactor(auth): await Copilot cache persistence (#144810)
  refactor(web-fetch): exercise URL normalization through the public tool (#144887)
  fix(ollama): preserve hosted subdomain model context (#144891)
  fix(doctor): explain Codex plugin health failures (#144813)
  fix(channels): honor pinned accounts in Mattermost model menus (#144880)
  fix(update): failed-update records hide the triggering error behind the excerpt tail (#144729)
  fix(logging): preserve OpenClaw package references in diagnostics (#144808)
  fix: retain plugin detail tab selections while inspection loads (#144647)
  fix: keep discovered models when sign-in tokens renew (#144861)
  fix(update): preserve local package overrides (#89985)
  fix(update): resolve compatibility bridges within the runtime graph (#144831)
  chore(i18n): refresh native locales (#144856)
  fix: preserve child signal termination during CLI respawn (#144838)
  fix(text): hide encoded MiniMax tool envelopes (#126307)
  fix(subagents): deliver child replies that match the empty placeholder (#130647)
  fix(cli): reject blank message channel selectors (#144802)
  fix(telegram): preserve mixed text order and pending stop (#144839)
  fix(memory): restore FTS fallback for same-name view collisions (#144783)
  chore(release): close out 2026.9.4 on main (#144708)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant