Skip to content

fix(summary): stamp first-summary debt when a batch projection lands a transcript on an untitled row - #25032

Merged
Git-on-my-level merged 13 commits into
mainfrom
lane/fabledebtstamp
Nov 11, 2026
Merged

Git-on-my-level merged 13 commits into
mainfrom
lane/fabledebtstamp

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Merge-main resolution under lead2 b60140; head a2fdeb52268d. Patch unchanged. Conflicts in backend/config/flag_budget.json and backend/tests/unit/test_flag_budget.py were resolved by keeping both sides (this PR's SUMMARY_PROJECTION_DEBT_ENABLED and main's EPISODE_COMPOSER_REUSE); flag_budget.count is 267, the merged name count.

Summary

A batch projection that lands a transcript on an already-completed row with no title and no summary now stamps the first-summary debt fields in the same write. Home then says "Writing notes" instead of hiding the row, and the debt repair can see it instead of refusing it as unknown_provenance.

Source: Fable account audit 2026-11-10, class 4 ("Batch rows with a transcript and no title carry no notes debt"). Authority: relay-cl1 ruling f6502a.

This is the consolidated fix batch for the three pre-reviews on #25032. It keeps the forward-only meaning of the stamp: old rows past the repair age gate are not stamped, and #25020 must exclude this cohort.

What changed

  • backend/utils/conversations/summary_delivery.py: stamp_projection_debt(write) now:
    • evaluates the exact repair eligibility with the provenance the stamp would add, using the same _refusal predicate the repair uses. It skips locks, client_processing, finalization ownership/BYOK, every non-empty summary_blocked_reason, below-floor clips, curated rows, discards, local-only rows and rows that already carry debt or a summary;
    • sets the row-level summary_title_provenance='server_minimum' and the debt clocks, but does not write structured.title_provenance. is_server_minimum gates apps, goals, memories, folders and vectors, so the stamp must not suppress those effects on a later reprocess;
    • preserves non-dict structured data instead of replacing it;
    • gives a row whose created_at is already past the repair age gate the provenance but no debt. The repair never sees it, so it cannot park it one-way, and Home hides it instead of presenting "Writing notes" forever;
    • keeps the double-stamp guard and the SUMMARY_PROJECTION_DEBT_ENABLED kill switch.
  • backend/utils/conversations/home_step.py: classify treats the row-level summary_title_provenance='server_minimum' as provisional, so Home and the repair agree without the derived-effect suppression that structured.title_provenance would cause.
  • backend/utils/batch_pipeline/live_projection.py: replace_record calls the stamp only when the projection actually placed new transcript segments, so the debt lands in the same transaction write.
  • Kill switch SUMMARY_PROJECTION_DEBT_ENABLED (default on; false/0/off/no restores today's behavior). Registered in config/feature-flags.yaml, backend/config/flag_budget.json (owner refactor-lead, review_by 2026-12-10) and the generated registry doc. The YAML row is appended at the end of the active flags: list to reduce insertion races with other open PRs.
  • backend/tests/support/lifecycle_writer_inventory.py: reviewed the two summary_due_at / summary_first_pending_at payload sites.
  • .github/failure-classes/FC-content-write-omits-implied-obligation.json: updated the canonical prevention to the row-level provenance and age-gate behavior.

#25020 ordering

#25032 lands before #25020. unknown_provenance is a missing-stamp defect for this cohort, not a durable refusal. #25020's backfill must exclude rows whose only refusal is unknown_provenance (or whose summary_title_provenance is server_minimum with a live debt clock) until a provenance backfill exists. This PR does not edit #25020's branch.

Tests

All through bin/omi-heavy on this head, with GCP credentials unset:

  • Merge-main re-run on a2fdeb52268d (merge of origin/main 88ce231c7c83): focused debt-stamp/registry/home/flag-budget suites 338 passed; exact schema-inventory test 1 passed; registry/render contracts OK; normal full pre-push gate passed (62 checks, 0 failed; bounded backend selection green).
  • Merge-main re-run on e63cd5b3aad7 (merge of origin/main 75dc53a81df7): focused debt-stamp/registry/home/flag-budget suites 338 passed; exact schema-inventory test plus deployment-contract suites 155 passed, 3 skipped; registry/render/policy-guard/release-process/runtime-image contracts all OK; normal full pre-push gate passed (62 checks, 0 failed; bounded backend selection green).
  • tests/unit/test_batch_pipeline_live.py and tests/unit/test_home_step.py: 213 passed. Covers the touched suite plus focused old-age, refusal, below-floor, non-dict, two-projection, double-stamp and every guard-branch case.
  • 25-file touched suite: 1758 passed. Includes test_summary_delivery, test_short_clip_summary_debt, test_home_transcribing_hold, test_home_transcribing_readers, test_record_partial, test_sync_failure_reason, test_lifecycle_state_table_writers, test_lifecycle_invariants, test_flag_budget, test_config_refactor_w6, test_runtime_env_sources, test_live_preflight, test_batch_pipeline_projection{,_release,_repair}, test_batch_held_contract, test_enrichment_age_gate, test_summary_persistence, test_summary_empty_recovery, test_conversation_phase, test_delivery_outcomes, test_conversation_smart_merge, test_sync_assignment_contention_retry, test_capture_assignment_dedupe and test_final_pass_assignment.
  • python3 scripts/check_feature_flag_registry.py: OK. python3 scripts/render_feature_flag_registry.py --check-parsers: OK. python3 scripts/failure-class validate --base origin/main --head HEAD --pr-body-file .agent-brief/pr-body.md: OK. bash scripts/run-release-process-guards.sh: OK. python3 backend/config/policy/guard.py: OK.
  • python3 backend/scripts/runtime_image_contracts.py check-source and check-third-party: OK. The age check is local to summary_delivery so the batch worker's static source closure does not pull in the testing-only parity module.
  • bash scripts/pr-preflight --lane local --base origin/main --head HEAD: 42 checks passed in 371s.

No production account data was read. No deploy, no data migration, no outbox enqueue.

Rollout and rollback

Set SUMMARY_PROJECTION_DEBT_ENABLED=false (or 0/off/no) to restore the pre-fix projection behavior. Reverting the PR also removes the stamp; existing stamped rows keep their debt and are handled by the normal repair. Rows past the age gate are never stamped, so no new unrepairable debt is created.

Failure-Class: new

Numbers-waived: no numeric capacity knob changed; the only new number is the existing deadline_seconds() deadline applied to the new debt.

State-exit-waived: no new pipeline state; the stamp enters the existing summary_debt:pending state whose exit is services/summary_debt_repair.py:tick.

…a transcript on an untitled row

A batch row that completes with no title never passes through the
server-minimum intake path, so it carried no summary debt: Home hid it and
the debt repair refused it as unknown_provenance. Stamp the debt in the
projection write that lands the transcript, behind a default-on kill switch.

Failure-Class: new
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T01:42:35.822364Z a2fdeb5 New commits
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 14eda6db5c

ℹ️ 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".

# A batch row that completes with no title never passes through the
# server-minimum intake path, so the projection is the only write that
# can stamp the first-summary debt Home and the repair read.
stamp_projection_debt(result)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add the required conversation lifecycle change note

This changes the batch transcript projection's lifecycle behavior by creating first-summary debt and altering Home presentation, but the commit contains no note under backend/docs/listen_pusher_pipeline/changes/. The backend guide explicitly requires a same-PR note for conversation lifecycle changes. Add a dated note documenting the atomic debt stamp, default-on kill switch, rollback behavior, and verification evidence so the pipeline's operational documentation includes this new repair entry path.

AGENTS.md reference: backend/AGENTS.md:L164-L164

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9ed7915dde

ℹ️ 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".

# needs to see the same provisional row the repair sees.
provisional = (
structured.get('title_provenance') == 'server_minimum'
or row.get('summary_title_provenance') == 'server_minimum'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Include row-level provenance in the slim list projection

When OMI_INDEXED_LIST_READS_ENABLED is enabled, the conversation list cannot reach this new branch: get_conversations_without_photos() in backend/database/conversations.py selects model fields plus explicit metadata, but summary_title_provenance belongs to neither Conversation.model_fields nor the added field sets. Because the stamp deliberately leaves structured.title_provenance unset and the list omits transcripts, these rows still classify as transcribing or, after two hours, failed, rather than writing_notes. Include the row-level provenance in the selected list metadata and test classification against the actual slim projection.

Useful? React with 👍 / 👎.

batch worker's static source closure, and that path reaches a testing-only
module the worker image does not ship. The cutoff and config are the same.
"""
from config import enrichment as enrichment_config

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Move the enrichment config import to module scope

The new function-local import violates the explicit backend convention that all imports must be at module scope. The source-closure concern documented above concerns importing utils.enrichment.age_gate, not the pure config.enrichment module actually imported here; move this config import alongside the other module-level config imports while retaining the call-time configuration read.

AGENTS.md reference: backend/AGENTS.md:L168-L168

Useful? React with 👍 / 👎.

Comment on lines +270 to +273
if _past_age_gate(write.get('created_at'), now=current):
return False
write['summary_first_pending_at'] = current
write['summary_due_at'] = current + deadline_seconds()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Check age eligibility at the scheduled repair time

For a projection landing shortly before the conversation's age cutoff, this check admits debt that the repair cannot service. With the default settings, a row created 71 hours, 59 minutes and 30 seconds ago passes this check but receives a deadline 120 seconds later; at that earliest eligible scan, services/summary_debt_repair.py:tick rejects it as expired and leaves its debt unchanged. If ordinary enrichment does not deliver a summary, a read retaining the provenance therefore shows writing_notes indefinitely, defeating the explicit provenance-without-debt treatment for historical rows. Account for the scheduled deadline when admitting debt, or provide a terminal disposition when a stamped row ages out before repair.

Useful? React with 👍 / 👎.

Git-on-my-level added a commit that referenced this pull request Nov 10, 2026
…25067)

## What and why

Publish the already-reviewed #25027 queue-config patch as one
replacement on current main. Supersedes #25027 because main churn after
#25019/#25021 left the old PR DIRTY and its two-push limit is exhausted.
Do not push the old branch again; leave #25027 open for merge-desk to
close after the replacement is green.

Permanent production values remain `enrichment-fresh` 30 concurrent / 10
dispatches/s and primary `enrichment` 300 concurrent / 25 dispatches/s,
per lead2 ruling `008024` (2026-11-10). Independent config hunks
preserve primary capacity during a fresh-only rollback. Named, asserted
intentional staging divergences retain primary 50/25 and fresh 5/2. This
publication adds no behavior or scope beyond the reviewed candidate;
retry and admission policy are unchanged.

The existing operational Firestore-pressure guard may temporarily lower
live fresh concurrency to 15 while retaining 10 dispatches/s; Git
remains 30/10. Re-evaluate the 168h age gate after the backlog drains.
Only `cl2-deploy` applies production configuration; this work applied
none.

## Refs and prior verdict

- Previous published candidate:
`44e120beae04e94153c263a8201f04cfeafb6c2b` on #25027. [Earlier review
verdict](#25027 (comment)):
Codex review completed at that exact head with no findings (2026-11-10
17:12:31 UTC). This is historical evidence, not a replacement-head CI or
review verdict.
- Reviewed local candidate carried here:
`909a2e8bd516380bf9a6a3d698fa117e501d6216`, based on
`720f078b33dde3872f5156fb87a961ffec2300c7`; its recorded result was
1,079 focused tests and 37 preflight checks green.
- Replacement base: `9fc3d64dc2e62c14acbfe4e77d33344cb13fdda0`
(`origin/main`, fetched 2026-11-10).
- Replacement head: `a69af6cd4bf075b0780e561d9c63cfea25017447`
(replacement push 1/2).
- Branch: `lane/pipeline-25027-replacement`.
- Diff against base: 5 files, +53/-15; 40 changed lines outside tests,
below the 500-line cap.

The candidate merge commit was cherry-picked relative to its second
parent (`git cherry-pick -m 2 909a2e8`) onto current main. It applied
cleanly. The stable patch ID is identical for the reviewed diff and
replacement diff: `8839886f923ca8e0a10ee366e7ab8fe630318db8`. No rebase,
force push, or additional PR merge. #25019
(`720f078b33dde3872f5156fb87a961ffec2300c7`) and #25021
(`9fc3d64dc2e62c14acbfe4e77d33344cb13fdda0`) are already merged in this
base. #25019's production repair admission limit of 8, service-env
spend-cap assertions, and debt ordering are preserved exactly as merged.
#25021's pending-first-summary admission is preserved.
Query/index/registry, repair service, summary config, and runtime
manifests remain identical to this base; only the five reviewed files
differ.

Plan row: L3 notes queue bundle, replacement of #25027 -> #25032 ->
#25020. #25021 and #25019 are already merged. Stop after publication for
fresh CI and delta-only Luna review; no deploy or merge.

## Verification

Repository: `BasedHardware/omi`, replacement worktree on m1. Evidence
layer: local source/config/docs contracts and pre-push checks; no live
production measurement. All checks use the worktree-owned
`backend/.venv` through `bin/omi-heavy run --`, with GCP credentials
unset:

```bash
env -u GOOGLE_APPLICATION_CREDENTIALS -u GOOGLE_CLOUD_PROJECT -u GCLOUD_PROJECT -u CLOUDSDK_CONFIG -u CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE -u SERVICE_ACCOUNT_JSON -u FIREBASE_AUTH_CREDENTIALS_PATH -u GCP_AGENT_TIER -u CLOUDSDK_CORE_PROJECT -u CLOUDSDK_PYTHON /Users/david/workspace/omi-workspace/bin/omi-heavy run -- bash -c 'set -euo pipefail
backend/.venv/bin/python -m pytest backend/tests/unit/test_config_train.py -q
backend/.venv/bin/python -m pytest backend/tests/unit/test_cloud_run_rightsizing_pins.py backend/tests/unit/test_sync_two_lane.py -q
backend/.venv/bin/python -m pytest backend/tests/unit/test_drift_check.py -q
for suite in test_summary_delivery test_summary_repair_limits test_firestore_query_shapes test_firestore_outside_query_contract test_firestore_caller_witnesses test_firestore_runtime_witnesses test_firestore_index_rules test_firestore_query_contract test_firestore_field_indexes test_vad_cache_ttl_config; do
  backend/.venv/bin/python -m pytest "backend/tests/unit/${suite}.py" -q
done'
```

| Contract | Result |
| --- | --- |
| Config-train (spend cap + queue/staging assertions) | 52 passed |
| Cloud Run rightsizing + sync two-lane | 52 passed |
| Drift check | 32 passed |
| Summary delivery | 63 passed |
| Summary repair limits | 35 passed |
| Firestore query shapes | 560 passed |
| Outside-query contract | 31 passed |
| Firestore caller witnesses | 40 passed |
| Firestore runtime witnesses | 25 passed |
| Firestore index rules | 96 passed |
| Firestore query/registry contract | 50 passed |
| Firestore field indexes | 41 passed |
| Existing pipeline-doc config contract | 2 passed |

All 1,079 focused tests passed on this exact head, including all seven
canonical Firestore index-guard suites (843 tests). PR-body preflight:
37 checks passed (43.74s). Normal full pre-push: passed, including
backend type checking, the selected 52-test config-train suite, and
pinned Python formatting. Replacement push 1/2 was accepted; no skip
hatch. Local logs: `.agent-brief/replacement-focused.log`,
`.agent-brief/replacement-preflight.log`,
`.agent-brief/replacement-push.log`. No skip hatch.

Product invariants: none — ops capacity, contract assertions, and
existing operational docs only.
UI-Evidence: none — backend configuration only.
Failure-Class: none

## Rollback and success metric

Use a targeted fresh-value config edit to 15 concurrent / 10
dispatches/s, applied by `cl2-deploy`; primary stays 300/25 and
summary-debt repair admission is preserved. Never fully revert to
primary 50/25 plus fresh 5/2 during backlog. The operational fallback is
temporary and leaves the permanent Git target at 30/10. Keep both queues
running to drain admitted obligations; never delete or purge their
tasks.

Acceptance metric: owed first summaries older than 15 minutes < 1%. This
is the owed success metric, not a new measured result or alert. Check
handler 5xx, 409 delivery-budget cuts, executor wait, LLM request
latency/errors, and title age before subsequent capacity decisions.


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

## Summary

- classify both terminal empty-output block reasons
(`empty_output_exhausted`,
`empty_output_lifetime_exhausted`) as the existing `home_step=noise`
state
regardless of `structured.title_provenance`, but only when the summary
has no
  overview or section body
- reuse `summary_delivery.present` so a title, action item, or event
cannot
masquerade as summary output; curated rows retain their existing
precedence
- a banked receipt (`summary_output_present` or `summary_completed_at`)
or a
live `summary_due_at` outranks a stale terminal reason, so a recovered
or
  re-opened row stays `ready`/`writing_notes` instead of disappearing
- add the default-on `HOME_EMPTY_OUTPUT_NOISE` kill switch, its
  registry/deployment classification, and a budget exception owned by
  `refactor-lead` with `review_by=2026-12-10`

Source: audit class 10 (2026-11-10), relay-cl1 ruling f6502a, lead
`refactor-lead`.

Failure-Class: FC-provisional-home-content-published-as-final

## Base and head

- Base: `origin/main` `35e63b5d701f94396cd166ef22db8df37aa947d4` (merged
  normally; no rebase, no force-push)
- Head: `c92dc8281539ab2a7a9f88db7e083fb60297f29a` (push 2/2)
- Diff against the merged base: 10 files, +149/-12; 58 non-test
additions.
The batch adds the receipt/debt guards, docstring, and expanded
regressions.

## Client impact

No Flutter change is needed.
`app/lib/pages/conversations/home_rows.dart`
already consumes `home_step=noise` and removes that row from default
Home. Its
status/title fallback is only for older servers where `home_step` is
absent. No
`app/` files changed.

## Kill switch, default, rollback

- `HOME_EMPTY_OUTPUT_NOISE` defaults on.
- `false`, `0`, `off`, or `no` restores the legacy `server_minimum`-only
  classification.
- `HOME_STEP_PROJECTION=off` remains the broader rollback that omits the
field.
- No deployment values change and no production data was read or
written.

## Metric

- No terminal empty-output row (both reasons, no overview/section body,
no
  banked receipt, no open debt) appears on default Home.
- No banked or re-opened row is hidden: `summary_output_present`,
`summary_completed_at`, or a live `summary_due_at` keeps the row visible
as
  `ready`/`writing_notes`.
- Curated, failed, dead-letter, upload-failed, BYOK and local-only rows
keep
  their existing precedence.

## Verification (measured on this head)

Credentials unset before every run (`GOOGLE_APPLICATION_CREDENTIALS`,
`GCP_AGENT_TIER`, `CLOUDSDK_CONFIG`, `CLOUDSDK_CORE_PROJECT`,
`CLOUDSDK_PYTHON`), via `bin/omi-heavy run --`:

- `tests/unit/test_home_step.py tests/unit/test_flag_budget.py
tests/unit/test_summary_delivery.py
tests/unit/test_summary_empty_recovery.py
tests/unit/test_list_projection.py
tests/unit/test_home_transcribing_hold.py`
  — **289 passed**
- `tests/unit/test_config_refactor_w6.py` — **157 passed**
- `python3 scripts/check_feature_flag_registry.py` — **OK**
- `python3 .github/scripts/check_deployment_secret_boundary.py --base
  origin/main` — **passed**
- `git diff --check` — **passed**
- `scripts/pr-preflight --lane local` — **42 checks passed**
- Normal full pre-push gate — **passed**, push accepted.
- Fresh exact-head GitHub workflow query (2026-11-10): all 13 returned
runs
completed successfully, including Backend Unit Tests, Backend Hermetic
E2E,
Backend Emulator Proofs, OpenAPI Contract, and Runtime Image Contracts.

New regressions cover: both receipt fields, open due debt, late re-open
(noise -> writing_notes/ready), both terminal reasons with the switch on
and
off, curated-row precedence, and output-present under the switch off.
The
missing-provenance cases are unchanged and still asserted.

## Merge-order notes

- `backend/config/flag_budget.json` `count` equals `len(names)` on this
head
(265 = main 264 + this flag). If corrected-base replacement #25055
(replacing #25028) or #25032 lands first, the merge
must set `count` to the actual `len(names)` on that merged head, not a
copied count.
- `config/feature-flags.yaml`: keep #25024's rewritten
`HOME_STEP_PROJECTION`
  line, then this `HOME_EMPTY_OUTPUT_NOISE` line, then
  `HOME_TRANSCRIPTION_PRESENTATION_GATE`.
- `backend/tests/unit/test_flag_budget.py`: keep every peer's
  `HELPER_KILL_SWITCHES` entry and `elif` branch alongside
  `HOME_EMPTY_OUTPUT_NOISE`.
- `backend/utils/conversations/home_step.py`: #25032 widens
`provisional` to
  include row-level `summary_title_provenance`; keep that and this
  `empty_output` block. The two are independent.
- #25020 is clean against this branch.

## Render evidence (blocker)

This is Home-visible behavior and no Flutter render has been produced
for this
head. Before merge, the driver must obtain renders for:

1. terminal reason + no overview/section body, provenance absent ->
hidden on
   Home, still findable in archive/search
2. same for the lifetime reason; kill switch off -> legacy
absent-provenance
   row visible again
3. banked output-present/completed receipt -> ready; open
`summary_due_at` ->
   Writing notes
4. overview or section body present, user-curated, and BYOK/local-only
-> stay
   visible as applicable
5. failed/dead-letter/upload-failed -> Activity Needs attention; no
failed row
   on Home
6. title/action-items/events only with no overview/section body ->
hidden with
no visible retry. This is the independent visibility review's case: the
row
is hidden and no automatic retry is surfaced, so David must accept that
   exact behavior.

Do not merge until fresh renders go to relay-cl1 and David acknowledges
them.
Git-on-my-level and others added 3 commits November 10, 2026 14:47
Preserve the reviewed debt-stamp behavior and current Home empty-output precedence.
Retain both flag budgets and peer helper entries. Apply the approved typed
privacy-authority fixture correction without changing assertions or privacy guards.

Authorized merge-main continuation: lead2 591811.
Reconcile remote 632e5a0 with qualified 30d5825 without rewriting history.
Retain the equivalent remote peer-helper tuple and the approved complete
synthetic privacy map. Preserve all debt and Home recovery behavior.

Authorized reconciliation: lead2 591811.
Git-on-my-level added a commit that referenced this pull request Nov 10, 2026
)

## What and why

Retire summary due indexes atomically when donor tombstones, manual
title/overview edits or already-enriched merges refuse repair. Preserve
`summary_first_pending_at`. Undo/manual-field removal and discard
restore recover owed debt in the same transaction using original
acceptance plus the row's policy deadline, without replacing a non-null
due or arming a refused/owned row. Internal debt metadata stays outside
reversible user-field receipts.

The guarded operator script clears legacy residue using the serving
refusal classifier. Unknown provenance is retained for provenance
repair; processing, local-only, BYOK and active finalization ownership
are explicitly retained even when another refusal has precedence. Both
completion metadata and output-present metadata retire copied legacy
due. No serving rate, feature flag, deadline, capacity, repair-service
or released-client schema changes.

## Merge order — required hold

Merge **after #25019 and #25032. This PR must not merge before #25032.**
Both dependency PRs were OPEN when this batch began. After #25019 lands,
rebase onto current `origin/main`, regenerate inventories and retain
both sides' tests; never resolve a shared-file conflict by taking one
side wholesale. Repeat exact inventory guards after any overlapping PR
lands. #25032 owns its upstream registry/flag-budget train conflicts;
this batch does not edit them.

## Operator run plan — cl2-deploy only

1. Deploy the merged code first, then identify the exact serving
revision. Old writer sites keep re-arming due during the sweep, so a
pre-deploy sweep or dry-run is insufficient.
2. Re-run a fresh dry-run **after deployment on that serving revision**.
Verify the deployed `summary_due_at` collection-group index and inspect
class/retained/eligible/conflict counts before any apply.
3. Run a bounded **5,000 scanned-row canary**, using an apply cursor
separate from the dry-run cursor. Production `--apply` additionally
requires `--confirm-production-project based-hardware` matching the
actual client's project. Review canary counts.
4. Run the full sweep **only on lead2's go**. Re-run the
serving-revision dry-run after any intervening code deployment; restart
without a cursor to reconsider conflicts as needed.

The sweep runs **two disjoint passes** at one cutoff instant: a numeric
`summary_due_at <= now` pass, then a Timestamp `summary_due_at <=
datetime(now, UTC)` pass. Each uses `(summary_due_at, __name__)`
pagination, classifier-only projection and batches of at most 400
writes. Every clear retains the original snapshot `update_time`
precondition, including individual retries after atomic batch failure.
Concurrent re-arm/delete is skipped. `--limit` bounds the combined
scanned rows across both passes, including retained rows. Aggregate
counts remain available, with scanned/eligible/classes/written/conflicts
also reported separately under `passes.numeric` and `passes.timestamp`.
Output is counts-only; private cursor files are written to unique
same-directory `mkstemp` files, explicitly set to mode `0600`, flushed
and fsynced before atomic replacement; any failed attempt removes its
temporary file and preserves the previous checkpoint. They include a
`pass` marker plus a numeric or tagged RFC3339 due and document path,
with no IDs printed. Cursors are separate for each pass: completing
numeric scanning checkpoints `{pass: "timestamp", due: null, __name__:
null}` before the first timestamp query. Resuming a timestamp checkpoint
skips the completed numeric pass. Older unmarked cursors infer their
pass from the due type. Keep apply/dry-run cursor files separate. This
operator-only metadata cleanup is exempt from content-generation batch
privacy admission: it never reads transcripts/generated summaries or
changes protection levels or content. No production access or operator
run was performed in this lane.

## Follow-up: private atomic checkpoints

Review-desk FIX-FIRST at `f940cf9dd489` found that the predictable
`.tmp` path could expose private cursor document paths through a
pre-existing permissive file or symlink. Checkpoint publication now uses
a unique file in the checkpoint directory, explicit `0600`, flush/fsync
before `os.replace`, and unconditional temporary-file cleanup on
failure. Atomic replacement also replaces a final-path symlink without
following its target.

- Backfill suite through omi-heavy: **101 passed / 1 existing
loopback-only skip**, 1.33s, completed approximately 2026-11-10 17:51Z.
All eight new filesystem/security cases passed. This follow-up changes
only the backfill script and its test file; no operator --apply or
production access.
- Checkpoint follow-up head: `8159c89608d86c4c67a9bfc5d077e57c7df2f48f`.
`make preflight`: **39 checks passed in 64.42s**, completed
approximately 2026-11-10 17:55Z. Full PR non-test scope: **397 changed
lines**, within the original 500-line cap. The single authorized
checkpoint follow-up push succeeded as a fast-forward, approximately
2026-11-10 17:55:43–17:57:17Z. Its normal hook passed **39 shared checks
(67.26s), typecheck with zero errors, 250 passing changed-file tests
plus 23 explicit loopback-only skips**, and pinned formatting.
Exact-head CI is being monitored with a 90-minute deadline.

## Follow-up: two-pass sweep

Review-desk FIX-FIRST at `50f47f8058fc` found that a numeric cutoff
never selects Timestamp-valued due. The backfill now queries both types
and keeps the same classifier, fences, dry-run default and counts-only
output in each pass. Checkpoints explicitly mark the active pass and
survive interruption at the pass boundary.

Read-only inspection also confirms the serving query/repair blind spot:
`database/summary_debt_queries.py:13,24` uses a numeric cutoff/cursor;
`services/summary_debt_repair.py:50` rejects nonnumeric due and its
overdue-age arithmetic assumes a number. Those files are **unchanged**,
as requested; cl2-fixnow should route that finding to #25019's owner.

- Focused selection re-run through omi-heavy, 2026-11-10 approximately
17:12Z: **2,209 passed / 23 skipped / 86 xfailed**. Adjacent **117
passed**; extra chat/tool/strict transaction selection **55 passed**.
Per-file commands, exact timestamps and results:
`focused-results-followup-m1.json` in the supplied task directory.
- Backfill tests against synthetic loopback Firestore: **94 passed**,
receipt completed 2026-11-10T17:12:06.668829+00:00. Includes actual
mixed-type inequality behavior, refused clears, owed/future retention,
shared limits, both cursor types, interruption at the pass boundary and
bounded/fenced writes. Emulator shut down normally.
- Follow-up at earlier head `f940cf9dd4898798c72e854c0dd5226554b76866`.
`make preflight`: **39 checks passed in 46.50s**, 2026-11-10
approximately 17:15–17:16Z. Full PR scope: **388 non-test changed
lines**, within the 500-line cap.
- Only the backfill script and its test file changed in this follow-up.
Serving query and repair files remain untouched. The single follow-up
fast-forward push succeeded on 2026-11-10 approximately
17:16:32–17:17:52Z. Its normal hook passed 39 shared checks (57.04s),
typecheck with zero errors, 242 passing changed-file tests plus 23
explicit loopback-only skips, and pinned formatting. CI is being
monitored on this exact head with a 90-minute deadline.


## Verification of the preceding batch

Verification is hermetic code and synthetic loopback Firestore evidence,
not deployed-runtime evidence. Commands use
`/Users/david/workspace/omi-workspace/bin/omi-heavy run --` and the
worktree's Python 3.11, with GCP credential environment scrubbed. Pytest
files run in isolated processes under the backend unit contract.

- Requested focused selection on this batch: **2,170 passed, 22 skipped
(loopback tests run separately), 86 xfailed**, 2026-11-10
16:14:30–16:15:06Z. The old ae48104 selection measured 2,087/4/86; new
guards add passing cases and the new emulator cases increase the
explicit loopback-only skips.
- Adjacent selection: **117 passed**, 16:15:06–16:15:13Z; additional
chat/tool/strict People transaction selection: **55 passed**,
16:15:13–16:15:18Z. Exact per-file commands, timestamps and logs:
`/Volumes/scratch/cl2-fixnow-move25020/focused-results-m1.json`.
- Synthetic loopback Firestore: **22 chat edit/undo tests passed** and
**31 People-generation emulator checks passed**, 2026-11-10
approximately 16:13–16:14Z. Emulator stopped. Used the installed Java 21
in the process environment only.
- `make preflight` on commit `50f47f8058fcb904bb5bd185184c1473284783cc`:
**39 checks passed in 55.79s**, 2026-11-10 approximately 16:17–16:18Z.
The full PR has **354 non-test changed lines** (342 additions / 12
deletions), below 500.
- Regenerated the lifecycle payload inventory for changed owners and all
People fingerprints (only the four already-audited chat scopes differ);
People generator check reports no delta. Exact lifecycle
inventory/state-table guard is included above; serving lifecycle write
guard passed in preflight. Normal pre-push on
`50f47f8058fcb904bb5bd185184c1473284783cc` passed all 39 shared checks,
typecheck with zero errors, 203 passing changed-file tests plus 22
explicit loopback-only skips, and pinned formatting for all 15 PR Python
files (2026-11-10 16:18:28–16:19:46Z). The single fast-forward push
succeeded with no bypass.


UI-Evidence: none — backend metadata and an operator script only.

## Finding dispositions

| Finding (review sources) | Disposition in this batch |
|---|---|
| Predictable checkpoint temp path can follow a symlink or reuse
permissive permissions (review-desk 72a878, FIX-FIRST) | Use exclusive
unique same-directory `tempfile.mkstemp`, enforce `0600` via `fchmod`,
write/flush/fsync, then `os.replace`. Cleanup runs on failure, leaving
the previous checkpoint intact. Regressions cover the old predictable
symlink/permissive file, permissive umask, write/fsync/replace/fchmod
failures, descriptor closure and safe replacement of a final-path
symlink. |
| Numeric-only cutoff misses timestamp-valued due (review-desk e7b7dc,
FIX-FIRST) | Replaced with numeric and Timestamp passes, distinct
pass-aware checkpoints and per-pass counts. Tests cover
refused/owed/future rows in both types, shared limits, resumable pass
boundary, update-time conflicts and 400-write caps. A loopback Firestore
regression verifies actual mixed-type query behavior. |
| Unknown provenance retired as durable; #25032 late projection stranded
(pd correctness/custody/tests/merge/Kimi) | Removed from
`DURABLE_REFUSALS` and durable test cases. Regression retains the legacy
due and first-pending anchor. Missing provenance still needs its owning
repair; this batch never clears it. |
| Manual undo loses owed debt (all correctness/custody/test reviews, old
merge/CI) | Chat restore and explicit null/DELETE_FIELD removals re-arm
atomically from preserved first pending plus the stored
`first_summary_policy` deadline, falling back to `deadline_seconds()`.
Refused rows and already-armed rows never acquire a replacement due.
Real codec, strict transaction and loopback emulator coverage. |
| Every other manual removal path needs coverage (sdclear-fix1) | Title
UI and offline empty titles remain non-null manual values, covered by
retirement tests. Chat tools reject blank title/overview edits before
IO. Sync restore and generated persistence preserve manual fields. All
actual removal writers are declared in the lifecycle inventory. |
| Summary BYOK reason not excluded; terminal BYOK semantics untested (pd
correctness/custody/tests) | Explicitly retain
`summary_blocked_reason=blocked_byok`, including a competing deleted
flag and no active job. Existing finalization BYOK exclusion remains. No
terminal-BYOK policy expansion. |
| Detached queued/leased finalization rows (pd correctness) | Explicitly
retain both statuses even without a job ID, including competing
manual/discard flags. Re-arm also respects these owners. |
| Output-present enriched row can retain copied due (pd custody) | Both
completion metadata and `summary_output_present=True` take the enriched
return and retire due. Empty reprocessing preserves banked structured
content without requiring a completion stamp. |
| Discarded rows recoverable after sweep (pd correctness/tests) | The
existing restore transaction re-arms only currently owed, unarmed rows
from original acceptance and policy. Tests cover cleared legacy rows
without receipts, manual/enriched/locked refusal, existing due and
writer ownership. |
| Refusal classes can later reopen (pd correctness/custody) | Manual and
discard inverses now recover debt. Empty-output revision re-arm stays
intact and is covered by the adjacent recovery suite.
Privacy/content-floor decisions remain governed by their existing
policy; this metadata cleanup does not introduce a new privacy/content
transition. `DURABLE_REFUSALS` now documents current-obligation
retirement rather than permanent lifecycle finality. |
| Backfill bypasses batch privacy fence (pd custody) | Documented
metadata-only operator exemption: no transcript or generated summary is
read or written; only the due index is cleared with a snapshot
update-time fence. Serving content-generation fences remain unchanged. |
| Non-JSON due checkpoint (pd custody) | Timestamp cursors use private
tagged RFC3339 values and decode on resume, preserving Firestore
timestamp type and nanoseconds. Numeric cursor format remains supported.
|
| No explicit prod apply guard (pd custody) | `--apply` on
`based-hardware` requires matching `--confirm-production-project
based-hardware`; an unknown project fails closed. Synthetic unit
coverage only; no operator apply was run. |
| CLI failure path / deleted cursor not tested (pd tests) | Added
counts-only CLI error regression and resume after a deleted numeric
cursor; timestamp cursor also resumes after a missing cursor document. |
| Unchanged-title path lacks assertion (pd tests nit) | Added
no-write/no-due-move assertion for an unchanged offline title. |
| Legacy exact title assertion fails CI (old CI/merge) | Already
corrected at ae48104; retained and re-run the full revision-contract
file. |
| Update-time fence, dry-run, bounded cursor, counts-only output (all
reviews) | Preserved; original race, atomic-batch, tie/resume,
scanned-row limit, batch-size and privacy tests remain intact. |
| Deploy must precede sweep (old merge, sdclear-fix1) | Run plan below
requires code serving first and a fresh post-deploy dry-run on that
exact serving revision before the 5k canary. Old writers would keep
re-arming due during a sweep. |
| Code revert cannot restore cleared rows (pd merge, old custody) |
Rollback explicitly requires a separately authorized re-stamp keyed on
preserved `summary_first_pending_at`, current owed rows only. |
| #25019 / #25032 ordering and same-file inventories (pd merge, old
merge, sdclear-fix1) | Must merge after both, never before #25032. Both
were OPEN at intake; no premature rebase. After #25019 lands, rebase and
regenerate inventories, preserving both sides and tests rather than
taking a side wholesale. |
| Upstream #25032 registry / #25034 flag-budget conflicts (pd merge) |
Dependency-owner work outside this batch. The merge train must resolve
those before #25020; no workflow/flag-budget edits here. |
| #25018 / #24866 / #24801 / #24897 / stale #24607 overlaps (old and pd
merge) | Re-fetch before integration; if these land first, rebase and
re-run exact inventories and both branches' tests. No unrelated PR
changes or merges performed here. |
| Operator query excluded from serving-query inventory (pd merge) |
Preserve script scope. Uses the existing `summary_due_at`
COLLECTION_GROUP single-field index; cl2-deploy must verify the deployed
index with the serving-revision dry-run before canary. No production
query in this lane. |
| People audit and lifecycle inventories after shared-scope changes (all
test reviews) | Regenerated reviewed entries and four existing People
fingerprints after strict transaction and loopback emulator proof;
exact-match guards re-run. |

## Rollback

A code revert **does not restore rows whose due indexes the backfill
already cleared**. Preserve the operator receipts/cursors and stop the
sweep. A separately authorized repair must enumerate/re-stamp keyed on
the preserved `summary_first_pending_at`; only rows the current
classifier calls owed, with no competing owner and a null/missing due,
may receive `summary_first_pending_at + stored first_summary_policy
deadline` (or `deadline_seconds()` without a snapshot). Never reset the
anchor, move a non-null due, or blindly re-arm refused rows. Do not use
the due index itself to find already-cleared rows.

Failure-Class: FC-obligation-outlives-terminal-owner

Line-Count-Exception: backend/database/conversations.py | 4960 -> 4969 |
Keep atomic due retirement and guarded discard-restore re-arm at their
owning writes.

Line-Count-Exception: backend/utils/sync/assignment.py | 1538 -> 1539 |
Keep atomic summary-debt retirement at the donor redirect write.
# Conflicts:
#	backend/utils/conversations/summary_delivery.py
#	config/feature-flags.yaml
# Conflicts:
#	backend/config/flag_budget.json
#	backend/tests/unit/test_flag_budget.py
@Git-on-my-level
Git-on-my-level merged commit a155a9b into main Nov 11, 2026
72 of 74 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/fabledebtstamp branch November 11, 2026 02:16
Git-on-my-level added a commit that referenced this pull request Nov 11, 2026
…ons (#25089)

Reconcile `backend/config/flag_budget.json` count from 267 to 268 after
a semantic merge race between #25077 and the `lane/fabledebtstamp` merge
(#25032). Both lanes added a distinct flag on their own bases, leaving
both names present with a stale count.

Verified 268 unique names and no duplicate JSON keys.
`BATCH_HELD_POLL_SKIP_ENABLED` is read through
`config.batch_pipeline.held_poll_skip_enabled()` by the store adapters;
`SUMMARY_PROJECTION_DEBT_ENABLED` is read through
`projection_debt_enabled()` in
`utils/conversations/summary_delivery.py`. Both have owned registry
entries. Only `count` changes. ADR 0006's seeded/replacement budget
remains 161; owned exceptions are validated separately.

Validation: `/Users/david/workspace/omi-workspace/bin/omi-heavy run --
backend/.venv/bin/python -m pytest
backend/tests/unit/test_flag_budget.py -q`

```text
........................                                                 [100%]
24 passed in 0.62s
```

Current head: `1e8ad1fb9b0c2a801a93407fdbcbdc9ce9659aa1`

Product invariants affected: none (inventory metadata only).
Failure-Class: none

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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