Skip to content

Dream: recheck reserved capacity before giving up the sweep; hold paid ramp at 0% - #23041

Merged
Git-on-my-level merged 2 commits into
mainfrom
lane/dream-drain-probe-wait
Oct 21, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
lane/dream-drain-probe-wait

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Summary

Follow-up to #23016, which moved Dream onto the 3.8 reservation with on-demand off. It is live in f162bdb.

dream_agent.drain() now gates every hourly sweep on a single dream_capacity.available_model(mode='reserved') call. When the shared 3.8 evidence is older than DREAM_RESERVATION_FRESH_SECONDS (15 min), that call:

  • claims the probe lease;
  • starts the probe that would refresh the evidence, in the background;
  • but answers no_states straight away.

So the sweep records waiting and gives up, and no owner runs for the hour.

In prod, the 12:00Z sweep on 2026-10-21 logged Dream sweep candidates=1 ... waiting=1 with dream_capacity_decision reason=no_states, and no pass ran. Before #23016 the allowlisted owner ran on-demand, which skipped this gate, so the gap never showed.

Fix: when the first check is closed, recheck up to 4 times, 30 s apart, before reporting reserved_capacity. That is at most 2 minutes, well inside DRAIN_TIMEOUT_SECONDS. Per-pass run_pass admission is unchanged: its worker already retries waiting every 60 s.

Also: hold the paid ramp at 0%. At 13:00Z the first 5% sweep failed about 17 cohort passes within seconds (error_type=other, applied=0, no on-demand spend). That breaks the ramp's clean metric (<2 failed/h). The rollout lead set DREAM_AGENT_PAID_PERCENT=0 live, and this commit sets '0' in the prod overlay so trains don't re-apply 5. The listed owner stays eligible. The failure cause is being diagnosed separately; the ramp resumes only after it is fixed.

Tests

backend/test.sh with BACKEND_UNIT_TEST_FILE_LIST, under nice/taskpolicy with 2 workers:

  • test_dream_capacity: 13
  • test_dream_agent_admission: 7
  • test_dream_sweep: 6
  • test_dream_report: 9

All passed. New: test_sweep_rechecks_after_stale_evidence_before_giving_up, which opens on the third check and fails on main. The existing closed-sweep test now asserts 1 + 4 checks. These results are unit level only.

Live check after deploy: hourly sweeps show complete or waiting per owner instead of a sweep-level reserved_capacity wait, and owner passes resume.

Review

GLM-5.3 (zcode) returned SHIP-WITH-NITS. It confirmed:

  • the recheck observes the probe's Redis publication (the 1 s snapshot and the lease don't hide it);
  • 120 s fits asyncio.timeout(1680), the 1710 s middleware limit and the 1740 s Scheduler deadline, with no retries and no overlap;
  • the on-demand path is unchanged;
  • both tests fail on origin/main.

Nits, accepted as is:

  • the new test proves re-polling, not probe→publication end to end;
  • after an inconclusive probe the rechecks burn 120 s before the same waiting;
  • in the worst case one full-length pass is cut about 65 s early by the drain deadline, which degrades to deadline with TTL fences, as designed.

Product invariants affected

  • INV-MEM-4

Matched only because backend/deploy/runtime_env.yaml changed (the Dream paid percent). Memory intake and promotion are unchanged.

Failure class

Failure-Class: none

🤖 Generated with Claude Code

With on-demand off, drain() gates every hourly sweep on one
available_model(mode='reserved') call. When the 3.8 evidence is older than
DREAM_RESERVATION_FRESH_SECONDS, that call starts the probe that would refresh
it but answers no_states immediately, so the sweep records waiting and no owner
runs for an hour (prod 2026-10-21 12:00Z: candidates=1 waiting=1 no_states).
Recheck up to 4 times, 30s apart, before reporting reserved_capacity.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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-21T13:47:24.988375Z d96fabb New commits
ℹ️ 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.

Manifest follow-up to the live DREAM_AGENT_PAID_PERCENT=0 rollback, so trains
stop re-applying 5. The listed owner stays eligible.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level Git-on-my-level changed the title Dream sweep: recheck reserved capacity before giving up the hour Dream: recheck reserved capacity before giving up the sweep; hold paid ramp at 0% Oct 21, 2026
@Git-on-my-level
Git-on-my-level merged commit fd343aa into main Oct 21, 2026
60 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/dream-drain-probe-wait branch October 21, 2026 13:58
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