Skip to content

fix(dream): recover quiet-hour admission behind probe leases; bound late passes - #23331

Merged
Git-on-my-level merged 2 commits into
mainfrom
lane/dream-quiet-hours-admission
Oct 22, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
lane/dream-quiet-hours-admission

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

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_headroom found no 3.8 success evidence within 900 s. Dedicated 3.8 usage fell from ~19M tokens/h to 1.6k. No dream_capacity_probe line 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:

  • Lease priority. Fresh generic probes are skipped, and a waiting admission gets expiring priority after lease expiry (vertex_reservation_state.py). There is still exactly one probe per 600 s lease fleet-wide, with WATCH-atomic claims.
  • Recheck window. It is now sized to outlast a held lease plus one bounded probe and a final read: 22×30 s = 660 s.
  • Late-pass budget (from GLM review). A pass admitted late gets 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 below MIN_PASS_SECONDS = 300.
  • Observability. New payload-free lines: vertex_reservation_probe_claim (claimed/leased/fresh), probe_skip, probe_start, probe_complete and store_unavailable. Each alternative zero-probe cause is now distinguishable in logs.
  • Invariants kept: reserved-only (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

  • Sol: 2,398 passed / 2 skipped across 54 files, the Firestore guards (780 passed, incl. digest pins), and preflight (33 checks).
  • After the late-pass change, under backend/test.sh with nice -n 19 taskpolicy -b:
    • Dream and reservation suites: 11 files, 369 passed / 2 skipped;
    • Firestore guard set: 13 files, all passed.
  • Behavioral repros (test_vertex_reservation_dream_probe.py) failed before the fix.
  • GLM adversarial review: SHIP-WITH-NITS. Findings 1–2 are fixed here. Finding 3 is the mixed-rollout deploy order above. Finding 4 is test fragility only.

These are unit/integration tests only. Prod proof is a quiet-hour sweep logging probe_claim decision=claimed → gateway vertex_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:

  1. Self-heal proven. At least one quiet sweep shows claim → gateway evidence → admit for an owner who first saw stale evidence.
  2. Two consecutive clean sweeps, each with:
    • every due owner admitted or completed (0 owners abandoned on no_states after rechecks);
    • failed < 2/h, 0 Dream ERRORs, 0 spillover tokens;
    • no sweep 500 and no missing candidates= summary;
    • probe_failed/state_error waits ≤ 0.5% of decisions, each followed by an admit within 60 s.
  3. Then 100% via its own PR, and a 6 h soak with the existing rollback trigger plus "any sweep 500 or missing summary".

Product invariants affected

none

Failure class

Failure-Class: none

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

Git-on-my-level and others added 2 commits October 23, 2026 00:53
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]>
@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-22T18:32:26.338707Z 3e45077 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: 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)))

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

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

@Git-on-my-level
Git-on-my-level merged commit 2807488 into main Oct 22, 2026
62 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/dream-quiet-hours-admission branch October 22, 2026 19:31
Git-on-my-level added a commit that referenced this pull request Oct 23, 2026
…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]>
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