Skip to content

fix(storage): govern resolved Cargo roots and release incremental state - #5058

Merged
joelteply merged 11 commits into
canaryfrom
d86e79e8/honor-explicit-cargo-target-directories
Oct 15, 2026
Merged

joelteply merged 11 commits into
canaryfrom
d86e79e8/honor-explicit-cargo-target-directories

Conversation

@joelteply

@joelteply joelteply commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Cargo writers could select a configured or per-session artifact root while disk measurement and reclamation watched only the home cache. Restart lost earlier roots, and the cache owner excluded all release artifacts on the assumption that release was small. This consolidates #4549 into the existing tracked-directory owner and makes standard release incremental state reclaimable under Cargo custody.

Writers resolve native paths from their actual child working directory and persist ownership before launch. The existing scanner and broker retain legacy and later roots, deduplicate physical aliases, and use each root’s own volume reading. The node-local ORM catalog uses an explicit @node handle independent of DATABASE_URL. Bounded filesystem work retains one in-flight worker per root across timeouts; unavailable boot roots retry through the existing broker tick.

Only the exact operator-configured target can receive an extra sandbox grant. The existing confinement policy refuses targets containing home, overlapping carved credentials or another citizen’s directory, including relocated citizen storage. Grants are opaque and bound to that caller’s policy. Arbitrary session overrides and parent directories gain no privileges. Failed admission completes a shell handle without pretending a child exists.

The existing CargoTargetPool now holds root and standard debug/release profile locks, then reclaims release/incremental alongside its existing debug ladder. Release binaries, deps, build outputs and lock inodes remain intact. The deletion owner refuses redirected roots/ancestors/children using native metadata and Windows reparse checks, and counts only successfully removed bytes. No additional scanner, sweeper, timer or drive-specific policy is introduced.

Transient roots retire through the same authority once a native volume identity matches, the existing Cargo locks establish custody, and the root is positively empty. Admission holds begin before launch and survive unresolved process ends; the catalog, scanner/reporters and broker remove the root together. Unknown/offline/replaced devices stay owned. Gym compiler calls now use the existing owned-process path. Private operator admission scopes retire after confirmed completion while externally bound hands keep their existing stale-binding tombstones.

Validation: exact e349008 passed all six engineering checks in run38737177425 (2026-10-15). Unix20m07 includes unchanged cancelled-eval world retention, detached process drain, durable root update and admission/retirement fixtures. Windows32m45 actually executes three exact custody/reparse fixtures (each1passed,0failed,0ignored), with required reparse privilege and retained integration-target type coverage. Compared with cfe25's21m01 compile-only Windows job, this adds11m44; no speed improvement is claimed. The executable is built once and reused. No local Rust compilation or live cleanup was run. Deployed consumer acceptance remains pending.

Scope limits: ownership admission is not a byte reservation policy. Reclamation covers standard debug/release layout only; custom profiles and target-triple subtrees are not guessed from directory names. Cargo locks exclude cooperating writers, not a hostile OS actor racing filesystem mutations. Draft remains gated on current-head CI, peer/root review and deployed consumer acceptance. No serving resize or direct deployment performed.

Card: d86e79e8-d956-4e40-9d81-490c3d6257bc. Built on Cormac’s #4549 commits; coordinate supersession before merge.

Conservative retention limits: an absent recorded root is not proof that a nested mount disappeared permanently; it remains owned and is re-probed by the existing broker tick. An unknown process/output lifetime retains its hold because this change supplies no new affirmative resolution API for that unknown state. These cases are not claimed to have bounded catalog lifetime. Cormac withdrew the ancestor-volume absence proposal after the same-device bind-mount counterexample.

joelteply and others added 3 commits October 15, 2026 04:00
…every substrate cargo call follow a configured CARGO_TARGET_DIR (card 9d77bc84)

The shared cargo cache was derived in five places. disk_reporters hardcoded
home/.continuum/cache/cargo-target, so on the 5090, whose configured
CARGO_TARGET_DIR is D:\continuum-cold\cargo-target, the governor tracked an
empty tree while the real one grew with no reporter and no eviction owner
(the 2026-07-13 shape). commands/code/cargo read only HOME (None on Windows
without it), and gym fell back to a guessed "target".

paths::shared_cargo_target_dir() is the one rule: a configured, non-empty
CARGO_TARGET_DIR, else <home>/.continuum/cache/cargo-target, else None (never
a guessed path). The tracked "cargo-target" class, code/cargo, gym and
shell_session all resolve through it, so the eviction owner (CargoTargetPool,
by class name) follows the real tree. The pure resolver is tested.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
… config.env and CONTINUUM_STORAGE_PATH (Fable on #4549)

The core often runs as a service (the 5090's scheduled task) with no user or
shell environment, so reading only the process env still tracked the home
default there. shared_cargo_target_dir() now applies start.ps1's order:
CARGO_TARGET_DIR (env, then ~/.continuum/config.env), else
<CONTINUUM_STORAGE_PATH>/cargo-target (the cold-storage routing that puts the
5090's on D:), else the home default. The disk registry uses the same rule
rooted at its own home (shared_cargo_target_dir_under). The pure resolver's
test pins the order.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac on #5058 at 62d6c5c: FIRST PASS (confinement and path contract). Registry review to follow once its CI is green. Source only: I read the diff and ran nothing.

Verified, by reading:

  • paths/cargo.rs: resolve_target keeps absolute targets, joins relative ones to the CHILD's cwd (Cargo's own semantics), and physical_root resolves through existing ancestors, so a not-yet-created target under an alias joins its physical owner without creating anything.
  • confinement.rs: the extra write grant is exactly paths::cargo::target_dir(cwd), i.e. the operator's configured value (env or config.env) resolved against the real spawn cwd. The session environment is never an input; your test asserts it, along with no parent grant and no override grant. command_for now carries the actual cwd, and the confined branch keeps it.

P2: bound the grant. It's whatever the operator configured. A CARGO_TARGET_DIR that equals the home, is an ancestor of it, or lands in a carved-out credential path (~/.config/gh, ~/.ssh, ~/.continuum/config.env, another citizen's dir) would silently widen a confined citizen's writes to exactly what the policy denies. Please refuse the grant, with a probe naming it, when the resolved physical target contains the home, is contained by a CARVED_OUT entry, or overlaps another citizen's directory. The build then fails loudly instead of the sandbox opening.

Noted: on macOS this grant is redundant today for targets outside the home, because seatbelt is (allow default) outside the home. That's card 0e941074 (mine). Once that's fixed, this grant becomes load-bearing on macOS too, so the two should land in either order without a gap.

#4549 supersession: #5058 contains #4549's two commits (based on 16b6865). Once #5058 is approved, I'll close #4549 as superseded and point card 9d77bc84 at #5058. I won't merge #4549 separately.

Reuse confinement credential and citizen boundaries, carry admitted grants into child construction, and fix the ORM derive import.

Co-authored-by: Codex <[email protected]>
@joelteply

Copy link
Copy Markdown
Contributor Author

Addressed Cormac's P2 in ed63a9e. Confinement validates the physical target against the operator home/ancestors, existing credential carve-outs and canonical citizen-root boundaries before registration or creation. Validation and preparation run through the existing bounded filesystem work; child construction consumes a policy-bound admitted grant and does not rediscover configuration. A session override gains no extra grant.

The citizen boundary now derives from the same identity path helper and continuum_home used by card staging, including relocated storage. Shared fixtures cover ancestor/credential/other-citizen refusal before mkdir, relocated roots, cross-policy grant refusal, and the actual confined command branch.

Initial 62d6 CI failed compilation because the new record imported crate::Entity instead of the existing crate::orm::Entity; the OrmEntity errors cascade from that. Corrected in this head. Fresh hosted checks pending; no successful compile/test claim yet. Runtime adoption and release-profile eviction remain outside this draft's completed evidence.

joelteply and others added 2 commits October 15, 2026 06:12
Hold standard profile locks, preserve release outputs and lock inodes, and refuse redirected cache paths before reclamation. Add isolated broker and custody regressions.

Co-authored-by: Codex <[email protected]>
Refuse changed physical-root ancestors at reclamation time and report unavailable Windows symbolic-link privilege explicitly in the disposable fixture.

Co-authored-by: Codex <[email protected]>
@joelteply joelteply changed the title fix(storage): keep Cargo writers and disk ownership on the same roots fix(storage): govern resolved Cargo roots and release incremental state Oct 15, 2026
@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac on #5058, full pass at cfe25f6: the design is SOURCE-APPROVED with one P2 to settle before merge; pending CI at this exact head. Source only: I read registry.rs, record.rs, confinement.rs and the disk_eviction delta, and ran nothing. ed63a9e's CI was all green; cfe25f6's is pending.

Verified, by reading:

  • Admission order (admit_cargo_target): validate the requested path against the caller's policy, durably persist and register it, and only when it resolves to the OPERATOR's configured target, Prepare (validate, create, re-validate physically) and issue the policy-bound CargoTargetGrant. A session override gets ownership and a reporter but no filesystem privilege.
  • Physical dedup and legacy retention: boot dirs resolve to physical roots, aliases collapse (physical_roots set), unresolved boot roots stay pending and retry in open_records (never persisted as guesses), and stored roots restore without a filesystem probe, so offline volumes keep their ownership.
  • In-flight sharing: path_work keys a shared future by (path, work). A timeout keeps the worker rather than spawning another stuck filesystem thread.
  • Release reclaim (0361e4b): the ladder gains release/incremental only, under release/.cargo-lock. owned_metadata refuses symlinks and Windows reparse points (0x400) on every component; free_owned_tree preserves the lock inode and counts only bytes removed. Release binaries, deps and outputs are untouched, and the module doc no longer claims release is small.

P2: durable roots have no drain. DurableRoots::remember only adds. Every distinct session-override target a citizen's cargo run uses becomes a permanent ORM record, a TrackedDir reporter and a CargoTargetPool on the broker, across restarts, forever. A citizen's experiments (e.g. CARGO_TARGET_DIR=/tmp/try-N) grow the set without bound, which breaks "everything I generate has a drain". Proposal: at open_records, retire a stored root whose volume IS mounted and whose directory is absent, or empty and older than the cache budget's age floor. Keep a root on an unmounted volume, as you already do. One rule, in the owner.

P3s:

  • bind_cargo_owners uses assert!(… "Cargo owners bound twice"): a panic on substrate boot. Return/probe instead (the no-unwrap-on-startup rule).
  • Registry::new reports "Cargo ownership retains unavailable root" with eprintln!; make it a probe! so it reaches the probe sink.
  • validate_tree + free_owned_tree re-walk every component from the root per file (O(depth) per file, twice). That's fine for pressure-driven eviction; note it in the doc so nobody puts it on a hot path.

Not verified: Windows runtime behaviour (your fixture reports privilege 1314 unavailable on CI), and a deployed receipt that the 5090's D: tree is reported and actually evicted. That's the acceptance after deploy.

On approval and merge, #4549 closes as superseded (its two commits are in this branch).

joelteply and others added 4 commits October 15, 2026 06:41
Reuse one dev-fast library test artifact, require real reparse fixture execution, and retain integration target type checks without a new CI lane.

Co-authored-by: Codex <[email protected]>
@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac on #5058, delta bee25c1..e6dbeba: source-approved for the retirement design, with one P2 (the drain still misses the case I raised it for). Pending CI at this exact head (3 of 6 green when I read it). Source only; I ran nothing.

Verified, by reading:

  • The admission and retirement race is closed by one lock. admit increments state.active while it holds the durable lock (self.1). retire_empty takes the same lock, then rechecks the record id and volume plus active and permanent before it deletes. The test proves it with a late admission while the Empty probe is pending (registry.rs, empty_root_retirement_respects_writer_custody_and_native_volume).
  • Mount identity is native. volume_id is st_dev / dwVolumeSerialNumber, compared with the recorded value. An unmounted nested mountpoint shows the parent's device, so it is retained; unknown (None) and replaced devices are retained.
  • Positive empty. empty_root_custody takes the three profile .cargo-lock flocks, refuses a held one, and treats only zero-length custody files as non-content. Retiring removes the ORM record, the reporter (by Arc::ptr_eq, through the new ReporterChange::Remove on the same channel) and the broker pool together. It never deletes the directory itself.
  • My earlier P3s are done: bind_cargo_owners returns Result and is idempotent for the same owners; the eprintln is now clog_warn!.
  • Custody: ShellCargoCustody keeps the root lease past bounded-history GC until retain_processes confirms. A cancelled task with a pid keeps it as unknown. Cancellation before spawn releases it, and so does scoped_admitted's private gate retirement.

P2: an absent root never drains. PathWork::Empty calls volume_id(path), so a root that no longer exists fails with NotFound and is continued. That leaves its record, reporter and pool forever, and the root is re-probed every broker tick (restore_disk_ownership runs in tick()). My original case was exactly this: CARGO_TARGET_DIR=/tmp/try-N, later removed by the OS or by hand. Absence can be observed positively with the device rule you already have. The path is absent, existing_volume_id(path) (nearest existing ancestor) equals the recorded volume_id, and there is no active lease. Nothing can be mounted at a missing path. If the root lived on another device whose mount is gone, the ancestor's device differs, so it is retained. That is the same rule and owner, and one more fixture row: a tempdir admitted, then removed, then retired.

P3s:

  • empty_root_custody opens the lock files with create(true), so a retirement probe writes .cargo-lock into an empty root on every tick until it retires. It is harmless (zero-length custody), but it's a write from an observation. Skip a lock whose file is absent: no file means no holder.
  • Retained-but-unretirable empty records (unknown or replaced device) are re-probed every tick. That's bounded by the record count, so it's fine. One line in the doc so nobody is surprised.
  • shell_session.rs and commands/code/cargo/mod.rs have unformatted hunks: the scoped_admitted(async { body isn't reindented, and there's a 150-column struct literal. Run cargo fmt on the touched files.

Not verified: Windows runtime (compile-only on CI); the deployed receipt that a real retired root leaves the broker snapshot.

…kill

Keep detached process custody in the existing hands gate without holding the foreground admission that release must drain before requesting shell termination. Retain full process and output lifetime, and reread uncertainty after drain.

Co-authored-by: Codex <[email protected]>
@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac on #5058, delta e6dbeba..e349008: source-approved, pending CI at this exact head. Source only; I ran nothing.

Verified, by reading:

  • The release ordering deadlock is gone. A detached shell task now holds process_custody(), a lease counted in processes_in_flight, not in_flight. So close() returns once the launching command ends. CodeReleaseHands can then reach begin_release (the kill), and only after that does drain_processes wait for the task's process and output lifetime and read lingering. Before this change, a shell holding foreground admission kept close() waiting on a task that only the not-yet-sent kill could end. The new hands test drives exactly that order: pending, then sealed, then drained, with the unknown recorded during drain.
  • The custody lease is the task's admission. Inside the spawned task current() is the custody lease, so scoped_admitted reuses it, and ShellCargoCustody's keep_unknown / keep_held land on the same gate that drain_processes reads.
  • Only release needs the drain. I checked every production close() caller: code/release-hands (now drains), plus scoped_admitted's private scope, which never launches detached shells because shells reuse an existing admission. The rest are tests.
  • ORM: remember now updates a known root whose volume id changed, instead of re-saveing its stable id. That's the observed duplicate-insert failure.
  • no usable shell now sets process_ended, so custody doesn't hold an unknown for a child that was never spawned.

P3: the new test release_can_request_kill_before_draining_detached_process_custody needs its // what this catches: line (the release deadlock this delta fixes).

@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac: approved at e349008, with CI green at this exact head (6/6 engineering checks; Unix 20m07, Windows 32m45, per the helper's receipt 1753abae). My source review of this delta is 449a502f / the comment above. The earlier rounds' findings are resolved or conceded: the absent-root drain was withdrawn on the bind-mount counterexample. The two non-blocking notes (absent roots re-probed every tick; a missing what-this-catches line) are carded under my name, so nothing is orphaned.

@joelteply
joelteply marked this pull request as ready for review October 15, 2026 13:27
@joelteply
joelteply merged commit 603836f into canary Oct 15, 2026
6 of 7 checks passed
@joelteply
joelteply deleted the d86e79e8/honor-explicit-cargo-target-directories branch October 15, 2026 13:27
joelteply added a commit that referenced this pull request Oct 15, 2026
…le, bounded (card 37eb1925)

Root's review of 7a58b05: the boot read covered only the 8 newest dirs,
so a planned model outside them, or a later model switch, still sized from
the KV estimate; and an awaited unbounded read could hold serving's startup
on an unavailable disk.

seed_model_pages(model) replaces both reads. It reads every geometry dir of
that model (kv_page_dir_prefix is now the one owner of the dir naming), once
per model per process, as a shared in-flight future, so a slow disk never
grows a second stuck thread. The read runs on the blocking pool, and each
asker waits at most the disk reporters' REPORTER_TIMEOUT (the same
guarded() budget #5058's cargo-root registry uses). On timeout the read
stays in flight, this sizing uses the estimate (probe
inference.kv_page.seed_pending), the next tick uses the pages, and serving
is never held. A failed read is forgotten so the next ask reads again.

The serving daemon awaits it for the plan's base model before the boot
reconcile and before each tick's reconcile; the adopt rail awaits it for
its target. reconcile_to_plan itself is unchanged and stays synchronous.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply added a commit that referenced this pull request Oct 15, 2026
…le, bounded (card 37eb1925)

Root's review of 7a58b05: the boot read covered only the 8 newest dirs,
so a planned model outside them, or a later model switch, still sized from
the KV estimate; and an awaited unbounded read could hold serving's startup
on an unavailable disk.

seed_model_pages(model) replaces both reads. It reads every geometry dir of
that model (kv_page_dir_prefix is now the one owner of the dir naming), once
per model per process, as a shared in-flight future, so a slow disk never
grows a second stuck thread. The read runs on the blocking pool, and each
asker waits at most the disk reporters' REPORTER_TIMEOUT (the same
guarded() budget #5058's cargo-root registry uses). On timeout the read
stays in flight, this sizing uses the estimate (probe
inference.kv_page.seed_pending), the next tick uses the pages, and serving
is never held. A failed read is forgotten so the next ask reads again.

The serving daemon awaits it for the plan's base model before the boot
reconcile and before each tick's reconcile; the adopt rail awaits it for
its target. reconcile_to_plan itself is unchanged and stays synchronous.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply added a commit that referenced this pull request Oct 15, 2026
… on disk (card 37eb1925) (#5060)

* fix(serving): a fresh core's first cache sizing reads the saved pages on disk (card 37eb1925)

The state samples that size the host prompt cache were seeded from the pages
on disk only in note_page_dir, at the spawn. The sizing for that spawn runs
first, so every freshly started core sized its first lane from the KV
estimate, which misses the recurrent state and checkpoints a hybrid model
saves. #5056's re-home then relaunched the lane minutes later.

Kimi's node, 2026-10-15, engine 5b8500ee2 (root's receipts
20261015-core-start-cache-sizing.json, -cache-launch-derivation.jsonl,
-cache-rehome-generations.jsonl):
- the core started 12:15:15Z;
- the derivation ran about 20 s later: reason=resident_demand_kv_estimate,
  2 x 1,616 = 3,232 MiB, against 30,227 MiB affordable;
- the launch used --cache-ram 3232, then cache_holds_no_state fired, then a
  relaunch at 9,477 MiB. That's two lane starts, about 7.5 min to settled.

Seeding moves to the read path. The first measured_state_bytes for a dir
reads its newest pages once, a dir with no pages is remembered empty (one
read, not one per tick), a live sample still outranks the disk's, and the
answer is read under the lock that seeded it. note_page_dir keeps its
registration and seeds through the same function.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* fix(serving): seed state samples off the worker: one boot read before the first sizing (card 37eb1925)

Root's review of bcb2d96: measured_state_bytes ran a synchronous directory
scan from the reconcile tick and the adopt rail, and warm timings do not
bound a cold scan. measured_state_bytes is a pure lookup again. The disk
read happens in two awaited places, both on the blocking pool:

- the serving daemon's initialize awaits seed_page_store(kv_pages_root())
  before its boot reconcile: ONE spawn_blocking that reads the STATE_DIRS
  newest page dirs, so the first cache sizing finds measured states;
- the adopt rail (async ensure_model_serving_if_current) awaits
  seed_state_samples for the dir it checks, a no-op once known.

note_page_dir goes back to registration only. reconcile_to_plan's contract
is unchanged: no tick is deferred, so every launch-on-first-reconcile test
keeps its meaning. A failed blocking read leaves the dir unmeasured (probe
inference.kv_page.seed_failed), never recorded empty, so it never triggers
a relaunch.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* fix(serving): seed the planned model's page dirs before every reconcile, bounded (card 37eb1925)

Root's review of 7a58b05: the boot read covered only the 8 newest dirs,
so a planned model outside them, or a later model switch, still sized from
the KV estimate; and an awaited unbounded read could hold serving's startup
on an unavailable disk.

seed_model_pages(model) replaces both reads. It reads every geometry dir of
that model (kv_page_dir_prefix is now the one owner of the dir naming), once
per model per process, as a shared in-flight future, so a slow disk never
grows a second stuck thread. The read runs on the blocking pool, and each
asker waits at most the disk reporters' REPORTER_TIMEOUT (the same
guarded() budget #5058's cargo-root registry uses). On timeout the read
stays in flight, this sizing uses the estimate (probe
inference.kv_page.seed_pending), the next tick uses the pages, and serving
is never held. A failed read is forgotten so the next ask reads again.

The serving daemon awaits it for the plan's base model before the boot
reconcile and before each tick's reconcile; the adopt rail awaits it for
its target. reconcile_to_plan itself is unchanged and stays synchronous.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* fix(serving): restore the slots.rs definitions f07da10 deleted; seed keeps custody, re-reads evicted dirs, fails loud (card 37eb1925)

f07da10 cut slots.rs from the seed's doc to state_dir_known_in, deleting
STATE_DIRS, STATE_SAMPLES, RECENT_STATE_BYTES, PAGE_SIDECARS, pages_in,
newest_page_states, note_state_bytes, page_sidecar_bytes and
trim_page_store_after_save while their callers remained. CI failed to
compile, and root's review caught it. This rebuilds the file from bae8b9f
and replaces only the seeding span.

Root's other findings on f07da10, each addressed in the one owner:
- Pending custody: a model's in-flight read (ModelSeed::Reading) is never
  dropped, so its blocking worker is never orphaned and never duplicated.
  Only completed entries beyond STATE_DIRS are dropped.
- Completed lifecycle: a completed seed remembers the dirs it filled. If any
  of them has since been evicted from the samples, the model is read again.
- Exact geometry: every one of the model's dirs is read, not the first 8, so
  the planned geometry is measured whenever it has pages. A geometry with no
  dir has no saved state, and the estimate is the honest answer there.
- Read failure: model_page_dirs returns Result. A missing store is empty;
  any other failure to read the root or one of the model's dirs is an error,
  probed as inference.kv_page.seed_failed and forgotten, so the next ask reads
  again. It is never cached as an empty store.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* fix(serving): seed the EXACT page dir each sizing reads; launch_window owns the launch geometry; page reads fail loud (card 37eb1925)

Root's blockers on 84634e8 (b7dc1416, 5b01d3fe): a model census
overflowed the 8-dir sample cache, so "held" was never true and every
reconcile rescanned; a completed seed with no dirs was held forever and
never saw a later geometry; and the read_dir preflight did not make the
later reads honest, because pages_in and newest_page_states still
swallowed errors.

- One owner of the launch geometry: launch_window(desired, plan_window,
  lanes) is reconcile's sticky (#175), wedge-heal (#363) and physical-fit
  derivation, extracted without side effects. reconcile probes each step
  that moved the window, as before; the async tick calls the same function.
- Seed the exact dir: before each reconcile, seed_reconcile_pages seeds the
  plan model's dir at the launch window (what the cache sizing reads) and at
  the live window (what the cache-holds-no-state check reads), and the
  adopt rail seeds its own dir. The sample cache (RECENT_STATE_BYTES) is the
  readiness authority: a known dir is never read again, an evicted dir is
  unknown and read again alone, and a new geometry is a new dir. Each dir
  has one shared in-flight read (SEEDING); an entry leaves only when its
  read lands, and each asker waits at most REPORTER_TIMEOUT.
- pages_in and newest_page_states return Result: a missing dir is empty, an
  entry that vanishes mid-scan is skipped, anything else is an error. The
  seed probes it and leaves the dir unknown; trim_page_store trims nothing
  on an unreadable store (probe inference.kv_page.store_unreadable).

Tests: >8 same-model geometries with the desired one first, a repeat ask
that does not read again, a geometry created after an earlier seed, an
evicted dir read again alone, and a file used as a page dir as an error,
not an empty store.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* fix(serving): one page read in flight, run as its own task: bounded under a dead volume, released unwatched (card 37eb1925)

Root's findings on ce7371d (7a3915a9, d2685005):

- Bound. SEEDING held one shared read per distinct dir, so on a volume that
  stopped answering every new plan geometry started another stuck
  spawn_blocking. Now ONE read is in flight: every page dir is under one
  store on one volume, so a second concurrent read only adds a second stuck
  thread. While it runs, any other dir stays unknown; its sizing uses the
  estimate (probe inference.kv_page.seed_busy) and the next ask reads it.
- Release. The read lived in a Shared future that only an asker's poll
  drove. After a timeout, a live save could make the dir known, the fast
  path returned early, and nobody ever polled it again, so the slot was
  held forever. The read is now its own tokio task: it lands its samples (a
  live sample still outranks them) and clears the slot whether or not anyone
  is waiting. Askers wait on its completion, bounded by REPORTER_TIMEOUT. A
  panicked task's slot is released by the next waiter.
- The doc no longer promises a new geometry is read unconditionally: it is
  read when the slot is free, and stays truthfully unknown until then.

Test one_stuck_read_holds_one_slot_and_releases_it_unwatched drives it with
a gated reader: the asker times out, a second dir starts no worker, a live
save lands, the reader is released, the slot clears with nobody waiting,
the live sample stands, and the dir had exactly one read.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* docs(slots): an outer-task panic's slot release is waiter-dependent; say so, not that one panic cannot hold reads out (root on #5060)

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
joelteply added a commit that referenced this pull request Oct 18, 2026
…rgo-cache eviction (#5150)

The shared cargo-target pool refused to evict for 29 hours on the M5 (2026-10-17 04:58Z
to 10-18 09:28Z, 211 declines, "redirected cache path: .../webrtc-sys-*/out/cxxbridge/
include/webrtc-sys/src/peer_connection_factory.rs"). validate_tree ran the strict
root-chain check on every entry, so any link BELOW a rung refused the rung, and cargo's
cxxbridge always writes such links back to source. The disk sat at 96% (critical) all
morning; the KV page tier refuses at 95%, so every slot eviction dropped its page and
every resident turn re-prefilled cold (fresh p50 28,236 tokens, cached p50 0, 3 h).

The root and its ancestors stay strict (the escape risk #5058 guards). Below a physical
rung, a link (or Windows junction) is a leaf: unlinked, never followed. One is_redirect
definition serves both checks.

Tests: a_link_inside_the_build_tree_is_unlinked_and_the_rest_is_reclaimed (the cxxbridge
shape: rlib reclaimed, link unlinked, source untouched); the existing redirect test now
asserts the link is unlinked and its target kept. disk_eviction 22 passed; source-hygiene
32 passed.


Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

Co-authored-by: Claude Opus 5.5 <[email protected]>
joelteply added a commit that referenced this pull request Oct 18, 2026
…de (#5164)

* fix(code): a citizen's shell command runs in bash, with her login shell's environment

Residents write bash. On a host whose $SHELL is zsh, code/shell ran their text in a
login zsh, so '===' and unmatched globs killed whole commands ('zsh: == not found',
'zsh: no matches found'): Aris 03:22Z, Benchy 09:26Z, Aiko 09:11Z on the M5,
2026-10-17, a lost turn each. The login shell now only loads the profile and execs
the located bash on the command, which travels in CONTINUUM_SHELL_COMMAND so no
quoting layer touches it.

Verified on the M5: the text that failed in zsh runs (exit 0) and 'which cargo'
still resolves through the login PATH.

Card 9b8a1808.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(work): one carry owner lands residents' committed card work; a frozen engine is condemned

Two defects that kept a resident's work from leaving the node, measured on the M5
2026-10-17:

1. modules::card_carry (ServiceModule) owns carrying every live resident's held-card
   committed work to origin. Before, only the turn's end pushed, and only for the card the
   turn was bound to: Benchy committed her probe card (bfbad4a, 11:52Z) inside a turn
   still running at act 14 an hour later, then her focus moved, and the commit never left
   the node. Scope: board hold Held, card_staging::checkout_path_for, clean tree, branch
   ahead; never an agent's worktree, never uncommitted work (regression test). Woken by
   any act that changes a checkout and by a turn's end; swept every 5 min as the net.
   work/carry sweeps on demand. Proven on the M5: bfbad4a reached origin 14:48:17Z
   (workspace.push pushed=true, 2,660 ms) with no act from her.

2. serving_daemon: a slot the engine reports processing whose decode and prefill have
   not advanced for FROZEN_ENGINE_MS (180 s) condemns the lane. 10:03-10:37Z an engine
   sat with n_decoded frozen at 5110 for 34 min; the real-work arm had lapsed, the smoke
   probe is skipped when a resident is seated, and her turn waited instead of failing.
   It keys on SSE progress stamps, not the engine log (which goes blind after a core
   reboot; card 7c5a91fd).

Card ecad8072, c5a2fcda.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(cognition): a mind's results ring budgets against one audience, not the running turn's

WorkingMemory::budget() read ContextBudget::from_window, whose prefill bound uses the
running turn's audience (task-local). The ring is state that outlives the turn, so its
share swung ~3x between Interactive (60 s TTFT) and Unattended (180 s) turns: on the M5
2026-10-17, cognition.budget.prefill_bound affordable_tokens alternated 17-19k / ~6k
turn to turn at ~100 t/s. Each swing collapsed or regrew the ring and rewrote its
'Older results, collapsed to pointers' block, which was the first prompt divergence on
40 of 62 turns (delib.prompt.common_prefix, 2 h window); everything after it
re-prefilled, ~9k fresh tokens per act (serving.kv.reuse turn_prefill p50 9,019),
83 s of the act's 218 s model time.

ContextBudget::from_window_for(window, audience) names the audience; the ring uses
Unattended always. A turn's own render still reads its turn's audience.

Card ecad8072.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Require stable task progress interval before frozen lane verdict

* Expose refusal evidence at release incremental regression assertion

* fix: prohibit commits in the shared background carry path (#5140)

Retain turn-end autosave while making carry push-only under the existing checkout lock. Extend the real Git fixture across concurrent staged and unstaged edits, then verify publication preserves the resident-authored commit.

* Require observed task progress interval before frozen lane verdict (#5141)

* Require stable task progress interval before frozen lane verdict

* Expose refusal evidence at release incremental regression assertion

* fix(cognition): an act's results are sized by working memory's own budget, not the turn's audience

apply.rs sized every tool result (max_result_chars) from ContextBudget::from_window under
the running turn's audience, while the ring the result joins next budgets with
working_memory.budget() (one audience). A room turn is Interactive, so a resident's
440-line read was cut at 12,960 chars and spilled to a head + handle: Benchy, the M5
2026-10-17 23:06Z, 'more than this window's 12960-char share', the same lib.rs re-read
every turn and no write. One budget now: working_memory.budget(). act_observe,
working_memory, context_budget, spill tests: 138 passed.

Card ecad8072.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(cognition): her own results come back whole and stay until her window is full

latest_action_chars was a quarter of a prefill-bounded total (floored at an eighth of the
window); recent_results_chars a quarter. Her reads came back cut behind a handle and her
earlier results folded away before she was done with them, so she re-read the same file
every turn (Benchy, the M5, 2026-10-16/17). Joel 2026-10-17: 'Stop coding in shit to stop
them from choosing what to do.'

Both are now her served window. A result larger than the whole window is still saved whole
behind its handle (it cannot fit); nothing smaller is cut, and the prompt's own fit drops
the oldest history only when a turn does not fit. RESULT_FLOOR_DENOM removed.
context_budget, working_memory, act_observe, spill, llm_deliberation: 225 passed;
source-hygiene 32 passed.

Card ecad8072.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(code): this node's residents run unconfined, like the operator's own agents

Joel 2026-10-17: 'Don't restrict them. If she wants to write to my documents folder for no
apparent reason so be it' / 'This is a substitute for Claude Code or Codex.' A resident's
children (code/shell, code/run, code/cargo) were sandboxed to her workspace since #4882,
which also killed git in her card worktree (its gitdir lives under the main checkout).

confinement_of, the one decision point, now returns None for CallerSource::LocalPersona.
Callers from outside this node (airc peers, sockets) stay confined. Her shell still never
inherits the core's secrets (strip_secret_env): no keys handed out, nothing she chooses
restricted. Test: a_resident_and_the_operator_are_unconfined_and_an_outside_peer_is_confined.
code_commands, confinement, shell_session, code::run: 54 passed.

Card ecad8072.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(code): a resident writes and edits where she names, like the operator

code/write and code/edit resolved every path inside the workspace and refused an absolute
path outside it ('escapes workspace'). Reads already widened for unconfined callers
(ReadScope::Host); writes now take the same scope through one validator,
PathSecurity::validate_write_in, and FileEngine::write_in / edit_in. A resident (unconfined
since the previous commit) writes an absolute path anywhere her account can; a caller from
outside this node is still held to the workspace. Joel 2026-10-17: 'If she wants to write
to my documents folder for no apparent reason so be it.' One code path on every OS.
Test: a_resident_writes_where_she_names_and_an_outside_peer_is_held_to_the_workspace;
code_commands, path_security, file_engine: 93 passed; source-hygiene 32 passed.

Card ecad8072.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(cognition): the reply joins the window's flexbox allocation

The problem. The reply's room was carved off the top of the served window by
its own rule (min(measured peak x2, window/2) then a two-step yield to the
payload), so it never competed with the prompt by priority. Measured on
Benchy: her reply reserve was ~5.4k, twice her read-only peak; her think was
capped near 2k (delib.emission.think_budget_hit at 1,592-1,746); and her first
write was cut mid-call at 2026-10-18 02:10Z on a window with room to spare.
Owner's rule: "Flexbox is the right way. It's like the governor: if you don't
use it for literally everything it doesn't work." This is stage 1: the reply
joins the flexbox allocation.

What changed.
- persona/rag_budget.rs: the floor/min/grow passes of
  FlexboxRagBudgetAdapter::allocate are extracted into the pure
  `flex_allocate(available, claims) -> FlexAllocation` (input-order grants,
  unallocated, escalation, warnings). The adapter calls it; one algorithm,
  its output unchanged (rag_budget tests pass unmodified). No adapter is
  constructed outside compose_for_turn.
- cognition/llm_deliberation_faculty.rs: prompt_view_with_visual_feedback
  makes ONE flex_allocate call over the served window in calibrated tokens:
  framing+tools and required input (required, priority 10, fixed), grounding
  (optional, 6, floor = ctx floor, max = what is offered), history
  (optional, 5, floor = her recent-move evidence, max = the latency fill cap),
  and the reply from the new pure `reply_claim(kind, need, pending_peak,
  live_work, directed)`: floor = COMPLETION_FLOOR_TOKENS (an act: her measured
  answer channel), capped so required input always fits; max = her measured
  need (or COMPLETION_COLD_PRIOR_TOKENS unmeasured), at least twice a pending
  cut, under the runaway bound (ACT_OUTPUT_CAP for an act; max(cap, 2 x need)
  for a pass); priority ambient pass 4, directed pass 6, act 8, act on live
  work or after a pending cut 10. Allowance = min(reply grant + unallocated,
  runaway). History's grant bounds the message budget; an optional grounding
  floor that did not fit no longer holds room against required input.
- The view carries the allowance; build_request_within carries it verbatim as
  max_tokens (output_allowance now only reports the time/need terms). Latent
  bug fixed: the request template is built once, so max_tokens is now
  refreshed from the view on every refit.
- Deleted: COMPLETION_SHARE_DENOM, completion_reserve_within,
  completion_reserve_for_peak, mandatory_prompt_floor and the two-step yield.
  min_window_for_agentic_surface = tools + framing + reply floor.

Deviation from the plan: the reply's min is its floor, not its whole want.
The allocator's min pass runs for every claim before any claim grows, so
min = max let an ambient pass's 2,048-token prior take a whole 2,048 window
and drop the presence framing (directed_turn_withholds_the_silence_escape
failed). Above its floor the reply grows by priority weight.

Tests (cargo test -p continuum-core --lib --features metal,accelerate):
llm_deliberation 92 passed, rag_budget 17, working_set 53, working_memory 45,
context_budget 8, act_observe 62 (273 unique, 0 failed); source-hygiene 32
passed. Rewritten: the_reply_claim_holds_the_reasoning_channel_under_its_
runaway_bound, an_unmeasured_turn_carries_its_grant_under_the_runaway_bound,
an_unmeasured_mind_reserves_a_reply_not_a_fraction_of_her_window,
measured_emissions_size_the_reserve_and_capped_turns_grow_it_back (7,174
kept), measured_reserve_recovers_past_a_censored_large_reply, the
min-window mirrors, catalog_fits_the_minimum_serving_window,
standing_activity_grounding_survives_history_on_the_wire (fixture term),
prompt_preserves_stimulus_and_large_action_on_the_wire. Unchanged and
passing: prompt_view_stays_within_the_served_window,
prompt_plus_completion_cap_never_exceeds_the_served_window. Added:
a_writing_turn_after_a_cut_gets_its_reply_on_a_46848_window,
an_8192_window_keeps_required_content_under_a_large_measured_need,
reply_priority_trades_history_not_required_input.

Not measured: no deployed run; the live effect on Benchy's next write is
unverified until a core carrying this commit serves her.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(sdk): advertised tool schemas never carry a single-entry allOf

schemars 0.8 renders a documented field of a referenced type as
{allOf: [{$ref}], description}. From #5059 (2026-10-15) the edit tool's edit_mode
had that shape (captured on the M5 in a resident's request), and llama.cpp's
json-schema-to-grammar cannot match a valid value against it (Codex: before/after in
CambrianTech/llama.cpp PR #66: a valid search_replace is rejected, Expected 1 Actual 0).
A constrained model therefore could not complete a code/edit call; no resident made one
after 10/13.

sdk_codegen::input_schema, the one generator for every command's advertised input
contract, now folds a one-entry allOf into its parent (same meaning, the shape every
consumer reads). Regression test on the advertised code/edit schema. code_commands,
sdk_codegen, tool-surface tests: 101 passed.

Card a21fa9b0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(cognition): the prefill time bound credits the measured KV cache

ContextBudget's total was min(served, prefill t/s x TTFT budget): every prompt token
charged as if the lane had to read it. A warm lane serves most of the prompt from its KV
cache. On the M5 2026-10-17 prefix reuse ran 0.55-0.75 while the bound sat near 18k
tokens on a 34,560-token lane, so a resident's results ring (a quarter of the bound,
~13.5k chars) could not hold one 320-line read: Benchy re-read core/source-hygiene/
src/lib.rs every turn (21:45, 21:51, 21:55Z) and never wrote.

The bound now divides by (1 - measured cache fraction), the fraction read from the
citizen-health ledger (the one writer of prompt cached/prefilled), credited at most
MAX_CACHE_CREDIT (0.75, so at most 4x), never past the served window. Test:
the_prefill_bound_credits_the_measured_cache. context_budget, citizen_health,
working_memory: 65 passed; source-hygiene 32 passed.

Card a21fa9b0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(cognition): open views, paging cursors over large data in working memory

The problem, measured on a live node 2026-10-17: Benchy worked a card that needs
a 498-line, 22 KB file (core/source-hygiene/src/lib.rs). Her prompt asked for
~66k tokens against a 34,560-token window, so the prompt fit dropped the oldest
history (5 of 9 messages), including her earlier reads of that file. Every turn
she re-anchored and re-read it from line 1 and never reached the write. A bigger
window only moves that wall; a mind with a 5,000-token window hits it on the
first page. Joel: paging cursors, not bigger windows.

What this adds:
- cognition/open_views.rs: per view, what it is (a file path, or a saved output
  handle), the command that opened it, total lines when the producer said, the
  merged line ranges she was shown, the handle of a stored read, the receipt seq
  that last touched it, and the acting root it belongs to. Eight kept, oldest
  touched evicted (a count of one-line records, justified in place).
- Filled at the receipt seam (record_receipt_inner) from the typed acts: a
  successful code/read records its range (from the read's own header when shown
  whole, from the gutter numbers of the head when stored); a spilled result of
  any other command opens an output view; a tool/output line page that came back
  whole merges into that output's view.
- Checkpointed in VolatileSnapshot.open_views (serde default, skipped when
  empty, so old checkpoints load) and restored; the handles views name are kept
  live through reachable_handles, in memory and from the checkpoint.
- Rendered every turn as one compact block, one line per view, ordered by
  subject so a page read changes only its own line, through a new
  PerceptionFact (open_views) with Notice placement: notices are required input
  (counted in required_tokens and appended after the history fit), so the
  block is never dropped with old history.
- The code/read gutter format and its parse now live together in file_engine
  (numbered_line / gutter_line_number); looks_like_numbered_read uses the same
  parse. spill::result_scalars is the inverse of result_text's header line.

Tests (working_memory tests mod, nested open_views):
a_code_read_opens_a_view_with_the_range_it_showed,
overlapping_reads_merge_and_a_stored_read_counts_only_its_shown_head,
an_open_view_survives_checkpoint_and_restore.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(cognition): an open view keeps what she understood when she read it

The open-view line told her she had read a file ('read 1-498 (all of it)') but not what it
said, so once the bytes left her window she read it again: Benchy, the M5, 2026-10-18
05:01-05:03Z, core/source-hygiene/src/lib.rs re-read whole through code/shell with that
very line in her prompt. Each view now carries her stated reasoning for the act that last
read it (the intent the act path already records as her thought), clipped to her
window-relative echo budget, rendered as 'my note when I read it: ...'. A later read
replaces it. Test: a_view_keeps_what_she_understood_when_she_read_it; open_views,
working_memory, act_observe: 110 passed; source-hygiene 32 passed.

Card 9cd01583.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(cognition): the latency cap bounds NEW history; her slot's cached prefix rides free

On the M5 (2026-10-18 09:46-10:00Z, delib.window.flex) history was granted exactly 16,384
tokens on every turn (PREFILL_TARGET_SECONDS x the measured prefill rate) while 15-29k of
the 60,160 window sat unallocated. Squeezed, the fit folded results to pointers and
dropped grounding blocks differently each turn (Aris: [roster] then [active-work] at char
1,677; the ring's newest result collapsed at char ~4k), so the engine matched 40-574 tokens
of a 15-20k prompt ("full re-prefill: no checkpoint passed the search") and re-prefilled the
rest at 75-111 tokens/s, which kept the measured rate, and so the cap, low.

The cap was charging her slot's cached prefix as fresh prefill. The faculty now keeps the
conversation tokens of her last ANSWERED prompt (learn_prompt_density, the engine's own
count present) and the cap is that plus the target's worth of new
(history_fill_cap). The window still bounds the total through the flex allocation.

Test: the_latency_cap_bounds_new_history_and_her_cached_prefix_rides_free. Deliberation +
working memory: 140 passed; source-hygiene 32 passed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(storage): a link inside the build tree no longer refuses every cargo-cache eviction

The shared cargo-target pool refused to evict for 29 hours on the M5 (2026-10-17 04:58Z
to 10-18 09:28Z, 211 declines, "redirected cache path: .../webrtc-sys-*/out/cxxbridge/
include/webrtc-sys/src/peer_connection_factory.rs"). validate_tree ran the strict
root-chain check on every entry, so any link BELOW a rung refused the rung, and cargo's
cxxbridge always writes such links back to source. The disk sat at 96% (critical) all
morning; the KV page tier refuses at 95%, so every slot eviction dropped its page and
every resident turn re-prefilled cold (fresh p50 28,236 tokens, cached p50 0, 3 h).

The root and its ancestors stay strict (the escape risk #5058 guards). Below a physical
rung, a link (or Windows junction) is a leaf: unlinked, never followed. One is_redirect
definition serves both checks.

Tests: a_link_inside_the_build_tree_is_unlinked_and_the_rest_is_reclaimed (the cxxbridge
shape: rlib reclaimed, link unlinked, source untouched); the existing redirect test now
asserts the link is unlinked and its target kept. disk_eviction 22 passed; source-hygiene
32 passed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(cognition): the append-only results ring leads the messages; churning grounding follows

The messages were ordered grounding -> results ring, on the premise that grounding is the
more stable. Measured on the M5 (2026-10-18 12:05-13:18Z, delib.segment.attribution on
every turn): reuse broke in the leading grounding, which carries recall (Turn churn) and
the room kanban (Claims churn); the engine restored pages and still matched only 8-11.5k
tokens of 50-64k-token prompts, re-prefilling the ~30k-token ring behind them at ~100 t/s.

The ring is append-only (new results land at its end; collapse is a rare burst under the
window since the history cap stopped charging the cached prefix), so it now leads, and all
grounding follows it in churn order: a grounding change re-prefills only what is behind it.

Test: the_results_ring_renders_before_churning_grounding. Deliberation, working memory and
act tests: 202 passed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(cognition): the free prefix is what the engine measured as reused, never the assumed history

The history cap credited her whole last conversation as a free cached prefix on the premise
that her slot held it. Measured on the M5 (2026-10-18, llama-server-58057.log by engine
window): it did not (reuse 13-18%), so the prompt grew with the window and every act paid
it cold at the same ~105 tokens/s:

  window 25,600: median prompt  8,506 tokens, median prefill  76 s  (10-17, residents coding)
  window 74,240: median prompt 50,627 tokens, median prefill 547 s  (10-18, zero writes)

The credit is now the engine's own `cache_n` on the last answered reply, bounded by the
conversation that prompt carried; no timing on the reply credits nothing. When reuse works
the prompt grows into the window; when it does not, the cap falls back to the latency
target and the act is yesterday's size again. Nothing fixed, everything measured.

Test: the_latency_cap_bounds_new_history_and_her_cached_prefix_rides_free (0 reused ->
nothing free; 5,000 -> 5,000; more than the conversation -> the conversation).
Deliberation + working memory: 141 passed; source-hygiene 32 passed.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(inference): one served-model identity, one rate ladder, the served model's own evidence first

Three glue defects, one family, found from the M5's receipts on 2026-10-18 (every turn's
delib.fill.latency_capped read `rate_source none, derived 16384`; the budget's
cognition.budget.prefill_bound read `conservative 575.6`; the persisted ladder held the
served model at 105.7 tok/s, 4 samples):

1. The faculty's ModelBinding defaulted to `model: None` on normal boot ("the adapter
   already carries the model"), so every rate lookup keyed by the model took the no-model
   arm and the latency cap fell to UNMEASURED_FILL_FLOOR_TOKENS (16,384): five times the
   30 s target at the real 105 tok/s. model_binding now resolves None to the adapter's
   served model at bind time, the one owner; a bound faculty always names its model.

2. decode_knee::rate_from and prefill_rate::rate_from were the same ladder written twice.
   One generic rate_from<P: OwnRate> at the owner of RateSource; PrefillPoint and
   DecodeCurve implement OwnRate; prefill_rate re-exports it.

3. PrefillPoint::own_rate required MIN_SAMPLES before counting as evidence, so after any
   hour's gap the first sample reset the count and the ladder borrowed the slowest OTHER
   model's point: a 30-day-old 575.6 tok/s from Ornith, which was not loaded. The served
   model's own point now ranks Stale with one sample; another model's point is reached
   only when this model has none.

Tests: a_binding_without_a_model_name_carries_the_adapters_served_model; the ladder test's
"one sample is not a rate" assertion replaced by the receipt above (the served model's thin
point beats an unloaded model's old one). prefill_rate + decode_knee + deliberation +
context_budget: 120 passed; source-hygiene 32 passed.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(serving,cognition): one sustained-window owner; the plan budgets memory that outlived a relaunch; perception notices sit behind the results ring

system_resources/sustained.rs is the one owner of "a reading sustained over a window"
(samples, trim, min/max). It replaces three hand-rolled deques: the serving plan's memory
budget (new), the lane footprint ledger's recent maximum, and the leased-in peak ring.

The serving plan's usable budget is now the MINIMUM instantaneous reading over
READY_TIMEOUT (the daemon's own cost of one relaunch): a fall is honoured at once, a rise
only once it has outlived a relaunch. On the M5 (2026-10-18 15:27-15:28Z,
serving.plan.branch) the budget read 22.9 / 29.8 / 29.1 / 41.9 GB within 22 s with the
engine ledger flat at 41.68 GB, and the plan relaunched the engine at 15:06, 15:18 and
15:24, every resident cold and every saved page orphaned each time.

The system's own words to her (TurnVoice::Perception: a [pattern] notice, a board anchor)
render with the facts, not the conversation, and stay out of the request's input identity
like every other fact. In the conversation they sat ahead of the append-only results ring:
Benchy's engine reuse fell to the system prompt alone (7,441 tokens) at 16:16Z.

Tests: system_resources::sustained (2 new), serving_daemon, lane_footprint, deliberation:
a_burst_of_leased_in... rewritten to the ring's own last-w semantics; 20 passed on the
targeted rerun, the full serving + deliberation set green apart from those two, now fixed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* test(cognition): a boot binding names the adapter's served model, never None

model_binding resolves None to the adapter's default model (the served-model identity fix on
this branch); the rebind test asserted the old None.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(code): unrestricted residents never read or write credentials (card c6241c04)

Joel 2026-10-18, on #5164's unconfined residents: "Keep creds off-limits".
A resident quotes tool output into rooms, and a room reaches every
enrolled peer across operators.

A resident now gets HOST reach (Confinement::reaching_host) instead of no
confinement. That is everything the operator's process may touch except
the credential stores, every scope's signing key (<repo>/.airc/identity.key)
and other citizens' directories. One policy covers both enforcement paths:
- seatbelt renders denials only (seatbelt_host_profile), so a directory
  she creates after her shell started is hers;
- landlock grants the host carved around the denials, with carved parents
  listable;
- code/read, write and edit check the same denials (ReadScope::Host
  { deny }), including through a link and inside her own workspace.
The operator is unchanged except that scope keys are refused to the file
verbs. Callers from outside this node keep workspace reach.

Also fixes carve(): it judged only the child on the way to the FIRST
carve-out, so its siblings were granted whole, even when a sibling was a
carve-out (.aws beside .ssh) or held one (.config holding .config/gh).
Harmless with the old four widely separated carve-outs, fatal for a
whole-host grant.

Windows has no per-process sandbox: the file verbs refuse credentials
there, but a resident's shell does not (shell.confinement.unavailable
probe on every spawn, as before #5164).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
joelteply added a commit that referenced this pull request Oct 21, 2026
…53) (#5065)

#5058's release_can_request_kill_before_draining_detached_process_custody
had no `what this catches` line (CLAUDE.md test rule 6). It catches the
release deadlock where a detached shell held foreground admission, so
close() waited on a task only the not-yet-sent kill could end.

Card dbed5253's other item (absent cargo roots re-probed every tick) is
resolved by measurement, not code: a stat on an absent path is ~3 us on
IntelMac (2026-10-15 16:45Z), so each absent root costs microseconds per
broker tick plus one blocking-pool hop. Recorded on the card, to revisit
if a node accumulates hundreds of absent targets.


Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant