Skip to content

Dream: run on the 3.8 reservation and ramp to paid owners - #23016

Merged
Git-on-my-level merged 5 commits into
mainfrom
lane/dream-reservation-cutover
Oct 21, 2026
Merged

Git-on-my-level merged 5 commits into
mainfrom
lane/dream-reservation-cutover

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Summary

The Vertex reservation moved from gemini-2.5-flash to gemini-3.8-flash at about 2026-10-20 23:00Z. Vertex online_serving metrics show:

  • the 2.5 dedicated traffic stops after 22:00Z;
  • 3.8 dedicated starts at 23:00Z.

Since then the 3.8 reservation has served only our reservation probes, about 7–10 calls an hour. Dream's real passes for the allowlisted owner ran on paid on-demand 3.8 instead, about 4–6M tokens an hour between 00:00Z and 05:00Z. The reservation's own probe state flipped 2.5 to inactive (exclusive_order_moved) at 01:11Z, and dedicated 3.8 probes return 200.

This change puts Dream on the reservation and starts a ramp to paid owners. David approved the ramp on 2026-10-21.

  • Reserved capacity only. DREAM_ON_DEMAND_ENABLED=false on prod backend, backend-sync, backfill and integration. Passes run on backend-sync's hourly sweep, so every pass now takes the reserved path, which is gated on the reservation probe and headroom (DREAM_DEDICATED_UTILIZATION_LIMIT, default 0.7). When the reservation is full, Dream waits. The gateway flag is untouched; with no on-demand requests arriving, it doesn't matter.
  • listen and pusher stay on allowlist, so this PR needs no listen roll to take effect. Their DREAM_ON_DEMAND_ENABLED is also set to false here. The backend-listen image mounts the manual-run route, so this closes the last on-demand path on their next roll. The cost: live-capture writes enqueue only the listed owner. Other ramp owners enter through discovery and backend/backend-sync writes. Moving listen and pusher to paid goes in a later listen roll, before step 3 of the ramp.
  • Cadence restored. DREAM_AGENT_PASSES_PER_DAY goes from 6 to 48 on backend, backend-sync and backfill. backend/deploy: cap Dream at 6 passes/day until the reservation switch #22066 cut it to 6 while we waited for the reservation switch.
  • New ramp knob, DREAM_AGENT_PAID_PERCENT. Under DREAM_AGENT_ELIGIBILITY=paid, an owner is eligible when they are on a paid plan and their stable bucket, sha256('dream-agent-paid:'+uid) % 100, is below the percent.
    • Unset admits every paid owner. A malformed value admits nobody from the ramp.
    • Listed owners (DREAM_AGENT_UID_ALLOWLIST) stay eligible at any percent. They are checked against the cached member list, never with a per-owner Firestore read.
    • Widening the percent only adds owners.
  • Prod eligibility on the four Cloud Run services changes from allowlist to paid at 5%. Auto-apply stays limited to title, overview and vocabulary.

Ramp plan

Step Cohort Hold Must stay clean Who expands
1 listed owner + 5% of paid owners 1h after the deploy is serving <2 failed passes per hour; no new Dream ERROR signatures on backend-sync; no dream_capacity_decision probe_failed storm; 3.8 dedicated utilization stays under the 0.7 headroom limit (waits are expected and fine); no 2.5/3.8 on-demand Dream spend Dream lane (Claude session), via one config PR on Nemotron's train
2 25% 3h same, plus undo rate under DREAM_AGENT_UNDO_RATE (0.2) same
3 100% of paid owners (DREAM_AGENT_PAID_PERCENT unset) 6h soak same same

Target: 100% of paid owners by 2026-10-22 12:00Z. Rollback is DREAM_AGENT_PAID_PERCENT=0, which leaves only the listed owner. The kill switch is the existing dream_control/global document or DREAM_AGENT_ENABLED=false.

Review

GLM-5.3 (zcode) reviewed this and returned SHIP-WITH-NITS. Follow-ups:

  • Major (fixed): backend-listen kept on-demand true for the listed owner's manual runs. Its prod values and overlay now set false; this takes effect on the next listen roll.
  • Nit (fixed): discovery deleted dream_due for every ineligible scanned row. Under paid that is about 10k no-op deletes per sweep. It now deletes only rows that exist.
  • Nit (documented): the dirty-signal freshness gap for ramp owners whose writes land on listen. See the listen and pusher bullet above.

GLM verified that allowlist behaviour is unchanged, that a malformed percent fails closed, that widening only adds owners, and that the paid branch adds no per-owner read. It also traced the reserved-only path across admission, capacity, transport and gateway.

Verification

  • backend/test.sh with BACKEND_UNIT_TEST_FILE_LIST, under nice -n 19 taskpolicy -b with 2 workers:
    • test_dream_paid_ramp (9, new)
    • test_dream_scheduler
    • test_dream_agent_admission
    • test_dream_cohort
    • test_dream_guards
    • test_backend_runtime_env_validator (146)
  • All passed. That is unit and manifest level only.
  • backend/deploy/runtime_env.yaml was regenerated with compose_runtime_env.py. scripts/check_feature_flag_registry.py reports OK, and the registry doc was re-rendered.
  • The live check comes after the deploy:
    • the backend-sync image tag contains this merge;
    • dream_capacity_decision reasons switch from allowlisted_on_demand to fresh_reservation_saturation_clear;
    • Vertex 3.8 dedicated invocations and consumed throughput rise above the probe floor;
    • 3.8 shared stays at 0.

Product invariants affected

  • INV-MEM-4

Matched only because backend/deploy/runtime_env.yaml changed. The change touches Dream eligibility, capacity and cadence values; memory intake and promotion paths are unchanged.

Failure class

Failure-Class: none

🤖 Generated with Claude Code

Git-on-my-level and others added 3 commits October 21, 2026 16:45
The Vertex reservation moved from gemini-2.5-flash to gemini-3.8-flash
around 2026-10-20 23:00Z. Since then it has served only reservation
probes, while the allowlisted owner's passes ran on paid on-demand
capacity.

- DREAM_ON_DEMAND_ENABLED=false on prod backend services, listen and
  pusher, so every Dream pass uses the reservation; reservation headroom
  is Dream's global cap.
- DREAM_AGENT_PASSES_PER_DAY 6 -> 48 on backend, backend-sync and
  backfill, restoring the pre-switch cadence.
- New DREAM_AGENT_PAID_PERCENT: a stable per-owner bucket (salted
  sha256 % 100) under ELIGIBILITY=paid. Unset means all paid owners;
  malformed admits none. Listed owners stay eligible at any percent and
  are checked against the cached member list, not with a per-owner read.
- Prod eligibility allowlist -> paid at 5%.

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

One declaration source per ramp key: DREAM_AGENT_PAID_PERCENT lives in
the prod Cloud Run overlay only. Passes run on backend-sync, so listen and
pusher need no roll for this step.

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-21T10:38:26.484411Z b45a66c 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.

Git-on-my-level and others added 2 commits October 21, 2026 17:19
Same queries; the transaction now deletes only existing dream_due rows.

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

@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: b45a66c5df

ℹ️ 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".

Comment on lines +54 to +55
raw = os.getenv('DREAM_AGENT_PAID_PERCENT', '100').strip()
if not raw.isascii() or not raw.isdigit() or int(raw) > 100:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restart discovery when widening the paid cohort

When the user collection exceeds one 20-page discovery scan, changing the rollout from 5% to 25% or 100% does not promptly add all newly eligible owners: paid_percent() reads the new value immediately, but dream_scheduler.discover() resumes from its persisted after cursor, so owners in pages already scanned at the lower percentage are not reconsidered until the entire collection wraps; any previous dream_due row for them is also deleted by the new ineligible-row branch. This can omit part of each intended ramp cohort for many hours or days and skew the rollout results, so reset/version the discovery cursor when the configured percentage changes or otherwise retain candidates that may enter on widening.

Useful? React with 👍 / 👎.

and not uid.startswith('dream-canary-')
and eligibility() != 'invalid'
and (eligibility() != 'allowlist' or _allowlisted(uid))
and (eligibility() != 'paid' or _paid_cohort(uid))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reject free bucket members before reserving capacity

When a non-paid owner hashes into the selected percentage and still has a dream_due row, such as after downgrading while queued, _paid_cohort() makes may_be_eligible() return true even though the authoritative eligible() check will reject the owner. Consequently run_pass() claims a reserved-capacity slot and executes the full dream_seed.load() history read before dream_store.acquire() checks the plan; that denial reschedules the due row instead of removing it, so subsequent sweeps repeat the expensive reads. Enough stale free-owner rows can fill the 5,000-owner candidate page and delay the actual paid cohort, so check authoritative paid eligibility and remove the row before claiming capacity or loading the seed.

Useful? React with 👍 / 👎.

Comment on lines +127 to +128
in_paid_ramp(uid)
and (user.get('subscription') or {}).get('plan', user.get('plan', '')) in PAID_PLAN_IDS

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Apply the canonical subscription validity check

With production now using the paid policy, an expired account is admitted whenever its stored plan remains in PAID_PLAN_IDS, because this check ignores subscription status and current_period_end. The repository's canonical config.plan_catalog.resolve_subscription_entitlements() explicitly resolves a paid-plan row with a missing or elapsed period to basic, and resolves inactive rows to basic once their period closes; candidate_page() does not even project those fields. These churned accounts can therefore receive full Dream passes, consume reserved capacity, and contaminate the paid-owner ramp, so project the validity fields and use the canonical entitlement result rather than raw plan membership.

Useful? React with 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit f162bdb into main Oct 21, 2026
66 of 68 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/dream-reservation-cutover branch October 21, 2026 10:59
Git-on-my-level added a commit that referenced this pull request Oct 21, 2026
…s shadow env reads (M3 merge)

- backend/deploy/ops/{prod,staging}.yaml: DREAM_AGENT_PASSES_PER_DAY 6 -> 48 on
  backend-sync-backfill, matching main's #23016 manifest change; test_config_train
  requires the ops file and the prod manifest to agree.
- batch_stage_env_baseline.json: main's batch shadow reads (compute_client.shadow_from_env,
  ShadowRunner.__init__), annotated.

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