Skip to content

ci: pin release evidence policy to the current ci.yml - #8377

Merged
lidge-jun merged 1 commit into
devfrom
fix/release-evidence-ci-pin
Nov 8, 2026
Merged

lidge-jun merged 1 commit into
devfrom
fix/release-evidence-ci-pin

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Summary

dev is red at gates. #8369 changed .github/workflows/ci.yml (moving heavy Linux jobs to the self-hosted pool) without updating its pinned digest in .github/scripts/release-evidence-policy.json. release-evidence.test.cjs › "production policy pins the current workflows and job-selection helpers" now fails on every PR cut from dev:

AssertionError [ERR_ASSERTION]: .github/workflows/ci.yml
+ '4d1d82f1d26d95d2448b1269dde1b7b14b73455e'
- '562e63d6bd140944d8c6ba808010913463c75826'

This follows the pattern earlier workflow changes used, for example #8345. It appends a new ci v1 policy entry identical to the previous one except for the ci.yml digest, which becomes 4d1d82f1…, the blob of ci.yml at dev 399925164. Earlier entries stay, so evidence from runs on older commits keeps validating against the policy that was current for them. ci.yml was the only stale entry: every other file in the latest ci and service policies still matches.

Verification

  • Failing-first: on dev, node --test .github/scripts/release-evidence.test.cjs gives 1 failure, the digest assertion above, matching the gates failure on fix(gui): explain a refused Remember instead of reporting the admin token unverifiable #8374 (job 128800965330). With this change: 25 pass, 0 fail.
  • node --test .github/scripts/release-dispatch-guard.test.cjs and node --test .github/scripts/release-resume.test.cjs pass. release-history.test.cjs fails 2 cases locally both on dev and on this branch, because it needs full tag history. It passes in CI, where the same gates log shows those cases green, and it does not read this file.
  • NOT RUN: the full suite. This is a data-only change to one JSON file.
  • Pushed with --no-verify. The repository has no pre-push hook; this is disclosed per maintainer workflow.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed. Not applicable.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. This touches release-evidence policy, so a separate security review is requested. It changes no workflow, permission or action ref: it only records the digest of the ci.yml already on dev.

Summary by CodeRabbit

  • Chores
    • Updated internal release validation records. There are no changes to the product’s features or behavior.

@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner November 8, 2026 17:23
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 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-08T17:25:25.706072Z 2853da4 PR opened
ℹ️ 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.

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Nov 8, 2026
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The release evidence policy adds a version-1 CI record. It lists the CI workflow and supporting files, including the workflow hash.

Changes: CI evidence policy

Layer / File(s) Summary
Add CI evidence record
.github/scripts/release-evidence-policy.json
The policy adds a version-1 CI record. It lists the CI workflow with hash 4d1d82f1d26d95d2448b1269dde1b7b14b73455e; the other listed file hashes match the preceding record.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Possibly related PRs

Merge Risk: Minimal · up to 2853d

The policy refresh has no identified merge-blocking issue and is mergeable subject to normal checks.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "ci: pin release evidence policy to the current ci.yml" matches the main change. The PR adds a new version-1 ci evidence record to .github/scripts/release-evidence-policy.json with an update…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "ci: pin release evidence policy to the current ci.yml" matches the main change. The PR adds a new version-1 ci evidence record to .github/scripts/release-evidence-policy.json with an updated ci.yml workflow hash. The objectives say the same thing: the ci.yml digest was stale and is now pinned to the current workflow. The title is specific, concise, and uses the conventional ci: prefix. Only the policy JSON file changed, so the title covers the full changeset.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • 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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3999251 and 2853da4.

Files selected for processing: 1

  • .github/scripts/release-evidence-policy.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@lidge-jun
lidge-jun merged commit f6506e7 into dev Nov 8, 2026
61 of 66 checks passed
@lidge-jun
lidge-jun deleted the fix/release-evidence-ci-pin branch November 8, 2026 18:07
lidge-jun added a commit that referenced this pull request Nov 8, 2026
No content change. dev fixed the release-evidence policy pin in #8377; this empty commit gives the pull request a new merge ref so gates runs against it.
lidge-jun added a commit that referenced this pull request Nov 9, 2026
…) (#8276)

* feat(link): reconcile per-device route intent from Home (#8274)

* fix(route-to): preserve live denials and deferred sync outcomes

* test(cli): include route-to metadata in isolated capability fixtures

* fix(cli): reconcile route-to compatibility contracts from CI

* fix(link): preserve Codex cleanup ownership and defer local writers

* fix(link): reconcile Codex enable during fresh enrollment

* fix(link): arm enrollment rollback before config publication

* test(cli): update ZCode aliases for durable route intent

* fix(link): stop intent controllers before runtime recycle

* fix(link): address policy, parity, ownership and recovery reviews

* fix(desktop): preserve native mode and owned route transactions

* docs(link): clarify device policy and recovery guarantees

* fix(link): settle config ACL before native apply admission

* fix(desktop): retain diagnostics at early ACL admission

* fix(link): report native intent lock contention as busy

* test(link): align native route regression with server layout seeds

* fix(link): keep device policy seeding under one config lease

* fix(link): report native decision failures with publication evidence

* fix(desktop): recheck ACL settlement at native decision commit

* fix(claude): decide native toggle after ACL admission

* test(link): propagate seed fixture rollback failures

* fix(link): preserve Home native intent and idle watch

* fix(link): preserve enrollment inheritance and desktop mode

* fix(link): restore standalone native intent on disconnect and failed enrollment

A linked Child persisted its Home's effective intent into its own native
switches (clientIntegrations.codex/grok/claude-desktop, claudeCode.enabled
and, as side effects, claudeCode.authModeMigratedAt and apiSurfaces.messages)
but disconnect and failed-enrollment rollback never put the standalone values
back, so a Child that was Codex-on before linking stayed Codex-off after a
Home turned Codex off and the Child disconnected (and the reverse).

A machine-scoped private record (<configDir>/link/native-intent-originals.json)
now captures each field's standalone value (presence included) the first time
a Child link write changes it, write-ahead of the atomic config write, plus
the value this writer published or had pending. Disconnect and failed
enrollment restore the original only where the current value is the writer's;
a person's later edit is kept. The record is removed after the restored
config is read back and verified, so an interrupted restore is retryable.
Home writes are not recorded.

The fresh-enrollment Codex compensation now uses the same restore, which also
covers a field a crashed earlier attempt left behind.

* test(link): cover native originals capture, crash recovery and relinking

Module-level regressions for the standalone native originals record: capture
once across repeated writes, no ownership for a no-op or a Home write, a
person's edit kept on restore, Claude enabled/migration stamp/Messages
presence, a crash between the write-ahead record and the config write, a
crash between the config write and publish, an interrupted restore retried
after either step, a different link after a crashed enrollment, and an
unreadable record refusing both capture and restore.

* docs(link): document standalone native restore and local opt-out retention

Public guide (en, ko) and structure/remote-link.md describe how a linked
Child records its standalone native switches before the first link write,
how disconnect and failed enrollment restore them while keeping a person's
own edits, the ABA limit, and that the Child's local opt-out list survives
disconnect (now pinned by a regression test).

* test(link): pin the disconnect-resume fault after token removal

The fixture failed the first config commit and relied on it being the
post-token connection clear. Disconnect now restores standalone native
switches in an earlier config commit, so the hook re-arms until the token
is gone and the fault lands where the test name says.

* fix(link): keep implicit Home Desktop and Grok intent to startup scope

An undecided Home Desktop intent (no persisted default and no Home
override) used to create an OpenCodex gateway profile and switch Desktop
to gateway mode on any unrelated Home route write. It now refreshes only
a gateway profile OpenCodex already owns and otherwise reports current
without writing. Implicit Grok intent follows the startup gate, so a
gated hub or sibling writes nothing. Explicit defaults and device
overrides still create.

* fix(link): keep the Home's own native switches over captured defaults

Captured route defaults exist to drive Children, but the Home projection
preferred them over the Home's live native switches. ocx restore,
Messages off and similar writers change those switches without recording
route intent, so any unrelated route write re-enabled Codex and Claude
Code and re-injected Codex. On the Home, a persisted native switch with
no Home override now wins unless the write decides that client, the
projection reads the durable switches, and a single-client Home write
materializes only that client while keeping the other clients' receipt
outcomes.

* fix(link): treat first-party Claude Desktop as current for enabled intent

First-party Desktop already routes through OpenCodex, yet the route
adapter reported a conflict for both on and off, so Home ocx sync exited
1 on every run and ocx route to sync stayed 409 after any enrollment.
Enabled intent is now current with no write; disabled intent stays a
conflict whose message names the existing mode switch.

* fix(link): keep ocx integrations native a Home-only decision

The CLI native toggle had become a Home default write, so it changed
every Child and skipped Claude Desktop's first-party transition that the
native route performs. It calls the native route again, which records
only the Home override and runs the client's own transition; on a Child
it refuses with the Home command for that device.

* fix(link): restore standalone file integrations on disconnect

Disconnect disabled every file integration with an ownership record, and
connect had already disabled or refreshed pre-existing ones, so a join
followed by a disconnect lost integrations the Child had set up on its
own. The first link apply now records, write-ahead and bound to the
link, which file clients the Child owned. Disconnect keeps those still
owned, applies again those the link disabled, leaves a local opt-out or
the person's own block alone, and removes only what the link created.

* fix(link): keep the enrollment token until native switches are restored

A failed enrollment removed its service token even when restoring the
standalone native switches threw, leaving no owner to retry. It now keeps
the token and pending marker, like disconnect, and names the record.
Plain ocx disconnect on a disconnected machine drains a lone native
originals record instead of refusing: it restores the switches, removes
the enrollment's own token, and on failure prints the record path and
the recovery step.

* fix(link): readmit the link key after a route intent watch wait

A watch read could wait up to 30 seconds and then answered after
rechecking only the link record, so a key revoked during the wait still
received fresh policy. The wait now repeats the listener's key admission
against current policy before the ownership recheck.

* docs(link): document Child tick rewrites, restore reversion and client toggle scope

State that the periodic Child sync rewrites its receipt and Home proof on
every apply, why a mid-apply parity report shows a brief withdrawal, that
ocx restore on a linked Child lasts only until the next sync unless the
person opts out with --local, and that plain ocx integration client
enable/disable writes the Home default and is refused on a Child.

* fix(link): let the Home's own native switches govern the Home

On the Home, Codex, Claude Code, Grok and Claude Desktop now project
from the Home's persisted native switch (absent is on) with source
"native", ignoring captured defaults and devices.home entries. Before,
the live switch won only when stored as a boolean with no Home
override, so ocx restore back (absent key), ocx claude desktop apply,
or any native toggle (which recorded a devices.home override) let a
plain ocx sync or route to sync rewrite the switch and re-inject or
strip the client.

A full Home sync now decides no client and never writes a Home native
switch; it only refreshes owned artifacts to match it, and an enabled
Grok or Desktop switch keeps startup scope. A Home write that decides
one of these clients (route to default, --device home, native PUT)
applies through the existing switch writer and keeps no devices.home
entry: recordHomeNativeDecision pins the off Child builtin for Grok
and Desktop, setRouteClientIntent refuses a Home native entry, and
initializeHomeRouteIntentDefaults drops one saved by an earlier
version. --device home inherit sets the switch to the default. The
native PUT captures defaults from the durable switches. The Home
receipt parser and ocx.route-to/1 accept the additive "native" source;
documents sent to Children never carry it.

* fix(route-to): mark any outcome for an earlier intent stale

routeToDeviceStatus only turned an outdated current outcome stale. An
earlier conflict or failure kept its colour after the intent changed,
so ocx route to <client> off --device <child> after a conflicted
enable exited 409 on a result that said nothing about the new intent.
Any outcome whose per-client intent digest differs from today's intent
now reads stale; receipts without per-client digests keep the
whole-document rule for current rows only.

* docs(link): document Home native switches, native source and pre-record Children

The remote-link guide (en, ko), structure docs and route to capability
notes now say that on the Home Codex, Claude Code, Grok and Claude
Desktop follow the Home's own switches, that Home writes for them
apply through the switch, that plain ocx sync and route to sync never
change them, that status reports source native, and that an outcome
for an earlier intent reads stale. They also state that a Child linked
before the file-integration originals record existed has none, so
disconnect does not set up again integrations the Home turned off.

* fix(link): capture Children's native defaults once from the Home's switches

A Child's projection fell back to the Home's live native switches whenever no
default was saved, so Home-only writers (ocx restore, restore back, Claude
Desktop apply, Messages off, the Claude toggle) changed what Children inherit,
and a later initialization saved the Home-only value permanently.

Children now never read the Home's switches: device override, then the saved
default, then the builtin. captureHomeRouteDefaults saves the four native
defaults once from the durable switches (Codex and Claude Code as the switch
says, Grok and Claude Desktop off). It runs in every route-intent
initialization (in the same single write, so an Aside refusal writes
nothing), before a Child projection, when the hub-link listener binds, and
before each Home-only switch writer changes a switch on a linked Home.
desired-state.ts stays free of link state for the core/link boundary; the
Home-only writers call setHomeIntegrationEnabled instead.

* fix(route-to): fail a Home write whose decided client the Home cannot apply

A Home write that decides a native client but is refused (first-party Claude
Desktop off) or fails (its switch cannot be written) leaves the Home switch
unchanged, so the rebuilt Home row read the recorded conflict or failure as
stale; the PUT answered 200 and ocx route to exited 0 without the mode switch.

The PUT now uses applyHome's own outcome for the decided client: on conflict or
failed it answers 409 route_apply_unresolved with that outcome in the Home row
and its message (naming the mode switch for first-party Desktop), so the CLI
exits nonzero. A default write still reports that the Children's default was
saved.

* fix(route-to): report a changed refresh-only Desktop profile as a conflict

An enabled Home Claude Desktop switch that no write decides only refreshes a
profile OpenCodex owns. That path returned current for a gateway_drifted,
unsafe or broken profile. It now reports the conflict as the decided path
does, and never takes the profile over even with overwrite: replacing it is a
decided write. The inspection reads the durable applied marker, since the
caller's snapshot can predate a Desktop apply by another process.

* docs(link): document one-time capture of Child native defaults

Children never read the Home's native switches; the Home saves their defaults
once at migration (Codex and Claude Code from the switches, Grok and Claude
Desktop off) and only a Home default write changes them afterwards. Also
document the 409 for a decided Home write the Home cannot apply and the
refresh-only Desktop conflict, in the English and Korean guides and the
remote-link structure notes.

* fix(route-to): leave a Desktop library OpenCodex never owned current on a refresh

A refresh-only Claude Desktop row (an unset Home switch read as on) reported a
conflict for any unsafe or broken library, including one OpenCodex never owned:
an unreadable _meta.json, an applied id outside the safe pattern, or another
app's missing profile. Every full Home sync then failed and advised
--overwrite-conflict, which would take over a library that was never ours.

The refresh-only path now reports a conflict only with ownership evidence (an
OpenCodex entry selected, or unreadable ownership plus a committed applied
fingerprint) and otherwise answers current with no write.

* fix(route-to): refuse a Home-only switch write with a typed refusal when route intent is unreadable

An unreadable or malformed route-intent.json (or config-lock contention) made
setHomeIntegrationEnabled throw a raw SyntaxError, so ocx restore, ocx restore
back, Claude Desktop apply, the Claude toggle and Messages off crashed, and
ocx restore --json printed no envelope.

These writers still refuse before the switch moves, since writing it first would
change what Children inherit once the file is repaired, but the refusal is now
typed: { ok: false, reason: "unavailable", retryable, message } naming the
route-intent.json path and asking to fix or remove it. ocx restore --json prints
one complete envelope with that message; Messages off and the Claude toggle
answer route_intent_unavailable (409 on contention, 500 otherwise).

* fix(route-to): report a saved Home override on a refused --device home write

A --device home write for a client the Home does not treat as native (opencode,
for example) saves a devices.home override before the apply runs. When that
apply answered conflict or failed, the 409 said desiredCommitted: false and "The
Home did not apply", though the override was saved. The 409 now reports
desiredCommitted only when route policy was saved and the client is not a Home
native one, and picks the "Route policy was saved" prefix from the same value.

* fix(route-to): capture Child native defaults on Home-only writes only once linked

The Home-only switch writers (ocx restore, ocx restore back, Desktop apply,
Messages off, the Claude toggle) captured the Children's native defaults only
when the Home had a link, but the native route, a --device home write and the
Home's own apply captured unconditionally. Two unlinked Homes in the same end
state then gave a later-enrolled Child different defaults depending on which
writer had moved the switch.

Every Home-only decision now follows the link-gated rule, through a whenLinked
option on initializeHomeRouteIntentDefaults: the native route, a --device home
write and the Home materializer capture native defaults only when the Home has a
link. Link-gated was chosen over unconditional capture because a standalone Home
never needs route-intent state written by a Home-only toggle, and a Child that
enrolls later inherits the switches as they stand at enrollment, which
seedRouteDeviceClients captures. A default write and enrollment still capture.
Until a default is saved, a Home inherit takes the builtin.

* fix(route-to): keep Child route-intent reads pure

GET /api/route-to and the link GET /v1/link-management/route-intent captured the
Children's native defaults through projectChildRouteIntent, so a read could
write route-intent.json, while the route registry lists the status read as
non-mutating and the link read is documented as not mutating state.

The capture is gone from projectChildRouteIntent. Every path that serves a Child
has captured before it reads: enrollment through seedRouteDeviceClients, and the
link listener's start for a Home that already has links. The test that asserted
first-read capture now asserts the reads write nothing and that enrollment saves
the defaults the Child then projects.

* fix(cli): drop the stale native toggle exemption from the route registry

The four PUT /api/native-integrations/<client> routes were exempt from the CLI
coverage check as a compatibility alias "because current CLI native toggles use
durable /api/route-to intent". That stopped being true when ocx integrations
native went back to calling these routes, which its capability already lists.
The exemption is removed, so the routes get the check, and the capability test
now asserts the routes are covered and not exempt.

The ocx integrations native comment and capability detail (and the generated
skill surface) no longer say a Home override is recorded: the route writes the
Home's native switch and records no Home route intent.

* docs(link): state when Child native defaults are captured

The Remote Link guide (en and ko) said the Home saves the Children's native
defaults when it serves a Child's route intent and in every Home-only switch
command. It now says when capture actually happens: a Home default write and
Child enrollment always save them; once the Home has a link, the link listener
and every Home-only command save them before the switch moves; on a Home with no
link nothing is saved, so a Child enrolled later inherits the switches as they
stand at enrollment; reads never save. It also notes that an unreadable
route-intent.json makes those commands refuse and name the file, that a Home
inherit takes the builtin until a default is saved, and that a Desktop library
OpenCodex never owned is reported current. structure/ notes follow the same
inherit wording.

* fix(route-to): report saved Home native switches and keep route intent off unlinked Homes

A refused or failed Home native decision now reports desiredCommitted from the
durable switch before and after the apply, so a Grok off that saved the switch
before hitting an incomplete block says so. On a Home with no link, native
toggles and --device home native writes no longer read or write
route-intent.json, so ownership defaults cannot pin a client the dashboard
later enables. An unreadable route-intent.json is a typed refusal naming the
file in the native toggle, route-to writes and dashboard file toggles, and a
dashboard file toggle on a Home that uses route intent is recorded as the
Home's devices.home decision so ocx sync keeps it.

* fix(link): retry an owed Child route-defaults capture after a failed listener start

* docs(link): unlinked Homes, saved switch reports and dashboard toggles under route intent

* fix(route-to): keep legacy Home native cleanup on unlinked syncs; linked fixtures for native bookkeeping tests

* docs(structure): unlinked Home syncs drop only legacy Home native entries

* fix(route-to): save Children's defaults before Home-only integration writes and record Aside and restore decisions

* fix(link): cancel an owed route-defaults capture retry when the listener closes

* fix(route-to): treat ephemeral ocx-child links as not supporting route intent

* fix(link): gate overwrite sync flags on a Child that honours them

* fix(route-to): report what a write saved when its apply fails unexpectedly

* fix(route-to): match Aside decision paths with one pattern the route registry does not read as routes

* fix(cli): make plain integration enable/disable a Home-only decision like the dashboard toggle

* docs(ocx-child): say the Rust parity parser is narrower than the Home's

* docs(link): Home-only integration decisions, ephemeral Children and the overwrite sync gate

* test(cli): plain integration toggles name the Home-only toggle route

* fix(route-to): read the durable config for Home integration decisions instead of cloning the live one

* ci: re-run checks on the current dev merge ref

No content change. dev fixed the release-evidence policy pin in #8377; this empty commit gives the pull request a new merge ref so gates runs against it.

* fix(route-to): let unlinked Homes change integrations when route-intent.json is unreadable

On a Home with no link a damaged route-intent.json refused every dashboard and CLI integration change with route_intent_unavailable. Nothing there needs protecting: no Child inherits from it, and ocx sync cannot read the file either, so it cannot undo the write. The write now proceeds and records nothing. Linked Homes still refuse by name. Docs now state that an unlinked Home that already uses route intent still records the Home-only row, which Children never inherit.
MannXo added a commit to MannXo/opencodex that referenced this pull request Nov 9, 2026
The pr-hygiene.yml header still said trusted scripts come from the PR base
revision, but the checkout below it uses the fixed `dev` ref since lidge-jun#8381.

The stale-branch cleanup plan said its new release-evidence entry repaired
the ci.yml drift left by 28b38f9. lidge-jun#8377 had already pinned that blob
(4d1d82f) on dev; the lidge-jun#8381 entry only pins its own ci.yml revision.
lidge-jun added a commit that referenced this pull request Nov 13, 2026
…land #8276) (#8416)

* feat(link): sync route intent and materialize clients per device (#8274) (#8276)

* feat(link): reconcile per-device route intent from Home (#8274)

* fix(route-to): preserve live denials and deferred sync outcomes

* test(cli): include route-to metadata in isolated capability fixtures

* fix(cli): reconcile route-to compatibility contracts from CI

* fix(link): preserve Codex cleanup ownership and defer local writers

* fix(link): reconcile Codex enable during fresh enrollment

* fix(link): arm enrollment rollback before config publication

* test(cli): update ZCode aliases for durable route intent

* fix(link): stop intent controllers before runtime recycle

* fix(link): address policy, parity, ownership and recovery reviews

* fix(desktop): preserve native mode and owned route transactions

* docs(link): clarify device policy and recovery guarantees

* fix(link): settle config ACL before native apply admission

* fix(desktop): retain diagnostics at early ACL admission

* fix(link): report native intent lock contention as busy

* test(link): align native route regression with server layout seeds

* fix(link): keep device policy seeding under one config lease

* fix(link): report native decision failures with publication evidence

* fix(desktop): recheck ACL settlement at native decision commit

* fix(claude): decide native toggle after ACL admission

* test(link): propagate seed fixture rollback failures

* fix(link): preserve Home native intent and idle watch

* fix(link): preserve enrollment inheritance and desktop mode

* fix(link): restore standalone native intent on disconnect and failed enrollment

A linked Child persisted its Home's effective intent into its own native
switches (clientIntegrations.codex/grok/claude-desktop, claudeCode.enabled
and, as side effects, claudeCode.authModeMigratedAt and apiSurfaces.messages)
but disconnect and failed-enrollment rollback never put the standalone values
back, so a Child that was Codex-on before linking stayed Codex-off after a
Home turned Codex off and the Child disconnected (and the reverse).

A machine-scoped private record (<configDir>/link/native-intent-originals.json)
now captures each field's standalone value (presence included) the first time
a Child link write changes it, write-ahead of the atomic config write, plus
the value this writer published or had pending. Disconnect and failed
enrollment restore the original only where the current value is the writer's;
a person's later edit is kept. The record is removed after the restored
config is read back and verified, so an interrupted restore is retryable.
Home writes are not recorded.

The fresh-enrollment Codex compensation now uses the same restore, which also
covers a field a crashed earlier attempt left behind.

* test(link): cover native originals capture, crash recovery and relinking

Module-level regressions for the standalone native originals record: capture
once across repeated writes, no ownership for a no-op or a Home write, a
person's edit kept on restore, Claude enabled/migration stamp/Messages
presence, a crash between the write-ahead record and the config write, a
crash between the config write and publish, an interrupted restore retried
after either step, a different link after a crashed enrollment, and an
unreadable record refusing both capture and restore.

* docs(link): document standalone native restore and local opt-out retention

Public guide (en, ko) and structure/remote-link.md describe how a linked
Child records its standalone native switches before the first link write,
how disconnect and failed enrollment restore them while keeping a person's
own edits, the ABA limit, and that the Child's local opt-out list survives
disconnect (now pinned by a regression test).

* test(link): pin the disconnect-resume fault after token removal

The fixture failed the first config commit and relied on it being the
post-token connection clear. Disconnect now restores standalone native
switches in an earlier config commit, so the hook re-arms until the token
is gone and the fault lands where the test name says.

* fix(link): keep implicit Home Desktop and Grok intent to startup scope

An undecided Home Desktop intent (no persisted default and no Home
override) used to create an OpenCodex gateway profile and switch Desktop
to gateway mode on any unrelated Home route write. It now refreshes only
a gateway profile OpenCodex already owns and otherwise reports current
without writing. Implicit Grok intent follows the startup gate, so a
gated hub or sibling writes nothing. Explicit defaults and device
overrides still create.

* fix(link): keep the Home's own native switches over captured defaults

Captured route defaults exist to drive Children, but the Home projection
preferred them over the Home's live native switches. ocx restore,
Messages off and similar writers change those switches without recording
route intent, so any unrelated route write re-enabled Codex and Claude
Code and re-injected Codex. On the Home, a persisted native switch with
no Home override now wins unless the write decides that client, the
projection reads the durable switches, and a single-client Home write
materializes only that client while keeping the other clients' receipt
outcomes.

* fix(link): treat first-party Claude Desktop as current for enabled intent

First-party Desktop already routes through OpenCodex, yet the route
adapter reported a conflict for both on and off, so Home ocx sync exited
1 on every run and ocx route to sync stayed 409 after any enrollment.
Enabled intent is now current with no write; disabled intent stays a
conflict whose message names the existing mode switch.

* fix(link): keep ocx integrations native a Home-only decision

The CLI native toggle had become a Home default write, so it changed
every Child and skipped Claude Desktop's first-party transition that the
native route performs. It calls the native route again, which records
only the Home override and runs the client's own transition; on a Child
it refuses with the Home command for that device.

* fix(link): restore standalone file integrations on disconnect

Disconnect disabled every file integration with an ownership record, and
connect had already disabled or refreshed pre-existing ones, so a join
followed by a disconnect lost integrations the Child had set up on its
own. The first link apply now records, write-ahead and bound to the
link, which file clients the Child owned. Disconnect keeps those still
owned, applies again those the link disabled, leaves a local opt-out or
the person's own block alone, and removes only what the link created.

* fix(link): keep the enrollment token until native switches are restored

A failed enrollment removed its service token even when restoring the
standalone native switches threw, leaving no owner to retry. It now keeps
the token and pending marker, like disconnect, and names the record.
Plain ocx disconnect on a disconnected machine drains a lone native
originals record instead of refusing: it restores the switches, removes
the enrollment's own token, and on failure prints the record path and
the recovery step.

* fix(link): readmit the link key after a route intent watch wait

A watch read could wait up to 30 seconds and then answered after
rechecking only the link record, so a key revoked during the wait still
received fresh policy. The wait now repeats the listener's key admission
against current policy before the ownership recheck.

* docs(link): document Child tick rewrites, restore reversion and client toggle scope

State that the periodic Child sync rewrites its receipt and Home proof on
every apply, why a mid-apply parity report shows a brief withdrawal, that
ocx restore on a linked Child lasts only until the next sync unless the
person opts out with --local, and that plain ocx integration client
enable/disable writes the Home default and is refused on a Child.

* fix(link): let the Home's own native switches govern the Home

On the Home, Codex, Claude Code, Grok and Claude Desktop now project
from the Home's persisted native switch (absent is on) with source
"native", ignoring captured defaults and devices.home entries. Before,
the live switch won only when stored as a boolean with no Home
override, so ocx restore back (absent key), ocx claude desktop apply,
or any native toggle (which recorded a devices.home override) let a
plain ocx sync or route to sync rewrite the switch and re-inject or
strip the client.

A full Home sync now decides no client and never writes a Home native
switch; it only refreshes owned artifacts to match it, and an enabled
Grok or Desktop switch keeps startup scope. A Home write that decides
one of these clients (route to default, --device home, native PUT)
applies through the existing switch writer and keeps no devices.home
entry: recordHomeNativeDecision pins the off Child builtin for Grok
and Desktop, setRouteClientIntent refuses a Home native entry, and
initializeHomeRouteIntentDefaults drops one saved by an earlier
version. --device home inherit sets the switch to the default. The
native PUT captures defaults from the durable switches. The Home
receipt parser and ocx.route-to/1 accept the additive "native" source;
documents sent to Children never carry it.

* fix(route-to): mark any outcome for an earlier intent stale

routeToDeviceStatus only turned an outdated current outcome stale. An
earlier conflict or failure kept its colour after the intent changed,
so ocx route to <client> off --device <child> after a conflicted
enable exited 409 on a result that said nothing about the new intent.
Any outcome whose per-client intent digest differs from today's intent
now reads stale; receipts without per-client digests keep the
whole-document rule for current rows only.

* docs(link): document Home native switches, native source and pre-record Children

The remote-link guide (en, ko), structure docs and route to capability
notes now say that on the Home Codex, Claude Code, Grok and Claude
Desktop follow the Home's own switches, that Home writes for them
apply through the switch, that plain ocx sync and route to sync never
change them, that status reports source native, and that an outcome
for an earlier intent reads stale. They also state that a Child linked
before the file-integration originals record existed has none, so
disconnect does not set up again integrations the Home turned off.

* fix(link): capture Children's native defaults once from the Home's switches

A Child's projection fell back to the Home's live native switches whenever no
default was saved, so Home-only writers (ocx restore, restore back, Claude
Desktop apply, Messages off, the Claude toggle) changed what Children inherit,
and a later initialization saved the Home-only value permanently.

Children now never read the Home's switches: device override, then the saved
default, then the builtin. captureHomeRouteDefaults saves the four native
defaults once from the durable switches (Codex and Claude Code as the switch
says, Grok and Claude Desktop off). It runs in every route-intent
initialization (in the same single write, so an Aside refusal writes
nothing), before a Child projection, when the hub-link listener binds, and
before each Home-only switch writer changes a switch on a linked Home.
desired-state.ts stays free of link state for the core/link boundary; the
Home-only writers call setHomeIntegrationEnabled instead.

* fix(route-to): fail a Home write whose decided client the Home cannot apply

A Home write that decides a native client but is refused (first-party Claude
Desktop off) or fails (its switch cannot be written) leaves the Home switch
unchanged, so the rebuilt Home row read the recorded conflict or failure as
stale; the PUT answered 200 and ocx route to exited 0 without the mode switch.

The PUT now uses applyHome's own outcome for the decided client: on conflict or
failed it answers 409 route_apply_unresolved with that outcome in the Home row
and its message (naming the mode switch for first-party Desktop), so the CLI
exits nonzero. A default write still reports that the Children's default was
saved.

* fix(route-to): report a changed refresh-only Desktop profile as a conflict

An enabled Home Claude Desktop switch that no write decides only refreshes a
profile OpenCodex owns. That path returned current for a gateway_drifted,
unsafe or broken profile. It now reports the conflict as the decided path
does, and never takes the profile over even with overwrite: replacing it is a
decided write. The inspection reads the durable applied marker, since the
caller's snapshot can predate a Desktop apply by another process.

* docs(link): document one-time capture of Child native defaults

Children never read the Home's native switches; the Home saves their defaults
once at migration (Codex and Claude Code from the switches, Grok and Claude
Desktop off) and only a Home default write changes them afterwards. Also
document the 409 for a decided Home write the Home cannot apply and the
refresh-only Desktop conflict, in the English and Korean guides and the
remote-link structure notes.

* fix(route-to): leave a Desktop library OpenCodex never owned current on a refresh

A refresh-only Claude Desktop row (an unset Home switch read as on) reported a
conflict for any unsafe or broken library, including one OpenCodex never owned:
an unreadable _meta.json, an applied id outside the safe pattern, or another
app's missing profile. Every full Home sync then failed and advised
--overwrite-conflict, which would take over a library that was never ours.

The refresh-only path now reports a conflict only with ownership evidence (an
OpenCodex entry selected, or unreadable ownership plus a committed applied
fingerprint) and otherwise answers current with no write.

* fix(route-to): refuse a Home-only switch write with a typed refusal when route intent is unreadable

An unreadable or malformed route-intent.json (or config-lock contention) made
setHomeIntegrationEnabled throw a raw SyntaxError, so ocx restore, ocx restore
back, Claude Desktop apply, the Claude toggle and Messages off crashed, and
ocx restore --json printed no envelope.

These writers still refuse before the switch moves, since writing it first would
change what Children inherit once the file is repaired, but the refusal is now
typed: { ok: false, reason: "unavailable", retryable, message } naming the
route-intent.json path and asking to fix or remove it. ocx restore --json prints
one complete envelope with that message; Messages off and the Claude toggle
answer route_intent_unavailable (409 on contention, 500 otherwise).

* fix(route-to): report a saved Home override on a refused --device home write

A --device home write for a client the Home does not treat as native (opencode,
for example) saves a devices.home override before the apply runs. When that
apply answered conflict or failed, the 409 said desiredCommitted: false and "The
Home did not apply", though the override was saved. The 409 now reports
desiredCommitted only when route policy was saved and the client is not a Home
native one, and picks the "Route policy was saved" prefix from the same value.

* fix(route-to): capture Child native defaults on Home-only writes only once linked

The Home-only switch writers (ocx restore, ocx restore back, Desktop apply,
Messages off, the Claude toggle) captured the Children's native defaults only
when the Home had a link, but the native route, a --device home write and the
Home's own apply captured unconditionally. Two unlinked Homes in the same end
state then gave a later-enrolled Child different defaults depending on which
writer had moved the switch.

Every Home-only decision now follows the link-gated rule, through a whenLinked
option on initializeHomeRouteIntentDefaults: the native route, a --device home
write and the Home materializer capture native defaults only when the Home has a
link. Link-gated was chosen over unconditional capture because a standalone Home
never needs route-intent state written by a Home-only toggle, and a Child that
enrolls later inherits the switches as they stand at enrollment, which
seedRouteDeviceClients captures. A default write and enrollment still capture.
Until a default is saved, a Home inherit takes the builtin.

* fix(route-to): keep Child route-intent reads pure

GET /api/route-to and the link GET /v1/link-management/route-intent captured the
Children's native defaults through projectChildRouteIntent, so a read could
write route-intent.json, while the route registry lists the status read as
non-mutating and the link read is documented as not mutating state.

The capture is gone from projectChildRouteIntent. Every path that serves a Child
has captured before it reads: enrollment through seedRouteDeviceClients, and the
link listener's start for a Home that already has links. The test that asserted
first-read capture now asserts the reads write nothing and that enrollment saves
the defaults the Child then projects.

* fix(cli): drop the stale native toggle exemption from the route registry

The four PUT /api/native-integrations/<client> routes were exempt from the CLI
coverage check as a compatibility alias "because current CLI native toggles use
durable /api/route-to intent". That stopped being true when ocx integrations
native went back to calling these routes, which its capability already lists.
The exemption is removed, so the routes get the check, and the capability test
now asserts the routes are covered and not exempt.

The ocx integrations native comment and capability detail (and the generated
skill surface) no longer say a Home override is recorded: the route writes the
Home's native switch and records no Home route intent.

* docs(link): state when Child native defaults are captured

The Remote Link guide (en and ko) said the Home saves the Children's native
defaults when it serves a Child's route intent and in every Home-only switch
command. It now says when capture actually happens: a Home default write and
Child enrollment always save them; once the Home has a link, the link listener
and every Home-only command save them before the switch moves; on a Home with no
link nothing is saved, so a Child enrolled later inherits the switches as they
stand at enrollment; reads never save. It also notes that an unreadable
route-intent.json makes those commands refuse and name the file, that a Home
inherit takes the builtin until a default is saved, and that a Desktop library
OpenCodex never owned is reported current. structure/ notes follow the same
inherit wording.

* fix(route-to): report saved Home native switches and keep route intent off unlinked Homes

A refused or failed Home native decision now reports desiredCommitted from the
durable switch before and after the apply, so a Grok off that saved the switch
before hitting an incomplete block says so. On a Home with no link, native
toggles and --device home native writes no longer read or write
route-intent.json, so ownership defaults cannot pin a client the dashboard
later enables. An unreadable route-intent.json is a typed refusal naming the
file in the native toggle, route-to writes and dashboard file toggles, and a
dashboard file toggle on a Home that uses route intent is recorded as the
Home's devices.home decision so ocx sync keeps it.

* fix(link): retry an owed Child route-defaults capture after a failed listener start

* docs(link): unlinked Homes, saved switch reports and dashboard toggles under route intent

* fix(route-to): keep legacy Home native cleanup on unlinked syncs; linked fixtures for native bookkeeping tests

* docs(structure): unlinked Home syncs drop only legacy Home native entries

* fix(route-to): save Children's defaults before Home-only integration writes and record Aside and restore decisions

* fix(link): cancel an owed route-defaults capture retry when the listener closes

* fix(route-to): treat ephemeral ocx-child links as not supporting route intent

* fix(link): gate overwrite sync flags on a Child that honours them

* fix(route-to): report what a write saved when its apply fails unexpectedly

* fix(route-to): match Aside decision paths with one pattern the route registry does not read as routes

* fix(cli): make plain integration enable/disable a Home-only decision like the dashboard toggle

* docs(ocx-child): say the Rust parity parser is narrower than the Home's

* docs(link): Home-only integration decisions, ephemeral Children and the overwrite sync gate

* test(cli): plain integration toggles name the Home-only toggle route

* fix(route-to): read the durable config for Home integration decisions instead of cloning the live one

* ci: re-run checks on the current dev merge ref

No content change. dev fixed the release-evidence policy pin in #8377; this empty commit gives the pull request a new merge ref so gates runs against it.

* fix(route-to): let unlinked Homes change integrations when route-intent.json is unreadable

On a Home with no link a damaged route-intent.json refused every dashboard and CLI integration change with route_intent_unavailable. Nothing there needs protecting: no Child inherits from it, and ocx sync cannot read the file either, so it cannot undo the write. The write now proceeds and records nothing. Linked Homes still refuse by name. Docs now state that an unlinked Home that already uses route intent still records the Home-only row, which Children never inherit.

(cherry picked from commit 83c9c3e6c65722268dda1fdeb7b2812b7eaf9463)

* fix(route-to): keep ocx sync working on upgraded Homes whose Aside profiles lack stable userIds

A Home that routed Aside profiles before it used route intent, and whose Aside accounts.json has no stable userId for them, started failing every ocx sync after upgrading with a link: the listener could save only the native defaults, and the Home apply then refused to derive an Aside default. A full Home sync now leaves Aside exactly as it is, applies every other client and prints how to resolve it; a write that decides Aside still refuses until the person does.

* fix(service): stop the tracked proxy before verifying a Windows scheduler restart

On Task Scheduler installs, restart ended the task and cleaned the wrappers, then required that no proxy answered. schtasks /end does not reach the wrapper child, so a Home or connected Child proxy survived and every restart failed with "The scheduler proxy is still running after wrapper cleanup". Restart now stops the home-verified tracked proxy the way ocx service stop does before that check.

* fix(service): let restart go ahead when the disconnected-Child cleanup does not apply

The disconnected-Child cleanup added to ocx service restart refused the whole restart when a disconnect marker was still pending or when the live client proxy on the port could not be proved to belong to this home (for example another home sharing the port). On dev the restart proceeded in both cases. The cleanup now skips those cases and the restart behaves as before; an interrupted disconnect is still finished by running ocx disconnect again. Ownership checks after the cleanup has started remain strict.

* docs(service): describe the restart proxy stop and the cases the Child cleanup skips

* fix(route): let an explicit Home Aside decision bypass unresolved derivation

`ocx route to aside on|off --device home` is the recovery command
HOME_ASIDE_UNRESOLVED_MESSAGE advertises, but on an upgraded linked Home
whose owned Aside profiles have no stable userIds it failed with 500: the
route commit and the apply both ran initializeHomeRouteIntentDefaults,
which derives the Children's Aside default and throws
HomeAsideIntentDerivationError before the devices.home.aside entry exists.

A saved devices.home.aside entry is the Home's own answer, so
readHomeRouteIntentState now returns at once when it exists, and both the
route commit and syncHomeRouteTo capture only the native defaults in that
case. defaults.aside stays absent, so Children keep their default, and a
later full sync reads the Home entry and keeps the decision. A plain
default write that decides Aside still refuses, because it sets what
Children inherit.

Regression: tests/routing/route-to-home-decisions.test.ts covers off and
on on an upgraded linked Home with unresolved ownership, each followed by
a full Home sync.

* fix(route): carry served model capabilities into connected Child exports

loadConnectedRouteModels kept only identity from the Home's /v1/models rows,
so a Child materializing Pi, OpenCode or another file integration from Home
route intent fell back to text-only with no reasoning controls.

Read the row's capability fields (input modalities, context and output
limits, the reasoning axes, ladder and declared default) strictly, dropping
malformed entries instead of forwarding them, and map them into ExportModel
the same way toExportModel projects /api/models. A field the served row does
not carry stays absent.

Coverage: tests/clients/route-intent-connected-capabilities.test.ts

* test(route): tighten seven assertions the review found vacuous

- Windows overwrite sync asserts the Child payload (link id plus both
  overwrite options), not only the version gate.
- Legacy Aside ownership drops the per-profile row so the assertion
  depends on root-store recovery.
- The disconnect retry keeps the persisted phase instead of rewriting it
  to token_removed.
- The device-id refusal test restores valid state first and asserts the
  selection error plus byte-identical bytes.
- Each legacy dashboard toggle asserts status 200, not only projections.
- The disconnected-client restart fixture verifies identity for the
  connected and standalone cases and only refuses the foreign one.
- The registration-guard fixture injects stopTrackedProxy.

* test(link): cover retry cancellation for a bound listener that closes

The two existing cancellation tests never bind, so a regression that skips
cancellation for a bound listener could still pass the close() path.

* fix(connect): keep post-commit route-apply contention out of enrollment rollback

Once a Link connection committed, the route apply's first lifecycle lock
acquisition sat outside its warning catch. Another operation holding that lock
(or a connection it had already changed) threw into the enrollment rollback,
which restored Codex routing while the committed connection stayed behind.

Move the acquisition inside the catch: post-commit contention only warns, and
the next sync applies route intent.

Coverage: tests/clients/route-intent-connect-post-commit.test.ts

* fix(route): accept expanded combo selectors and read the first-apply receipt strictly

A Home's /v1/models expands a listed combo into <base>--fast and
<base>--<effort> rows that the route catalog does not list, so a connected
Child rejected its whole served roster and left enabled integrations stale.
Such a row now takes its verified base combo's key; one whose base is not
listed is left out on its own, and any other unlisted combo still rejects.

The first-apply check before capturing file-integration originals used the
lenient receipt reader, so a corrupt receipt read as a first apply and a Pi
the link created could be recorded as standalone and kept on disconnect. Use
the strict reader: the sync refuses and the damaged receipt is preserved.

Also cover the round-1 capability mapping end to end: a served Grok ladder
reaches the Grok config and a routed 1M window reaches Desktop's supports1m.

Coverage: tests/clients/route-intent-connected-capabilities.test.ts,
tests/clients/route-intent-file-originals.test.ts

* fix(route): omit the Aside target when no profile is selected

aside on --accounts none (and any apply selecting no profile) returned an empty
target string. The Home record's outcome schema rejects an empty label, so a
linked Child's sync failed to persist its receipt and never published the
apply. Omit the target for an empty selection.

Coverage: tests/clients/route-intent-aside.test.ts

* fix(route): let a --no-sync link disconnect while no route apply has begun

A Child with a standalone Pi that connected with --no-sync has no route
receipt, so disconnect refused its ownership record as lost evidence, and the
prepared disconnect then blocked sync too: nothing could move it forward.

Connect now writes a proof bound to the link id and connectedAt in the commit
block, and the first route apply removes it before changing any client. With
a matching proof and no receipt, disconnect keeps ownership records as the
person's standalone integrations; unowned routing residue still refuses, and
once an apply began a lost receipt still refuses as before.

Coverage: tests/clients/route-intent-file-originals.test.ts,
tests/clients/route-intent-connected-review.test.ts

* fix(route-to): report unresolved Aside after a Home sync, and skip discovery for off-only decisions

On a Home whose existing Aside profiles have no stable userIds and no saved
Aside decision, ocx route to sync applied every other client and then failed
building its status matrix, answering 500 route_to_failed. Status and sync now
project those devices with Aside as intent "unresolved" (never off), keep every
other client's outcome, and carry the recovery command in warnings[], which
the CLI prints to stderr without failing the sync.

A Home decision that only turns clients off (ocx route to pi off --device
home) finished its work in the off pass but still waited for model discovery,
so a busy catalog returned an error after the disable. It now completes from
the off pass, which keeps the receipt's last served roster.

Coverage: tests/routing/route-to-home-sync-review.test.ts

* fix(client): report the saved selection from /api/machine/clients after a scheduled sync

A Link Child's route-intent tick rewrites the saved connection's
selectedClients, but /api/machine/clients kept returning the selection the
listener captured at startup. Read the saved connection and report its
selection while it still belongs to the connection the listener serves;
another connection's selection is never reported.

Coverage: tests/clients/route-intent-scheduler.test.ts

* fix(service): restart the verified scheduler registration when asset writing fails

Windows repair and restart stop the scheduler (and, on restart, the tracked
proxy) before rewriting the script, VBS launcher and task XML. A rewrite that
failed there, for example on a read-only asset, left the proxy stopped even
though the registration it verified could still run.

Snapshot the assets before the rewrite. On failure, put back any asset whose
bytes changed (removing one that did not exist), re-verify that the live
registration still matches the one checked before the stop, start it, and
report the original error; a changed or unreadable registration is preserved
and not started, and the failure lists both errors.

Coverage: tests/service/service-scheduler-restart-cleanup.test.ts

* docs(route): correct the --clients default and the integration-toggle contracts

link issue --clients claimed an omitted selection defaults to Codex and Claude
Code. Omitted, the device inherits every Home default, including an off Codex
or Claude Code; listed clients start on and unlisted Codex/Claude start off.

The structure docs said plain client toggles alias Home default intent and use
/api/route-to. They call /api/client-integrations/{clientId} as a Home-only
decision recorded as the devices.home override, leaving Child defaults alone;
native toggles keep /api/native-integrations/{client}.

Regenerated the skill surface reference.

* fix(service): snapshot scheduler assets before stopping; list --recover-config in disconnect usage

A restart or repair took the scheduler asset snapshot only after it had
stopped the task, the wrappers and the tracked proxy. The snapshot read is
outside the failed-rewrite recovery, so an unreadable asset (an ACL refusal)
left the service stopped. The snapshot is now taken before anything is
stopped, so that failure refuses while the service is still running.

DISCONNECT_USAGE now lists --recover-config --yes, which the command already
accepts and the capability registry already documents. The Korean remote-link
guide now limits the ephemeral-Child refusal to ocx route to sync --device,
as the English guide does.

Regression: tests/service/service-scheduler-restart-cleanup.test.ts covers an
unreadable snapshot on restart and repair (nothing is stopped).

* fix: preserve unresolved Aside child intent

* fix: report unapplied child Codex configuration

* fix: serialize Home sync and integration decisions

* docs: show supported Link client ids in connect usage

* fix: resume interrupted Link retirement

* test: reproduce the scheduler restart respawn refusal on the real stop route

* fix(service): stop a scheduler restart's proxy through a receipt-backed deferred stop

A Windows scheduler restart keeps its task registered, so the proxy's own
POST /api/stop answered 409 respawnable_service and the restart aborted
with the task stopped and the proxy serving. The restart now claims a
pending-teardown receipt for the exact endpoint, sends the deferred stop
the route honours for the caller that verifies the respawn window, and
releases the receipt once the stop is answered.

Wrapper cleanup moved after the accepted stop: a refused or unverifiable
survivor keeps the wrappers that supervise it. A child respawned in the
gap is stopped once more. The scheduler asset snapshot now restores the
captured bytes as they were instead of re-encoding them.

* fix: reconcile the Link retirement and disconnect paths with dev

Interrupted-disconnect native-intent recovery now admits after config-root
ACL work like both disconnect phases. Test fixtures for Link removal list
the link's issued key and a valid Home-initiated host key, as stored
records do, so the resumable retirement's validation and single revoke
are exercised; a concurrent removal of the same link is refused by the
job admission it now holds.

* fix(client): fence syncs across a bound restart and its rollback

A Home sync already past admission kept writing client files while the
restart drained the listener, and after a failed replacement it could
commit an obsolete decision: the rollback republished an identical
runtime record, so the sync's own recheck passed. The restart now marks
the runtime stopping before teardown, and every publication carries a
fresh servingGeneration, so syncs admitted before the restart stand down
and syncs admitted after the rollback proceed.

* docs(structure): describe the receipt-backed scheduler restart stop and the restart sync fence

* test: pin the client runtime publication with its serving generation

* fix(client): abandon a bound restart whose sync fence cannot be written

Marking the runtime stopping could fail (the config lock busy through
every retry) and the restart still drained the listener, so a sync
admitted before it could commit during the teardown. The fence now runs
first and a failed fence leaves this runtime serving.

* fix(service): keep a scheduler restart's teardown receipt until a replacement serves

The receipt was released as soon as the stop returned, so a restart that
failed or died after the proxy exited left client routing pointed at a
dead endpoint with nothing for 'ocx stop' to recover. Only a refusal
releases it now; otherwise the restart keeps it until a replacement other
than the stopped pid serves. A failed second stop after wrapper cleanup
now reports that proxy as unsupervised instead of implying its wrappers
remain.

* fix(service): prove a replacement on each receipt's endpoint and bind deferral to the stopped port

A scheduler restart released its teardown receipts when any verified new
proxy answered, including a package-tree-fenced one or one on another
port, while client routing still named the stopped endpoint. It now
requires a healthy, home-verified proxy on each receipt's own endpoint,
and a restart that fails after a recovery start releases or names what it
kept. The stop route honours a receipt only when it names this proxy's
served port, so one proxy's receipt cannot defer another's teardown.
A live Child connected over a Remote Link is refused before anything
changes: its stop would keep Codex routed to an unauthenticated loopback
port nothing is guaranteed to bind again.

* fix(service): attest the proxy a restart stops and the replacement that releases its receipt

The scheduler restart sent this home's admin token to an endpoint found by
an unattested /healthz and released its receipt when a listener on the
endpoint merely named a live pid. A restart stop now goes only to the
endpoint this home's runtime record names for the pid, after the listener
proves the record's attestation secret; a replacement counts only as the
freshly published record's pid answering healthy and proving the same.
The linked-Child refusal is decided again before every tracked stop.
'ocx stop' no longer re-reads the runtime record when it resolved no
endpoint, so its receipt cannot be sent to another port. Disconnect's
route cleanup admits after config-root ACL work.

* fix(service): bind receipt deferral to the bound port and gate the restart's forced stop

The stop route fell back to the configured port when its runtime record
was missing, so a proxy on an explicit --port could refuse a valid
receipt or accept one for another port; it now uses the port its
listener is bound to and honours no receipt before it serves. The
restart proves and posts to the same normalized host, and its kill
fallback signals the pid only while it is still the verified ocx start
process.

* fix(link): close a removed link's sockets when reconciliation fails after the commit

Removal deleted the record and revoked the key, then a failing
route-intent reconciliation returned 503 before the link's WebSockets
were closed, leaving an active response to the next sweep. The sockets
now close whenever the record is gone. stopProxy no longer reads the
runtime record for its reclaim wait when the caller pinned the endpoint,
and the Grok stop oracle matches the gated kill call.

* fix(link): resume a journalled revoke's retirement before replaying it, and bind a receipt to its cleanup mode

A recorded revoke could replay as committed after a crash between record
removal and route-intent/listener cleanup, leaving the retirement receipt
and stale policy behind. Replay now resumes the matching retirement first
and settles the operation only after that cleanup completes.

A retirement receipt now records its removal mode (force, disconnect or
purge). A retry asking for a different mode is refused instead of
reporting a purge that never ran. Receipts without a mode stay readable.

Also mirrors the English remote-link and integrations guide changes in
the Spanish docs.

* fix(link): reserve the link and journal the resumed removal when a recorded revoke resumes its retirement

R8 review follow-ups to the journalled revoke resume:

- The resume now takes the link's Child-job reservation (unless the
  caller already holds it), so a job admitted after a restart is not
  left running while the resume revokes its key.
- When the record is still listed (the process died after the receipt
  claim), the resumed key revoke and record removal are marked on the
  same journal entry, so the operation settles committed instead of
  staying unknown, including after a later crash.
- Settling checks and writes in one journal section and drops a
  resolvedAt left by a resolve; the journal refuses a committed entry
  carrying one, which made the retry fail with 500.

* fix(link): bind a retirement receipt to its journalled revoke and settle before clearing it

R9 review follow-ups:

- A retirement receipt now records the operation id of the journalled
  revoke that claimed it. A recorded revoke's replay resumes only its own
  receipt in the mode it asked for; another removal's receipt (another
  operation, or none) is left alone and the recorded outcome replays.
  Before, a purge whose Child never confirmed the purge could finish a
  later forced removal's receipt and report committed.
- A resumed retirement settles its journal entry before clearing the
  receipt. A failed or interrupted settle now leaves the receipt for the
  next repeat instead of a finished removal stuck as unknown.

* fix(link): continue an interrupted removal's receipt only under the identity that claimed it

R10 review follow-up. Once an interrupted journalled revoke settled
unknown, a plain revoke or a revoke under a new operation id could adopt
its retirement receipt: the new operation was reported committed (for a
purge, without running or confirming the Child purge) and the owner lost
the receipt it settles from, replaying unknown forever.

A fresh removal now continues a receipt only under the same identity,
else 409 link_retirement_owned. A journalled revoke continues only its
own receipt. A plain revoke, which writes no journal, may finish a
receipt with no owner or one whose owning entry the journal no longer
holds, but not one whose owner can still be repeated.

* fix(link): finish an orphaned retirement receipt only with a plain revoke

R11 review follow-up. Once a revoke's journal entry was pruned, repeating
its operation id passed the receipt identity check, opened a new entry,
skipped the Child cleanup because the receipt existed, and reported the
new entry committed (for a purge, without purge evidence).

A journalled revoke now continues a receipt only while the owning entry
is still journalled. A receipt with no owner, or whose owner was pruned,
can only be finished by a plain revoke, which writes no journal and
claims no outcome; the 409 says so instead of naming a pruned id.

* fix(link): pin a retirement receipt's owner in the journal and trust receipts only under a protected root

R12 review follow-ups:

- The journal never prunes a revoke entry while its own retirement
  receipt exists (ownsRetirement, passed as a keep pin to
  updateOperationsJournal). Recovery's effect marks could prune an
  expired resolved owner mid-removal, revoking the key and then failing
  with the owner gone; and a pruned id could be reused.
- The owner of a receipt is the revoke of that same link under the
  receipt's id (retirementOwner). An unrelated entry reusing the id no
  longer blocks a plain revoke of the orphaned receipt with guidance
  that cannot work.
- A receipt lets a removal skip the Child cleanup it records, so it is
  honoured only under a protected config root (owner-only ACL on
  Windows; otherwise owned by this user and writable by no one else).
  Otherwise the removal answers 503 link_retirement_untrusted and
  changes nothing. The config mutation lock only tries to protect the
  root and continues without it.

* fix(link): honour a retirement receipt only when its provenance holds

R13 review follow-ups:

- readTrustedLinkRetirement replaces the root-permission check. On POSIX
  the config root and link/ must be real directories owned by this user
  and writable by no one else, and the receipt a single-link regular file
  owned by this user with no group or other access, opened without
  following a link and checked to be the inspected file. On Windows both
  directories must hold the owner-only ACL and the receipt must carry
  this user as owner under a protected DACL; the claim now hardens it.
  A symlinked, hard-linked, foreign or loosely permissioned receipt, or
  one under a writable link/ directory, answers 503
  link_retirement_untrusted.
- An owner's replay checks provenance before comparing identity, and a
  replayed open revoke settles committed only when no receipt for its
  link is outstanding, so a receipt with a stripped or changed identity
  can no longer yield a false committed.
- A resumed owner recorded failed_clean (a journal write failure right
  after its claim) now settles committed from the resumed removal's
  marks instead of reporting that nothing changed.

* fix(link): never treat a retirement receipt as proof the Child was cleaned up

R14 review follow-up. Proving a receipt's file provenance kept growing
edges (a Windows check-then-read swap, a symlinked config home rejecting
the receipt this code just wrote). The receipt's dangerous power was
letting a removal skip the Child cleanup while the link record is still
listed, so that power is removed instead:

- While the record is listed, a removal that meets a receipt runs the
  Child cleanup again unless the owning journal entry recorded it
  (remote_cleanup done and, for a purge, the Child's purged:true for that
  link), the same evidence a replayed purge already answers from. A
  removal on dev always runs that cleanup for a listed link.
- Once the record is gone, the receipt only drives local post-commit
  work (route intent, listener, receipt removal).
- The tunnel is stopped whenever the record is listed, and a resumed
  purge records the Child's purged:true on its own entry.

This drops readTrustedLinkRetirement, the root-protection gate and
503 link_retirement_untrusted, and the Windows receipt hardening added
for them.

* fix(link): let a plain --force finish an interrupted removal whose cleanup cannot run again

R15 review follow-up. A plain purge that cleaned the Child and died after
claiming its receipt left the record listed; a retry had to purge again
and failed because the purge had already removed the Child's executable,
while --force was refused by the cleanup-mode check, so the link was
stuck. The same held for a journalled purge without recorded evidence.

A plain --force may now finish any receipt: it removes the link and its
key locally, claims no Child cleanup, writes no journal, and leaves an
owning entry with the outcome it recorded. The mode check now refuses
only a retry whose stronger cleanup would be skipped (record gone, or
the journal recorded the cleanup). The 409 messages name --force as the
way out.

* fix(link): let a plain --force finish a receipt whose owner a dead process left open

R16 review follow-up. The open-revoke guard refused a plain --force while
the receipt's owner was still open (its process died), so the documented
local escape did not apply there.

A plain --force now first settles such an owner as its own replay would
settle it. It holds the alias lock and the per-alias set, so an open
owner it meets belongs to a dead process. An outstanding receipt counts
as touched in that recovery, so the owner settles unknown and keeps that
outcome after the force removes the link.

* fix(link): disown an owned receipt before a plain --force acts on it

R17 review follow-up. After a plain --force settled an open owner, a
force that died after removing the record left the owned receipt; the
owner's replay then resumed it and, from its earlier record_removed
intent, settled committed for a removal the force had performed.

The force now rewrites the receipt without the owner's operation id
(same nonce, link and mode, under the config lock) before changing
anything, so the owner can no longer resume it and keeps its unknown
outcome. A crash before the rewrite leaves the owner able to finish its
own removal truthfully.

* fix(link): unresolve a resumed owner on a new cleanup attempt; let a plain --force pass a damaged journal

R19 post-merge review follow-ups:

- When a resumed revoke records a new Child cleanup intent, its owner
  becomes unknown and unresolved again. An earlier resolution covered
  only the earlier attempt; without this, a new attempt that ended
  uncertain left the owner resolved, and dev's link suspension did not
  keep the tunnel down toward a Child that may now be purged.
- A plain --force that meets an owned receipt no longer fails on an
  unreadable journal: the owner is left unsettled, as dev lets a plain
  force through a damaged journal, and the receipt is still disowned
  before anything changes.

* fix(link): run a resumed cleanup as an open, live revoke; refuse a force whose readable journal cannot settle the owner

R20 review follow-ups:

- A resumed revoke that records a new Child cleanup intent reopens its
  owner as an open, live revoke (dev's model for a running revoke), so
  resolve refuses it while the attempt is pending; a resume that fails
  settles it unknown and unresolved (settleResumedRevoke) and drops the
  live mark. Before, the owner was set unknown up front, so a
  concurrent resolve could cover an attempt that then ended uncertain,
  lifting the link's suspension.
- A plain --force probes whether the journal can be read. If it can and
  the open owner cannot be settled (a failed write), it refuses with
  500 operation_journal_failed before the receipt changes hands; only an
  unreadable journal skips settling the owner.

* fix(link): never restart the tunnel after a resumed cleanup fails

R21 review follow-up (both reviewers; the security reviewer reproduced
one restart with the link unsuspended at that moment). A resumed revoke
marks its owner open and live, so the supervisor did not suspend the
link; when platform discovery failed before the new cleanup ran, dev's
rule for a cleanup that never ran restarted the tunnel, toward a Child
an earlier attempt may already have disconnected or purged. Settling the
owner unknown afterwards did not stop the spawned tunnel.

A resumed retirement's journal now says keepsTunnelDown: any failed
cleanup leaves the tunnel down and the owner settles unknown, so the
link stays suspended. A fresh revoke keeps dev's rule.

* fix(link): fence a resumed removal from its first intent, and set its live mark only after a durable write

R22 review follow-ups:

- A resumed revoke whose journal already recorded the Child cleanup
  skips that cleanup, so it never wrote a remote_cleanup intent and its
  unknown owner was not reopened; a concurrent resolve during stopLink
  could cover a local commit that then failed, lifting the link's
  suspension. The owner is now reopened as an open revoke on the
  resumed journal's first intent of any kind (written before stopLink).
- The live mark was set inside the journal mutation, before the write
  was durable; a failed write left the link briefly unsuspended until
  failure settlement cleared it after an await. The mark is now set
  only after the reopening write succeeds, and settleResumedRevoke drops
  it before awaiting anything.

* fix(link): fence a receipt's owner for a whole plain --force takeover; bound resumed marks

R23 review follow-ups:

- Security (reproduced): a plain --force settled an interrupted owner
  unknown up front; a concurrent resolve during stopLink could then mark
  it resolved, and a failed key revoke left the still-listed link
  unsuspended. The force now fences an open or unknown owner for the
  whole takeover (fenceRetirementOwnerForForce): reopened as an open,
  live revoke once that write is durable (resolve refuses it; the
  open-revoke guard exempts that one owner), its live mark dropped as the
  tunnel hold is released, and settled unknown and unresolved on every
  way out. It is never credited with the force's removal.
- Independent P2: repeated resumes of a pinned owner appended the same
  marks every time, growing the entry without bound. A resumed journal
  no longer appends a mark already recorded (recovery reads only whether
  a mark exists).
- Independent P3: a resumed completion without a purge receipt is best
  effort, as for a fresh revoke, instead of escaping settlement.

* fix(link): keep the tunnel down when a journalled revoke's receipt claim fails after its cleanup

R24 review follow-up (both reviewers). When the link record changed
between a journalled disconnect or purge and the retirement receipt
claim (another process editing the route), the link_changed branch
restarted the tunnel while the revoke was still marked live, so the
supervisor could reconnect to a Child that may already be disconnected
or purged; the later unknown settlement did not stop it.

That branch now leaves the tunnel down for a journalled revoke whose
cleanup ran, and for a resumed one; the revoke settles unknown and the
link stays suspended. A plain revoke, or one that ran no cleanup,
restarts it as before. These are the only two restart sites in
removeReserved, and both now follow the same rule.

* fix(link): run a plain force's refusals before its takeover, and restore an owner whose takeover never began

R25 independent review follow-up. A plain --force fenced and reopened
the receipt's owner, clearing a resolution, before its own refusals ran;
an early exit (another open revoke, a changed link, or a receipt that
could not be disowned) then settled the owner unknown and unresolved
without having held or stopped a tunnel that the resolution had already
let reconnect.

The force's refusals now run before it fences or disowns anything, and
fenceRetirementOwnerForForce has abandon(): a takeover that stops before
its removal begins restores the owner exactly as it was, resolution
included. settle() runs only once the removal has begun.

* fix(link): settle a force takeover's owner before the receipt clear; begin the takeover at the tunnel

R26 review follow-ups:

- Independent: a successful plain --force cleared the receipt before
  settling the owner it took over; a crash in between left the owner
  open with its own record_removed intent and the record gone, which
  recovery credited as committed. The takeover journal now settles the
  owner in beforeReceiptCleared; a failed write keeps the receipt.
- Security: the takeover counted as begun before removeReserved read
  the store, so a failed read settled the owner unknown and unresolved
  while its tunnel kept running. It now begins at removeReserved's first
  intent (just before the hold and stopLink); a takeover that never got
  there gives the receipt back to its owner (reownLinkRetirement) and
  restores the owner exactly as it was.

* fix(link): let an operation take back a receipt a plain --force disowned but never acted on

R27 independent review follow-up. A plain --force durably disowns the
receipt before its first effect; a crash right after that write left
the original operation unable to resume its own receipt (it settled
unknown), losing, for example, a purge's recorded evidence.

A disowned receipt now names its formerOwner. That operation's replay
takes the receipt back (reownLinkRetirement) only while the force has
provably committed nothing: the record is still listed and its key is
still present, in the operation's own mode. Once the force has revoked
the key or removed the record, the receipt stays the force's and the
owner is never credited. A receipt cannot name both an owner and a
former owner.

* fix(link): fence a disowned receipt's former owner on every later plain --force

R28 independent review follow-up (reproduced). After a plain force
disowned a receipt and then failed, a later plain force looked only at
the receipt's operationId and so did not fence the former owner; a
concurrent resolve could then mark it resolved, and a failed force left
the still-listed link unsuspended. Owner lookup for a plain force now
falls back to the receipt's formerOwner, so that operation is fenced
and settled exactly like an owner.

* fix(link): pin a disowned receipt's former owner in the journal

R29 independent review follow-up (reproduced). The journal pin kept an
entry only when the receipt named it as operationId; a resolved former
owner of a disowned receipt could be pruned past retention, after which
a later plain force found nothing to fence and a failed force left the
still-listed link unsuspended. ownsRetirement now pins an entry named by
either ownership field, in both prune paths.

* fix(link): coordinate force-revoke recovery with an outstanding retirement receipt

R31 post-merge review follow-up (both reviewers reproduced). After a
forced revoke of an ephemeral Child removed the link but left its
retirement receipt (a crash, or a failed post-commit step), ocx link
recover could clean the Child and settle its tombstone, and retrying the
revoke then wrote a fresh tombstone for an already-cleaned Child (or
failed with tombstone_limit before finishing its local follow-up).

- Only a forced revoke that will remove a still-listed record writes a
  tombstone; a resumed retirement relies on the one the original force
  wrote.
- Recovery, under the alias lock, rechecks that the link is gone and
  refuses 409 link_retirement_pending while its retirement receipt is
  outstanding.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant