Skip to content

row 155: the translate cap leaves the contract; the kernel hands it in the plane's settings and the codec reads it from the plane's own state (stacked on #1030) - #1031

Open
MattJackson wants to merge 5 commits into
predevfrom
lane-p3-llm-codec-translate-cap
Open

MattJackson wants to merge 5 commits into
predevfrom
lane-p3-llm-codec-translate-cap

Conversation

@MattJackson

@MattJackson MattJackson commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Row 155 (lane-p3-llm), coordinator/contract-ABI ruling. busbar-contract holds no state (BUSBAR-1.6.0.md Part 4; spec l.3701, l.4589). This PR removes TRANSLATE_CAP_READER from crates/busbar-contract/src/codec.rs.

STACKED ON #1030 (DRAFT until #1030 lands, rule 19). It does not need #1028's CodecHost threading. It is stacked because the retired hot-ABI service slot (PlaneHostVtable::SERVICES, services::arm, the services.rs/host.rs docs) is the same hunk #1030 edits for the tap-fault latch, and rule 20 forbids two open PRs on one hunk. After #1030 lands: merge origin/predev, push once, and ask the coordinator to undraft.

The seam (ruling: the cap reaches the plane through its settings)

  • Kernel to plane: the root's kernel_sections hands limits.request_body_max_bytes in the limits section a door plane is opened AND refreshed with. The value is cfg.limits.request_body_max_bytes: the LimitsResolved value the kernel already mirrors into proxy::max_translate_body_bytes, so it is the same number.
  • Plane state: Shaping reads it, and Shaping::translate_cap() falls back to the same 32 MiB default (TRANSLATE_BODY_MAX_BYTES_DEFAULT, now a plain const in the contract) when none is handed. The door hands each unit's generation cap to ReplyCtx.translate_cap.
  • Codec reads from that state, at all four former reader sites:
    • the whole-answer over-cap check (Reply Whole), with the same whole::over_cap 500 bytes;
    • the relay's same-dialect usage copy (RelayCtx/Relay::from_parts);
    • the stream translators' writers. new_stream_translator_on(.., translate_cap) calls StreamTranslate::with_translate_cap and then ProtocolWriter::set_translate_cap, which drives the Gemini tool-args buffer and every Responses accumulator. Each is an AtomicUsize on the per-stream writer.
    • the buffered-to-stream synthesizer: TranslateCodec::translate_response(.., translate_cap), then a new IrHandle::apply_translate_cap (a defaulted shape method), then synthesize_from_response(.., cap).
  • Linked engine (busbar-llm, the default build's llm path): it hands the kernel's own value (busbar_kernel::proxy::max_translate_body_bytes, through its existing proxy import line, so the ports-only count is unchanged) through the same parameters. It also installs a kernel-capped stream-translator factory (engine::stream_translator) in place of the plane's default-capped one. The hot linked lane (root/linked.rs) reads the kernel's value directly.
  • Contract: TranslateCapReader, the static, install_translate_cap_reader and max_translate_body_bytes are gone. The hot translate_cap slot stays in the layout but is retired: SERVICES and arm no longer touch it. The kernel stops arming the reader.

Same value, same default, same refusal bytes

  • The configured value and the 32 MiB default are unchanged, and the over-cap refusal is the same whole::over_cap answer.
  • The cap is read ONCE PER CONFIG GENERATION (in the linked engine, once per relay or translator) instead of per piece. Plugin-owned settings are valid to the next refresh generation (spec §11), so mid-response consistency is the correct behaviour: a live limits reload no longer moves the cap under a body already in flight. Nothing in 1.5.5's oracle exercises a reload mid-stream.

RED

  1. Contract compile_fail doctests on TRANSLATE_BODY_MAX_BYTES_DEFAULT: max_translate_body_bytes() and install_translate_cap_reader(..) no longer exist, so no reader static remains.
  2. crates/busbar-plane-llm/tests/conformance.rs::the_translate_cap_the_settings_carry_is_the_one_the_door_enforces, run linked AND dropped in:
    • opened with no cap, an openai caller's anthropic whole answer translates (200);
    • refreshed onto settings with limits.request_body_max_bytes: 64, the same answer is exactly whole::over_cap("openai")'s status and bytes.
  3. tests/exchange_shaping.rs::the_translate_cap_is_the_one_the_settings_carry_else_the_default.
  4. crates/busbar/src/root/tests/door_steps.rs::the_limits_a_door_plane_is_handed_carry_the_operators_translate_cap: the kernel hands the operator's value, or its default.
  5. The contract-stateless gate: a static put back is a NEW finding.

Ledger (before → after, on top of #1030)

Overlap

Nothing was run locally (cargo fmt only); ModernCI is the proof.

…n the plane's settings and the codec reads it from the plane's own state

TRANSLATE_CAP_READER, its install port, max_translate_body_bytes and the hot vtable's translate_cap
service are gone (the slot stays in the layout, retired). The root hands
limits.request_body_max_bytes (the kernel's resolved value) in the limits section a door plane is
opened and refreshed with; the llm plane's Shaping reads it (translate_cap(), the 32 MiB default
when none), and the exchange threads it to the whole-answer over-cap refusal, the relay's
same-dialect usage copy, the stream translators' writers (Gemini tool args, Responses accumulators)
and the buffered-to-stream synthesizer (IrHandle::apply_translate_cap). The linked engine hands the
kernel's own value through the same parameters, and installs a kernel-capped translator factory.

qa/contract-stateless.toml 39 -> 38 rows (codec.rs TRANSLATE_CAP_READER). qa/abi-freeze.toml hot
6100 -> 6075.
This was referenced Oct 14, 2026
@MattJackson
MattJackson marked this pull request as ready for review October 14, 2026 18:17

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant