Skip to content

llm codec: translated bytes back to 1.5.5 (row-159 L3#5-#9, L2#1) - #857

Open
MattJackson wants to merge 3 commits into
predevfrom
lane-llm-codec-bytes
Open

MattJackson wants to merge 3 commits into
predevfrom
lane-llm-codec-bytes

Conversation

@MattJackson

Copy link
Copy Markdown
Collaborator

What. These are codec HIGHs from the row-159 plane-llm audit. Each puts back the bytes 1.5.5 sent, or fixes a 1.6.0 defect that has no 1.5.5 counterpart. None of them moves a billed figure. The one billing edge, Gemini audioDurationSeconds on the read side, is split into its own $ PR.

finding change 1.5.5 source
L3#5 A translated stream into a Responses client stamped created_at: 0 (1970). It now stamps the host wall clock (busbar_contract::codec::wall_clock_now, the same reading the Chat writer uses). v1.5.5 proto/openai_responses/writer.rs:479 (now_unix_secs())
L3#6 The same-dialect relay's stop-reason scan matched the first "finishReason" anywhere in the body, so a model-written functionCall.args object faulted a shared lane. StopKey now names a member at a container depth (Gemini candidate = 3, Cohere top level = 1), and the scanner walks the JSON lexically, inline and without heap use. Q31 failure detection kept
L3#7 Gemini candidatesTokenCount was the output minus reasoning, with a new thoughtsTokenCount. It is the whole output again, with no new member. v1.5.5 proto/gemini/writer.rs:962-964
L3#8 Streamed Gemini tool ids after text counted only a still-open text block (position 2 for the second call). They now count text_index.is_some(), matching the buffered ids. v1.5.5 proto/gemini/reader.rs:895
L3#9 (writer) A duration-billed transcription no longer writes an invented usageMetadata.audioDurationSeconds. v1.5.5 handlers/gemini.rs:259-265
L2#1 A lane without native structured outputs drops response_format again, with a warn and a reported control. It no longer sends a synthetic busbar_response_format forced tool, which overwrote the caller's tool_choice and streamed back to the client as a tool call. v1.5.5 proto/anthropic/writer.rs:343-347; CHANGELOG 1.6.0 "an omitted key sends what 1.5.5 sent"

RED-able tests.

  • tests/proto/stream_translate_tests.rs::a_translated_stream_into_responses_carries_the_host_clock_created_at
  • gemini/tests/tests.rs::{a_finish_reason_inside_tool_args_is_not_the_stop_reason, stop_key_scanner_reads_the_candidate_member_at_every_split, streamed_tool_ids_after_text_match_the_buffered_ids}
  • gemini/tests/ir_mapping_tests.rs::reasoning_tokens_stay_inside_candidates_for_a_gemini_client
  • gemini/tests/handler_tests.rs::a_duration_billed_transcription_writes_no_usage_metadata
  • anthropic/tests/ir_mapping_q57_tests.rs::ant07_default_lane_drops_the_directive_as_in_1_5_5
  • anthropic/tests/anthropic_hardening_tests.rs::read_response_rewrites_no_tool_use_block
  • Unit golden resp_r2g_reasoning.json goes back to its bytes from before 971e2b6.

Not in this PR. L3#10's byte moves are pre-approved by the fidelity rule, but each needs a register entry plus a CHANGELOG line, and those files are outside this lane's write set (reported to the coordinator). No ledger, oracle cell or ceiling changes.

…ni stop scan, candidates count, tool ids, transcription usage, Anthropic response_format)

- Responses: a translated stream stamped created_at 0 (1970); it stamps the host's wall clock
  again, as 1.5.5 stamped now_unix_secs() (v1.5.5 proto/openai_responses/writer.rs:479).
- Gemini/Cohere: the relay's stop-reason scan is structural (member at a container depth), so a
  model-written tool `args` object holding "finishReason":"MALFORMED_FUNCTION_CALL" no longer
  faults a shared lane.
- Gemini: candidatesTokenCount is the whole output again, with no thoughtsTokenCount
  (v1.5.5 proto/gemini/writer.rs:962-964); streamed tool ids after text count the text block as
  1.5.5 did (v1.5.5 proto/gemini/reader.rs:895), matching the buffered ids; a duration-billed
  transcription writes no invented usageMetadata.audioDurationSeconds (v1.5.5 handlers/gemini.rs:259-265).
- Anthropic: a lane without native structured outputs drops response_format again (v1.5.5
  proto/anthropic/writer.rs:343-347) instead of a synthetic forced tool that overwrote the
  caller's tool_choice and streamed back as a tool call.
Unit goldens resp_r2g_reasoning.json returns to its pre-971e2b6508 bytes.
@MattJackson

Copy link
Copy Markdown
Collaborator Author

row 155 B2 (#974) edits crates/busbar-plane-llm/src/codec/{anthropic,openai_responses}/mod.rs at fn claims and the DECL quota_exceeded_status / auth_failure_status_and_kind rows, and proto_codec.rs at the DialectRef DialectCodec impl (attach_error_response_headers -> error_response_fields); disjoint from this PR's hunks.

…onse_format drop in busbar-llm's audit tests, the tool-args stop test)

- gemini/handler.rs write_transcription_response: the single-arm `match` is an `if let`
  (clippy::single_match). It writes the same bytes.
- busbar-llm engine/tests/egress_dropped_controls_audit_tests.rs: the two tests that pinned the
  post-1.5.5 `busbar_response_format` forced tool now hold 1.5.5 (v1.5.5
  crates/busbar/src/proto/anthropic/writer.rs:343-347; ARCHITECT ruling 2026-10-13, F25 rows
  107/109, as #884 ports them).
  - openai_to_anthropic_response_format_forwards_dropped_and_audited: the default Anthropic lane
    forwards with no response_format, tool_choice or tools, and records the
    `response_format on anthropic` degraded audit event.
  - egress_dropped_controls_reports_the_right_controls_per_dialect: the default Anthropic lane
    reports ["response_format"].
- gemini tests a_finish_reason_inside_tool_args_is_not_the_stop_reason: the raw scan reads the
  candidate's own `STOP` (EndTurn), never the args' MALFORMED_FUNCTION_CALL (Error). The test had
  also compared it to read_response's stop reason, which promotes a tool-call STOP to ToolUse from
  the content; a token-only scan cannot see that, and the fault check does not need it. The test
  now asserts each side for what it is.

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