Skip to content

fix(dream): keep the served verify hold funded after a main turn overshoots - #24193

Merged
Git-on-my-level merged 4 commits into
mainfrom
lane/dream-verify-floor
Oct 31, 2026
Merged

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

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Why

#24166 (verify hold, live since the 10-31 15:11Z train, revision *-14d7e31-*) was meant to stop staged Dream edits from being dropped unverified when a pass runs out of budget. A prod readback shows it doesn't (ro-prod, dream_pass lines on backend-sync, 10-31 15:30–21:18Z):

  • 60 edits unverified in 5.8 h, about 248 a day against the 252/day baseline before the hold.
  • 44 of the 60 have the reason budget_tokens, and most of those come from passes with verifier_calls 0.
  • Those passes end at a weighted spend of 1,005,644–1,057,707 against a 1,000,000 limit, or just over 625,000 on medium passes. The hold (33–80k) was reserved, but a main turn cost more than its pre-call estimate (a cache miss on a 1.3–2.2M-token history) and spent it. The verify lane then has nothing left, and every call raises dream_input_token_budget.

What

  • After the main loop ends, a served hold (DREAM_VERIFY_HOLD_MODE=serve, already the default) gives the main verification call an allowance: the staged items' two-call reserve, minus whatever budget the pass still has. Both invoke_once's remaining budget and verify_budget use it, so batch sizing matches what the calls can afford.
  • The allowance applies only to the dream_verify.verify call. It is cleared in finally, so the value judge and the shadow state pass, which share the verify lane, never draw on it.
  • levers.verify_hold.allowance records the allowance granted on each pass.

Spend

Everything stays on the gemini-3.8-flash reservation; Dream is reserved-only, so there is no new vendor spend. A pass can now go over its token limit by the overshoot already spent plus one two-call reserve for its staged items: 33–80k weighted in the readback, about 3–8% of a heavy pass. That is the same verification #24166 meant to pay for. The judge and state-pass allowances are unchanged.

Rollout

  • No new flag. The fix sits behind the existing kill switch: DREAM_VERIFY_HOLD_MODE=shadow or off removes both the hold and the allowance.
  • Metric that must stay clean: unverified edits per day (verify_reasons.budget_tokens). It should fall well below 252/day, with no rise in failed passes or dream_lever_error lever=verify_hold.
  • The Dream owner reads it back after the train.

Tests

  • New tests in backend/tests/unit/test_dream_verify_hold.py:
    • a served hold still verifies after a 200k overshoot;
    • a shadow hold grants no allowance;
    • the allowance never funds the value judge. This test fails with the finally removed (mutation-checked).
  • All 46 tests/unit/test_dream*.py files pass through test.sh under omi-heavy.
  • Luna review: round 1 BLOCK (the judge leak), fixed in 8ffa796.

Failure-Class: none

Line-Count-Exception: backend/utils/dream_agent.py | 1586 -> 1598 | the verify-lane allowance lives beside the hold and judge/state allowances it must stay scoped against; splitting the pass loop is out of scope for a one-bug fix

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

Git-on-my-level and others added 3 commits November 1, 2026 04:24
…the pass

Prod readback 10-31 (rev 14d7e31): the served hold was spent by main turns that
cost more than their pre-call estimate (cache misses on 1.3-2.2M-token passes),
so verification still refused with dream_input_token_budget (60 unverified in
5.8 h, about 248/day vs 252 before). Give the verify lane an allowance equal to
the staged items' two-call reserve past what the pass has left.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The value judge and the state pass share the verify lane; clear the allowance
when verification returns so it never funds them (Luna review R1).

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

chatgpt-codex-connector Bot commented Oct 31, 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-31T21:40:54.592529Z 488916d 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.

@Git-on-my-level
Git-on-my-level merged commit 172e2a7 into main Oct 31, 2026
56 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/dream-verify-floor branch October 31, 2026 22:29
Git-on-my-level added a commit that referenced this pull request Nov 1, 2026
…not starve the second (#24209)

## 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](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/24209?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/24209?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24209&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
YinkaAdepoju pushed a commit to YinkaAdepoju/omi that referenced this pull request Nov 1, 2026
…not starve the second

Readback after BasedHardware#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]>
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