Repository navigation
Dream: count owner decisions per kind; pause a kind after 3 recent undos - #24168
Merged
Merged
Conversation
… undos dream_outcome JSON records (kind, undo/redo/accept/dismiss, applied-age bucket) on Undo/Redo of Dream changes and on Review answers; verifier_by_kind on every dream_pass. Demotion adds a low-volume backstop: DREAM_AGENT_UNDO_RECENT_COUNT (3) undos among changes applied in the last DREAM_AGENT_UNDO_RECENT_DAYS (7) pause that kind for the owner, alongside the existing 30-day rate rule whose 10-sample floor never protected owners Dream reaches weekly. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…aise Review fixes: demotion and outcome records use the change's edit_kind (memory- target spelling keys 'memory'; accepted proposals are re-keyed agent:user:); an accepted proposal counts as accept even when it wrote nothing new; the main Undo/Redo path records the transition its transaction committed; telemetry error accounting is best-effort; the runbook names what is and is not counted. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level
added a commit
that referenced
this pull request
Oct 31, 2026
…eled calibration export (#24171) ## Summary This adds an edit-level **value judge** in shadow, the instrument the rest of the Dream bitter-lesson plan gates on. It follows #24166 (verify hold) and #24168 (owner-decision records and the low-volume Undo backstop). The second check asks whether an edit is *supported*. The judge asks whether the owner is *better off*, which is what we actually want to maximise. Hand-weighted edit counts can't tell 800 great edits from 800 useless ones, and 98% of today's applied edits are dismissals of junk people. ## Design - **Sampling.** Stratified and owner-independent: - every applied edit of a rare, high-stakes kind (merges, memory/task edits, `close_task`, `entity_summary`, `set_language`); - `DREAM_JUDGE_COMMON_PERCENT` (2%) of the common kinds, chosen by a salted hash of the edit key. Nothing about the owner affects selection (INV-MEM-5). - **Blind input.** The judge sees the owner-visible change view from `change_view.edit_change`: kind, before/after, speaker-marked cited speech and record labels. It never sees the proposer's reason or the verifier votes. - **Cost and capacity.** - One call per judged pass covers up to 25 edits, the pass edit cap, so no rare edit is dropped. - It runs only after **scheduled** owner passes: never canary, dry-run, manual or operator CLI runs. - It is **reserved capacity only**: `model_turn(reserved_only=True)` never uses on-demand capacity. - Spend is bounded by `DREAM_JUDGE_TOKENS_PER_PASS` (60k) and `DREAM_JUDGE_MAX_CALLS_PER_SWEEP` (4), at most about 1% of the reserved daily draw. Expected spend is far lower. - **Output.** Content-free `dream_judge` records (kind, stratum, verdict, three 0–2 scores) and `levers.value_judge` counts. It changes no outcomes, and judge failures fail open. `DREAM_VALUE_JUDGE_MODE` is off/shadow, default shadow. - **Calibration (David 2026-10-31: David labels in decision-mill, via an in-pod export of his own changes).** - `backend/scripts/dream-label-export.py` runs in an isolated operator pod. - It refuses any owner not listed in `DREAM_LABEL_EXPORT_UID_SHA256S` (fail closed). - It samples that owner's journaled Dream changes and judges the same projection on reserved capacity within one total allowance, stopping after any failed call. - It prints decision-mill `proposal` items to operator stdout, with the judge verdict under `hidden` so labeling stays blind. - Labels never enter git. - Judge scores gate nothing until their agreement with owner labels reaches 0.7. ## Ramp plan - Shadow on deploy (records only). - Weekly calibration on David's account. - Judge-based gates for later Dream changes are enabled only at ≥ 0.7 agreement with owner labels. **Clean metric:** judge tokens ≤ 1% of daily Dream weighted tokens; zero `dream_lever_error lever=value_judge`; `dream_judge` carries only bounded labels and scores. **Expander:** dazheng, by 2026-11-14. **Rollback:** `DREAM_VALUE_JUDGE_MODE=off`. ## Verification - `tests/unit/test_dream_judge.py` (20 tests) covers: - stratification (rare always; common share about 2%, deterministic and owner-independent); - env controls fail closed; - a blind projection that includes cited speech with speakers; - supplied-id filtering and fail-open; - content-free records; - end to end: a sampled applied edit is judged, an unsampled one is not, and judge-off makes no call; - manual and `judge=False` runs are not judged; - one call covers the edit cap; - per-sweep caps survive overlapping sweeps; - reserved-only transport; - export consent, blindness and speaker names, and stopping after a failed call. - The Dream, agent-capabilities, review and Firestore guard suites pass under `backend/test.sh`. - Luna adversarial review: - Round 1: BLOCK, 6 findings fixed (cited speech, the 8-item cap, cost caps, on-demand capacity, export consent, manual runs). - Round 2: BLOCK, 4 P2s fixed (the CLI path, export spend on failure, overlapping sweep counters, export speaker names). - These are unit-level results. **Prod proof:** `dream_judge` records in backend-sync logs, and `levers.value_judge` on `dream_pass`. ## Product invariants affected None. Sampling is owner-independent, the judge is shadow-only, and the export is operator-only for a consenting owner. ## Failure class Failure-Class: none 🤖 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/24171?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/24171?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24171&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. -->
Git-on-my-level
added a commit
that referenced
this pull request
Nov 1, 2026
…ate pass in shadow (#24293) ## Why Dream's weekly state pass has been merged and off since #24166, #24168 and #24171 went live. The rollout lead approved turning it on in shadow (bus 88966c). Until it runs in shadow, we have no numbers to decide whether it should ever serve. ## What Sets `DREAM_STATE_PASS_MODE=shadow` in the prod overlay on `backend-sync`, which runs the sweep today, and on `backend-sync-backfill`, where #24216 moves it once the scheduler is reconciled. Setting both means the flag doesn't get lost in the move. `runtime_env.yaml` and the feature flag registry doc are regenerated, and the flag is added to the deployment-setting classification. In shadow, the pass's people and task cleanup proposals go through staging and the two verifiers and are never applied or offered. It does write: the ref-grounded profile v2 and the planner's notes on each processed owner's user doc (`users/{uid}.ai_user_profile_v2`), and the `last_state_pass_at` cadence stamp on the owner's `dream_users` state record. No product feature reads the profile v2 or the notes yet, so no user sees any change; the state pass itself rereads them for its next run. **Voice fix:** verifier evidence for a person now comes from an allowlist (`PERSON_EVIDENCE_FIELDS` in `dream_verify.py`). Reading a person record in full returns `speaker_embedding`, the speech sample fields and the nested `person_voice_base` and `person_voice_confirmations`, and staging needs them to protect that person, so they can't be dropped at read time. A person with voice data can't be an edit target, but one cited only as evidence would have sent those fields to the verifiers. In a person's evidence row, verifiers now get only the listed fields, plus `has_voice_profile: true` when real voice data exists. A voice field added later stays out by default. This also covers the main Dream loop's verifier calls, which use the same function. **Not fixed here (main loop only, existing live behaviour, flagged to David):** - The main loop's `read` tool (`agent_capabilities/session.py`) can return a full person row, voice fields included, to the planning model. - A staged question's `quote` is matched against the full cited record (`guards.verbatim_quote`) and sent in the verifier payload, so a model that read a person's sample transcript could quote it to a verifier. The state pass reaches neither: its planner gets slim projections, and `StatePlan` has only cleanup and profile ops, so it cannot stage a question. **Data the pass reads:** the planner sees slim projections (people without voice fields, generated tasks, memory facts, conversation titles). Staging and the cleanup verifiers then read the records the plan cites, up to 48 per pass, with person rows narrowed as above; the profile-line check uses the slim projections. A whole-conversation citation sends that conversation's full transcript text to the verifiers. This is the same read path and reserved model the main Dream loop already uses, with no new provider, but this PR does turn that flow on for the state pass. The 1800s backfill request timeout the lead also approved is **not** in this PR. The deploy passes per-service flags only for `backend-integration`, so setting it in source means editing `.github/actions/`, which needs David to name the change. Details are on the bus (253fbd). ## Spend Reserved capacity on gemini-3.8-flash only, so no added vendor spend. Limits: - `DREAM_STATE_PASS_TOKENS_PER_PASS` (120000) covers the planner, cleanup verifiers and profile-line check. - `DREAM_STATE_PASS_SECONDS` (480) covers that same work. The profile write runs after it, on purpose: the transaction refuses to start past the deadline but can finish just after it. - `DREAM_STATE_PASS_MAX_PER_SWEEP` (4), and one complete pass per owner per week. - **Outside those caps:** the shadow value judge that follows a pass. It has its own per-sweep counter, so it adds up to 4 calls per sweep on top of the normal judge's 4, each with a 60000-token allowance (up to 240000 tokens per sweep). It is bounded by the outer Dream pass deadline, and its tokens are not in `levers.state_pass.total_tokens`. ## Rollout - **Metric and gates:** the row for this flag in `backend/docs/feature-flag-registry.md`, measured over at least 300 shadow state passes. - **Who expands it:** the Dream owner reads back after the train. Serving is a later change; this PR only reaches shadow. - **Rollback:** set `DREAM_STATE_PASS_MODE=off`, or revert this PR. That stops new runs but does not cancel one in progress; profile v2 fields already written stay on user docs, unread. - **Readback:** `levers.state_pass` on `dream_pass` lines. ## Product invariants affected - INV-MEM-4: named because `runtime_env.yaml` matches its path glob. Shadow proposals are never applied, and profile v2 lives on the user doc with no reader, so this adds no memory intake or promotion route. ## Review - Luna R1 returned BLOCK on the PR body, not the config: it understated the transcript reads, the 480s scope and the separate judge calls, and put the cadence stamp on the wrong record. All were checked against the code and are corrected above. That code is already merged and behaves as its comments and the runbook intend, so this PR has no code change for them. - Luna R2 returned BLOCK on voice fields reaching the verifiers, and R3 on nested voice fields that the first fix missed. The allowlist above replaces that first fix. - Luna R4 cleared the allowlist and returned BLOCK on the question-quote path above. It is main-loop only, so it is disclosed here and left to the read-tool follow-up. ## Tests `test_person_voice_fields_never_reach_a_verifier` covers top-level, nested and future voice fields; it failed when the first version of the fix was reverted, and the allowlist passes it. `test_dream_verification`, `test_dream_verify_hold` and `test_dream_state_pass` pass. Config: `test.sh` via `omi-heavy` on `test_backend_runtime_env_validator`, `test_render_backend_runtime_env`, `test_check_cloud_run_env_drift`, `test_config_train`, `test_cloud_run_service_identity`, `test_cloud_run_forbidden_env_deploy` and `test_dream_state_pass`: 148 passed. Not run in prod yet. Failure-Class: none 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds measurement and a safety backstop before Dream gets any more freedom. It's the second step of the bitter-lesson plan, after #24166; the planning lenses ranked missing owner-decision data as the biggest gap.
Today we can't tell whether Dream's edits are wanted.
demoted_types) needs 10 changes of a kind in 30 days before an undo rate can pause it. Dream reaches each owner about weekly, so an owner who undoes 3 wrong dismissals in a row is never protected.Changes
dream_outcomeJSON log record (content-free:kind,decisionundo/redo/accept/dismiss, and an applied-age bucket). It is emitted on Undo/Redo of a Dream-journaled change and on Review answers to Dream edit/vocabulary proposals.edit_kind, not the key segment. Memory-target spelling keys usememory, and accepted proposals are re-keyedagent:user:.verifier_by_kindon everydream_passrecord.demoted_types.DREAM_AGENT_UNDO_RECENT_COUNT(3) undos among a kind's changes applied in the lastDREAM_AGENT_UNDO_RECENT_DAYS(7) pause that kind for the owner. The existing 30-day rate rule is unchanged.memorywhilespellingkept auto-applying.Ramp plan
The backstop serves on deploy for every owner. It only ever moves an auto kind to Review (suggest) for an owner whose own recent undos trip it; Undo is unchanged. The outcome records are log-only.
dream_outcomerecords appear for undo, redo, accept and dismiss with bounded labels; applied auto edits per sweep don't fall more than the demoted share explains; zerodream_telemetry_error record=outcome.DREAM_AGENT_UNDO_RECENT_COUNT=1000.Verification
tests/unit/test_dream_outcomes.pycovers:dream_kind/change_kind;backend/test.sh.omi_dream_undo_totalcounter has the same race. The follow-up is to have those setters return the transition flag.dream_outcomerecords andverifier_by_kindin backend-sync logs.Product invariants affected
None. INV-MEM-5 holds: demotion is a UID-independent function of each owner's own decisions.
Failure class
Failure-Class: none
🤖 Generated with Claude Code