Repository navigation
Re-cut native Finish summary matching and natural deadline scheduling - #25992
Conversation
Co-authored-by: multica-agent <[email protected]>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment |
Co-authored-by: multica-agent <[email protected]>
|
@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2f931b1760
ℹ️ 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".
| @pytest.mark.parametrize('overview', ['Actual notes', '']) | ||
| @pytest.mark.parametrize('terminal_family', [False, True]) | ||
| def test_background_notes_stamp_visibility_before_worker_settle( | ||
| lifecycle_store, monkeypatch, overview, terminal_family |
There was a problem hiding this comment.
Use the strict Firestore fixture for background notes tests
This transaction test uses lifecycle_store, whose _DocumentRef.get() ignores the transaction and whose transaction methods apply writes immediately without enforcing read-before-write ordering. It also stores dotted update paths literally, which the assertions below explicitly accommodate. Consequently, this coverage can pass for transaction behavior that production Firestore rejects, undermining verification of the atomic visibility-receipt write. backend/AGENTS.md explicitly requires StrictFirestore for transaction tests involving document reads and updates; use that fixture here and assert the resulting nested document state.
AGENTS.md reference: backend/AGENTS.md:L236-L236
Useful? React with 👍 / 👎.
| revoked_native_ids = {cid for cid, row in existing.items() if _revoked_native_window(row, recordings)} | ||
| immutable = {cid: row for cid, row in existing.items() if cid not in revoked_native_ids} |
There was a problem hiding this comment.
Retire revoked windows that the natural plan no longer matches
When two adjacent native windows awaiting notes both lose their upload proof, removing both from ownership lets the natural planner combine their speech into one window. _match() reuses only the earliest prior ID, but ordinary reconciliation does not remove unmatched rows (remove is populated only for re-derivation). The other derived row therefore remains visible with its stale native binding and v3_process_pending=True; its notes fence keeps rejecting the source, leaving a duplicate processing tile and recurring sweep work. This is reproducible with two recordings separated by less than five minutes and both upload revisions advancing before notes are written. Retire or explicitly settle unmatched revoked rows when committing the replacement plan.
Useful? React with 👍 / 👎.
| and isinstance(next_start, datetime) | ||
| and next_start >= native_cuts[prior_line['conversation_id']] | ||
| and previous['end'] <= line['start'] |
There was a problem hiding this comment.
Reject overlapping speech before applying a native cut
With overlapping recordings, the last line by start time need not be the line that ends the stretch. For example, another recording can contain a segment spanning 0–60 seconds while the native recording's tail spans 10–20 seconds and its stop is at 30 seconds. A successor starting at 70 seconds satisfies this cut condition, splitting and finalizing the preceding stretch despite only ten seconds of silence. The later native_manual_end check rejects the manual boundary because the overlapping speech extends past the stop, but the split has already happened. Apply that overlap/end guard before accepting native_cut so an ambiguous stop cannot prematurely split the continuing conversation.
Useful? React with 👍 / 👎.
Co-authored-by: multica-agent <[email protected]>
|
@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment |
Co-authored-by: multica-agent <[email protected]>
|
@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment |
Co-authored-by: multica-agent <[email protected]>
|
@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment |
Co-authored-by: multica-agent <[email protected]>
|
@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c32255bffb
ℹ️ 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".
| def manual_stop_patch(current, job, job_id, revision): | ||
| # Persist intent without exposing a manual cut before the full native transcript. | ||
| return ( | ||
| {NATIVE_MANUAL_STOP: {'job_id': job_id, 'revision': revision, 'finished_at': current['finished_at']}} |
There was a problem hiding this comment.
Add the required pipeline change note for native Finish
This change introduces explicit-stop provenance and changes when native recordings trigger conversation finalization and summary generation, but the commit contains no pipeline change note. Searching backend/docs/listen_pusher_pipeline/changes/ also found no note covering this native Finish behavior. Add the required note describing the lifecycle changes, rollout/flag state, and verification evidence so the pipeline's operational documentation stays aligned with the implementation.
AGENTS.md reference: backend/AGENTS.md:L164-L164
Useful? React with 👍 / 👎.
Co-authored-by: multica-agent <[email protected]>
|
@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 975c816841
ℹ️ 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".
| **( | ||
| {'summary_covers_through': receipt['finished_at'], 'v3_notes_written': True} | ||
| if receipt and receipt.get('finished_at') | ||
| else {} |
There was a problem hiding this comment.
Arm created delivery when recovering already-written native notes
If background notes commit their visibility receipt and the source subsequently becomes unavailable before settle_processing() runs, this recovery marks the derived row as notes-written and clears v3_process_pending, but never arms v3_created_pending. Consequently, created.deliver() cannot discover the completed conversation, and its conversation-created integrations are permanently skipped. The normal recovery in service.reconcile() cannot repair this afterward because it requires the prior processing marker to remain set. When the recovered row passes policy.created_eligible, arm the delivery obligation atomically with this settlement.
Useful? React with 👍 / 👎.
| Empty maps replace that map; arrays and scalars are leaves. FieldPath quotes | ||
| literal dotted/backtick keys rather than treating them as update paths. | ||
| """ | ||
| from google.cloud.firestore_v1.field_path import FieldPath |
There was a problem hiding this comment.
Keep the extracted helper's imports at module scope
The extracted helper moves FieldPath from a module-level import into the function body, contrary to the explicit requirement in backend/AGENTS.md: “All imports at module top level — never inside functions.” Move this import to the new module's header; the newly added function-local imports in the native fence and projection code should follow the same convention.
AGENTS.md reference: backend/AGENTS.md:L168-L168
Useful? React with 👍 / 👎.
Co-authored-by: multica-agent <[email protected]>
|
@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment |
Co-authored-by: multica-agent <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment |
Co-authored-by: multica-agent <[email protected]>
|
@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment |
Co-authored-by: multica-agent <[email protected]>
|
@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment |
|
/approve-ui 37591f1 |
…/v3-closure-budget Conflict in database/conversations_v3.commit_projection: main moved batching into conversations_v3_projection_budget.partition_rows; kept it and the locked-closure batch cap right after it, still before any transaction. commit_projection digest re-pinned with both review reasons. Failure-Class: new Co-Authored-By: Claude Opus 5.5 <[email protected]>
Takes #25992 (native Finish summary matching, natural deadline scheduling). Conflicts resolved by keeping both sides: - conversation_finalization_jobs: main's capture_allowed() helper (`allowed`) with this branch's completed_manual_end private status. - conversations_v3_processing: main's native notes visibility receipt and clearing join this branch's write-path eligible signal, which now reads the full committed update. - service: main moved plan() into _plan_projection; the Finish window bindings (finish_windows, remember_window) are threaded through it. - planner, live, engine tests: both sides' additions. Interaction fixed: a native Finish manual end (sealed tail, not a recording cut) now carries its recording in _finish_sli_sources, so the SLI still binds its window. #25992's zero-preview provenance test accepts this branch's private completed_manual_end transaction status. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…il reaches the first summary (live_words_cascade) (#26473) ## What changed and why `live_words_cascade`: one per-account flag store rule (the family of #26348), app and backend, inert for an account its rule does not admit. No rule exists for it. The page of a conversation in progress went separately in #26467; this is the live-words half of the same work. Builds on `vendor_recognizer_on_opened_app`; its End parts also need `end_open_conversation`. - **Order.** Per stretch of audio time the grey live words show the provider's words where it has them and the phone's own recogniser's only where it has none (the reverse of today); stored text still replaces both. The phone's recogniser is not started for an account whose language is multi-language or outside its list. Its phrases are joined into one paragraph instead of one line each, and a line rebuilt from part of its words no longer starts with a space. - **How long a grey word stays.** Until a stored line covers its moment of audio (2 s reach) or, where stored text exists to compare with, until it is five minutes old. This replaces, under the flag, the rule that dropped every live line older than the last stored line minus 10 s. A conversation that has ended keeps the live words of its own time range on its page by the same rule. - **An End cuts the live words** at the End instant (the `X-Omi-Ended-At` time), per word, for every screen, and the phone tells the display connection (`{"type":"end"}`), so the provider's line in progress breaks there. - **The End's tail reaches the first summary.** The End request carries `live_tail`, the words shown for the conversation being ended (at most 600 words). The backend checks and bounds it, keeps it encrypted with the stored End and nowhere else, and adds the words no stored line covers to that conversation's notes prompt, marked as a draft. The count the notes read and the time of its first word are stamped on the conversation; the late-speech rewrite rule takes stored words that land in that stretch to be the same speech, up to that count, and a summary pass still running when that speech lands settles instead of writing the notes again. Speech from before that stretch that lands late counts in full, as before. **Trust boundary, stated plainly.** `live_tail` makes phone-authored text an input to one model prompt for an admitted account. That is a deliberate exception to the rule that client-authored text is display only, which `tests/unit/test_client_processing_trust_boundary.py` proves for `client_processing`; that field and that test are untouched. The bounds: only under the flag; a separate request field hidden from the published schema; 600 words / 6,000 characters / 200 lines; control and bracket characters removed; only words that start before the End, at most six hours before it and inside the conversation; dropped wherever stored text exists; never written to a conversation, a recording row or a transcript; one reader (the `transcript=` argument of the notes prompt). What the notes say (title, summary, the action items they propose) can therefore reflect those words, and so can whatever reads the notes; the discard and wake-word checks, memory extraction and search read the stored transcript alone. Change note: `backend/docs/listen_pusher_pipeline/changes/2026-11-26-live-words-cascade-end-tail-title-at-end.md`. ### Known limits - An End with a tail must reach a backend that has this change: an older one does not take `live_tail` for part of the app's Finish body and answers 404 where it would have finished the recording. The flag tool's live check refuses to admit accounts before the serving commit includes the key. - The stored tail is removed when a later summary pass finds it covered, when the credit is used up, or at the owner's next End with a tail (Ends one to eight days old). There is no timed sweep, so a tail whose speech never lands can stay (encrypted, at most 6,000 characters). - A summary pass writes the tail count to the conversation before the notes are written; a grouping pass that had already loaded that conversation loses its commit race once and is retried. - A grey word that stored text never covers sits under newer stored lines for up to five minutes, because grey lines are drawn after the transcript. - `/v4/live-words` still needs a load-balancer path rule before a wide ramp (unchanged). ## Product invariants affected - INV-CAP-1: `app/lib/services/capture/capture_controller.dart` and `capture_composition.dart` gain one optional callback that an End calls after it has sealed the open phone file. With `live_words_cascade` off the callback returns null and the End request is byte-for-byte what it was; capture, upload and receipt handling are unchanged in both modes. - INV-MEM-4: `backend/utils/conversations/process_conversation.py` changes in one argument of the notes prompt builder. Memory intake, consolidation and promotion are untouched; memory extraction reads the stored transcript, never the tail. - INV-TASK-2: the same one-argument change. No capture-policy outcome, Candidate path or writer changes; action items the notes propose go through the path they went through before. For an admitted account the notes prompt can contain the tail's words, so a proposed item can come from them. ## How it was verified - On an iPhone 16 Pro with an Omi pendant against a local prod-parity stack, flags selected through the development override: - cascade: twenty minutes of real speech with the provider's words replacing the phone's on screen (local counters: most of the phone recogniser's words replaced, a handful only it had, no recogniser restart); - one End pressed mid-speech: every live line left the list at the End instant, the display stream logged its line break at the same moment, the server stored the tail and the summary pass read the uncovered part; - On the local stack with a probe and fresh accounts (`live_tail` sent with an End, then the same speech uploaded): the first summary held facts that existed only in the tail, the stored transcript held only the batch text, and the landing 6 s later left the summary as it was (no rewrite). The same run without a tail wrote a second summary. - Backend: the changed and neighbouring test files one file per process; `backend/scripts/typecheck.sh`; `scan_async_blockers.py`. - The phone and stack runs above were made before this branch was rebased onto #25992, which moved the grouping pass's planning loop into `_plan_projection`; the tail credit was carried into it unchanged and the backend tests were run again afterwards. - App: `flutter test` on the live-preview, unit, widget, page and provider folders; `dart analyze lib` no errors. Not verified: Home's Listening row, the Listening page and the next conversation right after an End with speech continuing (the test phone was restarted seconds after the End); the five-minute rule, the joined paragraph and the indent fix on a phone's screen (unit tests only); a language outside the phone recogniser's list on a phone; a landing that brings substantially more than the tail on a stack (unit test only); the per-account form of the flag against a real flag store (the local stack uses the development override). ## Tests - `backend/tests/unit/test_reliability_experiment_live_words_cascade.py` (43 cases): per-account switch, payload bounds and plain text, encrypted storage with the End, covered words dropped, transcript never written, the prompt as the only reader, rewrite accounting, the settle rule, removal of stored words, the display line break. - `app/test/services/live_preview/live_words_cascade_test.dart` (46 cases): reversed merge, joined paragraph and spacing, language rule, counters, watchdog, the End cut per word on the inputs of all three screens, a conversation's own time range, the stored-text-or-five-minutes rule, the tail payload and the End request body, the End message on the display connection. ## UI evidence UI-Evidence: none -- the grey live words keep the look merged in #26394; what changes is which words are listed and for how long (asserted in `live_words_cascade_test.dart`), and the screenshots taken on the test phone show real speech, so they are not published. ## Failure class (fixes) Failure-Class: none Line-Count-Exception: app/lib/backend/http/api/conversations.dart | 1780 -> 1787 | one optional field on the End request beside the header it travels with Line-Count-Exception: app/lib/pages/conversation_detail/page.dart | 1874 -> 1900 | the flag-gated branch that picks a conversation's live words by its time range, inside the function that already picks them Line-Count-Exception: app/lib/services/capture/capture_controller.dart | 5138 -> 5149 | one optional callback an End calls after sealing the open phone file Line-Count-Exception: backend/routers/conversations.py | 3358 -> 3365 | passing the optional tail to the End's stored cut Line-Count-Exception: backend/utils/conversations/process_conversation.py | 3614 -> 3622 | one argument of the notes prompt builder and its comment Line-Count-Exception: backend/utils/conversations/v3/service.py | 2013 -> 2051 | the tail credit beside the rewrite rule it adjusts and the tail read beside the notes call it feeds 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Summary
Re-cuts #25759 from
origin/mainatd9be505b41a79ca7d7e2d3ab0d4558f0f5bd4278, using the SCA-3042 candidate4087ad173fand the old PR’s subsequent recovery fix as references.Verification
.agent-artifacts/ui-evidence/sca-3024/.The local runs use synthetic recordings and do not measure production stop-to-render latency.
Panel repair
Receipt clearing (SCA-3634 and SCA-3636)
Clear the native visibility receipt and v3 notes coverage in the same transaction that empties notes. Regressions cover background updates and merges, on-open writes, and editing the default notes to empty before a source replan.
Worker 2 passed 237 focused backend tests under a 115-second cap and six loopback Firestore emulator cases under a 65-second cap. The repository-pinned formatter passed across the PR’s changed backend Python files. The lifecycle writer inventory and Firestore query-review digest failures from the earlier projection repair still reproduce locally. Release requires green CI, exact-head UI approval, and lead2’s custody acknowledgment.
CI guard repair
The lifecycle inventory now records the single unmatched native retirement payload in
reconcile. It clears summary debt and pending work, hides and retires the row, clears its native binding, and advances the content revision. The separate live re-derive retirement entry stays in the inventory.The Firestore query checklist review compared
commit_projectionwith the previously pinned body. Refinement and redirected live repair still call the existing donor-task query. The registered driver exercises the transactional and nontransactional profiles. Unmatched native retirement uses keyed document reads and writes. The existing coverage applies, so the digest is refreshed with the same query shape and indexes.Firestore SDK import repair
Resolve
FieldPathonly when generating an update mask. Worker 2 passed 264 unit tests, covering every file reported failing by shards 1, 3, 6, and 7, SDK field escaping, and receipt clearing. The shard 1 router redaction case passed locally. Six Firestore emulator tests and 21 targeted guard assertions also passed.Native Finish custody follow-up
An unmatched revoked tile keeps its conversation ID so task and memory links can still resolve. The builder hides it from Home, clears its revoked binding and stale work, and replaces its recording claims in a single projection transaction. The regression covers direct link resolution, no deletion or removal marker, and a second reconciliation with one visible window.
Legacy backfill re-derive keeps its existing path for ordinary inputs. Native Finish inputs block before planning or deletion, and the projection commit rejects a native tile in the legacy delete list. The pre-existing backfill hard-delete link and marker gap is tracked separately on SCA-3669. Exact-head R19 and custody disposition remain required.
UI evidence