Repository navigation
L24: self-host backup, restore, guarded upgrade and teardown - #2918
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
Merging this PR will not alter performance
Comparing Footnotes
|
Codex Review Summary: ✅ CompletedThis 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. |
|
@coderabbitai review |
Action not completed
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f546d917b5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 761662d843
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cd2e646af1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c47839706b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f7882d180
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 39f3fa951c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a29aadf84a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 99960ba8ec
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 73d673fc3a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a2a45b8b9f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2895321867
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5bbbe61b3c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…-slice-n4byak # Conflicts: # deploy/selfhost/README.md
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: afd19c8178
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0755f69d63
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
b23b995 to
0755f69
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b23b995c02
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d436de56b1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
…M6 step 4) L24 #2918 (4a40c52): backup, restore, upgrade rollback, exact-ownership teardown; #2932 legacy compose adoption; #2934 restore keeps fence rules readable. Main's version of every operations file. The branch's earlier drafts that main's modules no longer export into are removed: deploy/selfhost/gcp-teardown.sh (main: teardown-gcp*.ts), adopt-check.test.ts, teardown-gcp-constants.test.ts, live/teardown-bucket.live.test.ts, testdata/fake-docker-teardown.mjs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>



Summary
SHIPPED: merged at
4a40c528c21cce9591cdf129ef0b16ffbe91dec0; actual Deploy Production 44685595228 succeeded for containing mainbb2b9cbec2077ea460df4c6ca008edc557fcdabf, including Cloudflare deployment and Health Check. Production marker7934917320recorded success at 2026-11-20 06:19:36 UTC. Main CI passed for both commits. Earlier no-op deployment wrappers were not counted. Coordinator-owned combined BOX smoke found the pre-L24 Compose adoption gap; follow-up task01M7VQQR2VBF219A7MJWMAWSZA/ idea01M7VRD7FTD50WANT5FKWQS678owns the fix and remaining smoke.Current release candidate:
be24db7669ccdc313efc943dfdbd5bd579a64585. Healthy upgrades and recovered old versions durably commit terminal state before cleanup; interrupted verification refuses snapshot replay, and a valid completed marker permits cleanup only. This prevents stale recovery metadata from discarding writes accepted after health success. Thirteen new boundary/scope controls cover the fix: old code reproduced accepted live and recovered data overwritten by snapshot rows. The earlier unverified-deployment policy remains explicit: writes served before verification are discarded on rollback; traffic fencing is tracked in idea01M7VNSGPNHEZHKD9P021128YR.Clone IDs also use private random target-local reservations, stable across print/restore/retry. Reservations cannot bypass empty-target checks; legacy journals fail closed. GCP bootstrap refuses conflicting/unknown active project receipts before external calls; per-project namespacing is tracked separately.
Current-head CI 44680117244 passed on
be24db7669ccdc313efc943dfdbd5bd579a64585; E2E smoke, CodSpeed and Sonar also passed. No unresolved review threads remain. Prior headd436de56b122f4ce47c1477eb81afeb7614e1695passed CI 44677494753. Main includes H2 #2907 and Wrangler #2912 (ef46680e5). Coordinator CI-restart-loop decision: the main deltac8f84a8e5..ef46680e5and L24 operations delta have zero overlapping files. If main moves again with an empty or documentation-only overlap, merge this candidate when its own full CI is green without another catch-up/restart. Main CI gates production deployment; fix any combined-result failure forward. Do not force-push.Rollback interruption recovery also binds the replacement ledger inode before publication and records exact directory identities in a private durable sibling receipt before renames. All recovery entries reconcile it before metadata reads. Ten real emitted-CLI kill/retry and foreign-directory controls cover the fix; both rename regressions failed on old code.
Land L24 operations from
sam/selfhost-pass-2: encrypted backup/restore, automatic upgrade rollback, Durable Object migration preflight and exact-ownership teardown. Runtime code stays inscripts/selfhostanddeploy/selfhost; Worker-loaded code, bindings and migrations are unchanged.Backups encrypt every secret-bearing payload with a separate operator key. Fresh restores authenticate everything first, resume only proven partial output, preserve crypto keys and executable modes, and assign a distinct installation identity. The copied active deployment pointer is omitted until fresh deployment so source background jobs cannot start. Upgrades validate installed/live/target DO history and automatically recover code, data and health on failure. Teardown preserves data identity under keep-data and refuses unproved or replaced resources.
Validation
Staging Verification (REQUIRED for all code changes — merge-blocking)
Required BOX verification completed on operations source
39f3fa951c104e410d1feb43123c8166580da727. Later main synchronization changes only the Claude action version. Subsequent fixes cover interrupted recovery bookkeeping and the formerly blocked bundled-store restore path. GCS data projection and migration checks are unchanged. Main L23860718dc3is merged into this candidate; its nft fingerprint/force-recreate and active-service filtering change the combined upgrade path. The coordinator explicitly accepts the combined live-proof gap without a new L24 BOX slot because this is self-host-only code with no Cloudflare impact. Real Docker cache-helper recovery, canonical MinIO and IAM security delta pass; full final-head CI remains required. Owed: coordinator post-merge combined smoke, tracked on landing idea01M72M9AEB933ZY8269D376DKC: after both H2 #2907 and L24 #2918 land on main, an in-place upgrade from the then-current BOX state to main, fence recreation, health and one rollback trigger. Real Docker and MinIO remain the pre-merge proof. Any upgrade/rollback break remains L24 follow-up ownership. No BOX access remains held.deploy/current.json, stripped source receipts and executable permissions. Immutable deployment objects remain intact. Restored shared alarms were never started.selfhost-hosted-git-v1.8f7882d → 39f3fa951upgrade passed DO preflight and health with data retained.--destroy-keyretry removed them successfully. Foreign containers and shared images remained untouched.F23 is reproduced and fixed from real evidence: SDK523 can ignore a failed download-finalization result and apply POSIX metadata/stat to a vanished local node destination, producing ENOENT. Isolated live-copy paths, temporary-file cleanup and a stopped-writer fresh full-copy fallback address the actual incomplete-copy mechanism. The exact SDK-shaped helper/CLI regression passes; tracker reuse alone remains unproved and is not claimed.
End-to-End Verification (Required for multi-component changes)
Data Flow Trace
backup.ts → runBackup → stopped-writer copy → authenticated encrypted tree. Restore authenticates the full tree, projects target identity/inactive deployment, validates an empty target or exact journal-owned subset, then writes bucket/state. Upgrade compares installed/live/target migration history before snapshot/deploy, and failure restores owned cache/data plus old code/dependencies through healthy restart. Teardown validates active receipts and immutable live identities immediately before dependency-ordered deletion.Untested Gaps
Restored shared application data is verified offline; starting copied shared alarms would affect shared VMs. Actual deploy/upgrade/rollback/teardown ran on a separate owned disposable installation. Production verification is limited to the normal deployment and basic health smoke.
Specialist Review Evidence (Required for agent-authored PRs)
Final
0755f69rollback-state delta: security-auditor PASS (FIFO and generic-error hardening applied); task-completion-validator PASS A–C/E/F, D N/A; doc-sync-validator PASS; constitution-validator PASS. No local reviewers pending or unresolved findings. Ten real CLI fault controls and full 995-test suite pass. Earlier rows retain the original complete-slice evidence.5bbbe61b3c08111a65e0685f4f5804ee2af687cbindependently verified; zero unresolved findings.5bbbe61b3c08111a65e0685f4f5804ee2af687cbverified, checks A–C/E/F pass, D is N/A. Release CI/merge/deployment remain tracked separately.CodeRabbit Review Evidence (Required for agent-authored PRs)
Requested at ready-for-review, 2026-11-19 23:03 UTC, through the trusted label workflow. CodeRabbit returned review-limit/rate-limit responses, ending the wait; no CodeRabbit findings or waiver. All 11 Codex findings were fixed with focused regressions, concrete replies and resolved threads: recovery retries, executable manual rollback, SA grant receipts, partial fresh restore, backup parent modes, immediate teardown failure stop, current-ledger preservation, clone identity, retained-key receipts, interrupted target binding and immutable backup deletion proof. Five additional findings are fixed: partial Compose creation preserves durable adoption proof; local-store restore permits only verified canonical store bootstrap; completion receipts survive progress-unlink/directory-sync failure; bootstrap receipts distinguish conditional and unconditional grants and teardown preserves conditional siblings; the emitted health command uses the quoted target domain from .env. Final Codex review requested once on
99960ba8ec58e219b5e5276a86fd6dca2f2e447f; its IAM finding is fixed with nine actual-bash policy controls and an independent security delta. The coordinator explicitly instructed no further Codex request. A later automatic firewall receipt-window finding (4637643089) is explicitly deferred under the coordinator’s prior decision to backlog01M7VB4538WSGP3QBP8EBDVTZA: it preserves ambiguous resources, and retained ingress cannot exceed the original rule’s configured tags/ranges/ports; README now documents manual ownership inspection. A later automatic P2 explicit-backup retry finding (4637719308) is deferred to backlog01M7VCEPA9D21XMHKN593YGBRD under the coordinator’s nonsecurity/nondata-loss/nonownership rule: recovery restores the old installation and preserves its snapshot, then safely refuses an occupied destination; retry with a fresh --backup-to path or omit the override. The later P1 state-swap finding (4638273658) is fixed in0755f69with ten real CLI fault controls and independent security/completion reviews. The later P2 anonymous init-volume leak (4638354201) is explicitly deferred under the coordinator’s nonsecurity/nondata-loss/nonownership rule to follow-up idea01M7VJM5C4K20M3F1XDFZ5N559; it preserves extra storage rather than deleting unowned resources. The follow-up requires exact anonymous-mount ownership and real Docker full/keep-data/retry controls. Final automatic clone identity and cross-project receipt findings are fixed ind436de56b; successful upgrade/recovery completion P1 is fixed inbe24db766with 13 new boundary/scope regressions, independent reviews and green own-head CI. All reviews are reconciled before merge.Comprehensive interruption/retry audit
Durable grant intent review delta
Project and service-account IAM mutations now persist exact unconditional grant intent before cloud mutation using the existing ownership ledger. File sync, atomic rename and parent sync complete first. Interrupted or lost-success retries preserve created ownership; preexisting grants remain reused. Changed scope/account identity, malformed pending intent and explicit conditional teardown receipts refuse. Thirteen new controls cover actual bash termination after side effects, final receipt failure, sync failures before cloud mutation, safe retry/recreation and conditional sibling preservation. Full self-host validation: 986 passed, four conditional skips, 56 files; TypeScript, lint, format and secret scanner pass. Independent security review found no blocker.
The coordinator explicitly deferred the pre-existing pool/provider/service-account/firewall post-create receipt windows to backlog idea 01M7VB4538WSGP3QBP8EBDVTZA. README teardown now lists manual inventories and requires immutable identity, audit-log and exclusive-use proof. Such resources are preserved rather than destructively adopted. A leaked firewall retains precisely the configured source ranges, target tags and ports; interruption cannot broaden them, though their original exposure persists until proven-owned cleanup.
Post-Mortem
Plaintext backups, absent rollback/history checks and name-based teardown assumptions were unsafe. Real SDK evidence replaced an unconfirmed tracker hypothesis. Disposable execution exposed read-only Go-cache cleanup and restored-binary mode loss; both now have discriminating regressions. Review strengthened clone isolation and lifecycle ownership. Clean CI exposed a provider dependency hidden by local build output; the full suite now proves operation without it. Task evidence is recorded in
tasks/archive/2026-11-19-l24-selfhost-operations.md.Agent Preflight (Required)
Classification
External References
Existing gcloud/mc/Docker interfaces and actual SDK523 source; celld v0.6.3 deployment-class format. Historical #2675/#2677/#2703, policy795e72a6 and rule56 ownership reviewed.
Codebase Impact Analysis
Self-host CLI and deploy packaging only. Runtime code under scripts/selfhost and deploy/selfhost; package.json command wiring. No Cloudflare Worker import-graph delta.
Documentation & Specs
README/.env.example describe authenticated encrypted backups, separate key, distinct restore identity/inactive deployment, retries, migration refusal, automatic/manual rollback, unique Compose identity and retained WIF/external stores.
Constitution & Risk Check
Principles X/XI/XIII: existing tools, no new service, configurable paths, fail closed on ambiguous ownership/history. Destructive verification used only disposable resources owned by this task. No secrets printed or read back in runners.