Skip to content

feat(selfhost): adopt pre-L24 legacy compose installs before upgrading - #2932

Merged
simple-agent-manager[bot] merged 12 commits into
mainfrom
sam/self-host-landing-post-mawsza
Nov 20, 2026
Merged

simple-agent-manager[bot] merged 12 commits into
mainfrom
sam/self-host-landing-post-mawsza

Conversation

@simple-agent-manager

@simple-agent-manager simple-agent-manager Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The post-merge combined L23+L24 smoke on the self-host box found that no install created before L24 can upgrade to main (idea 01M7VRD7FTD50WANT5FKWQS678). Such installs run under the fixed Compose project sam-selfhost with no compose creation receipt. main's pnpm selfhost:upgrade refuses them (upgrade-preflight.ts:assertRollbackReady: "missing installation compose creation receipt", or "legacy shared compose project" when the name is set). Their own checkout also still holds the pre-snapshot tool, and main's docker-compose.yml requires COMPOSE_PROJECT_NAME. The README asked for an "operator-controlled migration" but gave no procedure.

This adds pnpm selfhost:upgrade --adopt-legacy --from <deployed full sha> --to <ref>, run from the target checkout (scripts/selfhost/legacy-adoption.ts:runLegacyAdoption):

  1. Ownership proof first (legacy-adoption-inventory.ts:proveLegacyOwnership):

    • every container of the legacy project carries this checkout's compose directory, compose files and .env;
    • bind mounts stay inside the checkout or state directory, and each project volume is used only by proven containers;
    • each container's config hash equals --from's compose configuration (so a wrong --from refuses), with exactly one running celld;
    • the canonical project is empty, or holds exactly the volumes this journal created.

    Anything ambiguous refuses before any change, including another checkout on the host using sam-selfhost.

  2. Backup first: the same encrypted runBackup, against the explicit legacy project, before the stack stops.

  3. Move:

    • stop the legacy stack;
    • copy each volume into a labelled <canonical>_<volume> with a no-network helper carrying the random adoption id, verified by a type/owner/mode/content digest;
    • write COMPOSE_PROJECT_NAME (every other .env byte kept), start the same deployed version under the canonical project and check health;
    • write the installation and compose-project receipts (existing recordInstall), then remove the stopped legacy containers.

    The legacy volumes are kept, and the exact docker volume rm command is printed.

  4. Then the normal L24 upgrade from --from to the target, with its own snapshot, automatic rollback and rollback command.

  5. Resumable and idempotent: a private, fsynced journal (.state/legacy-adoption.json) plus a private copy of the original .env. A rerun after a kill resumes at the recorded step, removes only its own orphaned helper (label-checked) and recopies an unfinished volume from empty.

  6. Rollback to legacy on any failure or failed verification:

    • remove the canonical containers and only the owned canonical volumes;
    • restore .env byte for byte;
    • if the new stack ran, copy each of its volumes back over the legacy ones, digest-verified (celld cache, certificates, and with local-store the bucket), so nothing it wrote is lost;
    • restart and health-check the legacy stack.

    The bucket is never restored, because adoption deploys no code.

Each new module stays under 400 lines; upgrade-lib.ts is untouched (rule 18).

Validation

  • pnpm lint (eslint on scripts/selfhost, prettier check)
  • pnpm typecheck (scripts/selfhost and live tsconfigs; the two metadata-proxy import errors are pre-existing when its isolated npm deps are not installed, and pnpm selfhost:test installs them)
  • pnpm test: pnpm selfhost:test 1046 passed, 4 skipped, 57 files
  • Additional validation: real-Docker live suite live/legacy-adoption.live.test.ts, 12/12 pass:
    • adopts then upgrades: before adoption the real assertRollbackReady throws the exact refusal main gives; afterwards it passes inside the upgrade hook. The upgrade runs from --from with the legacy stack stopped. Data (owners, modes, symlink) survives; legacy containers are gone and legacy volumes kept; a second run is refused.
    • kill mid-copy then resume: a separate process is SIGKILLed while its copy helper copies a 256 MB + 4000-file cache. The rerun removes the orphaned helper and completes with identical file count and checksum.
    • ambiguous ownership: a second "checkout" container on the same project is refused. No backup is taken and nothing changes (.env bytes, containers, volumes, journal, checkout). Control: once it is removed, adoption succeeds.
    • failed verify: the legacy stack is back with the same container, .env byte-identical, caddy data intact, and a file the canonical celld wrote carried back into the legacy cache; no canonical containers or volumes remain, and the upgrade is never called.
    • kill past the .env switch, resume, failed verify: the rerun resumes at switched, rolls back, restores the original .env and keeps the data.
    • kill mid-rollback (during the cache copy-back): the rerun finishes the rollback; it never goes forward.
    • kill between compose stop and its journal entry: the rerun resumes from the stopped stack and completes.
    • kill after a completed upgrade (by our flag, or by L24's surviving completed marker): the rerun does not replay the upgrade.
    • unlabelled volume at a canonical name: refused before the backup and the stop; legacy keeps running and the foreign volume is untouched.
    • helper image absent (coordinator's condition for an install older than the fence): the image is removed first, and the run pulls it before the backup, the stop or any volume creation. Without ensureHelperImage the test goes red, because docker run would pull mid-copy.
  • Guard deletions went red on exactly their test: no .env restore, no cache copy-back, no orphan-helper removal, no stopRequested, no completion evidence (2 tests), no rollback resume. A first draft without the orphan-helper removal failed the kill test with "volume ... is also used elsewhere", found by the real test.
  • Unit tests legacy-adoption.test.ts (22): argument guards (--from, shell COMPOSE_PROJECT_NAME, dirty tree, run from --from, --to mismatch, resume with another --from, orphaned .env copy) with no docker call on refusal; journal validation (phase, refs, foreign volume, identical projects, relative backup path, group-readable file), original .env kept across resumes, .env rewrite, and proof refusals (wrong --from hash, outside bind mount, a volume shared with another container, a volume of another project) plus an accepting control.
  • Bounds (rule 81): one copy per legacy volume, no count caps. The box's volumes total about 46 MB (celld-data); the copy runs while the legacy stack is stopped, so downtime is copy time plus one restart.

Staging Verification (REQUIRED for all code changes — merge-blocking)

  • Staging deployment green: N/A, self-host operator CLI only (scripts/selfhost, deploy/selfhost/README.md). It is not part of the Cloudflare Worker, web app or any deployed bundle.
  • Live app verified via Playwright: N/A, same reason
  • Existing workflows confirmed working: N/A, same reason
  • New feature/fix verified on staging: verified on real Docker (above). The live gate is the self-host box, below.
  • Infrastructure verification completed: N/A: no infra changes (no cloud-init, VM agent, DNS, TLS or scripts/deploy)
  • Mobile and desktop verification notes added for UI changes: N/A, no UI

Staging Verification Evidence

Reproduction (before the change): on the shared box (app.vmtest.sam2.party, 7f086c7, legacy sam-selfhost), main's real pnpm selfhost:upgrade --to main was run from a separate main worktree against the box's .env/.state. It refused in both forms with no mutation (receipt sha256 unchanged).

Live gate, before merge: PASS on the real box at PR head 80cce88ea (2026-11-20 06:27–06:33 UTC, app.vmtest.sam2.party, legacy project sam-selfhost at 7f086c7).

  • Seeded first: agent-test and admin-r18 signed in by email code through the box's mail collector. Hosted-git project 01M7VT518EWTAT355S86ACJH6R was created with commit 6b240bed3dd7… pushed to smoke/adopt. Project lists were recorded.
  • pnpm selfhost:upgrade --adopt-legacy --from 7f086c72bfbf225cdfbd5b573791eecf4fe15769 --to 80cce88eab3070eeabedc9294348fc98ef3f1992 --encryption-key-file ~/.config/sam/backup.key:
    • the ownership proof passed against the real 8-container layout;
    • encrypted adoption backup: 6,640 objects, celld down 7.1 s, at backups/pre-adoption-2026-11-20T06-27-22-062Z;
    • 4 volumes copied with digest verification: sam-selfhost_{caddy-config,caddy-data,celld-data,egress-fence-attestation} → sam-selfhost-0453bcf9d4e3_*;
    • "adopted: compose project sam-selfhost-0453bcf9d4e3 is healthy with its receipts".
  • Then the chained L24 upgrade 7f086c72bfbf → 80cce88eab30 (177 files, compose inputs changed, no D1 migrations):
    • own snapshot: 6,650 objects, celld down 6.1 s;
    • "DO migration preflight passed against the active deployment and target checkout";
    • stack restarted; "upgraded to 80cce88…; healthy". The rollback command and the legacy docker volume rm command were printed.
  • Data survival after the run:
    • both users sign in again;
    • both users' project lists are identical to before;
    • a read-token clone of smoke/adopt has sha 6b240bed… and git fsck --strict is clean;
    • anonymous access is refused.
  • Install state after the run:
    • selfhost:verify-fence: "egress fence in effect" (exit 0); public /health 200; app 200;
    • .env has COMPOSE_PROJECT_NAME=sam-selfhost-0453bcf9d4e3;
    • no legacy-adoption.* or upgrade-pending.json left;
    • the receipts now hold installation a6fd9767…, compose-project sam-selfhost-0453bcf9d4e3, state-dir, env-file, bucket (reused) and both backups;
    • legacy containers are removed and legacy volumes retained.

Changes since the box run (80cce88 → f98892c): fixes for four Codex P1 findings (see below). They change only interrupted, failure and resume paths, plus the copy helper image: it is now the digest-pinned Alpine base of the egress fence, pulled if absent, instead of sam-selfhost-egress-fence:local. The box is already adopted, so it cannot be adopted again. These paths are proven by the real-Docker live suite (9/9), which uses that same pinned Alpine image. The upgrade-completion hook is also exercised by the post-merge normal upgrade on the box.

After merge: a normal L24 upgrade from the PR head to main, then the forced-verify rollback trigger and forward again (combined smoke steps 1, 2 and 4).

UI Compliance Checklist (Required for UI changes)

N/A: no UI changes.

UI Screenshot Evidence

N/A: no UI changes.

End-to-End Verification (Required for multi-component changes)

  • Data flow traced from user input to final outcome with code path citations
  • Capability test exercises the complete happy path across system boundaries (real Docker compose, volumes and containers; real L24 preflight)
  • All spec/doc assumptions about existing behavior verified against code (the L24 refusals were reproduced on the box; recordInstall writes the compose receipt only for the canonical name)
  • Gaps documented below

Data Flow Trace

upgrade.ts (--adopt-legacy) → legacy-adoption.ts:runLegacyAdoption:

  1. checks the clean tree, --from commit and that --to is HEAD; then the journal or startJournal (installation id from platform-keys.json, canonical name via install-record.ts:expectedComposeProjectFor);
  2. git checkout --detach --from;
  3. adopt: removes stale helpers, proveLegacyOwnership (using docker compose config --hash '*'), assertCanonicalClear, then runBackup (legacy project), then compose stop;
  4. legacy-adoption-volumes.ts: createCanonicalVolume, copyVolume, volumeDigest;
  5. .env gets envWithProject; compose up -d under the canonical project; checkHealth; recordInstall; phase adopted; removeLegacyContainers;
  6. opts.upgrade = upgrade-lib.ts:runUpgrade(from → to); on success the journal is cleared.

On failure, rollbackToLegacy runs compose down, copies every canonical volume back with copyVolume, removes the owned volumes, restores .env, then runs compose up -d (legacy) and checkHealth.

Untested Gaps

The live suite injects the upgrade step (it asserts the real L24 preflight passes) and stands in for the encrypted backup, which needs a fleet bucket. Both are the existing L24 code, unchanged. The real backup, the chained real runUpgrade and the real celld stack are exercised on the box after merge.

Post-Mortem (Required for bug fix PRs)

What broke

Every self-host install created before L24, including the team's box, had no way to upgrade to main: the new tool refused it, and the old tool would have broken mid-upgrade without a backup.

Root cause

L24 (#2918, 4940559e2) made the Compose project installation-specific (name: ${COMPOSE_PROJECT_NAME:?}) and gated upgrades on a compose creation receipt. Neither exists on older installs, and no migration was shipped.

Class of bug

A new required identity or receipt with no migration for existing state (the rule 71 family: a new requirement deletes a capability for every existing install).

Why it wasn't caught

L24's live proofs used fresh disposable installs, never a legacy-project box; the combined post-merge smoke was deferred.

Process fix included in this PR

The upgrade path for legacy installs plus real-Docker tests that start from a legacy fixture. No rule change: rule 71 already covers this class.

Post-mortem file

Idea 01M7VRD7FTD50WANT5FKWQS678; task tasks/active/2026-11-20-selfhost-legacy-compose-adoption.md.

Specialist Review Evidence (Required for agent-authored PRs)

  • All local reviewers completed and findings addressed before merge
  • If any reviewer did NOT complete: needs-human-review label added and merge deferred to human
Reviewer Status Outcome
security-auditor ADDRESSED PASS (no CRITICAL/HIGH). 3 MEDIUM fixed in 087ae2b: failed rollback keeps its journal; canonical cache copied back instead of emptied; volume stranded before its CreatedAt was journaled is re-adopted by adoption-id label. 4 LOW fixed (journal regexes, orphaned env copy, missing labels, path containment). Delta review PASS (one LOW, rollback cause logging, fixed in 80cce88)
task-completion-validator ADDRESSED WARN (no CRITICAL/HIGH). Checklist ticked; argument-guard unit tests added (no docker call on refusal); resume after a kill past the .env switch then failed verify added (live); guard deletions recorded
security-auditor (delta, Codex P1 fixes f98892c) ADDRESSED No CRITICAL/HIGH. In e345f3f: a MEDIUM (a resume with a completed marker and the checkout at --from threw a misleading error; it now checks out the deployed target first) and LOW L1 (marker validation equal to readPendingFrom) and L2 (a fresh adoption refuses an existing upgrade record) are fixed. L3 (a pull failure on resume after the stop leaves the stack stopped with the journal kept; the rerun recovers) is accepted: it needs the image pruned between runs, and the journal plus README guide the retry
doc-sync-validator ADDRESSED README: preconditions, flag rules, phases, checkout after refusal vs rollback, failed-rollback handling, helper image not built, plain-upgrade pointer

CodeRabbit Review Evidence (Required for agent-authored PRs)

  • CodeRabbit requested when the PR was marked ready for review
  • Waited about 15 minutes (or until a skip, rate-limit or quota reply)
  • Either CodeRabbit reviewed and no CodeRabbit feedback is unresolved, or it did not review and the observed outcome is recorded below

CodeRabbit Notes

Requested at ready-for-review, 2026-11-20 06:17 UTC, through the trusted label workflow (both runs succeeded). CodeRabbit answered "Review skipped: auto reviews are disabled" and then "Review rate limited", which ends the wait under rule 25. No CodeRabbit findings.

Codex connector review on 80cce88 raised four P1s. All are fixed in f98892c with discriminating tests, replied to and resolved:

  • interrupted rollback resumed forward → journaled rollingBack, plus a missing-copy check;
  • helper image absent on pre-fence installs → pinned Alpine, pulled before any mutation;
  • a completed upgrade replayed after a kill → completion hook inside L24's completed-marker window;
  • a kill between stop and journal entry dead-ended the retry → stopRequested intent.

A second Codex round on e345f3f raised three more:

  • P1: an unlabelled canonical-name collision was found only after the stop → every expected name is now inspected before the backup (8ccbc13, live test);
  • P2: rollback cleanup was not resumable → the journal is removed before the .env copy, and a byte-identical leftover copy is removed (8ccbc13, unit tests);
  • P1: the task was archived with an unchecked gate → the gate was complete; the item is clarified (post-merge smoke steps belong to the smoke task).

A third Codex finding on c924b1a (P1): rollback carried back only the celld cache, so with local-store bucket writes in the copied objectstore-data volume were lost. Fixed in 74b4e83: once the canonical stack ran, every canonical volume is copied back (digest-verified) before removal. The live test writes into a second volume, and fails when the copy-back is narrowed.

A fourth Codex finding on 74b4e83 (P1): a kill inside the backup could leave the legacy celld stopped and the retry unable to recover. Fixed in 2d79678 by journaling backupStarted and restarting the legacy celld on resume or on a pre-stop failure. The live test covers the returned-failure and kill paths, and each fails without its restart.

All threads are replied to and resolved; main is merged in.

Exceptions (If any)

Agent Preflight (Required)

  • Preflight completed before code changes

Classification

  • external-api-change
  • cross-component-change
  • business-logic-change
  • public-surface-change
  • docs-sync-change
  • security-sensitive-change
  • ui-change
  • infra-change

External References

Docker Compose project-name precedence (-p over COMPOSE_PROJECT_NAME over top-level name:) and docker compose config --hash, checked against Compose v5 on the box and in the real-Docker tests. Real box layout captured before the change (4 volumes, 8 containers, host networking only). L24 task tasks/archive/2026-11-19-l24-selfhost-operations.md, rules 71, 62, 81 and 18.

Codebase Impact Analysis

scripts/selfhost/upgrade.ts gains the CLI flags. New scripts/selfhost/legacy-adoption{,-inventory,-journal,-volumes}.ts. Reused unchanged: backup-lib.ts:runBackup/composeArgs, install-record.ts:recordInstall/expectedComposeProjectFor, upgrade-lib.ts:runUpgrade. No Worker, web or package change.

Documentation & Specs

deploy/selfhost/README.md: the "Upgrade" section now documents legacy adoption, resume, rollback and retained volumes, replacing the "operator-controlled migration" placeholder.

Constitution & Risk Check

  • Principle X: reuses the existing backup, receipt and upgrade code, with no new service.
  • Principle XI: helper image, backup paths and project names come from existing configuration or options.
  • Principle XIII: ownership proof, journal validation and canonical-volume labels all fail closed.

Data-loss risk is limited by: backup before stop; legacy volumes only read (except the cache, which receives the newer canonical copy on rollback); no bucket mutation by adoption; rollback restores .env exactly. No secrets are printed; .env copies stay private (0600) in the state directory.

🤖 Generated with Claude Code

raphaeltm and others added 2 commits November 20, 2026 06:03
Installs created before L24 run under the shared `sam-selfhost` Compose project with no
compose creation receipt, so `pnpm selfhost:upgrade` refused them and their own checkout
still held the pre-snapshot tool. `selfhost:upgrade --adopt-legacy --from <deployed sha>`
proves the legacy project belongs to this checkout, takes the encrypted backup, copies the
volumes into the canonical project, writes COMPOSE_PROJECT_NAME and the receipts, verifies
health and then runs the normal upgrade. It is journaled and resumable, and rolls back to the
legacy project on failure.

Found by the post-merge L23+L24 smoke on the self-host box (idea 01M7VRD7FTD50WANT5FKWQS678).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@simple-agent-manager
simple-agent-manager Bot marked this pull request as ready for review November 20, 2026 06:17
@simple-agent-manager simple-agent-manager Bot added the coderabbit-review Trigger CodeRabbit review for opt-in PRs label Nov 20, 2026
@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T07:49:11.341928Z 2d79678 New commits
ℹ️ 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.

@raphaeltm

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5a1e199bbf

ℹ️ 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".

Comment thread scripts/selfhost/legacy-adoption.ts Resolved
Comment thread scripts/selfhost/legacy-adoption.ts Resolved
raphaeltm and others added 2 commits November 20, 2026 06:22
- A failed rollback keeps its journal and .env copy (the outer catch no longer clears them).
- Rollback copies the canonical celld cache back over the legacy cache instead of emptying it,
  so nothing celld kept locally is lost.
- A canonical volume created before its CreatedAt was journaled is re-adopted by its random
  adoption-id label instead of dead-ending the resume.
- Stricter journal validation, refusal of an orphaned .env copy and of missing compose labels,
  and a correct path-containment check.
- README: preconditions, flag rules, phases, checkout position after refusal versus rollback, and
  failed-rollback handling.
- Tests: argument guards (no docker call on refusal), resume after a kill past the .env switch
  followed by a failed verify, and the cache copy-back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 80cce88eab

ℹ️ 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".

Comment thread scripts/selfhost/legacy-adoption.ts Resolved
raphaeltm and others added 2 commits November 20, 2026 06:41
- A killed rollback resumes as a rollback (journaled `rollingBack`), and the forward path
  refuses to start the canonical stack when a journaled copy is missing, instead of letting
  Compose recreate it empty.
- The copy helper defaults to the digest-pinned Alpine base of the egress fence (a test keeps
  them equal), and it is pulled before any mutation: installs older than the fence never built
  a local image.
- The chained upgrade marks the adoption journal inside its own completed-marker window
  (`completeUpgradeJournal` hook, success path only), so a kill after a successful upgrade never
  replays it. A target re-checkout makes HEAD useless as that evidence.
- The legacy stop is journaled as an intent first, so a kill between the stop and the phase
  write resumes from the stopped stack instead of refusing it and discarding the journal.

Each fix has a real-Docker or unit test proven discriminating by deleting its guard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 99a8ccd13d

ℹ️ 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".

…tion evidence

- Live test (coordinator condition): the helper image is removed before adoption, and the run
  pulls it before the backup, the stop or any volume creation. It fails without
  ensureHelperImage, because `docker run` would otherwise pull it mid-copy.
- upgradeCompletedTo validates the marker as readPendingFrom does (regular private file, refs,
  absolute backup path).
- A resume that finds a completed marker checks out the target (the deployed version) before
  cleanup, instead of failing with "uncertain".
- A fresh adoption refuses a pre-existing upgrade-pending record.
- Task record outcome.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e345f3f260

ℹ️ 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".

Comment thread scripts/selfhost/legacy-adoption.ts Resolved
raphaeltm and others added 2 commits November 20, 2026 07:04
…sumable cleanup

- Every expected canonical volume name is inspected before the backup and the stop. A label
  filter misses an unlabelled volume at that name, which previously surfaced only mid-copy and
  then deadlocked the rollback on the same ownership check.
- The adoption journal is removed before its .env copy. A later run removes a leftover copy that
  is byte-identical to .env, and refuses any other.
- The task record states that the post-merge upgrade and rollback belong to the smoke task.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c924b1a607

ℹ️ 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".

Comment thread scripts/selfhost/legacy-adoption.ts Resolved
Once the canonical stack has run, each of its volumes holds the newest state: the celld cache,
renewed Caddy certificates, and with `local-store` the bundled bucket itself. Rollback copied
back only the celld cache, so bucket writes accepted before a failed verification were lost
(Codex P1). Every present canonical volume is now copied back over its legacy volume
(digest-verified) before any canonical volume is removed. The live failed-verify test writes to
a second volume and fails when the copy-back is narrowed to the cache.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 74b4e83ca7

ℹ️ 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".

Comment thread scripts/selfhost/legacy-adoption.ts Resolved
raphaeltm and others added 2 commits November 20, 2026 07:42
…ckup left stopped

The backup stops celld for its delta copy and restarts it in a `finally`, which a kill skips.
The adoption journals `backupStarted` before the backup. A resume with an unfinished backup
restarts the legacy celld before the ownership proof (which requires it running), and a
pre-stop failure after the backup started restarts celld before discarding the journal; if that
restart fails, the journal is kept (Codex P1). The live test covers both the returned-failure
and kill paths, and each fails without its restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@simple-agent-manager
simple-agent-manager Bot merged commit a6791eb into main Nov 20, 2026
30 checks passed
simple-agent-manager Bot pushed a commit that referenced this pull request Nov 20, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coderabbit-review Trigger CodeRabbit review for opt-in PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant