Skip to content

refactor(update): simplify manual capture and Doctor evidence - #178629

Merged
steipete merged 1 commit into
mainfrom
deslop/z40-23-update-evidence-20261015
Oct 20, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/z40-23-update-evidence-20261015

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Update recovery and Doctor each carried extra bookkeeping around evidence that does not authorize a write. Manual original-state captures rejected already verified private images when the live database advanced afterward. Optional clean-history hints separately retained native admissions and checked write tokens despite the update owner already comparing full physical generations and file-family observations. The pnpm bootstrap also wrapped its successful result in an intermediate nullable envelope.

User Impact

Manual recovery evidence can seal a verified image even if the live database has since advanced. It remains manual evidence, not permission for automatic restoration. No user action or migration is required.

Why This Change Was Made

Trust the chosen manual SQLite images after safe acquisition and verification; preserve backup warnings and document that those bytes may precede later live writes. Remove the redundant final live-generation reread, not automatic rollback's generation guard. Keep a direct WAL/journal check at missing-database inventory admission so pre-existing recovery bytes still prevent sealing incomplete evidence.

Remove native admission/token retention from optional historical-scan hints. Keep full generation comparisons, file-family observations, canonical paths, bounded external parsing, complete scan identity and actual repair authority/current-row comparison. Return the resolved pnpm bootstrap directly, sharing failure cleanup and the existing string-record helper.

Net production LOC: 101 removed across three existing owners (27 manual capture, 62 optional hints, 12 bootstrap). This is a residue under the campaign's 100-line waiver, not a LARGE PR. No persisted shape, schema, config, protocol, dependency or public export change. Standalone session memory machinery is untouched.

Best-effort tradeoffs accepted

  • A live database can advance after a verified manual image was chosen. The introducing manual-recovery work (fix(update): preserve original state before direct updates #161044, perf(update): reuse verification for owned recovery images #175359) defines non-atomic evidence, not automatic restoration authority; the inspected provenance contains no qualifying human incident requiring the final reread. The chosen image now seals while later live rows remain intact. Automatic rollback still refuses later generations.
  • An exact reversal to indistinguishable physical content/write evidence can reuse an equivalent clean-history result; an unsupported writer immediately after the reuse check can stale that advisory pass. The optional hint implementation in improve(doctor): updates scan retained transcripts once instead of twice #177933 provides no human-reported incident requiring an additional native-token lifecycle, and tokens are not exclusion. Existing family observations and final full generations remain; changed intervals do not propagate a new hint, and repair still checks current authoritative rows.
  • Ill-typed internal numeric/boolean environment entries are dropped instead of stringified. The typed ProcessEnv contract and existing normalization owner accept strings; real environment strings, empty values, Windows Path casing, pin checks and cleanup remain supported.

Evidence

Focused proof completed: all five selected capture cases, all 25 unchanged historical-scan reuse cases, three original-capture cases, 15 Doctor result/IPC cases, three PR-wrapper import-closure cases, 14 suppression cases, and all four unchanged WAL-generation restore transitions pass. The first full backup/package run also supplies 27 unaffected backup cases and ten bootstrap cases; counting overlapping replays once gives 106 distinct passing cases across eight files. Follow-up selectors deselect unrelated cases; no configured skip, timeout, retry or assertion was weakened.

The first run caught a stale worker count and showed that the removed broad reread also carried missing-database journal rejection. The final candidate tightens the count to one worker and checks the authoritative missing-resource inventory inside the existing error boundary. Both existing sidecar tests remain unchanged and pass, preserving their recovery bytes and contextual refusal.

Six-root targeted types, typed lint, formatting and whitespace pass. Runtime and Madge import cycles were zero; the later repair changes no imports. Fresh independent whole-candidate P0–P2 review is scoped-clean with no actionable findings. All local runtime proof used task-owned HOME/OpenClaw/XDG state, nice 10 and one worker. No red-control, latency, native-Windows, live Gateway or upgrade claim. Hosted CI on the exact pushed head is broad proof.

@clawsweeper

clawsweeper Bot commented Oct 20, 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.

@steipete
steipete marked this pull request as ready for review October 20, 2026 18:10
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T18:27:52.759344Z 1c641c1 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: M labels Oct 20, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 20, 2026
@clawsweeper

clawsweeper Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR simplifies manual recovery capture, optional Doctor scan receipts, and pnpm bootstrap handling.

Example: A verified database image contains row 42 with value "retained", then the live database receives "later" before capture sealing.

  • Before: The final generation comparison leaves the manual capture unsealed.
  • After: The verified image seals as manual recovery evidence while both live rows remain intact.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A coherent, scoped simplification with meaningful owner-level coverage and passing gates; behavior evidence remains below shipped-entry-point proof.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; supplied validation exercises production capture owners with real SQLite files and scan-reuse tests, while claiming no shipped CLI or upgrade execution. Source comparison verifies unchanged manifest and IPC shapes with no migration or rewrite of existing user data.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Updates can leave an otherwise verified manual recovery image incomplete solely because its live source subsequently advances.
Reason: The maintainer-authored direction explicitly accepts the narrower evidence contract and removes redundant machinery without adding settings or changing automatic rollback.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR makes a justified simplification, with no actionable correctness or security findings and passing exact-head gates.

Priority: P2
Reviewed head: 1c641c14e81e91e4c0980068cf2292ddbb504d84

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No current-head shipped update or Doctor run exercising the changed capture and scan-reuse paths, or red-on-base regression run, is supplied.
Agent review details

How this fits together

The update and Doctor infrastructure receives configuration, database inventories, and prior scan receipts, then produces private recovery images, advisory scan results, and a resolved build manager.

flowchart TD
  A[Update or Doctor command] --> B[Existing maintenance owners]
  B --> C[Verified database acquisition]
  C --> D[Manual recovery capture]
  B --> E[Physical generation observations]
  E --> F[Optional clean scan receipts]
  A --> G[Pinned pnpm bootstrap]
Loading

Technical review

Best possible solution:

Keep verified manual images and advisory scan reuse in their existing owners while preserving independent acquisition, repair, and automatic rollback checks.

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

Current-main source rejects manual sealing after a post-snapshot generation change, and the changed regression supplies that exact trigger; no target code was executed during this review.

Is this the best way to solve the issue?

The simplification uses the existing capture, generation, and bootstrap owners, removes the replaced paths, and documents the intentional manual-evidence and advisory-reuse tradeoffs.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Manual capture sealing and recovery documentation changes intended behavior with a stated reason (e47d0ce: Retain original state before update initialization or Doctor mutation as manual, non-atomic recovery evidence; later work improved owned-image verification and incomplete-capture diagnostics.)
  • Doctor historical-scan token retention changes intended behavior with a stated reason (27aa074: Avoid duplicate retained-history scans using conservative generation, token, file-observation, and identity checks; this PR explains why optional hints retain the physical checks without a separate token lifecycle.)
  • pnpm bootstrap result handoff keeps the original intent (f78878c: Keep private preparation inside its existing consumer while preserving bootstrap behavior; returning the resolved result directly continues that ownership direction.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit e47d0ce adds src/infra/update-recovery-baseline-capture.ts:107 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e47d0ce424bc; files: src/infra/update-recovery-baseline-capture.ts)
  • Jason (Json): Raw commit 27aa074 adds src/infra/update-doctor-scan-receipts.ts:68 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 27aa0742fc28; files: src/infra/update-doctor-scan-receipts.ts)

PR surface

Source -101, Tests +2, Docs 0. Total -99 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 57 158 -101
Tests 2 49 47 +2
Docs 1 8 8 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 114 213 -99

Labels

Label changes:

  • add P2: Preserves useful verified manual recovery evidence when live databases advance and reduces update bookkeeping without changing automatic restoration authority.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Preserves useful verified manual recovery evidence when live databases advance and reduces update bookkeeping without changing automatic restoration authority.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

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

  • Provide a redacted shipped CLI trace showing a verified manual capture sealing after later live writes while those live writes remain intact.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 20, 2026, 2:38 PM ET / 18:38 UTC.

@steipete
steipete merged commit f06bab6 into main Oct 20, 2026
208 of 209 checks passed
@steipete
steipete deleted the deslop/z40-23-update-evidence-20261015 branch October 20, 2026 18:47
@steipete

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

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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