Repository navigation
fix(dream): label admission state-read exceptions state_error, not probe_failed - #23283
Conversation
…obe_failed available_model() mapped every exception from reservation_state.refresh() and dream_headroom() to reason=probe_failed with no exception visibility. The probe callable cannot actually raise into that frame: _probe converts its own failures to 'inconclusive' and refresh runs the probe as a background task, so the old label misattributed shared-state read and transaction errors (prod 2026-10-22: a probe_failed wait 0.45 s after mark_saturated()'s record write to the same state, no gateway probe ran). Exceptions on the shared-state path now wait with reason=state_error and emit one payload-free WARNING per decision carrying the exception class and failing stage (client/refresh/headroom); waiting semantics are unchanged. No bounded retry added: #23051's contention retries cover Firestore transactions, while this state is Redis with its own WATCH/ MULTI retry and read budgets. Co-Authored-By: GLM-5.3 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 99d7ed36bc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # own failures to 'inconclusive' and refresh runs it as a background | ||
| # task, so every exception here is a shared-state read/transaction | ||
| # error. Payload-free class/stage only; messages can embed private bodies. | ||
| reason = 'state_error' |
There was a problem hiding this comment.
Include state_error in the active Dream ramp gate
After this relabel, evidence-path failures no longer emit reason=probe_failed, but the active DREAM_AGENT_PAID_PERCENT rollout criterion in config/feature-flags.yaml:127 still explicitly watches for a probe_failed storm, and the new diagnostic is only a WARNING so it is not covered by the adjacent Dream ERROR criterion. Repeated state-read failures that recover during admission retries can therefore disappear from the documented expansion gate; update the canonical clean metric and its operational query to include state_error before changing the label.
Useful? React with 👍 / 👎.
| local = _local() | ||
| if local.cooldowns.get(DREAM_MODEL, 0) > time.monotonic(): | ||
| return _decision(DREAM_MODEL, 'saturated', waiting=True, source='local_cooldown') | ||
| stage = 'client' |
There was a problem hiding this comment.
Separate policy parsing from client-stage state errors
When either DREAM_RESERVATION_FRESH_SECONDS or DREAM_DEDICATED_UTILIZATION_LIMIT contains a nonnumeric value, the float(...) conversion raises while stage is still client, so this new handler reports state_error stage=client even though the Redis client and shared state are healthy. This undermines the diagnostic distinction introduced here and directs operators toward the wrong subsystem; parse and classify these settings as a policy/configuration error before entering the state-error stages.
Useful? React with 👍 / 👎.
Summary
Every exception from Dream's shared reservation-state path is currently labeled
probe_failed, with nothing logged. That hides the real cause.On 2026-10-22 at 10:21:31Z, one
reason=probe_failed source=evidencewait appeared 0.45 s aftermark_saturated()wrote a 429 record to the same Redis state. It was one wait among 461 admits, and no gateway probe ran.The probe cannot raise into
available_model():_probeconverts its own failures to'inconclusive'(dream_capacity.py:128-129).refresh()launches the probe as a fire-and-forget background task (vertex_reservation_state.py:343-348), and_run_probealso catches (:419-420).So the catch-all only ever saw shared-state errors:
client()construction,refreshtransact/snapshot, and the raw reads and JSON parsing indream_headroom.This PR:
state_error. It emits one payload-free WARNING per decision,dream_capacity_state_error model=… stage=client|refresh|headroom exc=<ClassName>. Exception messages are deliberately not logged, because they can embed private bodies. This follows Dream: retry Firestore contention on turn ledger, admission and discovery; log failure stages #23051's convention.waiting=Trueand admission behavior stay the same.probe_failedatclaim()'s shared-slots site. That site is out of scope.transactalready retriesWatchError3 times, and admission rechecks with jitter. Dream: retry Firestore contention on turn ledger, admission and discovery; log failure stages #23051's Firestore retry is a different store.Verification
backend/tests/unit/test_dream_capacity_fail_open.py:state_error, plus exactly one payload-free WARNING;refreshstays contained and never labels the decision.backend/test.shwithBACKEND_UNIT_TEST_FILE_LIST(7 Dream capacity/reservation files): 336 passed, 0 failed, undernice -n 19 taskpolicy -b.These are unit-level tests only. The prod effect, a
state_errorreason with stage and exception class in the logs, is observable after deploy.Rollout: ships on the next train. Dream's ramp gate counts
state_errorwaits exactly likeprobe_failed, so the relabel cannot make a sweep look cleaner.Product invariants affected
none
Failure class
Failure-Class: none
🤖 Generated with Claude Code