Repository navigation
fix(dream): recover quiet-hour admission behind probe leases; bound late passes - #23331
Conversation
Skip generic discovery while strict evidence is fresh. Give an expiring admission waiter the next probe window without stealing the shared lease, and recheck long enough for a full lease plus a bounded probe to complete. Keep the reserved-only gateway route and strict completed PT publication. Add scoped claim, execution and evidence diagnostics, clock-driven quiet owner recovery coverage, independent scope checks and operator log guidance. Co-Authored-By: Codex Sol <[email protected]>
The longer quiet-hour recheck window (up to 660 s) could admit a pass with far less than PASS_TIMEOUT_SECONDS of drain budget left, so the drain's outer timeout cancelled it mid-flight and discarded reserved-capacity work. Each pass now gets min(PASS_TIMEOUT_SECONDS, remaining drain - FINISH_MARGIN_SECONDS), and no pass starts below MIN_PASS_SECONDS. Runbook notes the probe kill switch signature. Addresses GLM review findings 1-2 on the quiet-hours fix. Co-Authored-By: Claude Opus 5.5 <[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: 3e450778f9
ℹ️ 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".
| return | ||
| try: | ||
| report = await run_pass(uid) | ||
| report = await run_pass(uid, timeout_seconds=int(min(PASS_TIMEOUT_SECONDS, remaining))) |
There was a problem hiding this comment.
Include pass setup in the remaining deadline
When a late pass spends more than FINISH_MARGIN_SECONDS in the pre-session work inside run_pass—such as generated-compute checks, cohort loading, capacity claiming, seed loading, or lease acquisition—the supplied timeout still starts only when run_session begins. Consequently its own deadline extends beyond drain_deadline, so the outer drain timeout can still cancel the pass and leave its leases/slot to expire, defeating the late-pass bounding this change intends. Pass an absolute deadline through the setup path or reduce the session timeout by elapsed setup time.
Useful? React with 👍 / 👎.
| # A pass starting late in the drain gets only the drain's remaining budget, so | ||
| # it ends through its own deadline (and finish) instead of being cancelled by the | ||
| # drain's outer timeout; below this floor the owner waits for the next sweep. | ||
| MIN_PASS_SECONDS = 300 |
There was a problem hiding this comment.
Raise the minimum late-pass budget above the reserved tail
run_session reserves 300 seconds by passing max(1, timeout_seconds - 300) to the main agent loop, so allowing a pass at MIN_PASS_SECONDS = 300 gives a non-idle owner only a one-second model deadline. A candidate reached when 300–301 seconds remain will therefore acquire capacity and an owner lease but cannot realistically complete even its first gateway turn, after which the timeout path deliberately retains those leases. Set the floor high enough to include both the 300-second verification reserve and a viable main-turn window.
Useful? React with 👍 / 👎.
…sed gate) (#23374) Discovery is bounded (#23302) and quiet-hour admission self-heals (#23331; proven 05:00Z 10-23). David approved the revised gate 10-23: self-heal plus two clean sweeps, then this env-only apply and a 6h soak. Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
Dream admission stalls in quiet hours. On 2026-10-22, the 16:00Z and 17:00Z sweeps each had one due owner, who waited on
dream_capacity_decision reason=no_states:dream_headroomfound no 3.8 success evidence within 900 s. Dedicated 3.8 usage fell from ~19M tokens/h to 1.6k. Nodream_capacity_probeline had been logged since 08:27Z.Cause (reproduced in tests): lease starvation. Generic discovery could renew the shared 600 s probe lease while evidence was still fresh. A waiting Dream admission then sat behind an inconclusive probe, and the drain's 4×30 s recheck window was shorter than the lease. The gateway's strict PT publication does refresh admission evidence when scopes match (an integration test proves it), and an HTTP 200 alone still teaches nothing.
Fix:
vertex_reservation_state.py). There is still exactly one probe per 600 s lease fleet-wide, with WATCH-atomic claims.min(PASS_TIMEOUT_SECONDS, remaining drain − FINISH_MARGIN_SECONDS), so it ends through its own deadline instead of being cancelled by the drain's outer timeout. No pass starts belowMIN_PASS_SECONDS = 300.vertex_reservation_probe_claim(claimed/leased/fresh),probe_skip,probe_start,probe_completeandstore_unavailable. Each alternative zero-probe cause is now distinguishable in logs.dream_reserved_only, a single provider attempt, no LKG/spillover), all kill switches (DREAM_AGENT_ENABLED,DREAM_GATEWAY_PROBE_ENABLED,DREAM_ON_DEMAND_ENABLED), and no PT inference from HTTP 200.Deploy requirement
Rebuild and release every reservation writer from this source: backend (incl. backend-sync), desktop-backend, and llm-gateway. An older reducer drops the new priority field when it rewrites the shared doc, which reinstates starvation (liveness only; the lease still prevents duplicate probes).
Verification
backend/test.shwithnice -n 19 taskpolicy -b:test_vertex_reservation_dream_probe.py) failed before the fix.These are unit/integration tests only. Prod proof is a quiet-hour sweep logging
probe_claim decision=claimed→ gatewayvertex_reservation_evidence outcome=dedicated_success→dream_capacity_decision decision=admit.Revised Dream 100% re-ramp gate (proposal; ramp is a separate PR)
At 25% the backlog has drained (candidates 53 → 27 → 1 per sweep), so "complete ≥ 8" is unreachable. Once this serves, the proposal is:
no_statesafter rechecks);candidates=summary;probe_failed/state_errorwaits ≤ 0.5% of decisions, each followed by an admit within 60 s.Product invariants affected
none
Failure class
Failure-Class: none
🤖 Generated with Claude Code