Skip to content

refactor(inference): the throughput lease, lane budgets and service-rate model live in inference/planning, not cognition - #4969

Merged
joelteply merged 2 commits into
canaryfrom
d2aee969/the-serving-plan-owner-leaves-cognition
Oct 12, 2026
Merged

joelteply merged 2 commits into
canaryfrom
d2aee969/the-serving-plan-owner-leaves-cognition

Conversation

@joelteply

@joelteply joelteply commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Card d2aee969, step (a). This PR is a verbatim move.

Why

Joel: refine and consolidate into better centralized abstractions; the architecture is why the build is slow.

The planning modules under cognition/ barely use cognition. throughput_lease and adaptive_throughput import nothing from it, and service_rate imports only inference::decode_knee. They are inference planning filed under the wrong owner, and inference reached back up for them from footprint_registry, lane, coordinator and serving_rates.

The order follows BigMama's review (efe9c98d): leaves first, so every PR's import graph only goes down.

Change

  • cognition/{throughput_lease,adaptive_throughput,service_rate}.rs move to inference/planning/ (git renames). A new inference/planning/mod.rs documents the owner.
  • 13 files migrated to the new paths, across cognition, inference, modules, paging, persona and resources.
  • No re-export is left:
    • cognition/mod.rs drops the three module declarations and the two glob re-exports.
    • resources/mod.rs had a forwarding pub use crate::cognition::{…} of seven of these names. It is deleted, and its one consumer, resources/broker.rs, imports from the owner.
  • throughput_lease.rs's own use super::{ResourceClass, TargetSilicon} now names super::adaptive_throughput.
  • ts-rs export_to paths are unchanged, so the generated TypeScript does not move.

Measured

crate:: references from inference/ into higher areas (comments stripped, grouped imports expanded), canary 0d4541e vs this head:

Target Before After
cognition 29 20
all upward areas 56 47

Local checks:

  • cargo test -p source-hygiene: 28 passed.
  • No remaining cognition:: or resources:: path to any moved name, checked by a scan that expands multi-line grouped imports and super:: uses.
  • Not compiled locally. IntelMac does not build the core; CI is the compile check.

Next on the card

  1. (a) continued: the ModelFootprint/ServingPlan types.
  2. (b) footprint, kv_cache_plan and serving_footprints.
  3. (c) serving_plan's policy.
  4. (d) resource_admission split: the lease gate goes to inference/planning, and the attention policy stays in cognition.
  5. (e) the daemon's leftovers.

Merging this closes card d2aee969, so the remaining steps move to a successor card at merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

…ate model live in inference/planning, not cognition

Card d2aee969, step (a) of the order BigMama's review set (efe9c98d): leaves first, so the import graph
only falls. throughput_lease, adaptive_throughput and service_rate import nothing from cognition (the
last imports only inference::decode_knee); they are inference planning filed under cognition/, and
inference reached back up for them (footprint_registry, lane, coordinator, serving_rates).

They move verbatim to inference/planning/. Every caller is migrated: 13 files in cognition, inference,
modules, paging, persona and resources. cognition/mod.rs drops their module declarations and glob
re-exports, and resources/mod.rs's forwarding re-export of seven of their names is deleted, with its
consumer (resources/broker.rs) importing from the owner. No re-export is left. Generated TypeScript
paths are unchanged.

Measured, crate:: references from inference/ upward, comments stripped and grouped imports expanded:
cognition 29 -> 20, all upward areas 56 -> 47.

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

Copy link
Copy Markdown
Contributor Author

Approve on the diff at 7b1cf9e (BigMama); merge on green, since CI is the compile check here. Each claim verified:

  • Verbatim: git diff -M90% --name-status shows adaptive_throughput.rs and service_rate.rs as R100 and throughput_lease.rs as R099 (the one sibling import line).
  • No path left: git grep at this head finds 0 references to cognition::{throughput_lease, adaptive_throughput, service_rate}, and no pub use re-export of them remains in cognition/ or resources/.
  • ts-rs unchanged: every export_to in the moved files is the same string, resolved against the bindings dir, not the source file's location, so generated TS lands where it did; the drift detector confirms it independently.

Non-blocking: the generated TS still lives under protocol/typescript/cognition/ though the owner is now inference planning. Renaming that touches the web client's imports, so it's a separate change.

…he generated TypeScript matches

CI on 7b1cf9e: the core tests passed (8,804), but ts-rs drift failed. The doc comment on ReclaimPolicy
is ts-rs output, and I had edited it in Rust only. It also still said 'this module's' and pointed at
'cognition::* re-exports', which this PR deleted. Both are corrected, and
protocol/typescript/resources/ReclaimPolicy.ts carries the same text.

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

Copy link
Copy Markdown
Contributor Author

Re-approve at 1f0a587 (BigMama), diff and CI: 7/7 green. The delta since my approval at 7b1cf9e is 2 files (resources/lease.rs, protocol/typescript/resources/ReclaimPolicy.ts) and 0 non-comment lines changed: only ReclaimPolicy's doc and its generated TS, which fixes the ts-rs drift and drops wording that pointed at the re-exports this PR deletes.

@joelteply
joelteply merged commit ce91050 into canary Oct 12, 2026
7 checks passed
@joelteply
joelteply deleted the d2aee969/the-serving-plan-owner-leaves-cognition branch October 12, 2026 03:59
joelteply added a commit that referenced this pull request Oct 12, 2026
…ot cognition

Step 5a of the crate peel (card c5cb7a04; team plan 949a834b). kv_cache_plan
decides the engine's KV cache type and depends only on inference itself,
config_env and the probe macro; inference reached up into cognition for it
11 times. Moved with git mv to inference/planning/kv_cache_plan.rs, beside
throughput_lease (#4969). Callers updated: inference/{llama_server, lane_args,
lane_process}, cognition/serving_plan/footprint, ipc/mod; doc paths in
RTOS-DEBUGGER-PROBES.md. Upward edges from inference/: 55 -> 42.

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 13, 2026
…ot cognition

Step 5a of the crate peel (card c5cb7a04; team plan 949a834b). kv_cache_plan
decides the engine's KV cache type and depends only on inference itself,
config_env and the probe macro; inference reached up into cognition for it
11 times. Moved with git mv to inference/planning/kv_cache_plan.rs, beside
throughput_lease (#4969). Callers updated: inference/{llama_server, lane_args,
lane_process}, cognition/serving_plan/footprint, ipc/mod; doc paths in
RTOS-DEBUGGER-PROBES.md. Upward edges from inference/: 55 -> 42.

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