Skip to content

feat(env)!: make migration resumable and cleanup explicit (HACK-2191) - #797

Merged
roodboi merged 46 commits into
nextfrom
codex/hack-2191-resumable-env-migration
Nov 15, 2026
Merged

roodboi merged 46 commits into
nextfrom
codex/hack-2191-resumable-env-migration

Conversation

@roodboi

@roodboi roodboi commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Env migration can now be previewed, resumed after interruption and rolled back. Migration keeps every legacy input; cleanup requires a separate later command. HACK-2191, part of HACK-2188; planned after next.17.

  • hack env migrate --json is read-only. Its documented version-1 contract reports file actions, canonical paths, key names and tracked status.
  • --apply uses the production snapshot library and a private per-file journal. Retry resumes unfinished publications; completed work is a no-op.
  • Doctor and implicit routes share the journal and retain legacy files. Implicit migration keeps Compose references; a later explicit phase can repair them without republishing env layers. It rechecks delivery, snapshot coverage and tracked consent, and invalidates the earlier startup proof.
  • An unavailable deferred repair is a nonfatal preview with status: recovery_required, composeRepair: unavailable and no file actions. Doctor reports and skips it; explicit apply still refuses. Current layers remain usable.
  • Later --cleanup --apply requires a successful full-project run, intact original snapshot, fresh value delivery, writer-locked receipts and the live-input guard before each deletion. Byte-identical permission tightening is allowed; changed content and wider access refuse.
  • Rollback refuses later edits unless preservation is explicit, reports private recovery paths and exits nonzero when incomplete. It restores original file modes and returns a fixed Doctor permission-review warning. Pending publication or rollback blocks env readers, including inherited worktrees and native selection.
  • Storage admission checks location and real hard-link capability before copying originals. Resume revalidates snapshot manifest/blobs before publication. Index-tracked key paths, including absent and case-folded aliases, refuse under the key lock.

Migration state model

Verification covers preview/apply parity, sentinel privacy, 54 real SIGKILL boundaries, production source and compiled CLI, Doctor/tracked consent, historical v4 upgrades, backup damage, permission drift and round-trip rollback. The maintained model explores 74 states; same-run cleanup and stale-startup-proof controls fail their intended invariants. Build, typecheck, lint/privacy and docs checks pass at recorded checkpoints. Exact-head counts, CI, full-suite and review results are in the latest verification/readiness comment; no full-suite pass is implied here.

Normal merges include the snapshot library and next 23fe08f0. The same persistent Opus reviewer is active again. All findings are fixed or explicitly answered/resolved; exact-head settlement remains required.

Hosted platform classification for changed tests: macOS-only doctor-fix-noninteractive, env-migration-journal, env-migration-provider, env-migration-safety, env-migration-tracked-consent, env-set-local-contract, legacy-env-cleanup (all tests/*.test.ts). v4-upgrade runs in both pools. Preview CLI, missing-project errors and cold-home wiring run on Linux. No manual macOS workflow dispatch; automatic CI selects its tiers.

Limits: cooperative locks and per-file publication do not cover unsynchronized writers or prove filesystem durability. No macOS/native runtime or cleanup SIGKILL qualification is claimed. The protocol and upgrade guide document storage custody, interruption residue, recovery and older-binary limits.

@vercel

vercel Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hack-docs Ready Ready Preview Nov 15, 2026 4:56am UTC

Request Review

@linear-code

linear-code Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

HACK-2188

HACK-2191

@roodboi

roodboi commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-15T04:56:05.532543Z
We couldn’t complete this review. Comment @codex review to try again.
06522fc Manual request
🔒 Security Review ✅ Completed 2026-11-15T02:31:06.083473Z 5cdbd3a Manual request
ℹ️ 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.

@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: b4c55b3e78

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

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib/env-migration-snapshot.ts Resolved
@roodboi

roodboi commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Status for lead: HACK-2191 is pushed on codex/hack-2191-resumable-env-migration at exact head b4c55b3e785b7dfadec988193c830c7f33ad3d6c. This normally merges next at b1e123bb (#796) without conflicts.

Implemented: read-only versioned preview, journalled/resumable apply, completed no-op, separate snapshot/delivery/live-input-gated cleanup, and guarded rollback with retained-edit recovery paths. Doctor and implicit migration keep all legacy files. The latest fixes keep a known pre-unlink refusal retryable, choose one recovery path per cleanup error, and name an unsafe journal's location without its contents.

Exact-head checks: 92 focused/integration regressions pass (1,044 assertions), including all 48 migration SIGKILL boundaries and the local-network JSON test. Rebuilt compiled-preview and model-verifier tests pass: 176 tests, 2,455 assertions. Root typecheck, lint (existing warnings), privacy and build pass. The updated model exhausts 37 states and its unsafe same-run deletion control fails the intended invariant with the registered witness.

Still draft: #790 is open and its snapshot module is absent from next. The adapter has passed against an isolated copy of its source API, but static binding, production source/compiled provider CLI, doctor/tracked-consent compatibility and full gates remain open. The same persistent Opus reviewer is rechecking this exact head; default Codex code review is also requested. No full-suite, macOS runtime or cleanup-kill qualification is claimed. I will post Ready for lead: only after those gates and bot findings are settled. This follows next.17.

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: b4c55b3e78

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

roodboi commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

CI/review checkpoint at b4c55b3: the reported test failure is the intentional draft gate (PR_DRAFT=true, “skipped: draft — full pull-request evidence is required before merge”). The five planned Linux shards were cancelled, so this run supplies no full-suite evidence; I am not rerunning it just to repeat that refusal.

The persistent read-only review reports no new findings at this exact head, with R1–R3 fixed. Its dependency/verification limits remain open. Codex's P1 about the missing production snapshot provider is accepted and answered on its thread, and will remain unresolved until #790 is integrated with a typed static import and the source/compiled provider routes and compatibility/full gates pass. PR remains draft, not Ready for lead.

roodboi commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

Shard-6 follow-up: run 43534780799 finished 115 files with 113 passing. v4-upgrade.test.ts hits the acknowledged absent snapshot provider (#790); that remains a real integration blocker. The other failure, native-compose-file-cold-home.test.ts, was a stale rejection boundary: migration journal admission now rejects a non-directory HACK_HOME during source acquisition, before private-owner preparation.

Fixed the test in 7341b2b to assert the same E_NATIVE_COMPOSE_STATE around acquisition plus preparation, keeping every no-material/no-generation/untouched-directory assertion. No product change, weakened error-code assertion or skipped case. Reproduced 7 pass/1 fail before; full cold-home plus env-preview tests now pass 10/10 (97 assertions), lint passes. Same persistent reviewer rechecking this test-only delta.

The Docker fan-in failure was the intentional draft gate (PR_DRAFT=true; Docker shards out of scope/skipped), not a failed Docker scenario. No macOS shards requested. PR stays draft pending #790, typed static binding and source/compiled provider/compatibility/full gates.

roodboi commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

Tightened the cold-home test in 060119a after independent review: symlink and unsafe-directory cases again require acquisition to succeed and the private owner's prepare step to reject. Only the non-directory file case allows the new earlier journal-admission refusal. Error code and every no-write/no-generation assertion remain. Full file passes 8/8 (65 assertions); lint passes. Same persistent reviewer rechecking this test-only delta. The successful docs deployment needs no action; #790 production integration remains the draft blocker.

roodboi commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

Exact-head review checkpoint: persistent read-only review is clean for the test delta at current head 060119a; the requested stage-specific unsafe-home assertions are restored. Local full cold-home file passes 8/8, 65 assertions. The passing-check notification on 7341b2b is for the prior head and is not full-suite evidence for the current head.

#790 remains open, so production typed-static snapshot integration, provider source/compiled CLI, doctor/tracked-consent compatibility and full gates remain open. Codex P1 remains acknowledged and unresolved. PR stays draft; not Ready for lead. No further changes from the deployment/check notification.

…able-env-migration

# Conflicts:
#	docs/reference/v5-model-coverage.md
#	scripts/lib/tla-runtime-models.ts
#	src/lib/project-env-config.ts
@roodboi roodboi changed the title feat(env)!: make migration previewable, resumable and reversible feat(env)!: make migration resumable and cleanup explicit (HACK-2191) Nov 14, 2026
@roodboi
roodboi marked this pull request as ready for review November 14, 2026 03:04
@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 00ee26a438

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

The breaking env migration change ships in next.18. List what changed and
what to do under a next.18 heading, and point the older Doctor-based
migration section at the new commands.

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

roodboi commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

New head 66d1cf9c142d6453ec40c6dccc8ae4bfa533ba68 (takeover of this unit). It adds one docs-only commit on top of 00ee26a438: a next.18 section in docs/guides/v5-release-notes.md that summarizes this breaking change and what to do. No product or test source changed. Confirmed that ef41fa673 is a plain merge of next 8e7242db94 into the accepted 8cab3a246b: the only extra change is the resolved tests/upgrade-check-failure.test.ts conflict plus its worker fixture. Root typecheck and docs:prepare/docs:check pass. Focused tests and a second-family review are running. No Ready note yet.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@roodboi

roodboi commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

Ready for lead: 66d1cf9

Takeover of this unit (the previous owner's session ended at about 16:35 UTC). No redesign.

What is on top of your accepted 8cab3a246b

  • ef41fa673: normal merge of the next.17 candidate 8e7242db94. I redid the merge from 8cab3a246b and compared: the only differences from a plain merge are the resolved conflict in tests/upgrade-check-failure.test.ts (keeps this PR's isolated child process; adds fix(upgrade): explain refused env layers with closed diagnostics #833's env-layer-refused case in next's order) and the matching case in tests/fixtures/upgrade-check-failure-worker.ts.
  • 5f83bc8f0..00ee26a43: the previous owner's fix for the Codex P2 (an initial Compose repair with existing env layers now runs the same delivery check as deferred repair), plus regressions and docs. That thread is answered and resolved.
  • 66d1cf9c1 (new, docs only): a next.18 section in docs/guides/v5-release-notes.md with this breaking change's migration notes (legacy copies kept, preview, resumable apply, separate cleanup, rollback, the delivery precondition), and a pointer from the older Doctor-based migration section.

What I ran at this head (pinned Bun 1.4.4, temporary HOME/TMPDIR, daemon autostart disabled)

  • Root bun run typecheck: pass.
  • Focused tests, 12 files: env-migration journal/live-inputs/preview-cli/provider/safety/tracked-consent, env-set-local-contract, legacy-env-cleanup, upgrade-check, upgrade-check-failure, v4-upgrade, doctor-fix-noninteractive: 220 pass, 0 fail.
  • docs:prepare + docs:check: pass.
  • Second-family reviewer (Codex gpt-6.1-sol on codex-dio), scoped to the merge result, the post-acceptance fix and the new notes: CLEAN at 66d1cf9, no findings. The review was static.
  • computer pr review-status: CLEAR at 66d1cf9, with no unresolved bot threads or change requests.

Not verified

  • The Codex bot did not review this head: the @codex review request returned "usage limits reached". Its last review was clean at 00ee26a43, and only the docs commit came after that.
  • Hosted CI at this head was still running when I posted this. I will check it and note the result here.
  • I did not run the full root suite at this head; the last full run was the previous owner's at 8cab3a246b. I ran no macOS or real-VM checks. Your Mac batch at 8cab3a246b came before the merge and the delivery fix, so a Mac rerun of the macOS-only env-migration files at this head would close that gap.

Ships in next.18. Not merged, and I will not push to this branch again.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits. You can see your limits in the Codex usage dashboard.

@roodboi

roodboi commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

Addendum to the ready note at 66d1cf9c142d6453ec40c6dccc8ae4bfa533ba68 (no push): the GitHub Codex review bot is out of usage. Per the lead, the second-family review of record for this PR is my Codex reviewer (gpt-6.1-sol on codex-dio), which returned CLEAN at 66d1cf9c142d6453ec40c6dccc8ae4bfa533ba68.

Conflicts:
- src/commands/env.ts: keep this branch's aliased migration import and
  next's ProjectEnvKeyState (#848).
- scripts/check-native-*-plan-cli.ts: keep this branch's HOME fingerprint
  and refusal-activity gates; the env plan script also keeps next's
  setup-unavailable detached refusal (#794). The shared refusal helper now
  forwards the private inputs to next's assertNativePlanHome check.

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

roodboi commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@roodboi

roodboi commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

Ready for lead: 5cdbd3a

This is a normal merge of next e47681ea0 (the 13-PR set) into the previous head 66d1cf9c1. There is no other change and no redesign.

Conflicts resolved

  • src/commands/env.ts (import list only): kept this PR's aliased migrateLegacyProjectEnv import and feat(env): report project key state in env list --json #848's ProjectEnvKeyState.
  • The six scripts/check-native-*-plan-cli.ts: kept this PR's HOME-fingerprint and refusal-activity gates. In check-native-env-plan-cli.ts, also kept feat(native): guide first-use runtime setup #794's assertion that a detached start with no runtime executor returns a setup-unavailable refusal. scripts/lib/native-plan-home-state.ts now passes the private inputs through to next's assertNativePlanHome, so its privacy check still runs.

What I ran at this head (Linux, pinned Bun 1.4.4, umask 022, temporary TMPDIR, daemon autostart disabled)

  • Root typecheck and the full bun run check (Bun pin, privacy, lint): pass.
  • bun run build:release --skip-tests --out=dist/config-compiler-release: pass. This host has no system C linker, so the Rust build linked through zig cc from mise via a scratch wrapper. That is not CI's toolchain.
  • Acceptance scripts from ci.yml, all pass:
    • check-config-compiler-cli
    • check-native-config-import-cli (49)
    • acquisition (198), endpoint (153), env, host (139), process (145) and routing (141) plan scripts
  • Not run: check-release-config-compiler.ts. It runs the release installer, which asks for sudo on this host. This session does not use sudo; the script stopped at the password prompt before installing anything. CI runs it.
  • Focused tests: env-migration (6 files), env-set-local-contract, legacy-env-cleanup, upgrade-check, upgrade-check-failure, v4-upgrade, doctor-fix-noninteractive, env-list-key-state and env-backend-command: 247 pass, 0 fail.
  • Second-family review of record: my Codex reviewer (gpt-6.1-sol on codex-dio), the same thread as the previous round, scoped to the merge result: CLEAN at 5cdbd3a. It confirmed feat(native): guide first-use runtime setup #794's setup path and feat(env): report project key state in env list --json #848's key_state survive, and that there are no changes outside this PR's paths compared with next. The GitHub Codex bot is out of usage.
  • computer pr review-status: CLEAR at 5cdbd3a.

Not verified: hosted CI at this head was still running when I posted this; macOS, the real VM, and the full root suite are not run. The release notes keep this PR's migration notes under the next.18 heading.

Not merged, and I will not push to this branch again.

@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: 5cdbd3ad1e

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

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/commands/env-migrate.ts Resolved
@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 5cdbd3ad1e

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@roodboi

roodboi commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

Mac pass at 5cdbd3a (local build, two real checkouts with legacy env layouts): hack env migrate and hack env migrate --json both exit 0; no file under .hack or any env file changed (content, size and modification time compared before and after), and git status is unchanged. The JSON uses the { ok, data } envelope with action, dryRun, files, journalPath, manifestPath, project, status, version. Not run on the Mac: --apply, --cleanup, rollback (those run on one project with a key backup after the prerelease). This head goes into the next combined Mac batch.

🤖 Generated with Claude Code

Build the fixture's failed, unregistered up record with the production
activity writer so it carries exactly the schema's nine keys and no path.
It passes with the current shared helper and with the stricter key-set
check proposed in #835, so merge order does not matter.

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

roodboi commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

Ready for lead: 969bf07

This replaces the note at 5cdbd3ad1e. It is a test-only change for your combined-batch result.

  • Change: tests/native-plan-home-state.test.ts now builds its fixture record with the production buildActivityRecord: a failed up, exit code 1, no project, branch or failed services, origin cli, a fixed timestamp and 42 ms. The record has exactly the nine schema keys and no path or value. The test logic and the seven negative controls are unchanged.
  • Verified locally (Linux, pinned Bun 1.4.4):
  • Second-family review of record: my Codex reviewer (gpt-6.1-sol on codex-dio), the same thread, is CLEAN at 969bf07. It confirmed every negative control still tests what it claims. The GitHub Codex bot is out of usage.
  • Merge order with fix(cli)!: standardize HACK-2218 machine output contracts #835 does not matter for this file. Hosted CI at this head was still running when I posted this.

Not merged, and I will not push to this branch again.

Env migration and Doctor's migration used the literal namespace "project"
when the config has no name, so an unnamed legacy project could migrate
without its stored secrets, or import another project's values from that
namespace. Use the same effective name as the env commands that stored
them: the configured name, else the checkout directory, as a slug.

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

roodboi commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@roodboi

roodboi commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

Ready for lead: 06522fc

This replaces the note at 969bf07215, which I posted too early. The Codex bot had already raised an unresolved P2 on the merge head (5cdbd3ad1e, at 02:29 UTC) before it ran out of usage, and I had not re-checked review-status first. Two commits are on top of 5cdbd3ad1e:

  1. 969bf0721, test-only (your fix(cli)!: standardize HACK-2218 machine output contracts #835 combined-tree result): the plan-home fixture now builds its activity record with the production buildActivityRecord, so the record has exactly the nine schema keys. It passes 14 of 14 with next's helper and with fix(cli)!: standardize HACK-2218 machine output contracts #835's. The old fixture fails 3 tests in a local, uncommitted merge with fix(cli)!: standardize HACK-2218 machine output contracts #835.
  2. 06522fcc3, product fix for the bot's P2: hack env migrate and Doctor's three migration sites used config.name ?? "project", which this PR had introduced. An unnamed legacy project therefore looked up its secrets under the literal project namespace: it could migrate without its stored secrets, or import another project's values. All four sites now use a shared resolveEffectiveProjectName: the configured name, else the checkout directory, as a slug. That is the name the env commands use when they store legacy secrets, and env.ts now calls the same helper.
    • For Doctor this is a small change from next, which used the raw cfg.name or directory name: a configured name that isn't already a slug, such as My App, is now looked up as my-app. That matches the store hack env wrote to. The reviewer agreed.
    • Regression tests cover env migrate --apply and doctor --migrate-env-config, each with an unnamed project in unnamed-app/ and a decoy value under project. Each test imports the decoy with its route reverted.
    • The preview JSON table in docs/reference/env-migration.md now says what projectName is. I replied on the bot's thread and resolved it.

What I ran at this head (Linux, pinned Bun 1.4.4, umask 022, temporary TMPDIR, daemon autostart disabled)

  • Root typecheck, full bun run check (privacy ok) and docs:prepare + docs:check: pass.
  • 16 focused files (env-migration ×6, env-set-local-contract, legacy-env-cleanup, upgrade-check, upgrade-check-failure, v4-upgrade, doctor-fix-noninteractive, doctor-fix-adopted-project, env-list-key-state, env-backend-command, native-plan-home-state): 267 pass, 0 fail.
  • Acceptance scripts: not rerun for these two commits. They change neither scripts/ nor the compiler, and they all passed at 5cdbd3ad1e (except check-release-config-compiler, which needs sudo here).
  • Second-family review of record: my Codex reviewer (gpt-6.1-sol on codex-dio), the same thread for all rounds: CLEAN at 06522fc. The GitHub Codex bot is out of usage again (it answered the latest @codex review with its limit message).
  • computer pr review-status: CLEAR at 06522fc, with 0 unresolved bot threads.

Not verified: hosted CI at this head was still running when I posted this; macOS, the real VM and the full root suite are not run.

Not merged, and I will not push to this branch again.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits. You can see your limits in the Codex usage dashboard.

@roodboi
roodboi merged commit 71164f8 into next Nov 15, 2026
30 checks passed
@roodboi
roodboi deleted the codex/hack-2191-resumable-env-migration branch November 15, 2026 05:59
roodboi added a commit that referenced this pull request Nov 15, 2026
…migration

`env migrate --json` (#797) is an envelope without `data.schema`;
`usage --json --by-service` (#852) is a schema-tagged variant, so its
schema id moves into MACHINE_SCHEMAS. Flag variants whose base command
keeps another shape now get their own reference row instead of a
hard-coded list.

The outputs this branch migrates first shipped in 5.0.0-next.17, so the
reference page no longer calls them unpublished and the next.18 release
notes describe the change for scripts.

BREAKING CHANGE: version, activity, projects --observe, global status
--observe and global install|trust --plan JSON move into the
{ok,data:{schema}} / {ok:false,error} envelope.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
roodboi added a commit that referenced this pull request Nov 15, 2026
**Update (Nov 15): breaking for next.17.** 5.0.0-next.17 shipped from a
tree without this PR, so `version --json`, `activity --json`, `projects
--json --observe`, `global status --json --observe` and `global
install|trust --plan --json` are now published in their older shapes.
This PR moves them into the envelope, so the title is marked `!` and the
next.18 release notes describe the migration for scripts. The desktop
core parser in this PR requires the new contract, so it cannot read a
next.17 CLI's `version --json`. Since then the inventory also covers
`env migrate --json` (#797, envelope without a schema id) and `usage
--json --by-service` (#852, `hack.usage.by-service.v1`).

The unpublished HACK-2218 JSON commands used incompatible top-level
shapes. Version, observe-only projects/global status, and administrator
install/trust plans now return `{ok:true,data:{schema,...}}`; Activity
gains its missing `hack.activity.v1` schema. Failures return a stable
`E_*` error envelope and nonzero status. Published plain `projects
--json` keeps its existing shape. Refused and incomplete plans retain
recovery evidence in `error.detail.plan`.

Desktop core consumes the version envelope and provides a strict schema
parser for the migrated contracts. Shared generated fixtures test both
CLI and desktop boundaries. The new [Machine-readable output
reference](docs/reference/machine-readable-output.md) inventories every
canonical JSON command, distinguishes legacy/streaming shapes, and is
checked against the command definitions. The native-env-plan acceptance
harness allows the lifecycle activity audit file while retaining its
no-registry/no-runtime-state checks.

![Machine-readable command
boundary](docs/reference/machine-readable-output.svg)

Validation: focused CLI/contract, administrator-plan, activity,
observation, generation and reference tests pass; root
typecheck/check/privacy, documentation checks and CLI build pass;
desktop core has 79 passing tests. Contract tests check the shared
usage-error boundary for all 80 canonical JSON commands and actual
success boundaries for migrated variants and prune. macOS administrator
tests are skipped on Linux. No live engine/native provider or Mac
application state-tool validation is claimed; the lead will verify real
Mac state. Desktop schema parsing requires the new CLI contract;
released CLIs do not yet provide it.

HACK-2238. Based on `next`; no app tab branches or desktop appendix rows
changed.

---------

Co-authored-by: Kit <344842+roodboi@users.noreply.github.com>
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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant