Skip to content

perf: reuse meeting-notes lookups and prefetched evidence - #23849

Merged
Git-on-my-level merged 3 commits into
mainfrom
lane/notescap
Oct 28, 2026
Merged

Git-on-my-level merged 3 commits into
mainfrom
lane/notescap

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Reduce forced notes submissions by reusing evidence already gathered for the conversation, without increasing the 6/10/15 lookup caps. Identical read calls reuse their response and spend no lookup or shaped-loop tool-call slot, including repeats within a batch. Other shaped adapters keep their default per-call charge; turn, token and wall-time limits remain enforced. People searches sort/deduplicate names before their 12-name cap and explicitly report dropped names. The cached conversation packet includes bounded matching People records and screen rows, with the same reply clip as live tools. Prefetched evidence counts toward the existing investigation floor. People data remains spelling evidence; speaker authority is unchanged.

DRAFT — replay blocked on dev token. The prescribed dev tunnel reached HTTP 200 on /health, but /ready returned 401. Lead ruling 0267de confirms no retained dev token file exists on m5 and directs this draft to wait for daytime approval. No credential changes, production reads/writes, model calls, merge or deploy were performed. Replay and final review/CI gates remain before ready.

The unconditional telemetry correction distinguishes submission_rejected_at_cap from an actual refused over-cap lookup and preserves the first force reason in mixed batches. New counters track duplicate and refused lookups by bounded tool name. CONVERSATION_NOTES_AGENT_LOOKUP_EFFICIENCY_ENABLED defaults on; false/off/0/no restores legacy tools, prompt, packet and charging while preserving accurate telemetry. Prompt version is v8 on / v7 off; tests pin both replacement targets.

Replay arm Runs Forced share/reasons Lookups/tool Duplicates Rejections/kind Est. cost/run Cache ratio Goldens
origin/main baseline 0 NOT RUN NOT RUN NOT RUN NOT RUN NOT RUN NOT RUN NOT RUN
candidate on 0 NOT RUN NOT RUN NOT RUN NOT RUN NOT RUN NOT RUN NOT RUN
candidate off 0 NOT RUN NOT RUN NOT RUN NOT RUN NOT RUN NOT RUN NOT RUN

Required before ready: same >=20 eligible conversations across all three word tiers, >=2 runs/arm, <=$3 total dev-gateway spend; target forced share <40% and clearly below baseline, no higher rejection rate, cost/run <=$0.0060, no golden regressions, off approximately baseline. Packet-size/token trade-off must be measured too. Supplied production evidence (not refreshed by this lane): 2,065/4,074 forced (50.687%); 1,554.500 lookup-cap labels include both overflow and rejection-at-cap; ~7.9 lookups/run, search_people ~2.6/run; estimated prior cost $0.0045/run.

Validation: original regressions failed on baseline. The review follow-up adds ten failures reproduced at the reviewed head. The current focused runner passes 170 tests across notes-agent (68), shared shaped loop (66), shaped cache invariants (3), and tool rules (33), with no ambient GOOGLE_APPLICATION_CREDENTIALS, serial under omi-heavy/nice. It covers duplicate spam within/across batches, default budget rollback, invalid tool charges, deterministic name truncation, prefetched reply bounds, first-reason preservation and prompt targets. The full enforced backend type checker passes with 0 errors. Local synthetic tests do not establish the replay acceptance metrics above; investigation-floor credit is unchanged for that measurement.

Later deploy needed: pusher through the coordinator train after replay, review, CI and parent merge. No deploy in this PR.

Failure-Class: none

Product invariants affected

none

Git-on-my-level and others added 3 commits October 28, 2026 10:27
Deduplicate run-scoped lookups, batch People names, prefetch matching People
and conversation-window screen context, and credit prefetched evidence toward
the investigation floor without raising lookup caps. Restore legacy behavior
through the default-on lookup-efficiency kill switch.

Separate submission_rejected_at_cap from refused lookups in forced-submit
telemetry and count refused/duplicate lookups in both modes.

Replay blocked on dev token; draft pending baseline/candidate/off benchmark.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Validate untrusted name-array inputs at the tool boundary, keep person aliases
in a separate local variable, and type the heterogeneous cache-default map.
The complete backend type checker now passes without errors.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sort and deduplicate People names before truncation and report dropped names.
Exclude cache hits from shaped-loop tool-call charges, including fills within
one batch, while retaining default per-call charging for other adapters.

Clip prefetched replies through the live-result formatter, keep the first
force reason in mixed batches, and pin the matched-People prompt guidance.

Ten regressions fail at the reviewed head; 170 focused tests and the full
backend type checker pass after the fixes. Replay stays blocked on dev token.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level marked this pull request as ready for review October 28, 2026 09:01
@Git-on-my-level
Git-on-my-level merged commit 0657e31 into main Oct 28, 2026
61 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/notescap branch October 28, 2026 09:01
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 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-28T09:08:40.253460Z b63aaad Draft marked ready
ℹ️ 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 added a commit that referenced this pull request Oct 28, 2026
…each (URGENT) (#23888)

## Summary

Firestore read config train — **5xx-guard flag-off (URGENT)**. The
2026-10-28T10:02Z evaluator tick failed the backend-sync 5xx guard (rate
0.0035 / 1424 errors vs ref 0.0014, floor 50) and flagged nine levers
UNSAFE. This PR sets those nine levers to **0** in every
`FIRESTORE_READ_LEVERS` declaration and keeps the eight SUPPORTED levers
at 100. No source query, authority, transcription, speaker, price, Free
benefit, or audio-retention behavior is changed here.

Flagged to 0: `singleton_loops`, `usage_month_cache`,
`backfill_task_reads`, `historical_scan_memo`, `ledger_purge_coalesce`,
`people_scan_dedupe`, `queue_age_sample_budget`,
`finjob_candidate_queries` (was 5), `usage_month_total` (was 100 on
Cloud Run only).

Kept at 100: `deletion_marker_cache`, `subscription_cache`,
`request_read_dedupe`, `serving_config_cache`, `candidates_page`,
`action_items_page`, `mcp_conversation_cards_cache`,
`canonical_statuses_dedupe`. `memory_list_index_window` and
`batch_privacy_memoize` stay 0.

## Monthly-total split — dissolved by this flag-off

`usage_month_total` goes to **0 on every surface**, including the four
prod Cloud Run services. The previously qualified `c2fs_20261026_r1`
epoch declarations are left untouched: every reader is off, so no reader
seeds or overwrites ready totals, and Cloud Run's qualified epoch stays
recorded for a deliberate re-enable. Re-enable path per the loop guard:
if the 5xx rate persists with these levers at 0, each lever is
exonerated and may come back at 5% individually with complete-literal
changes, restoring the monthly-total split at that point.

Declarations: `backend/deploy/runtime_env/_base.yaml`,
`prod.overlay.yaml` (all four Cloud Run service overrides), four
listen/pusher chart values; generated runtime manifest, flag registry,
and both contract tests updated
(`test_verify_pusher_config_references.py` pin;
`test_firestore_train_preserves_monthly_reader_scope_and_cloud_run_overrides`
now asserts readers-off on every surface with epochs unchanged).

## Product invariants affected

- INV-MEM-4 — keep privacy/deletion authority checks unchanged; this is
a read-cache/scan-dedupe flag-off with 0% kill switch semantics in the
direction of safety.
- INV-DATA-1 — existing configuration keys and data planes; no routing
or ownership change.

## Verification

- Focused suite: `test_render_backend_runtime_env.py` +
`test_verify_pusher_config_references.py` — **119 passed** on this head.
- Complete-literal check: all 42 literal sites (11 base + 4 prod overlay
+ 22 rendered manifest + 4 chart + 2 test pins) grep-verified: every
flagged lever is 0, every kept lever is 100/0 as intended, no other key
moved.
- Diff is literal-only outside README + one test expectation block;
runtime_env.yaml changes are exclusively `FIRESTORE_READ_LEVERS` value
lines.

## Lead-owned ship plan (URGENT flag-off train)

Ship **listen → pusher → Cloud Run** as soon as the train allows
(FIRESTORE_READ_LEVERS order listen → pusher → Cloud Run);
desktop-backend and jobs follow the standing train. This is a
guard-response rollback: reads give back until attribution lands. If the
breach is attributed to a non-lever cause (sync-path code PRs
#23849/#23857 merged 08:33–09:01Z inside the breach window are
candidates), restore the prior literal (#23837 state) in every
applicable full literal, retaining the monthly-total split.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/23888?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/23888?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F23888&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. -->
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