feat: Bedrock Converse codec and typed routed-call failure contract - #1
Open
c1-squire-dev[bot] wants to merge 3 commits into
Open
feat: Bedrock Converse codec and typed routed-call failure contract#1c1-squire-dev[bot] wants to merge 3 commits into
c1-squire-dev[bot] wants to merge 3 commits into
Conversation
c1-squire-dev
Bot
force-pushed
the
paul.querna/bedrock-converse-codec
branch
from
August 12, 2026 02:21
f3d5b0f to
567e914
Compare
Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com> Signed-off-by: Paul Querna <paul.querna@conductorone.com>
…tus seam The typed routed-call contract landed with three consumers still reading the legacy shape, so a host that classifies its own failures lost behavior the status-shaped path had. - staged escalation: the efficient-tier fall-through matched only `ContextWindowExceeded`, so a host returning `RoutedCall` terminated the run instead of escalating. It now also accepts an advanceable `ContextWindow` or `TargetIncompatible`, and still honors `Stop` as terminal. - exhaustion status: `ProviderTargetsExhausted` collapsed to 503 with its bounded summary unread. It now resolves from the partition in precedence order -- exact availability evidence or a circuit bypass, then host or provider timeouts, then homogeneous rate-limit and request-shape cases, then a plain routing failure -- so the 429, 504, and 422 public codes are reachable and 503 stays truthful. - overflow exhaustion: an exhaustion whose every real failure was an overflow reported target unavailability, which is the conflation this contract exists to remove. It is now reported as a context-window condition at both seams that consume the distinction: the candidate hop's reason, and the runner's terminal telemetry kind. Bypassed circuits neither establish nor contradict the overflow, and an all-bypassed exhaustion stays unavailability. Mixed classes remain unavailability. `ProviderTargetsExhaustedSummary` grows `real_failures` and `is_context_window_exhaustion` so the aggregate rules are stated once, and rejects an over-long class-entry list before it sizes an allocation. Behavioral tests cover each seam, including the five aggregate-precedence combinations. No existing public type, constructor signature, or client requirement changes. Staged on the D-TB-103 immutable review fork ahead of upstream submission. Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com> Signed-off-by: Paul Querna <paul.querna@conductorone.com>
c1-squire-dev
Bot
force-pushed
the
paul.querna/bedrock-converse-codec
branch
from
September 5, 2026 00:33
0621ca8 to
3036a85
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two independent public-surface additions staged on this fork branch for review.
Rebased onto current upstream
main(5879c10). This branch previously sat onfb3fc30, 133 commits behind.mainon this fork was a stale mirror with no commits of itsown and has been fast-forwarded to the same revision, so this PR is exactly the three commits
below.
Upstream had moved the code these changes touch, so the second and third commits were ported
rather than replayed: routing fallback classification now lives in
libsy-llm-client::run::fallback_reason(it moved out oflibsy::core::algorithm), theescalation classifier lives in
libsy/src/algorithms/escalation.rs, and the newswitchyard-runner::failureclassifier is an additional dispatch point that did not existbefore. Per-session context-window eviction memory was deleted upstream; see the third commit
for how that affects the overflow case.
Bedrock Converse translation codec
bedrock_converseas a first-class protocol formatTyped routed-call failure contract
Lets a routing host classify its own call failures instead of having libsy re-derive
fallback policy from an HTTP status.
RoutedCallFailure,RoutingDisposition, and the non-exhaustiveRoutedCallFailureClasswith immutablestable_tag()values toswitchyard-protocol,plus
LlmClientError::RoutedCallRoutedFailureCount,ProviderTargetsExhaustedSummary). Validating constructors are the only way to buildthese, so a value always satisfies the contract: candidates bounded to 16, unique
nonzero class entries that partition attempts and circuit-open bypasses, no nested
exhaustion, and retry advice capped at 300000 ms
RoutingDispositionfor aRoutedCall.The existing 403/408/429/5xx inference is untouched for the transport- and
status-shaped variants, so current clients keep their behavior
RoutedCallat every semantic dispatch point: libsy fallback classification, judgebounded reasons, client observability labels (reusing the immutable stable tag), and
switchyard-serverstatus/body mapping with a rounded-upRetry-Afterwhen the hostsupplied truthful advice
The types are provider-neutral by construction: bounded class tags, an optional bounded
provider status, and counts only — no provider body, message, or target name.
Follow-up commit
fix(routing): honor routed-call classes at every fall-through and status seamcloses three gaps found in review of the commit above:ContextWindowExceeded, so ahost returning
RoutedCallterminated the run instead of escalating to the capable tier.It now also accepts an advanceable
ContextWindoworTargetIncompatible, and stilltreats
Stopas terminalProviderTargetsExhaustedcollapsed to 503 with its bounded summary unread. The statusnow resolves from the partition in precedence order — exact availability evidence or a
circuit bypass, then host or provider timeouts, then the homogeneous rate-limit and
request-shape cases, then a plain routing failure — so the 429, 504, and 422 codes are
reachable and 503 stays truthful. No provider status is consulted
which is exactly the conflation this contract exists to remove. It is now reported as a
context-window condition at both seams that consume the distinction: the candidate hop's
reason, and the runner's terminal telemetry kind, where it previously fell into
Other.Bypassed circuits neither establish nor contradict the overflow, and an all-bypassed
exhaustion stays unavailability; mixed classes remain unavailability
ProviderTargetsExhaustedSummarygrowsreal_failuresandis_context_window_exhaustionsothe aggregate rules are stated once for all three consumers, and rejects an over-long
class-entry list before it sizes an allocation. No existing public type, constructor
signature, or client requirement changes.
Note for reviewers: upstream deleted per-session overflow memory, so the repeat-overflow cost
the third bullet originally eliminated is real again on this base for every client, not just
routed-call hosts. This branch keeps the classification truthful but does not re-add the
memory — that reverses an upstream decision and is worth deciding deliberately.
Validation
cargo fmt --all --checkcargo build --workspacecargo test --workspace -- --test-threads=1cargo clippy --workspace --all-targets -- -D warningsRUSTDOCFLAGS=-D warnings cargo doc --locked --no-deps --package switchyard-libsy --package switchyard-protocolThis fork PR is the review staging point before a human submits the change upstream to
NVIDIA-NeMo/Switchyard, per D-TB-103.