Skip to content

Prevent background carry from committing concurrent resident edits - #5140

Merged
joelteply merged 1 commit into
9b8a1808/code-shell-runs-zsh-in-a-resident-s-commfrom
1b3ce373/carry-committed-work-without-ever-commit
Oct 17, 2026
Merged

joelteply merged 1 commit into
9b8a1808/code-shell-runs-zsh-in-a-resident-s-commfrom
1b3ce373/carry-committed-work-without-ever-commit

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

When a resident edits a checkout after background carry's clean precheck but before its sync lock is acquired, the ordinary turn sync can create a WIP commit on her behalf. Carry now passes an explicit Never commit policy through the existing admitted, locked sync; turn-end autosave keeps its existing behavior.

This is an isolated shared correction stacked on #5133 at 47c7844 for Fable's integration review. It does not modify the frozen-slot detector or add an OS-specific workflow.

The existing real Git fixture now waits deterministically for the actual carry future to reach the held checkout lock, creates staged/unstaged/untracked work, and checks unchanged HEAD, index diff, and files. It then makes the resident's own commit and verifies that carry publishes that exact SHA to a disposable local bare origin. Existing setup and sync owners are reused; no new test runner or runtime hook.

Validation so far: Rust parsing and git diff checks passed; actual disposable Git routing check passed. Independent exact source review by Codex budget peer passed. The Rust regression has NOT been compiled or executed locally; this draft requests the existing hosted CI lanes. No deployment or live citizen workspace mutation.

Card: 1b3ce373-9ad4-413d-a1a6-6d4b1330e789. Source: 5b31e60.

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.
@joelteply
joelteply marked this pull request as ready for review October 17, 2026 21:07
@joelteply
joelteply merged commit b17b20f into 9b8a1808/code-shell-runs-zsh-in-a-resident-s-comm Oct 17, 2026
9 checks passed
@joelteply
joelteply deleted the 1b3ce373/carry-committed-work-without-ever-commit branch October 17, 2026 21:07
joelteply added a commit that referenced this pull request Oct 17, 2026
…etection (#5133)

* 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

---------

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]>
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