Skip to content

Split merge-train: the last seven oversized-file splits, one baseline measurement (#5229-#5233, #5240, #5244) - #5245

Merged
joelteply merged 24 commits into
canaryfrom
fable/split-merge-train
Oct 21, 2026
Merged

joelteply merged 24 commits into
canaryfrom
fable/split-merge-train

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Lands seven reviewed split PRs together. Each lowers the same lines-over baseline, so landing them one by one would mean a re-measure, a new head and about 45 minutes of Windows CI per PR.

Contents

Each PR's own commits, cherry-picked onto canary 8e26442 unchanged (-x records the originals):

PR Split Review
#5229 code/file_engine.rs independent PASS at 1403e9a
#5230 cognition/resource_admission.rs independent PASS at c940b1d
#5231 working_memory, openai_adapter, dream_consolidation independent PASS at 9ecce31
#5232 llm_deliberation_faculty.rs (12,678 lines) independent PASS at 0f0d2cc
#5240 act_observe tests Cormac PASS at 13e77d7
#5233 inference/llama_server.rs (Codex) independent source APPROVE, fully green at e887947
#5244 modules/serving_daemon.rs (Codex) independent source APPROVE at 3676ae9

Verify

The union check is git range-diff of each original PR range against its picks here. Codex has agreed to audit union and source equivalence. The originals stay open until this merges, then close as landed via this PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

joelteply and others added 24 commits October 21, 2026 04:42
… each under 1,000

Split by the names already in the file: suggest (nearest paths), ops (read,
write, edit, delete, diff, undo, history), introspect (path resolution,
exists, list_dir, glob), edit_checks (parse checks, notices, repair hints),
apply (applying and reversing an edit), tests/{mod,filesystem}. Pure moves:
children `use super::*`, moved private items become pub(super), the parent
globs them back so every path holds; super::workspace_events becomes
crate::code::workspace_events (one level deeper); gutter_line_number keeps
its pub(crate) path through a re-export.

file_engine tests: 58 before, 58 after, all pass. Lines past 1000:
155,781 -> 152,846.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit 18a6f6d)
…, gate, tests)

Pure move: no behaviour change. Every file is at most 1,000 lines; public paths unchanged via glob re-exports.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit 251e832)
working_memory.rs 4138 -> 618 lines (types, snapshot, Drop; re-exports
WorkingMemoryFaculty). Moved verbatim into working_memory/:
  ledger.rs 451 (construction, action statements, fingerprints, receipts)
  continuity.rs 429 (pins, notices, facts, snapshot/restore, claim-gone)
  perception.rs 490 (readers, dispatch, collapse, settlement)
  faculty.rs 213 (WorkingMemoryFaculty + render_trail)
  tests/{mod,actions,custody,faculty,open_views,pins,provenance,rebuilt_marker,trail}.rs
    (all <=423 lines; the two test mods become one tests tree)
Widened to pub(super): push_receipt_head, collapse_results_over_cap,
publish_live_handles. Test files carry #![cfg(test)] so source-hygiene
keeps counting them as test code.

Tests: working_memory filter 49 passed before and after. Lib warnings
122 -> 122, lib-test warnings 74 -> 74. source-hygiene baselines lowered:
lines-over-1000 155781 -> 152643, excess test mods 19 -> 18.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit 088a602)
openai_adapter.rs 3730 -> 267 lines (config/types; re-exports
extract_reasoning). Moved into ai/openai_adapter/:
  runtime.rs 423 (construction, endpoints, runtime models, slot pool)
  lora.rs 198, registry.rs 139, reasoning.rs 107, embedding.rs 72
  provider.rs 482 (AIProviderAdapter impl)
  stream.rs 789 (generate_stream_checked body)
  tests/{mod,lane_transport,request_shaping,lora_page_in,
         prefill_progress_is_liveness,unguaranteed_model_refusal_...}.rs
    (all <=593 lines)

Not a pure move in two places, both forced by the 1000-line cap:
- The AIProviderAdapter impl was a single 1250-line trait impl (one
  790-line method), which cannot span files. generate_stream_checked's
  body moved verbatim to the inherent `stream_checked` in stream.rs;
  the trait method is now a one-line forward.
- A doc link to crate::cognition::embedding in provider.rs became plain
  code formatting so the file-per-upward-import layer ratchet did not
  rise (cognition was named by two files after the split).
Widened to pub(super): endpoints, endpoints_for_model,
targets_local_serving_lane, refresh_runtime_models, resolve_dmr_model_name,
runtime_models_contain, ensure_slot_pool, lora_scale_vector,
match_lora_index, map_finish_reason, and the embedding helpers.

Tests: openai_adapter filter 41 passed before and after. Lib warnings
122 -> 122, lib-test 74 -> 74. source-hygiene lines-over-1000 baseline
152643 -> 149913.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit 463d122)
dream_consolidation.rs 2817 -> 200 lines (module header, BrainRegion impl,
engram builders, PersonaReflectionSource impl for the registry; re-exports
distiller::* and region::*). Moved into cognition/dream_consolidation/:
  distiller.rs 484 (DistilledFact, Lens, SemanticDistiller)
  region.rs 358 (reflection source, region state, boundaries, entry points)
  consolidate.rs 516 (consolidate_with, review-only, received passes)
  passes.rs 475 (dream/review/supersession passes)
  tests/mod.rs 307 (incl. pub(crate) helpers training_producer imports),
  tests/region.rs 505 (pub(crate) mod region, path kept)
Widened to pub(super): region consts/fields/ReviewBoundaries/DreamPermit/
CONSOLIDATE_EXECUTOR/consolidate_cooldown_elapsed, consolidate_with, the
pass fns, observations_block, union_recall_keys.

The original file's first code-level #[cfg(test)] (a field gate at line 694)
hid ~1,300 lines of production from the unwrap ratchet; split files expose 9
unjustified unwraps. Each now carries a same-line JUSTIFIED comment (comments
only) so the baseline does not rise.

Tests: dream_consolidation filter 18 passed before and after. Lib warnings
122 -> 122, lib-test 74 -> 74. source-hygiene baselines lowered:
lines-over-1000 149913 -> 148096, unwired 60 -> 59.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit afa6700)
… by theme (pure move)

Each nested test module becomes its own file; the loose prompt-shaping and
verdict tests group by theme as on the owner split. include_str! paths gain
two ../ for the added directory depth.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit 28e811b)
…ure move)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit 3b34e76)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit cfcf416)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit e3bda14)
…out of llm_deliberation_faculty.rs (pure move)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit 5e3eced)
…culty.rs (pure move)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit 9817768)
The depth rewrite skipped 'in super::' meant for pub(in super::..) but also
matched 'for fact in super::perception_facts'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit 24e88f6)
…nly)

ShedPreview, ContextComposition's framing fields and the GroundingPiece
notice helpers sit in prompt/ now; private -> pub(in super::super) like their
siblings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit c776905)
mod.rs was a 49-line coordinator plus a 2,460-line inline test module. The test
module moves to act_observe/tests/ (declared `#[cfg(test)] mod tests;`):

- tests/mod.rs           shared fixtures: RecordingExecutor, FailingExecutor,
                         ScriptedExecutor, ActThenSpeak, AlwaysAct, CountingSpeaker,
                         body/body_with_wm/admission/acts_of helpers (410 lines)
- tests/chain.rs         causal ActChain linking scenarios (125)
- tests/apply.rs         apply_act scoping, folded/running alias, no-hands/failure (440)
- tests/drive.rs         drive_to_settle / settle_step scenarios + nudge rearm (534)
- tests/credit.rs        directed credit and live room input scenarios (509)
- tests/investigation.rs multi-act investigation, re-awaken, promise/echo gates (507)

Test bodies are moved verbatim (dedented); two relative paths gain one `super::`
(settle::NARRATION_BUDGET, perception::batch_evidence). Uncompiled locally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit 946a8c0)
…ad them as test code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit 13a29ca)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
(cherry picked from commit 13e77d7)
git grep -n -E AdmissionHold|GateRefusal|PromptCacheGrant -- core apps found only serving_daemon definitions and implementation references, no external named caller. Retain original pub(crate) root definitions for the pure-split visibility contract; children consume those types directly. Removes redundant reexports and artificial super-qualified signature uses; preserves type comments and behavior.

(cherry picked from commit 3676ae9)
The only Rust file past 1,000 lines is the vendored quantized_llama.rs.
Every changed count names its cause beside it; cargo test -p source-hygiene
passes 43/43 on a fresh build of this tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Union/source equivalence APPROVE for b7ddb23, conditional on exact-head CI and existing constituent reviews. Compared every changed continuum-core source path from each of #5229, #5230, #5231, #5232, #5233, #5240 and #5244 with its current exact PR head: zero final source differences for all seven (8/6/35/30/35/7/33 paths respectively). Per-PR source range-diffs match; differences are cherry-pick provenance metadata and the shared probe target arm already supplied by #5233, coalesced once for #5244. Direct Git-blob census of the union finds only vendored quantized_llama.rs above 1,000 lines (1,364), so file-size excess 364 is confirmed. Other hygiene counts still rely on the required batch CI. This is an integration equivalence review, not a replacement for constituent independent reviews or tests. #5244 CI has a training_producer staged_credit-table failure tracked separately by Fable as d4909786; no green or merge claim until gates pass.

@joelteply
joelteply merged commit 741c118 into canary Oct 21, 2026
9 checks passed
@joelteply
joelteply deleted the fable/split-merge-train branch October 21, 2026 10:20
joelteply added a commit that referenced this pull request Oct 21, 2026
…; a dense model's GGUF is read once (card 60f74ac5, f3ba3b56 item 19)

Re-applied onto canary 445ae4b after #5245 split serving_daemon.rs (the builder
and its readers now live in serving_daemon/placement.rs and moe_cache.rs) and #5249
moved the probe macro to continuum_base.

moe_serving_context returned None both for a dense model and for a GGUF it could not
read (open or header error, no architecture, a layout error other than NotMoe, no
router top-k, no block_count). A MoE with unreadable geometry was served dense, with
no expert placement and no word. It now returns Result<Option<ctx>, why>: Ok(None) is
dense (NotMoe), and an expert count with no stacked tensors or a malformed layout is
an error, not dense.

The placement cache held only a MoE context, so for a dense model every call re-opened
and parsed the GGUF header. The guard now caches the verdict per model (Option<ctx>,
dense included) and probes serving.moe.geometry_unreadable once when it is built. A
GGUF that does not resolve yet is not cached, so it is read once it lands. The two
readers match Some((id, Some(ctx))).

source-hygiene 43/43 on IntelMac. Core compile is CI's.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply added a commit that referenced this pull request Oct 21, 2026
…s are re-asked (card 6080a28f, f3ba3b56 items 11 and 13)

Re-applied onto canary 445ae4b after #5245 split llama_server.rs (prepare.rs,
kv_support.rs, genome.rs) and #5249 moved the probe macro to continuum_base.

Item 13: server_bin() falls through to a bare 'llama-server' from PATH when no
override, slot or legacy install resolves. A stock build there runs without the fork's
routes (slot save-size, /train, MTP). prepare_local_launch now calls
engine_slots::note_unowned_launch, which probes serving.engine.unslotted when the
engine is a bare PATH name no operator override chose. Resolved::Path's doc says what
actually happens.

Item 11: ensure_engine_kv_support_recorded latched once per process before probing, so
a failed or timed-out --help probe left /train off and KV to the backend table for the
core's life, and an engine promote kept the old binary's answers. The latch is now the
binary that answered; a failure is asked again at the next launch, a promoted binary
afresh, and a failure resets ENGINE_TRAIN_DIR and ENGINE_QUANTIZED_KV to unknown.

source-hygiene 43/43 on IntelMac. Core compile is CI's.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply added a commit that referenced this pull request Oct 21, 2026
…ned over a resident (card 1ca5abe1, f3ba3b56 item 4)

Re-applied onto canary 445ae4b after #5245 split slots.rs and openai_adapter.rs
(the request placement now lives in openai_adapter/stream.rs) and #5249 moved the
probe macro to continuum_base. The slots test move this PR used to carry is already
on canary.

A Turn with no (persona, room) key (a nil-room eval on her live lane, or a caller that
dropped its room) went out UNPINNED with cache_prompt on whenever the pool had a
scratch slot, so the server placed it by similarity and could overwrite a resident's
KV. The one placement rule is now slots::placement (slots/placement.rs): only a keyed
Turn owns a slot. Every other request, a keyless Turn included, takes the slot its
admission borrowed or the scratch slot, and without a scratch slot never persists a
cache. A keyless Turn probes inference.turn.keyless with its purpose, and only a keyed
Turn registers an in-flight slot guard.

Test: slots::tests::only_a_keyed_turn_owns_a_slot pins the four cases.
source-hygiene 43/43 on IntelMac. Core compile is CI's.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply added a commit that referenced this pull request Oct 21, 2026
…s, not a silent re-prefill (card f3ba3b56, items 1, 3 and 6)

Re-applied onto canary 445ae4b after #5245 split openai_adapter.rs (the completion
probe now lives in openai_adapter/stream.rs) and #5249 moved the probe macro to
continuum_base. The turn_admission test move this PR used to carry is already on canary.

- turn_admission: TurnAdmission records how its KV reached the slot, as PageIn
  {None, Resident, Restored, RestoreRejected}, instead of a restored bool. A restore
  the engine refuses is probed at the decision (inference.restored_turn
  outcome=restore_rejected), so it counts even for a turn that never completes.
- stream.rs: at completion, Restored is judged warm/cold as before. A Resident slot
  that reused nothing is its own class (inference.resident_prefix_lost), kept out
  of the restore verdict.
- track-canary.sh: the deploy self-check counts restore_rejected against the economy,
  reports lost resident prefixes on their own line (a failure when they outnumber warm
  restores), and reports refused KV page ledger adoptions with their reasons.

source-hygiene 43/43 on IntelMac. Core compile is CI's.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply added a commit that referenced this pull request Oct 21, 2026
…state sized it (card 37eb1925)

Re-applied onto canary 445ae4b after #5245 split serving_daemon.rs: the derivation,
with_measured_state and the decision type all live in serving_daemon/prompt_cache.rs,
which now owns sized_by and its test too.

A sizing raised by a measured saved state reported the KV estimate's reason, so the
receipt read the same before and after card 37eb1925's fix, and a fresh core's first
sizing could not be told from the defect (Kimi's node, 8eaed76: one_conversation
4,816 MiB from a 5,050,734,260-byte page, under resident_demand_kv_estimate).
derived_prompt_cache_mib keeps the estimate beside the raised demands, and sized_by
relabels the decision resident_demand_measured_state only when a measured state raised
a demand; a prior is never relabeled. The receipt's serialized_state_bytes reports the
measured bytes instead of 'unobserved'.

Test: a_measured_state_sizing_says_so_and_a_prior_is_never_relabeled.
source-hygiene 43/43 on IntelMac. Core compile is CI's.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply added a commit that referenced this pull request Oct 21, 2026
…ard cb3221a5)

Re-ported onto canary 445ae4b after the #5245 file splits. Three flaky lib tests
in a row turned canary red and refused every node's deploy on 2026-10-15
(#5066, #5067): tests that only READ the process home (continuum_home, HOME,
home_dir) took no lock, so a guarded fixture could swap the home between two reads.

Five readers take HomeGuard::preserve_blocking() (one async test takes
preserve().await). The probe-env pair (tracing_init, probe_file_sink) both
set/remove CONTINUUM_PROBE_DIR/CLASSES unlocked and restore each other's values
mid-assertion; they take the same lock. test_env's doc says the ONE lock covers
every test that mutates process env, so there is one env lock, not one per variable.

The earlier forge test move is dropped: canary already split modules/forge.
No production change. source-hygiene 43/43 on IntelMac, no baseline change.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply added a commit that referenced this pull request Oct 21, 2026
…split canary as one commit)

Squash of the #5215 branch (9 commits plus its canary merge) re-applied onto
current canary after #5245 split the files it edited and #5249 moved the probe
macros: the same edits, landed in the split child modules. Ratchet baselines
are canary's; CI measures the exact lowered counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Oct 21, 2026
…st-only items (rebased onto split canary as one commit)

Squash of the #5195 branch (8 commits plus review fix) re-applied onto current
canary: the same deletions landed in the split child modules from #5245, the
probe path from #5249, and files #5200 already removed are skipped. Ratchet
baselines are canary's; CI measures the exact lowered counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
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