Skip to content

fix(dream): label admission state-read exceptions state_error, not probe_failed - #23283

Merged
Git-on-my-level merged 1 commit into
mainfrom
lane/dream-capacity-error-label
Oct 22, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
lane/dream-capacity-error-label

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

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=evidence wait appeared 0.45 s after mark_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():

  • _probe converts 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_probe also catches (:419-420).

So the catch-all only ever saw shared-state errors: client() construction, refresh transact/snapshot, and the raw reads and JSON parsing in dream_headroom.

This PR:

Verification

  • 4 new tests in backend/tests/unit/test_dream_capacity_fail_open.py:
    • a state exception at each of the 3 stages → state_error, plus exactly one payload-free WARNING;
    • a raising probe through a real refresh stays contained and never labels the decision.
  • backend/test.sh with BACKEND_UNIT_TEST_FILE_LIST (7 Dream capacity/reservation files): 336 passed, 0 failed, under nice -n 19 taskpolicy -b.

These are unit-level tests only. The prod effect, a state_error reason with stage and exception class in the logs, is observable after deploy.

Rollout: ships on the next train. Dream's ramp gate counts state_error waits exactly like probe_failed, so the relabel cannot make a sweep look cleaner.

Product invariants affected

none

Failure class

Failure-Class: none

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

…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]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T10:55:22.306512Z 99d7ed3 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit cb5a5bf into main Oct 22, 2026
62 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/dream-capacity-error-label branch October 22, 2026 11:05
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