Skip to content

fix(doctor): preserve unresolved findings for each repair outcome - #117448

Merged
steipete merged 1 commit into
mainfrom
codex/qa401-doctor-repair-outcome-ownership
Aug 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa401-doctor-repair-outcome-ownership

Conversation

@steipete

@steipete steipete commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Root cause

The Doctor repair owner discarded each check's original finding when a repair was skipped, failed, unavailable, or could not be validated. Aggregate repair counters also hid these unresolved findings when another check in the same batch succeeded.

Fix

Select the authoritative findings while each individual check's repair outcome is still available: use post-repair findings only after that same check completes validation; otherwise preserve its original findings. Existing caller contracts, check order, configuration threading, and repair counts remain unchanged.

Verification

  • Regression-first producer suite: 12 failing cases and 7 existing passes before the fix; all 19 pass afterward.
  • Mixed batches cover successfully repaired siblings combined with skipped, failed, thrown, unavailable, and unvalidated split or runnable checks.
  • Three targeted existing Doctor contribution tests pass; the complete 101-test contribution file exceeded the shared-host 120-second inactivity watchdog.
  • Eight existing registered Workspaces owner tests also pass; the chosen Vitest config discovered that owner file only from a two-file sibling request.
  • Real registered Workspaces check, real repair runner, and unchanged contribution consumer report the blocked repair while preserving the isolated workspace fixture.
  • Exact-file configured type-aware lint, format, and whitespace checks pass.

Real registered Doctor repair: exact before/after console proof

Ran Node v24.18.0 against current main (71a59512ba476df3328cf485d84748121cf341f2) and this exact PR head (b408623e10754e6155b4661aded28d764fc574d1). The isolated fixture contains a real retired-Workspaces fingerprint at <STATE_DIR>/workspaces/workspaces.sqlite and deliberately configures that same directory as the active agent workspace. The actual production CORE_HEALTH_CHECKS registry selects core/doctor/removed-workspaces-state; the actual production runCoreContributionHealth(...) Doctor command path performs detection, safely skips the destructive repair, and renders the final structured result. No mocked check, repair, consumer, or Gateway is involved.

Exact commands:

/Users/steipete/.local/bin/node --import tsx /private/tmp/openclaw-qa401-doctor-registered-proof.mts /Users/steipete/Projects/openclaw before
/Users/steipete/.local/bin/node --import tsx /private/tmp/openclaw-qa401-doctor-registered-proof.mts /private/tmp/openclaw-qa401-doctor-repair-outcomes-133a fixed

Current main:

checkout=before
registered-check=core/doctor/removed-workspaces-state
before-repair findings=1; repair-status=skipped; after-repair remaining=0; validated=0
actual-doctor-console-lines=0
workspace-database-preserved=true; network-attempts=0

Exact PR head:

checkout=fixed
registered-check=core/doctor/removed-workspaces-state
before-repair findings=1; repair-status=skipped; after-repair remaining=1; validated=0
actual-doctor-console-lines=1
  [warning] core/doctor/removed-workspaces-state <STATE_DIR>/workspaces - Retired Workspaces plugin fingerprints remain at <STATE_DIR>/workspaces, but agents.defaults.workspace resolves to that directory or an overlapping path. Automatic removal is disabled.
workspace-database-preserved=true; network-attempts=0

Therefore the unchanged, real Doctor consumer previously emitted no structured console outcome after the real owner safely skipped repair; the exact PR head preserves and renders the unresolved warning while leaving the protected workspace database untouched. Network calls are denied and counted; both runs observed zero attempts. Fixture paths are redacted; no credentials or user state are read.

Rank-up move response

  • Show real registered Doctor owner/harness output: addressed above with exact commands, current-main/frozen-head console output, the real production registry/check/repair/consumer, persistent fixture verification, and zero-network proof. This check has no Gateway dependency; a mock Gateway would not exercise an additional user-visible boundary.
  • Document focused verification: regression-first producer was 12 failures/7 passes before and 19/19 after; unchanged consumer regressions 3/3; registered Workspaces-owner regressions 8/8; configured typed lint, formatter, whitespace check, and fresh genuine independent autoreview passed. The broader 101-case consumer suite hit the shared-host inactivity watchdog; it is not claimed green.

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 1, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 11:31 AM ET / 15:31 UTC.

ClawSweeper review

What this changes

The branch changes Doctor repair aggregation so each unvalidated check retains its original finding while successfully validated repairs use their post-repair findings.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep this PR open for maintainer review. Current main still drops a check’s original findings whenever that check skips, fails, or cannot validate repair, so the requested Doctor warning remains necessary; the patch repairs that owner boundary with focused mixed-outcome coverage and no discrete correctness finding found. The maintainer label requires an explicit human merge decision.

Priority: P1
Reviewed head: b408623e10754e6155b4661aded28d764fc574d1
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with strong source alignment, comprehensive mixed-outcome regressions, green supplied checks, and credible registered-check console proof.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR body contains a redacted current-main versus PR-head console transcript through the real registered Workspaces Doctor check and unchanged renderer, visibly showing the unresolved warning restored after a skipped repair while the protected workspace database remains intact.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body contains a redacted current-main versus PR-head console transcript through the real registered Workspaces Doctor check and unchanged renderer, visibly showing the unresolved warning restored after a skipped repair while the protected workspace database remains intact.
Evidence reviewed 6 items Current-main defect: Current main appends only each check's remainingFindings; split and runnable checks return an empty list when repair is skipped, fails, is unavailable, or cannot validate, so the original detected warning is lost before the contribution renderer consumes it.
Consumer contract: runCoreContributionHealth renders remainingFindings after real repairs, making this aggregation the direct owner of the visible unresolved Doctor outcome.
Repair-boundary fix: The proposed loop chooses per-check post-repair findings only when that same check reports completed validation; otherwise it keeps the original findings, preserving warnings for skipped, failed, unavailable, and unvalidated outcomes without changing repair counters or ordering.
Findings None None.
Security None None.

How this fits together

Doctor runs registered health checks, may repair their findings, and then renders unresolved findings back to the operator. The repair flow sits between per-check execution and the Doctor contribution renderer, so its remaining-finding list determines whether an unresolved warning is visible.

flowchart LR
  A[Registered Doctor checks] --> B[Per-check detection]
  B --> C[Repair attempt]
  C --> D{Validation completed?}
  D -->|Yes| E[Post-repair findings]
  D -->|No| F[Original unresolved findings]
  E --> G[Doctor result renderer]
  F --> G
Loading

Decision needed

Question Recommendation
Should the protected maintainer review approve merging this focused Doctor repair now that it has source-backed mixed-outcome coverage and a redacted registered-check before/after transcript? Approve and merge: Accept the per-check validation boundary and merge the focused repair with its mixed-outcome regressions.

Why: The patch is technically sound on the inspected execution path, but the PR carries the repository's protected maintainer label, which requires explicit human handling rather than an automated merge decision.

Before merge

None.

Agent review details

Security

None.

PR surface

Source +4, Tests +108. Total +112 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 1 +4
Tests 1 112 4 +108
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 117 5 +112

Review metrics

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/flows/doctor-repair-flow.test.ts, migration/backfill/repair: src/flows/doctor-repair-flow.ts, unknown-data-model-change: src/flows/doctor-repair-flow.test.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Merge the per-check aggregation repair after the designated maintainer confirms the protected-label review, so every unresolved Doctor finding reaches the existing structured renderer while validated repairs remain clean.

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

Yes. Current source shows that the contribution renderer consumes remainingFindings, while skipped or unvalidated per-check outcomes return no such findings; the PR body additionally supplies a matching registered-check before/after console transcript.

Is this the best way to solve the issue?

Yes. Selecting the authoritative result per check at the aggregation boundary is narrower and more maintainable than changing renderers or asking each individual health check to duplicate fallback findings.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 7bcbe743bd42.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body contains a redacted current-main versus PR-head console transcript through the real registered Workspaces Doctor check and unchanged renderer, visibly showing the unresolved warning restored after a skipped repair while the protected workspace database remains intact.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body contains a redacted current-main versus PR-head console transcript through the real registered Workspaces Doctor check and unchanged renderer, visibly showing the unresolved warning restored after a skipped repair while the protected workspace database remains intact.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: Without this repair, a real Doctor check can safely skip destructive remediation yet emit no structured unresolved warning to the operator.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body contains a redacted current-main versus PR-head console transcript through the real registered Workspaces Doctor check and unchanged renderer, visibly showing the unresolved warning restored after a skipped repair while the protected workspace database remains intact.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body contains a redacted current-main versus PR-head console transcript through the real registered Workspaces Doctor check and unchanged renderer, visibly showing the unresolved warning restored after a skipped repair while the protected workspace database remains intact.

Evidence

What I checked:

  • Current-main defect: Current main appends only each check's remainingFindings; split and runnable checks return an empty list when repair is skipped, fails, is unavailable, or cannot validate, so the original detected warning is lost before the contribution renderer consumes it. (src/flows/doctor-repair-flow.ts:63, 7bcbe743bd42)
  • Consumer contract: runCoreContributionHealth renders remainingFindings after real repairs, making this aggregation the direct owner of the visible unresolved Doctor outcome. (src/flows/doctor-health-contribution-core.ts:75, 7bcbe743bd42)
  • Repair-boundary fix: The proposed loop chooses per-check post-repair findings only when that same check reports completed validation; otherwise it keeps the original findings, preserving warnings for skipped, failed, unavailable, and unvalidated outcomes without changing repair counters or ordering. (src/flows/doctor-repair-flow.ts:63, b408623e1075)
  • Regression coverage: The branch adds mixed-batch cases for split and runnable checks across skipped, failed, thrown, unavailable, and validation-failed outcomes after a successful sibling repair. (src/flows/doctor-repair-flow.test.ts:322, b408623e1075)
  • Real behavior proof: The PR body provides a redacted before/after transcript through the registered core/doctor/removed-workspaces-state check and unchanged contribution consumer: current main reports zero structured lines after a skipped repair, while the PR head reports the retained warning and keeps the workspace database intact. (src/flows/doctor-removed-workspaces-state-check.ts:157, b408623e1075)
  • History availability: Local git blame attributes the central current-main runner lines to Peter Steinberger, but broader feature history could not be completed because this partial clone attempted a promisor fetch and network DNS resolution failed; GitHub and gitcrawl were also unavailable for live corroboration. (src/flows/doctor-repair-flow.ts:41, d585c0c1ec49)

Likely related people:

  • steipete: The PR commit is authored by steipete, and local blame attributes the current repair-runner ownership lines to Peter Steinberger; the available repository identity maps this current area signal to steipete, although partial history prevented a fuller provenance trail. (role: recent area contributor; confidence: medium; commits: b408623e1075, d585c0c1ec49; files: src/flows/doctor-repair-flow.ts, src/flows/doctor-health-contribution-core.ts)

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 (2 earlier review cycles)
  • reviewed 2026-08-01T14:59:26.354Z sha b408623 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-01T15:04:11.742Z sha b408623 :: needs real behavior proof before merge. :: none

@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Addressed all ClawSweeper rank-up moves in the updated PR body with exact current-main versus PR-head output from the real registered Workspaces Doctor check and unchanged Doctor command renderer; the failed/skipped repair now visibly preserves its warning. @clawsweeper re-review

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 1, 2026
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer decision: accept the canonical per-check Doctor repair outcome refactor. The updated PR body now includes exact current-main versus PR-head output from the real registered Workspaces Doctor check, proves the skipped repair warning is visible, and verifies that the protected workspace database remains untouched; full required CI and all review gates are green.

@steipete
steipete merged commit 83208eb into main Aug 1, 2026
140 of 153 checks passed
@steipete
steipete deleted the codex/qa401-doctor-repair-outcome-ownership branch August 1, 2026 15:47
@steipete

steipete commented Aug 1, 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

maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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