Repository navigation
feat(update): orchestrated ocx update plan/apply contract (update.orchestrated/1) - #8103
Merged
Merged
Conversation
Owner
Author
|
Maintainer integration record (dev-only exception, MAINTAINERS.md).
|
lidge-jun
added a commit
that referenced
this pull request
Nov 2, 2026
… and shorten the pinned-sync watchdog case PR test 4/4 at 7f4924e hit the 15-minute job timeout (job 125416446261) with no failing test. Its merge with dev ran tests/update/update-orchestrated-entry.test.ts (#8103) for 98 s, and like the other files #8099, #8100, #8103 and #8104 added it had no recorded duration and weighed the 176 ms median: the shard predicted 728 s and ran 852 s of tests. Both tables are refreshed with scripts/ci/test-durations.ts. Linux/macOS: run 41462914814 (dev 09b5585, Linux and macOS shards) plus the Linux shards of pull_request runs 41485932590, 41482553737 (#8103) and 41483744349 (#8104); every test file now has a row and the four Linux shards predict 716 s each. Windows: run 41462914814's eleven shards; the #8103/#8104 files and three files of the two stopped shards have no Windows measurement yet and still weigh the median. The POSIX "version writer ignoring signals" case waited out the production ten-second watchdog. It now runs the same script with a one-second watchdog and asserts the shipped script keeps "sleep 10": the case drops from about 10.4 s to 1.4 s.
Merged
3 tasks done
lidge-jun
added a commit
that referenced
this pull request
Nov 2, 2026
…fan-out test fixture (#8106) * fix(link): keep Windows containment refusal at 126 and correct the fan-out test fixture #8100 packed every Windows remote command and inflated it before the containment helper existed, outside any try. A Child whose PowerShell runs in Constrained Language Mode could not inflate it and exited 1, which the Home reads as an ordinary ocx failure. Guard only the inflate so it exits 126; Invoke-Expression stays outside the guard so the inflated script's own errors and exit codes pass through. The new local-only fan-out test spawned the CLI with a stripped POSIX environment (no SystemRoot, a ':' PATH, a sh-script ssh) and without the owned-service-home preload that keeps Codex write admission away from the runner's real Task Scheduler. It timed out on Windows and could not prove "no ssh" there at all. Give CLI children the inherited environment and the owned-service-home fixture, add a Bun-spawn ssh sentinel with positive controls, and prove local-only in process as well. * docs(structure): separate inflation refusal from contained-run failures in the Windows contract * docs(devlog): record the measured encoded-size cost of the inflate guard * docs(devlog): quote the shipped wrapper and control in the plan * test(link): pin the fan-out Home outcome and keep inflated script errors out of 126 Address review: the local-only subprocess case now asserts the Home outcome its fixture is built for, and a Windows case shows an error raised by an inflated script keeps its own exit instead of the containment refusal (packedPowerShellArgv is exported for it). * ci(test): record durations for the #8099/#8100/#8103/#8104 test files and shorten the pinned-sync watchdog case PR test 4/4 at 7f4924e hit the 15-minute job timeout (job 125416446261) with no failing test. Its merge with dev ran tests/update/update-orchestrated-entry.test.ts (#8103) for 98 s, and like the other files #8099, #8100, #8103 and #8104 added it had no recorded duration and weighed the 176 ms median: the shard predicted 728 s and ran 852 s of tests. Both tables are refreshed with scripts/ci/test-durations.ts. Linux/macOS: run 41462914814 (dev 09b5585, Linux and macOS shards) plus the Linux shards of pull_request runs 41485932590, 41482553737 (#8103) and 41483744349 (#8104); every test file now has a row and the four Linux shards predict 716 s each. Windows: run 41462914814's eleven shards; the #8103/#8104 files and three files of the two stopped shards have no Windows measurement yet and still weigh the median. The POSIX "version writer ignoring signals" case waited out the production ten-second watchdog. It now runs the same script with a one-second watchdog and asserts the shipped script keeps "sleep 10": the case drops from about 10.4 s to 1.4 s.
3 tasks done
lidge-jun
added a commit
that referenced
this pull request
Nov 2, 2026
…ithSession #8103 moved the three reviewed guardedStartWindowsTray deferred imports from runUpdate into runUpdateWithSession, and the policy table follows the code. The fixture now uses that context; the fourth binding, raw namespace, unreviewed binding and other-context cases stay rejected. Windows-only lint; reproduced and verified under Node.
lidge-jun
added a commit
that referenced
this pull request
Nov 3, 2026
* fix(ci): make the Windows batch shards green after #8103 Run 41491122166 left four Windows shards red; dev was green on all eleven in 41262132337 before #8103. - update-orchestrated-identity: the fixture used POSIX paths that are not native on win32. The product also rejected a Windows source path written with '/' separators, so a live install could read as unknown; win32 now equates only the separators (dotted, doubled and wrong-suffix forms still fail closed). - update-bun-ownership-lease: the fixture did not recognize the Windows installer bridge (runWindowsInstallerSync) that #8103 introduced, so it answered unconfirmed and the updater kept its fence. - claude-intercept-acl-barrier: stub the PowerShell owner-ACL probe like the writer-barrier suite, so a slow cold probe cannot use up the 1 s ACL budget before the mocked icacls runs. - update-mutation-guard (windows 9/11): this lint runs only on Windows, where Bun can start the TypeScript sync client, so #8103 landed with 1258 unreviewed findings. Review every #8103 site into the existing tables plus two orchestrated-module sidecars; accept exit 10 only for the exact enterMutation refusal branch, with mutants; orchestrated-entry launches its child through probeSpawn, as job.ts does. - Windows durations refreshed from runs 41491122166 and 41462914814. - storage-policy and lab-read-surfaces left unfinalized prepared statements that keep SQLite files open, so each Windows afterEach removal waited its 15 s retry budget (about 210 s per run) and leaked the home. Plan and evidence: devlog/_plan/261103_windows_batch_shards/010_plan.md * test(update): reject relaxed mutation-entry refusal shapes Add mutants for an unawaited or different initializer, an inverted entered.ok predicate and an else branch (CodeRabbit review). * test(update): pin the deferred-import admission fixture to runUpdateWithSession #8103 moved the three reviewed guardedStartWindowsTray deferred imports from runUpdate into runUpdateWithSession, and the policy table follows the code. The fixture now uses that context; the fourth binding, raw namespace, unreviewed binding and other-context cases stay rejected. Windows-only lint; reproduced and verified under Node. * fix(update): hand the orchestrated child a parent-issued result channel The orchestrated update child now writes its outcome records only into a result file its parent created for it. The parent creates a fresh temp directory holding one exclusively created capability file and passes the token in OCX_UPDATE_RESULT_CAPABILITY. Before any session write, mutex use or identity probe, the child accepts only a canonical, single-link, non-symlink regular file (owner-only on POSIX) whose size and entire content equal that capability document, then publishes every record through the descriptor it validated (truncate, then write at explicit offsets). The parent reads, unlinks and non-recursively removes only the file and directory identities it recorded, and bounds the record size. Update-lint rows are re-reviewed for the new sites, and the POSIX supervisor and marker rows now state only what the code enforces. Tests cover rejected destinations left byte-identical, a path swap after validation, interrupted and oversized records classifying as uncertain, identity-bound cleanup, and real Bun and Node parent-to-child handoffs under a symlinked temp root. * fix(update): compare result-channel file identity with BigInt stats NTFS and ReFS file ids can exceed Number.MAX_SAFE_INTEGER; every identity-bearing lstat/fstat in the result channel and destination validation now uses { bigint: true } (CodeRabbit review). * fix(update): scope the result handoff token and channel cleanup Remove the result capability from the parsed environment so probes and installers never inherit it; the Node launcher passes it only to the Bun process continuing the same child. Channel cleanup removes by path only on POSIX with non-replaceable ancestors, and otherwise leaves the channel. Cover symlinked and junction destinations in both Node and Bun. * test(update): qualify result channel and marker review rows State that cleanup identity checks precede path-based removal on POSIX only, and that marker publication assumes the OpenCodex home cannot be replaced.
3 tasks done
This was referenced Nov 6, 2026
Closed
3 tasks done
This was referenced Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
External orchestrators (GOAT) need to update an OpenCodex install safely and machine-readably. Today
ocx updateis interactive-shaped, decides against whatever install theocxon PATH belongs to, and can update an install that is not the one serving the running proxy (seen on a Remote Link child: PATHocxis npm 2.50.0 while a different install serves 2.83.0).This adds contract
update.orchestrated/1:ocx update --plan --json [--tag latest|preview | --version X.Y.Z]— read-only plan (ocx.update.plan/1): currentVersion, targetVersion, installer, runtimeOwner, servingPath, cliPath, canApply, reason, restartRequired, planToken, updateInFlight, mutationBoundMs. Always exit 0; usage 64. The decision is made against the install that serves the live runtime: the runtime now records its relaunch command in runtime-port.json, and the listener must prove the record's attestation secret. CLI ≠ serving install →cli-not-serving-install; unknown →serving-install-unknown; desktop-app installs →desktop-app-owned(the Tauri updater has no external trigger). Plan entry is passive: no Desktop handoff, boot-restore, Bun install or shim repair.ocx update --yes --json [--version X] [--expect-plan T] [--not-after MS]— non-interactive apply (ocx.update.result/1), one JSON document on stdout. Exit 0 applied+verified or up-to-date, 10 refused (nothing touched), 11 failed with the previous version verified active, 12 unverified, 64 usage. Apply pins the planned version in npm, pnpm and Bun lanes, reuses the existing guarded updaters, and fences mutation in this order before any tray/runtime/package change: sync/update mutex → ownership lease → in-flight marker → deadline / plan-token / attested identity re-check. Outcomes are classified from child-reported phases plus passive tree and runtime verification. npm/pnpm are driven from the Node launcher so the bundled Bun is idle during replacement.ocx synctakes the same sync/update mutex and exits 7update-in-flightwhile an update holds it.ocx capabilities --jsongains top-levelcontracts(every output shape);ocx capabilities --contracts --jsonprints only{"schemaVersion":1,"contracts":[...]}.Design and four audit rounds:
devlog/_plan/261102_ocx_update_orchestrated/010_plan.md.Verification
bun run typecheck,bun run structure:check,bun run skill:surface:check,bun run privacy:scan: exit 0.tests/update/update-orchestrated-*, sync mutex, stop-first, capabilities, sync expect-link, launcher Desktop handoff, shim autorestore, client start fence, file-size ratchet, test layout, core–Lab boundary, skill-ocx, structure-ssot, repo-hygiene) with a temp HOME: 512 pass, 1 skip, 0 fail, exit 0.bun run test:changedcould not complete locally on a heavily shared host (interrupted after >5 min). Failures seen in its partial run were environment leaks reproduced on this host (inheritedGOOGLE_ANTIGRAVITY_USER_AGENT; a version-manager PATH putting a real npm/codex ahead of fixtures incodex-cli-update-*tests) or load timeouts.ci:fullis set so the full Ubuntu shards cover the subprocess and read-as-data paths.Checklist
Summary by CodeRabbit
ocx update --plan --jsonto preview update eligibility, installation details, and runtime status.ocx capabilities --contractsto list versioned machine contracts, including in JSON output.ocx syncrefuses without making changes when an update is in progress or coordination is unavailable; it exits with code 7.