Skip to content

refactor(proxy-capture): remove redundant peer check - #130068

Merged
steipete merged 1 commit into
mainfrom
cleanup/proxy-local-peer-guard
Aug 26, 2026
Merged

steipete merged 1 commit into
mainfrom
cleanup/proxy-local-peer-guard

Conversation

@steipete

@steipete steipete commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The proxy-capture coverage owner carried an exact 127.0.0.1:11434 check immediately before a generic 127.0.0.1: prefix check that already accepts the same host. The stale special case added a duplicate decision and implied provider-specific behavior where none exists.

This is a maintainer-requested, AI-assisted cleanup from the bounded M-P owner campaign.

Why This Change Was Made

Remove only the subsumed equality and retain the canonical loopback/localhost prefix checks. For every normalized host string, host === "127.0.0.1:11434" implies host.startsWith("127.0.0.1:"), so local-peer membership, counts, map insertion order, and sorted output remain identical.

The original proxy-capture commit (#64895) introduced both terms together. No separate product, provider, persistence, security, or compatibility boundary distinguishes the exact port. Alternatives that extracted a helper or changed the local-peer policy were rejected as broader and less direct.

Production LOC: +1/-5 (net -4). Tests: +0/-0.

User Impact

No user-visible behavior changes. Proxy-capture coverage continues to classify all 127.0.0.1:<port> and localhost:<port> hosts exactly as before, with one fewer redundant predicate.

Evidence

Exact head: 35a609d7e54f2205c92aa39ae7f221a2d996a284

  • Direct production-path assertion through DebugProxyCaptureStore.summarizeSessionCoverage: 127.0.0.1:11434, 127.0.0.1:1234, and localhost:8080 remained in localPeers in the same order; api.example.com remained excluded.
  • node scripts/run-vitest.mjs src/proxy-capture/store.sqlite.test.ts — 14/14 passed.
  • node scripts/check-changed.mjs -- src/proxy-capture/store.sqlite.ts — all changed-file gates passed, including core/core-test types, dead exports, lint, cycles, and database guards.
  • node scripts/run-oxlint.mjs src/proxy-capture/store.sqlite.ts — 0 warnings/errors.
  • git diff --check — passed.
  • Deslop — clean, no changes required.
  • Structured exact-head autoreview — clean, correctness 1.00.
  • Separate independent exact-head Codex review — clean, correctness 1.00.

@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 26, 2026 10:17
@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@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 Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 10:50 AM ET / 14:50 UTC.

ClawSweeper review

What this changes

Removes the exact 127.0.0.1:11434 local-peer condition because the retained 127.0.0.1: prefix condition already covers it.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open for normal maintainer handling: this member-authored, maintainer-labeled refactor removes a logically subsumed condition without changing proxy-capture output, subject to the pending exact-head preflight and base refresh.

Priority: P3
Reviewed head: 35a609d7e54f2205c92aa39ae7f221a2d996a284

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A small, source-proven simplification with no correctness or security finding; final readiness depends on refreshed exact-head CI.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored behavior-neutral refactor is exempt from the external-contributor real-behavior-proof gate.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored behavior-neutral refactor is exempt from the external-contributor real-behavior-proof gate.
Evidence reviewed 6 items Exact-head semantic equivalence: The PR retains both loopback-prefix checks and removes only an equality whose matching string necessarily starts with 127.0.0.1:; the map update and sorted result remain on the same path.
Normalized host contract: The owner normalizes row.host to a nonempty primitive string before the predicate, so the retained startsWith call has no changed type or throw behavior.
Consumer boundary: QA Lab forwards the coverage summary unchanged from the capture store, establishing the operator-facing consumer of localPeers.
Findings None None.
Security None None.

Live Verification

Command: OPENCLAW_STATE_DIR=/tmp/openclaw-proxy-proof pnpm proxy:coverage

Result: PASS (completed)

$ node scripts/run-node.mjs proxy coverage
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 120.08 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 14.7s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4413ms (slowest: built plugin control-plane loads 3656ms)
{
  "summary": {
    "total": 11,
    "captured": 9,
    "proxyOnly": 2,
    "uncovered": 0
  },
  "entries": [
    {
      "id": "provider-transport-fetch",
      "label": "Provider HTTP transport",
      "modulePath": "src/agents/provider-transport-fetch.ts",
      "protocols": [
        "http",
        "https",
        "sse"
      ],
      "status": "captured",
      "notes": "Central provider fetch seam routes through explicit proxy overrides and records request/response payloads."
    },
    {
      "id": "discord-rest",
      "label": "Discord REST monitor fetch",
      "modulePath": "extensions/disco
… output truncated …

Assertions:

  • PASS expect_output: summary

How this fits together

Proxy capture stores request hosts and summarizes session coverage for debugging. Its local-peer subset is returned through the QA Lab capture-coverage API for operator inspection.

flowchart LR
  A[Captured request events] --> B[SQLite capture store]
  B --> C[Session coverage summary]
  C --> D[Loopback host classification]
  D --> E[Local peer counts]
  C --> F[QA Lab coverage API]
  F --> G[Operator debugging view]
Loading

Before merge

  • Complete next step (P2) - No repair lane is needed; this clean maintainer PR only needs normal exact-head CI and merge handling.
Agent review details

Security

None.

PR surface

Source -4. Total -4 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 1 5 -4
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 1 5 -4

Review metrics

Metric Value Why it matters
Production versus test LOC production −4 net, tests 0 The one-file change simplifies an existing predicate without adding a behavior, setting, or persistent-data surface.

Merge-risk options

  • GitHub currently reports the branch behind its base and the exact-head preflight is still in progress; merge after the refreshed head has green required checks.

Maintainer options:

  1. Decide the mitigation before merge
    Land the narrow simplification after rebasing or refreshing the branch and confirming green exact-head checks; no new abstraction, configuration, or compatibility path is needed.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the narrow simplification after rebasing or refreshing the branch and confirming green exact-head checks; no new abstraction, configuration, or compatibility path is needed.

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

Not applicable: this PR does not report a user-facing defect; source inspection establishes equivalence for every normalized host string.

Is this the best way to solve the issue?

Yes: deleting the subsumed equality is the narrowest maintainable repair and preserves the existing loopback classification policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 376510eb7128.

Labels

Label justifications:

  • P3: This is a small behavior-preserving cleanup with no claimed user-visible effect.
  • 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: This member-authored behavior-neutral refactor is exempt from the external-contributor real-behavior-proof gate.

Evidence

What I checked:

Likely related people:

  • Takhoffman: Authored the merged proxy-capture feature that introduced this store and test surface. (role: original feature author; confidence: high; commits: 958c34e82cdb; files: src/proxy-capture/store.sqlite.ts, src/proxy-capture/store.sqlite.test.ts)
  • Peter Steinberger: Current-main blame attributes the predicate block to this recent source commit. (role: recent source contributor; confidence: medium; commits: b85c6e3ac73d; files: src/proxy-capture/store.sqlite.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Rebase or refresh against current main and wait for the exact-head preflight to complete successfully.

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.

History

Review history (4 earlier review cycles)
  • reviewed 2026-08-26T10:24:15.998Z sha dfa9e23 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-26T11:06:11.150Z sha dfa9e23 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-26T13:26:23.278Z sha f94054fd45451ab0ab4612d2c6834b41b93f9f80 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-26T14:08:45.039Z sha f94054fd45451ab0ab4612d2c6834b41b93f9f80 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the cleanup/proxy-local-peer-guard branch from dfa9e23 to f94054f Compare August 26, 2026 13:19

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete
steipete force-pushed the cleanup/proxy-local-peer-guard branch from f94054f to 35a609d Compare August 26, 2026 14:44

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

Copy link
Copy Markdown
Contributor Author

Land-ready at exact head 35a609d7e54f2205c92aa39ae7f221a2d996a284.

  • Focused proxy-capture store proof: 14/14 passed.
  • Changed-file checks, oxlint, diff check, and deslop: clean.
  • Structured autoreview and separate independent Codex review: clean, correctness 1.00 each.
  • ClawSweeper durable exact-head review: no findings; security cleared (comment, run 32982320220).
  • Full exact-head CI: green (run 32982152761).
  • Production +1/-5 (net -4); tests +0/-0.

The optional ClawSweeper rank-up item is satisfied by the completed refresh after the broken-main repair and the green exact-head CI above. Current live state is mergeable with no non-green checks; unrelated subsequent main drift is left to the native merge relevance guard.

@steipete
steipete merged commit 1fec7b6 into main Aug 26, 2026
200 of 203 checks passed
@steipete
steipete deleted the cleanup/proxy-local-peer-guard branch August 26, 2026 18:14

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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: XS 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.

2 participants