Repository navigation
fix(doctor): distinguish ledger settlement from config changes - #193476
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR distinguishes plugin-migration ledger settlement from actual configuration changes when selecting Doctor’s post-plugin work. Example: Doctor settles the retained migration obligation for plugin "fixture" while its settings remain {"region":"us-en"}.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR fixes a concrete current-main bookkeeping error with a focused change, and no introduced correctness or security defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherDoctor preflight reads configuration and migration obligations, completes existing repair owners, and returns snapshot and change facts to the contribution selector. flowchart TD
A[Updater retirement request] --> B[Doctor preflight]
B --> C[Existing plugin migration owner]
C --> D[Refresh config snapshot]
D --> E[Compare inputs validity and config]
E --> F[Doctor eligibility checks]
F --> G[Six retained contributions or full pass]
Technical reviewBest possible solution: Keep snapshot refresh and repair replanning in the existing preflight owner while recording only actual configuration changes. Do we have a high-confidence way to reproduce the issue? Current main visibly maps a ledger-triggered snapshot refresh to configChanged=true, and the existing production-preflight fixture exercises settlement with unchanged settings; no target code was executed during this review. Is this the best way to solve the issue? The patch corrects the fact at its existing producer, preserves sticky prior changes and projection changes, and introduces no competing owner or persistence mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5492b763a42a. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +6, Tests -9. Total -3 across 3 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 5, 2026, 8:03 AM ET / 13:03 UTC. |
…law#193476) Keep snapshot refresh and fresh repair planning after plugin-migration settlement, but only report a config change when input, validity, or the validated projection changes. This lets unchanged config use the existing retirement-only post-plugin Doctor while genuine changes and findings still widen. Preserve maintenance, capture, backup, refusal and recovery owners. The fixed-driver native pair completes retirement and final transport with 91 to 22 post-plugin sections, 133014 to 125666 SQL statements and 409 to 281 requests. Runtime MAIN does not increase. Include the accepted extra deferred Gateway integrity work in whole-flow counts; generation observations remain unchanged and no timing speedup is claimed.
What Problem This Solves
A post-plugin Doctor can finish a retained plugin-migration obligation without changing config. Preflight nevertheless sets
configChangedwhenever completion asks it to refresh the snapshot. That false fact widens a deferred-model-retirement pass into the full Doctor contribution list.User Impact
Deferred model retirement can finish with the existing narrow Doctor when settling a migration ledger did not change config. Genuine changes and findings still require the full pass.
Why This Change Was Made
Keep the snapshot refresh and fresh repair plan, and use the existing config-input comparator plus validity and validated-config equality to decide whether config actually changed. Prior config changes remain sticky. Removing validation exclusions can change the validated projection even when file bytes stay equal; that still widens. No retirement implementation, fallback, state schema, SQL, authority, capture, backup, or recovery owner changes.
The existing narrow path keeps config migration writes, auth-profile migration, session transcripts and their bound post-session plugin plan, Codex session routes, final config write, and final validation. A genuine config/projection change, plugin change, unresolved migration, refusal, or new finding retains the full-pass behavior. Successful state migrations may also settle a ledger entry without changing config; this is not limited to stateless plugins. Such installs can now take the existing narrow post-plugin path. An explicit
openclaw doctorstill runs the full pass. The review specifically checks for downstream repairs this could omit.This correction must be in the candidate Doctor. The installed updater must already support retirement-only requests for the contribution saving; older drivers keep their existing full-pass selection. The larger proposed completion-handoff protocol is not included.
Acceptance recorded before native measurement — POSTPASS-STAGE1-V1
Measured production head:
6c1c0dd124c69a892ae85f94e67bf712198ef85a. Final head:7f4cfc1a0d8d3e8ba29831e8c10b5b2817f67546(documentation only; production/test blobs identical). Baseline:18a3a6c22624550f23852645836013dfd1765a05. Fixed installed driver:ef81b2545c8cf6f20f1b2723628fc5291d45bde0.Use the committed
scripts/perf/doctor-retirement-measure.mtscold native update workload on macOS/Node 26.12.1 with retained WAL, synthetic standing advisories, deferred-to-completed retirement, and final real loopback Gateway transport. Recreate the same explicit internal scratch root for baseline then candidate; one count sample per arm using the frozen v3.1.5 observer. Random credentials/ports are synthetic; no user state is read. Record each Doctor's sections, SQL statements, worker requests, process-main work, generation observations, and Gateway runtime MAIN separately. The wrapper is orchestration only; the workload is committed.Pass: the candidate post-plugin Doctor runs exactly the six retained contribution IDs, completes retirement and final transport/cleanup, reduces statements and requests, and does not increase Gateway runtime MAIN. Genuine changes/findings still widen; refused and interrupted repair, captures and backups keep existing owners. Native and published-driver proof plus exact-head CI (including all three PostgreSQL shards and static gates) are required before landing.
No latency or CPU-speedup claim comes from observer counts or one diagnostic pair. Any separate timed experiment requires the timing lock, load below 24, five alternating samples per arm with cold/warm kept separate, median/p95/spread and no adverse user-facing cell. The coordinator explicitly accepts this small correctness fix without a minimum timing gain.
Evidence
configChanged=true; expected false.doctor:write-config-migrations,doctor:auth-profile-migration,doctor:session-transcripts,doctor:codex-session-routes,doctor:write-config, anddoctor:final-config-validation; no widening diagnostic. Rehearsal and first-live counts were identical.The entire-native request total includes 153,881 generation-observer requests in each arm. Final Gateway including shutdown has an adverse count cell: 580→582 SQL, 138→165 requests (cold 129→154; shutdown 9→11). The candidate ran an additional deferred startup-integrity child plus background startup/health work before the short transport-ready cutoff. The workload does not drain all deferred startup. These costs remain included in the overall reduction; no steady-state claim is made. Final launch-to-ready diagnostic was 7,848→9,306 ms with the observer, one sample each, so this is not qualified timing evidence or a speedup claim.
The coordinator accepted the final-Gateway count increase as moved background work, conditional on readiness remaining independent and completed verification being reusable. Source confirms dispatch/preparation readiness does not await the scan; successful verification publishes its age through the existing owner, then an orderly close seals it for restart. The native child ran after sidecar readiness and overlapped the transport probe; the short harness cutoff did not record its owner-completion receipt. A supplemental replay of the unchanged integrity owners passed 14 selected cases: serving/writing while verification is held, recording age/seal after success, rejecting proven corruption, and reopening from a valid on-disk seal without another integrity scan. It used the retained fixed-driver source; all relevant owner/test blobs match the reviewed candidate. Interrupted checks or unclean close still require later verification. No unconditional every-restart saving is claimed.
Generation/copy work is not solved by this correction: observations remain unchanged. Completed-retirement rows are not serialized by the analyzer; the native harness independently asserts completion. The fixture does not exercise managed-service restart; the published-driver cell supplies that coverage. Some process exit events were not serialized, while independent process-group cleanup was confirmed. Byte-copy totals are not instrumented.
Release-note context: avoid repeating full post-plugin Doctor contributions when plugin-ledger settlement leaves config unchanged, while retaining full checks for actual changes and findings.