Repository navigation
Dream: retry Firestore contention on turn ledger, admission and discovery; log failure stages - #23051
Merged
Merged
Conversation
Retry atomic read-time aborts and SDK commit-exhaustion wrappers with the existing bounded transaction helper. Keep ambiguous failures unreplayed. Log payload-free exception class, stage and source location, including drain retries after capacity waits. Co-Authored-By: Codex Sol <[email protected]>
Apply the existing bounded transaction-contention helper to owner acquisition and each discovery page. Preserve admission, reclamation and queued due-row semantics; classify exhausted contention explicitly in pass metrics. Refresh both discovery query-coverage digests and cover read-abort recovery plus exhaustion. Validation: 557 passed, 1 deselected across seven targeted backend test files. Seven new regression cases fail on c88bae0 and pass with this change. Co-Authored-By: Codex Sol <[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. |
Git-on-my-level
added a commit
that referenced
this pull request
Oct 21, 2026
… contention fix (#23065) * config(dream): re-ramp paid owners to 5% with concurrency 8 after the contention fix The first 5% sweep failed on Firestore Aborted contention (fixed in #23051). Re-ramp at 5% and cap Dream workers at 8 on all four Cloud Run services. Co-Authored-By: Claude Opus 5.5 <[email protected]> * config(dream): classify DREAM_AGENT_CONCURRENCY as a deploy config binding Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Git-on-my-level
added a commit
that referenced
this pull request
Oct 22, 2026
…obe_failed (#23283) 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]>
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
At 2026-10-21 13:01Z, prod's first Dream sweep with 5% of paid owners failed about 18 passes in seconds on one backend-sync instance:
turns=0,error_type=otherandapplied=0;ValueError.The ramp was rolled back to
DREAM_AGENT_PAID_PERCENT=0(#23041).Root cause (Codex Sol, high confidence in the defect, moderate in prod attribution).
database/dream_turns.reserve/settleran Firestore transactions without the existing helper that retries transaction-readAborted.Abortedescapes, and exhausted commit retries surface asValueError from Aborted.Abortedfalls outside the metrics allowlist, so it's labelledother.Fix.
reserveandsettle;dream_store.acquire's claim;dream_scheduler.discover's initialize. A discover abort previously killed the whole sweep with no report.file:func:lineno), with no uid, message, document path orexc_info.drainrecords worker failures.FirestoreContentionExhaustedis added to the metricERROR_TYPES.discover's Firestore query-shape digest is re-pinned in both registry locations.Review
GLM-5.3 (zcode) returned SHIP-WITH-NITS. It confirmed:
Findings and what happened to them:
acquireanddiscovertransactions were unwrapped.FirestoreContentionExhaustedrendered asother.integrationand excluded fromtest.sh).Verification
Codex Sol ran
backend/test.shwithBACKEND_UNIT_TEST_FILE_LIST, under nice/taskpolicy with 2 workers. Final head: 557 passed, 1 deselected across 7 targeted files, including 495 Firestore query-shape tests and 18 scheduler tests. Every new regression case failed before the patch.A local Firestore-emulator run with 20 concurrent owners passed, preserving receipts, spend and minute totals.
These are unit and emulator results only.
Re-ramp plan
After deploy, re-ramp
DREAM_AGENT_PAID_PERCENTto 5 withDREAM_AGENT_CONCURRENCYcapped (8), as one config change. Watch:The clean metric is unchanged: <2 failed passes per hour.
Product invariants affected
none
Failure class
Failure-Class: none
🤖 Generated with Claude Code