Repository navigation
feat(mac): harden Peekaboo elevation cutovers - #124564
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 17, 2026, 4:57 AM ET / 08:57 UTC. ClawSweeper reviewWhat this changesThe PR hardens the macOS Peekaboo elevation package, installer, migration, and recovery flow with artifact attestation and durable transaction state. Merge readinessThe PR has a blocking recovery-custody flaw: its new restore helper can overwrite a concurrently recreated LaunchAgent or receipt, contrary to the fail-closed cutover invariant. Keep it open for a no-clobber recovery repair. Priority: P1 Review scores
Verification
How this fits togetherThe macOS elevation host packages a signed computer-control application and installs it as a background owner. Its installer transfers app, LaunchAgent, and receipt custody before reconnecting the host to the Gateway. flowchart LR
A[Release source and Peekaboo pin] --> B[Signed package and receipt]
B --> C[Portable installer]
C --> D[Durable prepared transaction]
D --> E[App and LaunchAgent cutover]
E --> F[Recovery or final receipt]
F --> G[Background host reconnects]
Before merge
Findings
Agent review detailsSecurityNeeds attention: Recovery can overwrite concurrently recreated custody files, defeating the PR’s fail-closed preservation guarantee. PR surfaceTests +4505, Docs +66, Other +2979. Total +7550 across 9 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Replace recovery’s replacing rename with identity-bound exclusive custody that preserves an unexpected destination, then add a race regression covering both the elevation plist and receipt restore paths. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: recreate the receipt or elevation plist after recovery snapshots it and before the direct destination-replacing move; the replacement is overwritten rather than preserved. Is this the best way to solve the issue? No. The patch already has an authenticated exclusive-custody pattern for raced migration files, and recovery should use that pattern instead of a replacing move. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5ebfbbf8d785. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
2e12dcd to
daaf40e
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
5cdacb0 to
132c62c
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
132c62c to
c49fa7a
Compare
|
@clawsweeper re-review The exact head is now The two prior P1 findings are closed: migration custody uses the single authenticated exclusive-rename helper and no fallback executable exists. The branch also now persists and fsyncs a UUID-bound prepared transaction before any custody mutation, binds durable sidecar and rollback identities through recovery, and resumes after SIGKILL or restored-owner restart. Exact local proof is 142/142 elevation/package tests plus 8/8 native maintenance-entry tests. The remaining physical signed install/recovery evidence is intentionally after the separate final Peekaboo pin, as stated in the PR body. |
5325484 to
7e49681
Compare
|
@clawsweeper re-review The exact head is now The two prior P1 findings are closed: migration custody uses the single authenticated exclusive-rename helper and no fallback executable exists. The branch also now persists and fsyncs a UUID-bound prepared transaction before any custody mutation, binds durable sidecar and rollback identities through recovery, and resumes after SIGKILL or restored-owner restart. Exact local proof is 142/142 elevation/package tests plus 8/8 native maintenance-entry tests. The remaining physical signed install/recovery evidence is intentionally after the separate final Peekaboo pin, as stated in the PR body. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Merged via squash.
|
* feat(mac): harden elevation cutovers * fix(mac): make elevation recovery transactional * fix(mac): revalidate elevation owner shutdown * fix(mac): quiesce elevation recovery owners * fix(mac): close elevation artifact and recovery races * fix(mac): use signed exclusive app renames * fix(mac): defer elevation hangup signals * fix(mac): restore receipts during elevation rollback * fix(mac): bind elevation receipts to both architectures * fix(mac): close elevation attestation races * fix(mac): bind elevation proof to final objects * fix(mac): keep elevation rollback independently trusted * fix(mac): validate every rollback generation * fix(mac): authenticate legacy elevation recovery * fix(mac): attest recursive Peekaboo sources * fix(mac): recover when elevation app is unavailable * fix(mac): preserve raced recovery custody * test(mac): preserve missing-tool coverage * test(mac): register recursive gitlink fixture * fix(mac): authenticate all elevation custody * fix(mac): bind elevation build and recovery inputs * fix(mac): persist elevation recovery transactions * fix(mac): durably publish elevation custody * fix(mac): complete elevation transaction durability
What Problem This Solves
The unattended macOS computer-control host could not safely adopt, upgrade, or recover an existing background app or canonical node owner while proving that transferred OpenClaw and Peekaboo artifacts came from the intended source generations. A crash during cutover could also leave recovery coordinates only in shell memory.
Why This Change Was Made
The elevation workflow now treats packaging, transfer, install, migration, recovery, and Gateway reconnection as one fail-closed transaction. A native pre-SwiftUI maintenance dispatcher owns exclusive rename and durable file, directory, and app-tree sync. The portable installer uses one independently copied and hash-bound helper with no fallback executables.
Before the first custody mutation, the installer publishes a fsynced prepared receipt containing a unique transaction ID, exact rollback paths, source identities, per-architecture CDHashes, migration sidecar identities, and owner state. Pending and final receipts correlate by transaction ID. Every rollback payload and staged app tree is durably synced before state advancement; every exclusive rename syncs its destination namespace. Recovery is idempotent across SIGKILL, owner restart, same-content replacement, missing or damaged apps, and interrupted receipt publication.
Migration custody uses authenticated
renamex_np(RENAME_EXCL)and durable VolumeUUID/inode/generation identities. Unexpected or concurrently replaced entries are preserved rather than overwritten or trusted. Canonical-node environment and wrapper paths, content, modes, identities, hashes, and the digest-verified LaunchAgent plist remain bound through explicit recovery.Packaging builds each architecture in an independent disposable Swift package root. It compiles against a read-only authenticated Peekaboo snapshot and proves every non-Peekaboo lock pin is unchanged before and after compilation. The final Peekaboo pin remains a separate two-file update after Peekaboo certification freezes.
User Impact
Release operators can migrate or repeatedly upgrade the unattended macOS computer-control host without foreground activation, silently losing node identity, accepting replacement files, or destroying recoverable app and LaunchAgent state. A killed installer leaves an operator-visible pending transaction that
statusrefuses andrecovercan finish on its first attempt.Evidence
7e496819e5c6fd0f34cf1bdabdcd3d3aced8c7bb.git diff --checkpassed.