Skip to content

fix(attention): expire non-retryable items (replacement for #25028) - #25055

Closed
Git-on-my-level wants to merge 4 commits into
mainfrom
lane/pipeline-25028-replacement
Closed

Git-on-my-level wants to merge 4 commits into
mainfrom
lane/pipeline-25028-replacement

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

What changed and why

Merge current main 35e63b5d701f94396cd166ef22db8df37aa947d4 (#25029) normally into the existing replacement branch in commit e1c309b3e047cbfb15933fb0d2246af8829cd459 (parents 7d75d6a598069ae9cdf5275efbdf4077e7569b40 and 35e63b5d701f94396cd166ef22db8df37aa947d4). Preserve both the reviewed attention expiry and inherited Soniox refusal failover. The shared declarations and snapshots keep both switches; recompute flag_budget.count == len(names) (265). Regenerate the flag registry from the combined sources. No new product behavior is introduced.

Supersedes #25028 because its stale base inherited the #25013 main-red failure in test_inventory_openapi_route_response_decode_migration_complete. #25037 reverted that change at d24d101cae; this replacement starts from freshly fetched main 986386ba0e480dd6963f0677a30cfbc7e5294580, which contains that revert. The old PR remains open for the driver to close after replacement verification.

Carries exactly these non-merge commits from reviewed head 02e0f364a980e5e65676931199470daf949d9806 (old base 8141729fccd928b90d16b34c13bcc162fef01fa5):

  • 6232889ff776e110644f68a6b26f728c242b42f5 → 329a8b8fa5: expiry predicate and initial tests.
  • b5d77ad0010c10c687215253e9d7fa8afcd2e388 → 3e0e6f98de: transaction fencing, tests, config, registry and documentation.
  • 02e0f364a980e5e65676931199470daf949d9806 → 7d75d6a598: pusher literal config snapshot.

The initial replacement cherry-picked these commits without conflicts, with a byte-identical diff. This continuation merges main without rebasing or force-pushing. The only textual conflict was the generated flag registry; preserve both rows by regeneration. The flag budget needed its combined count recomputed. Attention expiry source and tests remain byte-identical to the reviewed parent, and Soniox source remains byte-identical to main. The PR review surface remains the original 18 paths; inherited .github/ content is unchanged from main. Scope is unchanged.

Both attention GET paths lazily expire only permanently non-retryable recovery_structure_unavailable items after seven days. Expiry retains the document with active=false, expired_at, and expiry_reason=non_retryable_ttl. The transaction rereads the observed item/version and common retry claim before writing, so concurrent changes, deletion and retry claims prevent stale expiry. Transient failure reasons remain visible. Legacy naive timestamps use UTC; missing/invalid dates remain visible. Pending-work limits apply after resolution and expiry filtering.

Product invariants affected

  • INV-MEM-4: the runtime change only adds attention expiry configuration; canonical memory consolidation and promotion authority retain their existing configuration. Attention expiry is distinct from Short-term memory disposition.

Tuning and rollback

  • NON_RETRYABLE_ITEM_TTL: before unbounded; after seven days from created_at, exclusively for recovery_structure_unavailable after retry reconciliation.
  • PROCESSING_ATTENTION_NON_RETRYABLE_EXPIRY_ENABLED: default on; setting the declared value to false and recomposing runtime configuration disables new expiry writes. All backend services and matching listen/pusher charts carry the binding.
  • Expiry is terminal. Already-expired documents remain inactive after disabling the switch; no automatic data restoration is claimed. Reverting this patch rolls back the code/config. The pending-work window continues scanning until 100 surviving items or end of the active set.

Verification

Fresh checks of merged head e1c309b3e047cbfb15933fb0d2246af8829cd459 passed: All tests, deployment contracts, preflight and normal pre-push run on m1 through /Users/david/workspace/omi-workspace/bin/omi-heavy run -- ..., with GCP credential environment variables unset and worktree-local Python 3.11 dependencies.

  • BACKEND_UNIT_TEST_FILE_LIST=../.agent-brief/continuation-focused-tests.txt bash backend/test.sh: 1092 passed, 1 deselected across 12 files. Includes the original attention expiry suite (67 passed), runtime env, flag budget, Firestore shapes, all 31 pusher snapshot tests, and all 14 schema inventory tests including the exact test_inventory_openapi_route_response_decode_migration_complete regression. Six inherited failover/metadata/renderer suites also passed.
  • bash backend/scripts/pre-deploy-check.sh: 511 passed plus hermetic deployment/runtime/state and workflow contracts.
  • OMI_PR_BODY_FILE=.agent-brief/pr-body.md BACKEND_UNIT_FILE_BUDGET_SECONDS=3600 make preflight: all 54 checks passed, including flag registry, composition and deployment classification.
  • Semantic comparison against both parents passed: the chart, runtime, flag, budget and deployment-classification settings retain the combined reviewed values, with count equal to the union of names. The attention implementation/tests match the reviewed parent; Soniox source and .github/ content match main. The PR review surface remains the original 18 files, 340 insertions and 11 deletions.
  • git push origin HEAD:refs/heads/lane/pipeline-25028-replacement: push 2/2 succeeded with the complete normal pre-push hook, including shared preflight, type checking, selected backend tests, contracts and pinned formatting. No bypass flags were used. The remote advanced normally from 7d75d6a598069ae9cdf5275efbdf4077e7569b40 to e1c309b3e047cbfb15933fb0d2246af8829cd459. Main was re-fetched and remained the fix(stt): fail over prerecorded Modulate refusals to Soniox #25029 merge before this push.

Logs and receipts are retained under .agent-brief/evidence/continuation-* in the existing replacement lane. Evidence is hermetic; real Firestore contention/SDK retries and deployed behavior are not claimed. This continuation consumes the second and final allowed push; fresh CI and a fresh independent review remain required before landing.

UI evidence

UI-Evidence: none -- backend-only expiry on existing API reads; no client or UI change.

Failure class

Failure-Class: FC-stale-selection-used-as-write-authority

View guided diff Turn on auto-fix

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 added a commit that referenced this pull request Nov 11, 2026
…25055) (#25070)

## What changed and why

Head: `672d873b5aa2322b1e47a112e5e57fe412e5d1e4`

Replacement for #25055 (which replaced #25028) on current `origin/main`
`7ebd8450b6e023474cfe3275cf3446b28f3a710f`, carrying the reviewed
attention-expiry patch plus the independent-review FIX-FIRST corrections
at `Earlier head:` `e1c309b3e047cbfb15933fb0d2246af8829cd459`.

Supersedes #25055 because that PR is at its two-push limit and its exact
head carries two independent-review FIX-FIRST findings. This replacement
starts a fresh branch from current main, carries the same reviewed
commits, and fixes both findings:

- **Scan bound (finding `77a43d`).** `list_items` no longer streams a
user's whole active attention collection. Each query is bounded to
`SCAN_LIMIT = 500` documents, and an optional `start_after` cursor lets
a caller start from a known document. Expiry transactions therefore run
only inside a bounded scan.
- **Zero limit (finding `34c935`).** `list_items(limit=0)` (and any
non-positive limit) returns an empty list before iterating or appending,
instead of returning one item.
- **Scan cursor (finding `3d2d9d`).** A full read now pages internally
on the last **scanned** document, not the last returned one, so
filtering (resolved or expired rows) cannot repeat a window or omit
later items. The 500-row query bound and the non-positive-limit early
return are unchanged.

Carried non-merge commits from the reviewed head:

- `329a8b8fa5d` — expiry predicate and initial tests.
- `3e0e6f98de1` — transaction fencing, tests, config, registry and
documentation.
- `7d75d6a5980` — pusher literal config snapshot.

The carried patch is otherwise behavior-identical: attention expiry,
banked/completed/live-debt guards, and the flag registry. No new product
behavior beyond the two fixes. No `.github/`, UI, credentials/IAM,
production data/config, or model changes.

### Test-only follow-up (push 3)

`1252bca525de` is a test-only assertion under the driver's third-push
allowance. The 620-item pagination regression previously ended its first
500-row page on an item that was returned, so a cursor based on the last
*returned* item would have passed it too. The test now resolves the last
document of the first page and asserts the second page's `start_after`
is that document, protecting the last-scanned cursor in
`processing_attention._scan_pages`. No product code changed.

### Firestore client seam (Codex P1 `4529060103`, lead2 `f66b9e`)

`672d873b5aa2` fixes the review finding that the new expiry path used
the legacy module-level `db` proxy, contrary to `backend/AGENTS.md`.
`items_ref`, `_scan_pages`, and `list_items` now resolve
`get_firestore_client()` at call time and expose an optional
keyword-only `firestore_client` parameter; the bounded scan, the
conversation/claim reads, and the expiry transaction use that single
resolved client. The new expiry tests inject `firestore_client` instead
of monkeypatching `store.db` (the module fixture now supplies the same
fake client through `get_firestore_client` so the unconverted
claim/finish helpers and HTTP route keep working). `db` remains only in
the unconverted claim/finish helpers and `pending_conversations`.
Pagination, cursor, and expiry-predicate behavior are unchanged; the
delta is 15 non-test changed lines in one file plus the test seam.
Merge-main resolutions under `1c606e` are unchanged from
`71aff3e888f4e`.

### Merge-main resolutions (lead2 `1c606e`)

This head is a merge-main resolution under lead2 `1c606e`.

`71aff3e888f4e` merges current `origin/main` (`a73632ce0ec9`, which
carries C2's operator-ledger census read from #25084) into the branch.
Six files conflicted, all additive on both sides and resolved by keeping
both: `config/feature-flags.yaml`,
`backend/tests/unit/test_verify_pusher_config_references.py`, and all
four `backend/charts` listen/pusher values (this PR's
`PROCESSING_ATTENTION_NON_RETRYABLE_EXPIRY_ENABLED` and main's
`SYNC_RECORD_COVERAGE_WAIT_MEMO`), plus
`backend/config/flag_budget.json`, where `count` is reconciled to
**271**, equal to the 271 names on the merged head.
`backend/tests/support/firestore_query_driver_registry.py` auto-merged
and was then checked against both parents: this PR's attention cursor
entries (`list_items` with `start_after`, `_scan_pages` covered-by) and
C2's census entries (`pipeline_ledger.iter_global_window`,
`pipeline_ledger.retention_start`,
`pipeline_ledger_census._capture_creates`,
`pipeline_ledger_census.census`) are both preserved, and the delta
against `origin/main` is exactly this PR's patch (19 files). No product
behavior changed; the reviewed patch is unchanged.

`Earlier head:` `5ad54d2f0d8f2` merged `origin/main` (`8fa2cbd36487b`,
the main-wide notes prompt-pin fix from #25108); that merge was clean
and `flag_budget.count` was 270 there.

`Earlier head:` `bf6efab1c7bf6` merged `origin/main` (`8659de6ee98d9`,
which carries the main-wide messaging flake fix from #25018) into the
branch, so the previously red messaging check ran against the fix. Five
files conflicted: `config/feature-flags.yaml` and both
`backend/charts/backend-listen` listen values (additive env/flag entries
on each side, kept both), `backend/config/flag_budget.json` (`count`
reconciled to 270, equal to the 270 names on the merged head), and
`backend/docs/pending-work.md` (narrative paragraphs from both sides
merged, keeping the `HOME_STEP_PROJECTION` text and the
bounded-attention text). No product behavior changed; the reviewed patch
is unchanged.

`Earlier head:` `047de1b18fb7` merged the prior `origin/main`
(`75dc53a81df7`) under the same ruling; its only conflict was
`config/feature-flags.yaml`.

## Product invariants affected

- INV-MEM-4: the runtime change only adds attention expiry
configuration; canonical memory consolidation and promotion authority
retain their existing configuration. Attention expiry is distinct from
Short-term memory disposition.

## Tuning and rollback

- `PROCESSING_ATTENTION_NON_RETRYABLE_EXPIRY_ENABLED`: default on.
Setting the declared value to `false` and recomposing runtime
configuration disables new expiry writes. All backend services and
matching listen/pusher charts carry the binding.
- `NON_RETRYABLE_ITEM_TTL`: seven days from `created_at`, exclusively
for `recovery_structure_unavailable` after retry reconciliation.
- `SCAN_LIMIT`: 500 active attention documents examined per query; a
full read pages internally on the last scanned document.
- Bundle kill switch: `HOME_STEP_PROJECTION` (existing, default on).
Turning it off is the L4 rollback.
- Rollback is the flag off; no data migration. Expiry is terminal:
already-expired documents remain inactive after disabling the switch,
and no automatic data restoration is claimed.
- L4 success metric: **no processing rows on past days**.

## Verification

Fresh checks of head `672d873b5aa2` on m5 through
`/Users/dazheng/workspace/omi/bin/omi-heavy run -- ...`, with GCP
credential environment variables unset and worktree-local Python 3.11
dependencies:

- Attention/pending-work set (13 files, including
`test_batch_pipeline_scheduler.py`): **360 passed** across the 13 files
run; `test_pending_work.py` alone: **76 passed**, including the
strengthened 620-item pagination regression and all expiry tests, now
with `firestore_client` injection.
- Full query-shape battery `test_firestore_query_shapes.py` (now
covering both driver sets): **572 passed**.
- Flag budget: **24 passed** (`flag_budget.count` 271 equals the 271
names on the merged head). `test_verify_pusher_config_references.py`:
**31 passed**. Runtime-env validator: **206 passed**. Notes
prompt-version node `test_llm_input_prompt_version.py`: **6 passed**
(including `test_prompt_sources_match_the_pinned_digest[notes]`).
Combined five-file run: **839 passed**.
- Normal full pre-push hook: **PASS**, 0 failures.
- The new cursor assertion was confirmed load-bearing: mutating
`_scan_pages` to advance on the second-to-last page item fails it with
`[None, 'item-0498'] != [None, 'item-0499']`.

Evidence is hermetic; real Firestore contention/SDK retries and deployed
behavior are not claimed.

## UI evidence

UI-Evidence: none -- backend-only expiry on existing API reads; no
client or UI change.

## Failure class

Failure-Class: FC-stale-selection-used-as-write-authority
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Closed by the flow owner as superseded by #25070; reopen if wrong.

@github-actions

Copy link
Copy Markdown
Contributor

Hey @Git-on-my-level 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing.

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community!

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