Skip to content

refactor(doctor): simplify preview policy warnings - #140124

Merged
steipete merged 1 commit into
mainfrom
steipete/cleanup-doctor-preview-relays
Sep 6, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/cleanup-doctor-preview-relays

Conversation

@steipete

@steipete steipete commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Related: #135868

What Problem This Solves

Doctor preview duplicated message-tool availability requests and carried private wrappers and provenance fields that no caller needed. This is a maintainer-requested cleanup companion to the #135868 split campaign; it extracts no recovery feature content.

Why This Change Was Made

Use the existing provider-policy and lazy-loader owners directly, build each availability request once, and remove the source-reply helper's unreachable no-grant option. Both callers always enabled that grant. Keep the filtered agent list's canonical inferred type, eliminating the two duplicated assertions and their exact baseline entry.

User Impact

No user-visible behavior changes. Warning text and ordering, explicit provider/global/agent restrictions, direct/group reply selection, malformed-entry filtering, and lazy channel loading remain intact.

Evidence

  • Production: +34/−94 = −60, one file, 940→880 lines. Tooling: one exact assertion-baseline row removed. Tests/docs unchanged.
  • Source and whole-repository caller inspection: removed helpers/data are private; provider-policy resolver already returns the same fresh key/policy pair; the same channel loader owns both awaited loads. The filtered roster helper remains shared by four callers.
  • Stable v2026.9.2 and the inspected main base have the identical original owner blob. Pickaxe history traces these helpers to e357203be57; this removes private plumbing while preserving the shipped warning contract.
  • 121 existing tests passed before/after; the final source-reply simplification passed its 54 targeted tests. Suites cover preview warnings, provider tool policy, Doctor config flow, and startup channel maintenance. The final type refinement emits identical runtime JavaScript.
  • 7,818 configurations produce 23,454 exact before/after comparisons through the three actual warning collectors and real policy/roster/route owners. Warning strings/order, frozen inputs, and 679 existing empty-roster error outcomes match. Removing the source grant changes 2,217 cases; bypassing provider denial changes 170. This is collector proof, not live provider execution.
  • Full selected changed-check plan passed, including core/core test types, scripts lint, all three dead-export scans, and architecture guards. Build passed in 6m23s, including native module loads and Doctor closure checks; generated bundled assets match committed bytes. Pinned-base local and committed-branch Codex reviews are clean through P2. Exact-head hosted CI follows publication.

Initial exact-head CI run 34035193405 failed in the existing Codex containment fixture, transport.process.test.ts:385 (the reparented case reports uncertain cleanup). Its test and runtime owners are unchanged on current main. The lead-requested second attempt passed on the same reviewed head; no test or runtime change was made. The final fresh-main rebase preserves all recorded proof inputs and the lockfile, and final-head CI passed in run 34036825802. Native prepare and merge completed successfully; merged as d4f67f2.

ClawSweeper disposition (reviewed 029f7d840cca): no code or security findings. Its requested data-model compatibility proof is inapplicable: the changed owner only reads configuration and produces transient diagnostic strings; the removed provenance field was private temporary data and never persisted. No schema, store, migration, serialization, config key, or write path changed. The other file is a tooling assertion-count ratchet, not an OpenClaw data store. Stable-tag source comparison, frozen-input comparisons, unchanged warning output, and existing Doctor tests cover the actual compatibility contract. No additional migration test or data-model change is warranted.

Follow-up diagnosis on the unchanged reviewed head: the targeted Codex case passed locally on macOS and in all ten Linux Testbox trials (run 34035880137; one-shot lease stopped). These trials did not establish the initial failure’s root cause. The subsequent lead-requested CI attempt passed; no assertion was weakened and no rerun is claimed as a source repair.

@clawsweeper

clawsweeper Bot commented Sep 6, 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 commands Command implementations size: S maintainer Maintainer-authored PR labels Sep 6, 2026
@steipete steipete self-assigned this Sep 6, 2026
@steipete
steipete marked this pull request as ready for review September 6, 2026 13:08
@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 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 6, 2026, 9:46 AM ET / 13:46 UTC.

ClawSweeper review

What this changes

Simplifies Doctor’s configuration-warning helpers and removes two unnecessary type assertions while preserving warning text, ordering, and policy checks.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this maintainer-requested cleanup open with no actionable findings. The previous migration-proof blocker was inapplicable: the introduced changes do not alter persisted data or upgrade behavior.

Priority: P3
Reviewed head: b346bb66f1c5e18e88d7176f5ae11f39f095824d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving cleanup with relevant existing coverage and no supported correctness or security blocker.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this maintainer-authored cleanup. The body reports before/after execution of the actual warning collectors, matching the changed diagnostic boundary; those results were not rerun here.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this maintainer-authored cleanup. The body reports before/after execution of the actual warning collectors, matching the changed diagnostic boundary; those results were not rerun here.
Evidence reviewed 8 items Verified introduced scope: The pinned merge-base-to-head diff contains only private warning-helper simplifications and removal of the corresponding two-assertion baseline allowance. The host-verified test merge likewise changes only these two files; provider onboarding differences belong to base drift.
Reply-policy equivalence: Both original unavailable-target callers always enabled the source-reply grant. The replacement retains that grant and all six policy checks. The channel predicate remains equivalent when group policy overrides global policy, including automatic groups with message-tool direct replies.
Existing helper contracts: The provider resolver already returns a fresh key/policy pair, so removing its copying wrapper preserves the consumed result. Both channel imports continue through the same cached loader. The roster owner returns typed agent entries, supporting removal of the widened return annotation and casts.
Findings None None.
Security None None.

How this fits together

Doctor examines OpenClaw configuration and presents diagnostic notes to operators. This change simplifies how its preview combines agent, provider, and reply policies into warnings.

flowchart TD
  A[OpenClaw configuration] --> B[Doctor preview]
  B --> C[Agent and channel routes]
  B --> D[Provider and tool policies]
  C --> E[Warning collectors]
  D --> E
  E --> F[Operator diagnostic notes]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source -60, Other -1. Total -61 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 34 94 -60
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 2 34 95 -61

Review metrics

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: config/assertion-safety-baseline.txt, migration/backfill/repair: src/commands/doctor/shared/preview-warnings.ts, unknown-data-model-change: src/commands/doctor/shared/preview-warnings.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Retain the simpler private helpers and existing warning contract without adding migration machinery or duplicate tests.

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

Not applicable: this refactor claims behavioral equivalence rather than a bug fix; source inspection and existing warning tests support that claim.

Is this the best way to solve the issue?

Yes. Reusing the existing resolver and loader, preserving inferred roster types, and removing an unused branch is a narrow simplification of the current implementation.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is a bounded internal cleanup with no intended operator-visible behavior change.
  • 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 external-contributor proof gate does not apply to this maintainer-authored cleanup. The body reports before/after execution of the actual warning collectors, matching the changed diagnostic boundary; those results were not rerun here.

Evidence

What I checked:

  • Verified introduced scope: The pinned merge-base-to-head diff contains only private warning-helper simplifications and removal of the corresponding two-assertion baseline allowance. The host-verified test merge likewise changes only these two files; provider onboarding differences belong to base drift. (src/commands/doctor/shared/preview-warnings.ts:138, b346bb66f1c5)
  • Reply-policy equivalence: Both original unavailable-target callers always enabled the source-reply grant. The replacement retains that grant and all six policy checks. The channel predicate remains equivalent when group policy overrides global policy, including automatic groups with message-tool direct replies. (src/commands/doctor/shared/preview-warnings.ts:88, b346bb66f1c5)
  • Existing helper contracts: The provider resolver already returns a fresh key/policy pair, so removing its copying wrapper preserves the consumed result. Both channel imports continue through the same cached loader. The roster owner returns typed agent entries, supporting removal of the widened return annotation and casts. (src/agents/provider-tool-policy.ts:29, b346bb66f1c5)
  • Prior blocker disposition: The removed provenance field existed only in a private policy result. The changed collectors produce transient strings, and Doctor passes those strings to its note emitter. No introduced hunk changes a schema, stored configuration, migration, serialization, or write operation. (src/commands/doctor-config-flow.ts:603, b346bb66f1c5)
  • Existing behavioral coverage: Inspected existing tests cover runtime message grants, provider restrictions, separate direct/group warnings, and routed agents. Additional inspected cases cover inherited provider policies and model-specific overrides. Tests were read, not executed during this review. (src/commands/doctor/shared/preview-warnings.test.ts:1235, b346bb66f1c5)
  • Current main and release comparison: The warning owner has identical blob 87a51339e0da8327b5b2d8037085975da6d46e42 on fetched main and v2026.9.2; this branch has blob 8baaaee2482fe202f0cb29a15fedea558d76166e. The requested cleanup is therefore not already present in either inspected reference. (src/commands/doctor/shared/preview-warnings.ts, b8ef27d69475)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-06T13:13:57.080Z sha 029f7d840ccaaa07a45f6a95e89674aac5386696 :: blocked before merge. :: none

@steipete
steipete force-pushed the steipete/cleanup-doctor-preview-relays branch from 029f7d8 to b346bb6 Compare September 6, 2026 13:40
@steipete
steipete merged commit d4f67f2 into main Sep 6, 2026
178 of 179 checks passed
@steipete
steipete deleted the steipete/cleanup-doctor-preview-relays branch September 6, 2026 13:51
@steipete

steipete commented Sep 6, 2026

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

commands Command implementations 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: S 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