Skip to content

fix(dream): pay the verify allowance twice so a costly first call cannot starve the second - #24209

Merged
Git-on-my-level merged 2 commits into
mainfrom
lane/dream-verify-floor-2
Nov 1, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
lane/dream-verify-floor-2

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Why

#24193 gives Dream's second check (the verifier) its own allowance after a main turn overspends the pass budget. Readback after it went live (revision 908206a, ro-prod dream_pass lines, 11-01 02:10–03:23Z):

  • The allowance was granted on 11 of 33 passes and helped on some of them. At 02:21Z it got 3 dismiss_person edits verified on a pass that had gone over budget.
  • 12 edits on two over-budget passes were still unverified (budget_tokens). On those, the first verifier call cost more than the reserve's per-call estimate, and the second call was refused.

What

  • Allowance doubled. On a served hold (the default), the allowance is now twice the staged items' two-call reserve (VERIFY_ALLOWANCE_FACTOR = 2). The allowance is a cap, so only what the calls actually spend is charged.
  • Cap fixed for large reserves. verify_need also takes the doubled reserve on a served hold. Before this, the 192k evidence floor capped a reserve above 96k.
  • Calibration telemetry.
    • levers.verify_hold.owed records the reserve.
    • levers.verify_hold.verify_used records what the verifier actually spent, on both the two-verifier path and the chain path, and 0 when no verifier ran.
    • Together these let the next readback tune the factor from data.

Spend

  • Everything stays on the gemini-3.8-flash reservation. Dream is reserved-only, so this adds no vendor spend.
  • The extra budget only goes to verifying edits that are already staged.
  • On an over-budget pass, the verifier may be granted up to the overspend plus 2× reserve.
  • Spend is checked after each call returns, the same way the main loop checks its own budget, so the last call can go a bit past what was granted. Nothing caps this on the provider side.

Rollout

  • No new flag. The existing kill switch DREAM_VERIFY_HOLD_MODE=shadow (or off) removes the hold, the allowance and the doubling.
  • Metric that must stay clean: verify_reasons.budget_tokens per day should fall from ~250/day (10-31) toward 0, with no rise in failed passes or in dream_lever_error lever=verify_hold errors.
  • The Dream owner reads back after the train and sets the factor from verify_used / owed.

Tests

  • New tests in backend/tests/unit/test_dream_verify_hold.py. Each one fails when its fix is reverted:
    • a first verifier call that costs 9k against a 9.8k reserve no longer starves the second call;
    • a 150k reserve is still offered at 300k.
  • All 46 tests/unit/test_dream*.py files pass via test.sh under omi-heavy.
  • Luna R1 BLOCK found the cap, the chain-path spend and the no-verifier case. All three are fixed in f7d13a3.

Failure-Class: none

Line-Count-Exception: backend/utils/dream_agent.py | 1598 -> 1606 | the allowance factor and its calibration fields sit with the verify hold they size; splitting the pass loop is out of scope for this fix

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

Git-on-my-level and others added 2 commits November 1, 2026 10:26
…not starve the second

Readback after #24193 (rev 908206a, 02:10-03:23Z 11-01): the allowance rescued
overshot passes (02:21Z, 3 edits verified), but 12 edits on two passes were still
unverified: the first verifier call spent past the reserve's estimate and the
second was refused. Pay the reserve twice (only spend is charged) and log the
reserve (owed) and the verifier's spend (verify_used) to calibrate the factor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…in spend

The 192k evidence floor capped a large doubled reserve; verify_chain never
reported its spend; verify_used was missing when no verifier ran (Luna R1).

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

chatgpt-codex-connector Bot commented Nov 1, 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-11-01T03:38:58.204550Z f7d13a3 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.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

View guided diff | Turn on auto-fix | Re-trigger cubic

@Git-on-my-level
Git-on-my-level merged commit 55a1662 into main Nov 1, 2026
65 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/dream-verify-floor-2 branch November 1, 2026 03:49
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