feat(renderer): send x-deadline-ms to the cloak sidecar mirror call#325
Merged
Conversation
Propagate the cloak arm's per-call budget (deadline.remaining().min(35s)) as an x-deadline-ms header on every mirror_once request, unconditionally (including attempt 0). Lets the sidecar deliver a slow cold solve in-band up to what the engine will actually wait, instead of fail-opening at its conservative default. Feature-gated (cloak) and inert when the tier is off. budget is guarded non-zero above, so x-deadline-ms: 0 is never emitted.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Lets the cloak sidecar deliver a slow cold solve in-band instead of fail-opening at its conservative default. Pairs with the crw-saas sidecar PR that honors the header.
What
One unconditional header on
mirror_once(crw-renderer/src/cloak.rs):x-deadline-ms = budget.as_millis(), wherebudget = deadline.remaining().min(CLOAK_DEFAULT_TIMEOUT_MS 35s)(the exact time the engine will wait). Sent on every call including attempt 0 (bypass=false), which is the generous-deadline first-request case this exists for.Why
Today the sidecar cannot see how long the engine will wait, so it self-caps at a conservative ~23s and fail-opens even when the engine granted up to 35s. With the header, a ~24s cold solve returns real content in-band on the first request for cloak-entitled (generous-deadline) traffic; tight-deadline requests still fail-open gracefully.
Safety
cloak): inert when the tier is compiled out or unconfigured; the whole function is under#[cfg(feature = "cloak")].budgetis guarded non-zero by the early return above, sox-deadline-ms: 0is never emitted.Verification
cargo fmt --check+clippy -D warnings+cargo test --workspace(773 tests) all pass via the pre-commit hook. The paired sidecar was verified in-container honoring the header (generous-deadline first request returns in-band).Ref: PLAN-cloak-deadline.md and the crw-saas cloak-sidecar PR.