Repository navigation
feat(conversations): historical-tier summary on open (T1+ open side, dark) - #25755
Merged
Merged
Conversation
…dark)
Adds the open side of the historical processing tier: the processing_tier
marker and summary_on_open projection, the HISTORICAL_OPEN trigger,
POST /v1/conversations/{id}/summary/open with its caps and gates, the
process_conversation short-circuit and summary-only seam, and guards on
/reprocess and /summary/stream. Nothing stamps the marker yet, so this
changes no live row; ingest stamping follows.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ic summary debt An empty or short transcript can return the provenance-stamped minimum from the notes pipeline; the historical row must still owe nothing the age gate parks. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…fields Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # backend/routers/conversations.py
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
- Historical titles carry title_provenance='historical_minimum': a stand-in for title stability and Home's short-fragment rules, never summary debt, derived effects or the mobile provisional marker. The open-time summary now replaces it. - Merging a historical source keeps the merged row historical (summary-only). - /reprocess on a historical row takes the open endpoint's admission: switch, BYOK LLM key, budget, hourly/daily/global/attempt slots. - Admission answers free refusals before taking slots, returns every slot on any refusal or store error (typed 503), re-reads after the claim so a racing open returns its summary, and reports a fenced persist as a retryable 503. - BYOK requires a validated LLM-provider key (generated_compute.validated_llm_byok). - The automatic short-circuit keeps the capture-group and smart-merge write fences. - merge_result records an open-time summary as delivered and keeps the historical block on an empty write instead of local_only. - The tier boundary is derived from ENRICHMENT_MAX_AGE_HOURS (0 means no tier); SYNC_HISTORICAL_TIER_MIN_AGE_SECONDS is removed. - CI guards: classify processing_tier/summary_on_open, pin the seam's dump, route the terminal status through process_conversation, outcome labels via reason_label, and a light historical_projection module so the router loads bare. Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
…zed first call Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ut of the router Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…mum provenance Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 19, 2026
Git-on-my-level
added a commit
that referenced
this pull request
Nov 19, 2026
## Summary Generate port task drafts when a merged Python PR changes finalization or batch behavior. The map covers all 34 finalization and 41 batch runtime Python sources cited by the [landed contracts](#25802), plus imported family policy and implementation. The [scope document](https://github.com/BasedHardware/omi/blob/9554967bf78fab4d18b1504a7ef19b31e46141af/backend-go/docs/port-map-scope.md) records the boundaries and exclusions. The PR branch includes `main` at contracts merge `97b4059861a7`. The batch map includes the projection kill-switch defaults introduced upstream in #25791. The Backend Go Checks workflow runs the Python suite when these files change in a PR. On each main push, it walks the pushed first-parent merge commits, looks up their merged main PRs, and checks the complete paginated file list against GitHub's `changed_files` count before drafting. The CLI also rejects duplicate filenames in a counted input and uses both sides of renames. The job prints JSON and uses read-only permissions. Tracker writes are outside this change. [Commit-to-PR API](https://docs.github.com/en/rest/commits/commits#list-pull-requests-associated-with-a-commit) · [PR files API](https://docs.github.com/en/rest/pulls/pulls#list-pull-requests-files) ## Verification - Nine focused tests exercise family matching, renames, duplicate or truncated file lists, malformed inputs, task text, existence of every mapped file, and coverage of the checked-in batch contract. Run `python3 -m unittest discover -s .github/scripts -p test_go_port_tasks.py -v`. - `actionlint .github/workflows/backend-go-checks.yml` passed. Ran the workflow's push steps locally over three real first-parent merges and verified Go test selection on Go and Python-only ranges. - `cd backend-go && TEST_FIRESTORE_REQUIRED=1 make check` passed with Postgres 16 and the Firestore emulator. - Compared both map families to every runtime Python citation in the landed contracts. Replaying merged PR #25791 also matched the new batch projection kill switch. - Repository preflight and `gh pr checks 25810 --watch` passed at head `9554967bf7`. Local preflight skipped the 90-day failure-class ratchet because the checkout is shallow. [Backend Go Checks](https://github.com/BasedHardware/omi/actions/runs/44627579785) ## Product invariants affected none ## Examples from merged PRs ```bash count=$(gh api "repos/BasedHardware/omi/pulls/$PR" --jq .changed_files) gh api --paginate --slurp "repos/BasedHardware/omi/pulls/$PR/files?per_page=100" | jq 'add' | python3 .github/scripts/go_port_tasks.py --pr "$PR" --changed-files "$count" ``` ### PR #25771 ```json [ { "family": "finalization", "title": "Port Python PR #25771 to Go finalization", "body": "Python PR [#25771](#25771) changed `backend/database/conversations.py`, `backend/models/conversation.py`, `backend/utils/conversations/process_conversation.py`, `backend/utils/conversations/render.py`, `backend/utils/conversations/v3/policy.py`. Review the merged diff and port any behavior changes to the Go finalization family under `backend-go/`. Add or update parity coverage for the changed behavior, or record why the Go port needs no change.", "matched_paths": [ "backend/database/conversations.py", "backend/models/conversation.py", "backend/utils/conversations/process_conversation.py", "backend/utils/conversations/render.py", "backend/utils/conversations/v3/policy.py" ] } ] ``` ### PR #25755 ```json [ { "family": "finalization", "title": "Port Python PR #25755 to Go finalization", "body": "Python PR [#25755](#25755) changed `backend/config/merge_before_processing.py`, `backend/models/conversation.py`, `backend/models/structured.py`, `backend/utils/conversations/deterministic_minimum.py`, `backend/utils/conversations/empty_structure_minimum.py`, `backend/utils/conversations/fragment_visibility.py`, `backend/utils/conversations/historical_minimum.py`, `backend/utils/conversations/home_titles.py`, `backend/utils/conversations/merge_conversations.py`, `backend/utils/conversations/process_conversation.py`, `backend/utils/conversations/processing_trigger.py`, `backend/utils/conversations/relevance_salience.py`, `backend/utils/conversations/summary_delivery.py`, `backend/utils/conversations/sync_hold_completion.py`, `backend/utils/episodes/member_notes.py`, `backend/utils/llm/notes_short_clip_policy.py`. Review the merged diff and port any behavior changes to the Go finalization family under `backend-go/`. Add or update parity coverage for the changed behavior, or record why the Go port needs no change.", "matched_paths": [ "backend/config/merge_before_processing.py", "backend/models/conversation.py", "backend/models/structured.py", "backend/utils/conversations/deterministic_minimum.py", "backend/utils/conversations/empty_structure_minimum.py", "backend/utils/conversations/fragment_visibility.py", "backend/utils/conversations/historical_minimum.py", "backend/utils/conversations/home_titles.py", "backend/utils/conversations/merge_conversations.py", "backend/utils/conversations/process_conversation.py", "backend/utils/conversations/processing_trigger.py", "backend/utils/conversations/relevance_salience.py", "backend/utils/conversations/summary_delivery.py", "backend/utils/conversations/sync_hold_completion.py", "backend/utils/episodes/member_notes.py", "backend/utils/llm/notes_short_clip_policy.py" ] } ] ``` ### PR #25686 ```json [ { "family": "finalization", "title": "Port Python PR #25686 to Go finalization", "body": "Python PR [#25686](#25686) changed `backend/utils/conversations/lifecycle.py`, `backend/utils/conversations/process_conversation.py`, `backend/utils/conversations/v3/policy.py`, `backend/utils/conversations/v3/service.py`, `backend/utils/conversations/v3/triggers.py`. Review the merged diff and port any behavior changes to the Go finalization family under `backend-go/`. Add or update parity coverage for the changed behavior, or record why the Go port needs no change.", "matched_paths": [ "backend/utils/conversations/lifecycle.py", "backend/utils/conversations/process_conversation.py", "backend/utils/conversations/v3/policy.py", "backend/utils/conversations/v3/service.py", "backend/utils/conversations/v3/triggers.py" ] } ] ```
Git-on-my-level
added a commit
that referenced
this pull request
Nov 20, 2026
## What changed and why - Historical `/reprocess` rejects an explicit `app_id` with HTTP 400 before it validates an app or reserves historical-summary quota. The processor also skips app execution and the app-results write for historical rows. - The revision-fenced summary write deletes `structured.title_provenance` when generated notes replace the historical stand-in. An empty write keeps the marker and leaves automatic summary debt unset. Fixes SCA-3427. Follow-up to #25755. ## Product invariants affected - INV-MEM-4. Historical notes stay within first-party summary processing. - INV-TASK-2. Historical reprocessing continues to bypass task creation. ## How it was verified - 210 tests passed across eight focused backend suites with `backend/test.sh`. The regression exercises the actual FastAPI route with an in-process client, synthetic conversation data, and stubbed service boundaries. - Confirmed the three regression cases fail against the original implementation. - `make preflight` passed all 41 checks. The pre-push hook also passed Pyright and the 40-file backend selection. ## Tests - `test_historical_summary_open.py` covers HTTP refusal before quota reservation, app lookup, or processing. - `test_historical_tier_processing.py` checks that even a direct processor call with a resolved app cannot trigger it. - `test_summary_delivery.py` checks the nested field deletion through the persistence writer's leaf mask and retention on an empty summary. ## UI evidence UI-Evidence: none -- backend-only change ## Failure class (fixes) Failure-Class: none Line-Count-Exception: backend/routers/conversations.py | 3014 -> 3015 | Keep the historical app-selection guard at the request boundary before admission. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/25894?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/25894?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F25894&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. -->
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.
What changed and why
Customers who sync old pendant audio see those conversations stuck on "Writing notes" forever. Backfill older than 72 hours never gets a summary, because the 72 h enrichment age gate (
ENRICHMENT_MAX_AGE_HOURS=72,backend/docs/runbooks/enrichment-age-gate.md) parks every enrichment wake for it. The intake minimum still stampssummary_due_at, though, so Home keeps showing the row as owed.This is PR 1 of 4 for the historical processing tier (T1+). Old backfill is stored with a transcript, speakers and a deterministic title. Its one summary is generated only when the owner opens it. It never gets memories, tasks, apps, folders, webhooks or notifications. This PR is the open side, and it is dark: nothing stamps
processing_tieryet, so no live row changes. PR 2 adds ingest stamping. PR 3 (mobile) and PR 4 (desktop) call the new endpoint.Marker and projection.
Conversation.processing_tier: Optional[Literal['historical']]is stored and wire-visible. A merge of any historical source stays historical.summary_on_open: trueis a read projection on list and detail (utils/conversations/historical_projection.py, import-light so the router still loads bare). It is set when the row is historical, has no summary, is not locked or discarded, and the open switch is on. Both fields are omitted when unset.Title. The historical deterministic title carries
title_provenance='historical_minimum'. Title stability, Home's neutral-title and short-fragment rules, salience and the notes-minimum checks treat it as a stand-in, likeserver_minimum, so the open-time summary replaces it and short fragments stay hidden as before. Summary debt,is_server_minimum(apps, memories, vectors), Home's "Writing notes" step and the mobilehasProvisionalTitleignore it.Trigger.
ProcessingTrigger.HISTORICAL_OPENuses mode(run_now, reprocess, KEEP). It is insync_hold_completion.EXPLICIT,member_notes.EXPLICITand the relevance decision vocabulary.process_conversation.historical(summary-only) seam.{HISTORICAL_OPEN, USER_REPROCESS, MERGE, BACKLOG_CHOICE}short-circuits before the funded-budget block, throughutils/conversations/historical_minimum.py. The row is stored completed, withdeferred=False, no_get_structured, its deterministic title or the existing open-time summary,terminal_no_derived_effectsandsummary_blocked_reason='historical_on_open'. The persist keeps the capture-group and smart-merge refresh write fences.complete_explicitsettles an outstanding sync hold, and an explicitly chosen template app writes its result.summary_delivery.merge_result) records an open-time summary as delivered (summary_completed_at,summary_title_provenance='generated', no block) and keepshistorical_on_openon an empty write. It never armssummary_due_aton a historical row.POST /v1/conversations/{id}/summary/open(utils/conversations/historical_summary.py). Refusals come in this order:conversation_locked,conversation_discardedornot_historical.X-Omi-Summary-Outcome: existingwhen a summary is already present. This path is idempotent, makes no model call and passes no gate.historical_summary_disabledwhen the switch is off.byok_keys_requiredwhen a BYOK account's request carries no validated LLM-provider key (a transcription-only key does not count).require_generated_compute(uid, 'historical_summary_open').conversation_processing_in_progresswhen the attention claim fails.No slot is taken before the free refusals, and every slot is returned on any later refusal. A store error during admission is a typed 503 that also returns them. After the claim the row is read again, so a racing open returns the summary it landed. Then it runs
process_conversation(trigger=HISTORICAL_OPEN, first_party_only=True)undertrack_usage(Features.HISTORICAL_SUMMARY). It answers 200generated, 502summary_unavailableon empty output, or a typed retryable 503historical_summary_retry, which also covers a write fenced by a newer append. The summary vector is written after the summary lands, behind a sub-switch.Guards.
/reprocesson a historical row takes the same admission as the open endpoint: switch, BYOK, budget and every slot. It stays summary-only and only indexes the summary vector. Old builds' "Summarize" CTA lands here.GET /summary/streamnever generates for a historical row; it serves the stored row.Switches.
HISTORICAL_SUMMARY_ON_OPEN_ENABLED,HISTORICAL_SUMMARY_VECTOR_ENABLEDandSYNC_HISTORICAL_TIER_ENABLED(read in PR 2) are ops kill switches, on unless set off.HISTORICAL_SUMMARY_GLOBAL_DAILY_LIMITdefaults to 10000 per day, and 0 disables it. The tier boundary is the enrichment age gate itself:config.historical_tier.min_age_seconds()parsesENRICHMENT_MAX_AGE_HOURSexactly asage_gatedoes, and a gate of 0 means no tier. There is no separate age setting. All env reads are inconfig/historical_tier.py, outside theflag_budget.jsonscope. They are registered inconfig/feature-flags.yaml, and the registry doc is re-rendered.Metrics.
omi_historical_summary_open_total{outcome}(labels throughreason_labelandHistoricalSummaryOpenOutcome) andomi_historical_summary_latency_seconds. Opens over PR 2'somi_historical_tier_rows_totalgive the open rate.Notes reuse key.
models/structured.pyis a notes prompt source, soNOTES_PROMPT_VERSIONmoves tonotes-8with its digest pinned. The widenedtitle_provenanceis schema-hidden, so prompt, schema and output are unchanged, andnotes-7stays reusable (the notes-7 precedent): nothing is re-bought.Clients. The app-client OpenAPI and the generated Dart, Swift and TypeScript DTOs are regenerated. The new fields are optional and additive.
title_provenanceis excluded from the schema; the plugin SDKStructuredaccepts the new value.Line-Count-Exception: backend/routers/conversations.py | 2919 -> 2957 | the summary-on-open route, the list/detail projection and the /reprocess historical admission live with their sibling conversation routes; the logic is in utils/conversations/historical_summary.py and historical_projection.py
Line-Count-Exception: backend/utils/conversations/process_conversation.py | 3517 -> 3541 | the historical short-circuit must sit before the funded-budget block and reuse the fenced persist; the store payload lives in utils/conversations/historical_minimum.py
Review findings
An independent review returned FIX. Every finding is addressed on this branch, each with a test that fails on the previous head.
processing_tier/summary_on_open; pin the seam's apps-results dump; the terminalstatusis set byprocess_conversation, the lifecycle owner; newmerge_resultsites declared; outcome labels viareason_label; the router imports onlyhistorical_projectionmerge_conversationsstampsprocessing_tierwhen any source is historicaltest_historical_tier_merge_and_persistence.py, through the realperform_merge_asynctitle_provenance='historical_minimum', treated as provisional bytitle_for_stabilitytest_the_open_time_summary_replaces_the_deterministic_title(real title path)/reprocessbypassed the switch, attempts, caps and BYOKhistorical_projection.admit_reprocessrunshistorical_summary.admitbefore the claim; refusals releasetest_reprocess_of_a_historical_row_*merge_resultoverwrote the block withlocal_onlyand never stamped delivery_merge_historicalpersist_processing_result_with_lifecycletest_an_admission_store_error_releases_its_slots_and_is_a_typed_503restart_succeededexistingtest_a_summary_landed_by_a_racing_open_is_returned_not_regeneratedgeneratedpersistence_observer; fenced is a retryable 503 with no vectortest_a_fenced_persist_is_a_retryable_503_with_no_vectorgenerated_compute.validated_llm_byokrequires an LLM-provider keytest_byok_account_with_only_a_transcription_key_is_409persist_with_fencestest_the_automatic_short_circuit_keeps_the_refresh_write_fencestest_refusals_never_spend_the_owners_hourly_or_daily_slotsENRICHMENT_MAX_AGE_HOURS; 0 is no tier; the separate setting is removedtest_the_tier_boundary_is_the_enrichment_age_gate,test_gate_off_means_no_tierDefaults decided by the coordinator (David can override):
HISTORICAL_SUMMARY_GLOBAL_DAILY_LIMIT10000 per day; short historical fragments keep the existing Home noise and neutral-title rules, which thehistorical_minimumstand-in provenance now reaches.Product invariants affected
How it was verified
The branch was built on origin/main 9c88e7f and merged with origin/main twice (no rebase). Every command went through
bin/omi-heavyon a host at load ~250-350.BACKEND_UNIT_TEST_FILE_LIST=<228 files> bash test.sh: theselect_backend_unit_tests.py --focused-outputlist for the fix diff, the earlier 94-file list, and the CI-red guard suites. All passed except two fast-unit CPU-guard trips: the merge-builder test, whose first call amortizes themerge_conversationsimport like its allowlisted siblings and is now allowlisted, andtest_conversation_processing_retryable_timeout(1.13-1.53 s), which trips the same way on unmodified origin/main on this host.scripts/check_feature_flag_registry.pyreports OK; the OpenAPI--checkand DTO generators show no drift;check_conversation_readers.pypasses.Tests
tests/unit/test_historical_tier_config.py: the boundary is strictly older than the gate and moves with it; a gate of 0 means no tier; untrusted clocks, switch defaults, the global limit parse, and the trigger table.tests/unit/test_historical_tier_processing.py: automatic triggers store without a model call before the funded block and keep the refresh write fences; owner triggers generate summary-only; the open-time summary replaces the stand-in title; non-historical rows are unchanged.tests/unit/test_historical_summary_open.py: every endpoint outcome and refusal order, slot accounting on every refusal, store errors, the racing open, the fenced persist, BYOK LLM-key requirement,/reprocessadmission, the projection and the stream guard.tests/unit/test_historical_tier_merge_and_persistence.py: the merge builder keeps the marker; the DB writer records delivery and keeps the block.UI-Evidence: none -- backend plus regenerated wire DTOs only; no client renders the new fields until PR 3/PR 4
Failure class (fixes)
Failure-Class: none
🤖 Generated with Claude Code