Repository navigation
fix(chat): correct the referent ceiling note, and make the materialization drop rate readable - #11866
Merged
Merged
Conversation
The Ceiling note on `directorStablePrompt` told the next reader that carrying `bucket_facts.identifiersJson` into `ContextBucketStore.snapshot` was the next lever. The premise is true and the conclusion is not: the snapshot does omit the column, but it emits `evidenceText` verbatim on the same fact line, and `BucketFactValidator.acceptedIdentifiers` keeps an identifier only when that same already-truncated `evidenceText` contains it. Every stored handle is therefore a substring of a string the director is already reading, so the column can add nothing. `ContextBucketStore.writeExtraction` is the only writer and derives both values from one string, so this holds by construction. Points the note at the real lever instead — extraction leaving `identifiers` empty while writing the handle into the statement (0/39 on real work screens, already recorded above) — and leaves a matching note at the snapshot SQL, which is where someone would look first. Comment-only: no prompt bytes change, so the cached prefix is untouched. Co-Authored-By: Claude Opus 5 <[email protected]>
Read-only ops script. Since #11844 a materialized proactive card is a backend row every client sees, so cards no longer diverge between devices; what survives is the single-consumer model, whose remaining failure is account-wide — no client ever materialized the intent, so the card exists nowhere. That number is what decides whether canonical server-side materialization is worth building, and it only started existing at that merge. Reads durable intent state rather than `CHAT_FIRST_PROACTIVE_TOTAL`. The counter does label `event='fetch'` and `event='kernel_receipt'`, but it is an in-process prometheus_client counter behind a bearer-gated `/metrics`, the API backend runs on Cloud Run with no scrape annotation, and no dashboard or alert consumes it; the observable counters in this repo belong to the GKE services. `delivered_at` and `materialization_receipt_id` are written together and only on acknowledgement, so 'delivered but unreceipted' is unreachable and is not the signal. A drop is an intent still in `ready` or `pending_kernel_receipt` past `--stale-after-hours`; younger ones are in flight and excluded from the denominator, since every intent starts life unacknowledged. Needs no Firestore index: age and delivery state are bucketed in Python so the account-wide pass is an unfiltered collection-group scan. Co-Authored-By: Claude Opus 5 <[email protected]>
Git-on-my-level
added a commit
that referenced
this pull request
Aug 19, 2026
## Summary This closes the actionable follow-ups from #11844 and #11866 without reopening their settled conclusions: - turn the materialization drop-rate instrument into a weekly, routed decision review; - improve referent supply at the extraction boundary, while leaving fact validity and the director cache prefix alone; and - make the preflight runner survive temporary backpressure from an inherited non-blocking output pipe. Failure-Class: none ## Issue 1 — materialization data gets a forcing function ### Chosen The existing report is now a reusable production module as well as an operator CLI. The hourly `notifications-job` calls it off the event loop; it does no Firestore work except during the fixed Monday 14:00 UTC slot. The classification remains the one established in #11866: `delivered` is acknowledged, `ready`/`pending_kernel_receipt` older than 48 hours is dropped, younger rows are in flight, and malformed undated rows are separate. Every due run emits one content-free aggregate verdict with `review=true`, including a healthy zero-drop verdict. A production notifications-job deploy idempotently creates or updates a Cloud Logging metric and a Cloud Monitoring policy routed to the repository's existing `SYNC_BACKFILL_ALERT_NOTIFICATION_CHANNELS` contract; it fails the deploy if the channel list is empty or the resulting policy has no channel. This is intentionally a decision-review signal rather than only a failure alarm: a 0% result must reach a human too, otherwise the deferred server-materialization decision can still disappear into silence. Durable drops and monitor failures log at error; full source and block-type breakdowns remain in the explicit CLI rather than becoming dynamic log labels. This is the long-term seam I would keep: the already-scheduled notification worker owns a related read-only operational check, the expensive collection-group scan runs weekly rather than hourly, the runtime log is bounded and content-free, and the deploy workflow reconciles the human route instead of assuming somebody created it by hand. ### Rejected - Prometheus remains the wrong path: the in-process API counter has no production scrape/consumer path. - A scheduled GitHub workflow would not be autonomous. Live repository inspection showed the `prod` environment has required reviewers and the read-only Firestore credential, so an unattended schedule would stop at environment approval before it could produce the number. - Cloud Tasks supplies execution, not a human sink, and there is no request whose lifecycle owns this weekly review. A separate Cloud Run job would duplicate the notifications job's Firestore runtime, deployment, schedule, and alert plumbing without creating a better ownership boundary. - Alerting only on non-zero drops was rejected because it preserves the original drift failure for the healthy case. The Cloud Monitoring resources were not applied from this branch. The next production notifications-job deployment performs and verifies that reconciliation; local `gcloud` production inspection was unavailable because the workstation credential could not be refreshed non-interactively. ## Issue 2 — referents are supplied during extraction ### Chosen The extraction prompt and the structured-output descriptions now carry the same cross-field contract. When the screen supplies a specific person, PR/ticket and repository, thread subject, document, file/branch, or meeting name/time, extraction must copy that wording into the fact statement and evidence and mirror the same strings into `identifiers`. When the screen supplies no identifier, `identifiers` stays empty and the fact describes only supplied context; invention remains forbidden. Both halves are deliberate. The prior director repair showed that schema descriptions and prompt instructions reinforce different parts of structured output, while the recorded 39-screen residual showed the fields were disagreeing. The regression test inspects all three schema fields so a later edit cannot quietly return to a single-field hint. Fact validity is unchanged and still checks evidence resolution only. The director prompt and `directorStablePrompt` bytes are unchanged, so the cached director prefix is byte-identical. Extraction does not pass a cache key, so changing its prompt/schema does not invalidate a provider prompt-cache prefix. ### Rejected - Carrying stored `identifiersJson` into the director remains a proven no-op because accepted identifiers are already substrings of emitted evidence. - Retuning the director was rejected because the 69-run baseline already named every supplied referent; supply, not selection, is the measured bottleneck. - An identifier validity gate was rejected because it previously demoted 1,083/1,085 facts on identifiers alone and would destroy evidence-backed facts again. - Inferring a handle absent from the capture was rejected as fabrication; the no-identifier fallback is explicit. The committed offline benchmark contract passes, including the two guard-case mappings. I did not claim a new live-model measurement: the isolated local harness had no running container runtime or provider credentials, while the remote-dev launcher explicitly uses production-backed Firebase identity/data. The live `--invoke` replay was therefore not run. The focused Swift production/test build did run, and all 29 `ContextBucketPromptAssemblerTests` passed. ## Issue 3 — checks must produce honest outcomes ### Chosen in this PR `preflight_runner.py` now treats `BlockingIOError` from `stdout`/`stderr.flush()` as temporary backpressure. On POSIX it waits for the inherited descriptor to become writable and retries the same buffered flush; the portable fallback uses the runner's bounded polling interval, and `InterruptedError` retries immediately. The regression test reproduces the observed Errno 35 twice before success. No gate is skipped, downgraded, or made quieter. ### Deliberately not changed here: Desktop Swift runner governance The evidence does not support a workflow code fix for a check that literally never renders. On #11844, `Desktop Swift Static & Test Contracts` started within seconds and ended after about 66.6 minutes (failed, after merge). On #11866 it waited about 45 minutes for a runner, then completed successfully about 39 minutes later (also after merge). Live branch-protection inspection returned `required_status_checks: null` for `main`. That makes the durable defect repository governance: maintainers can merge before the stable aggregate `Desktop Swift Build & Tests` has published a verdict. Changing test commands, splitting the job, or weakening parallelism would not make anyone wait for it and would risk hiding the two suites under investigation. The long-term fix is an external GitHub ruleset/branch-protection change requiring that aggregate check once its current flaky failure class is repaired. Repository settings are not versioned by this PR, so I am explicitly leaving that operation out rather than pretending a workflow edit solves it. ## Verification completed before the full gates - `python3 .github/scripts/test_preflight_runner.py` — 25 tests passed, 6 skipped. - Focused backend files through `backend/test.sh` — 12 materialization-report tests and 5 notifications-job orchestrator tests passed. - `./scripts/dev-feedback.py --once swift 'ContextBucketPromptAssemblerTests'` — 29 tests passed after a full Swift production/test build. - `desktop/macos/scripts/agent-logic-harness.sh --cross-surface-smoke` — Swift and agent cross-surface contracts passed. - `bash desktop/macos/tests/test-context-bucket-benchmark.sh` — 34 fixture contracts and 24 director mappings passed; this is the offline contract, not a live model replay. - `actionlint .github/workflows/gcp_notifications_job.yml` — passed. - `OMI_PR_BODY_FILE=/tmp/omi-proactive-followup-pr.md make preflight` — all 40 checks selected by the current local manifest passed. - `OMI_PR_BODY_FILE=/tmp/omi-proactive-followup-pr.md bash scripts/pre-push origin < /dev/null` — the real, broader pre-push gate exited successfully. - `cd backend && bash scripts/typecheck.sh` — the final strict run completed with 0 errors and 3,667 pre-existing warnings. 🤖 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/11873?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="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
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.
Two small follow-ups to #11844. No behaviour changes: the desktop half is comment-only, and the backend half adds a read-only ops script that nothing calls.
1. The referent "Ceiling" note pointed at a dead end
#11844 left a note on
directorStablePrompttelling whoever tunes it next that carryingbucket_facts.identifiersJsonintoContextBucketStore.snapshotwas the next lever, and that it was "a store change, not a prompt change."The premise is true and the conclusion is wrong. The snapshot does omit the column — but the same fact line emits
evidenceTextverbatim:and
BucketFactValidator.acceptedIdentifierskeeps an identifier only when the evidence contains it:ContextBucketStore.writeExtractiontruncates evidence to 1,000 characters first, derives the identifiers from that truncated string, and stores both. It is the only writer of the column. So every stored handle is, by construction, a case-insensitive substring of a string the director is already reading, and surfacing the column separately can add nothing. Anyone acting on the old note would have spent the work to move a value that was already in the prompt.The note now says that, and points at the real lever instead — extraction leaving
identifiersempty while writing the same handle into the statement (0/39 on real work screens, already measured and recorded in the same file). A matching note sits at the snapshot SQL, which is where someone would look first.The 912-run measurement and every conclusion #11844 drew from it are unaffected; only the forward-looking "next lever" sentence was wrong. No prompt bytes change, so the cached prefix is untouched.
2. A way to actually read the materialization drop rate
#11844 deliberately left canonical server-side materialization as follow-up work, to be decided by production data that only started existing at that merge. The intended instrument was
CHAT_FIRST_PROACTIVE_TOTAL, which already labelsevent='fetch'andevent='kernel_receipt'.That instrument is not readable in production. It is an in-process
prometheus_clientcounter behind a bearer-gated/metrics; the API backend runs on Cloud Run with no scrape annotation; and no dashboard or alert consumes it. The counters that are observable in this repo (pusher_queue_drops_total,backend_listen_active_ws_connections) belong to the GKE services, which carryprometheus.io/scrape: "true". Waiting two weeks and then querying it would have produced nothing.backend/scripts/chat_first_materialization_drop_rate.pyreads durable intent state instead, which survives instance churn.Two details that are easy to get wrong, both covered by tests:
acknowledge_materializationwritesdelivered_atandmaterialization_receipt_idtogether, so looking for one without the other finds nothing. A drop is an intent still sitting inreadyorpending_kernel_receiptpast--stale-after-hours.It needs no Firestore index and adds no entry to
firestore_index_registry: age and delivery state are bucketed in Python, so the account-wide pass is an unfiltered collection-group scan. Read-only, no writes on any path.It also breaks drops down by block type, so
conversationLink— the meeting-notes card from #11844 — can be read off directly.Testing
make preflight— 32/32 passbackend/scripts/typecheck.sh— 0 errors; the new script is added topyrightconfig.jsonand is clean understrict🤖 Generated with Claude Code