Skip to content

Enable #22083 controls on PROD runtime services - #22099

Merged
Git-on-my-level merged 1 commit into
mainfrom
lane/luna-22083-flags-on
Oct 18, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
lane/luna-22083-flags-on

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Summary

  • Enable FIRST_SUMMARY_PRESERVE_ADMITTED_ENABLED on PROD Cloud Run backend-integration, backend-sync, and backend-sync-backfill.
  • Enable BATCH_PIPELINE_READ_ONLY_METRICS_ENABLED and BATCH_PIPELINE_PROJECTION_TIMING_ENABLED only on PROD backend-integration.
  • Keep dev and PROD backend off; add no allowlist bindings.
  • Regenerate the composed runtime manifest and feature flag registry.

Product invariants affected

  • INV-MEM-4

Verification

  • nice -n 19 backend/.venv/bin/python scripts/check_feature_flag_registry.py — passed.
  • nice -n 19 backend/scripts/check_runtime_env_compose.sh — passed.
  • nice -n 19 backend/scripts/pre-deploy-check.sh — passed, 315 tests.
  • nice -n 19 make preflight — passed, 20 checks.
  • Runtime manifest flag matrix and PROD allowlist absence assertion — passed.

This PR changes the PROD manifest only; it has not been deployed.

View guided diff Turn on auto-fix

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T05:32:53.996900Z f19dc95 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Git-on-my-level
Git-on-my-level merged commit 9b632bc into main Oct 18, 2026
62 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/luna-22083-flags-on branch October 18, 2026 05:43
Git-on-my-level added a commit that referenced this pull request Oct 21, 2026
…es stop looping (#23092)

## Summary
Sync intake stores rule-settled "review" fragments with
`discarded=True`. When the first-summary wake for such a row runs,
`_reprocess_conversation_after_update` re-derives the discard verdict
and calls `discard_by_relevance`, which returns `False` because the row
is already hidden. The callback then returned `None` with no discard
receipt, and with `FIRST_SUMMARY_PRESERVE_ADMITTED_ENABLED` (prod since
#22099, 2026-10-18) `reprocess.run` raised `FirstSummaryCallbackPending`
→ HTTP 409 → Cloud Tasks retry with backoff → the same result on every
attempt; after the attempt cap the 2-minute sweep re-created the wake.
Before the flag the same path silently deleted the obligation. On
2026-10-21 backend-sync logged ~3,000 `callback_pending` retries/hour
(2,990 of 3,000 sampled enrichment outcomes), every non-OK response on
`sync-jobs-fresh` was an `sr-` task on its 4th–10th attempt, and the
outbox held 4,839 fresh-lane + 4,792 backfill-lane obligations overdue
≥4h with no lease and no deferral. Those retries share the queue that
carries every real first summary (P44 write-up:
`data/run-2026-10-13-two-lane-nemotron/first-summary-finished-at-2026-10-21.md`
in the workspace repo).

The read predicate derives `discarded` for every uncurated review row,
so the callback cannot tell a stored discard from a refused write by
looking at the row; only the write's own outcome can.
`database.conversations.rule_discard_outcome` now reports `discarded` (a
write; cache/index side effects run), `already_discarded` (stored hide;
no side effects) or `refused` (deleted, revised, curated, non-completed,
missing). `discard_by_relevance` keeps its True-only-on-write contract
for `scripts/conversation_relevance_backfill.py` and
`test_people_stats_cache`. The pipeline receipts both `discarded` and
`already_discarded` (the relevance metric is recorded only for a real
write); a refusal still leaves the obligation for the next attempt to
re-read, as before.

## Lane / contract
Lane first-summary (P44 brief, two-lane program); contracts: none. No
other lane's files edited.

## Product invariants affected
none (no locked path touched).

## Verification
Layer: unit (synthetic fixtures), m5, `nice -n 19`,
`BACKEND_PYTEST_WORKERS=4`, via `backend/test.sh` with
`BACKEND_UNIT_TEST_FILE_LIST`:
- Directly affected files, 210 passed: `test_sync_reprocess_coalesce.py`
(91; +3 new: the pipeline receipts an intake-discarded fragment without
a second write, with and without a process context; an admitted
obligation on such a row settles `processed` through the real callback
instead of raising `FirstSummaryCallbackPending`; the existing
persistence test now also asserts the relevance metric count),
`test_rule_discard_visibility.py` (44; +2 new: the real DB function
against the strict Firestore fake receipts a stored discard without
rewriting it, and `rule_discard_outcome` distinguishes `discarded` /
`already_discarded` / `refused` with exactly one cache invalidation),
`test_owner_recognition_telemetry.py` (23), `test_people_stats_cache.py`
(52, unchanged contract).
- Neighbouring consumers, 720 passed: relevance backfill, free-tier
matrix, mobile client journeys, owner-identity telemetry, sync cross-job
assignment, enrichment custody, fragment visibility, lineage
allowlist/dedupe/recording, minimal redrive, `test_sync_v2`, summary
delivery, summary persistence.
- `scripts/backend-python-format --check` clean on all six files.
- NOT run locally: the full backend unit suite (CI selects it because
`database/conversations.py` changed), integration/emulator suites, and
any live layer. No deploy; the fix is dark until the next train.

## Rollback
Revert. No flag: the new tri-state is internal to the discard write;
`discard_by_relevance` is unchanged for its callers.

Failure-Class: FC-permanent-write-rejection-retried-forever
Line-Count-Exception: backend/database/conversations.py | 4475 -> 4501 |
rule_discard_outcome must live beside discard_by_relevance: the
strict-store tests monkeypatch this module's db, cache and index seams,
and the relevance backfill keeps the bool wrapper
Line-Count-Exception: backend/utils/sync/pipeline.py | 3644 -> 3647 |
the rule-discard branch of the callback that owns it now branches on the
write outcome


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/23092?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/23092?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F23092&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. -->
tivince82 pushed a commit to tivince82/omi that referenced this pull request Oct 21, 2026
…es stop looping

Intake stores rule-settled review fragments with discarded=True. When the
first-summary wake for such a row runs, _reprocess_conversation_after_update
re-derives the discard verdict and calls discard_by_relevance, which returns
False because the row is already hidden. The callback then returned None
without a discard receipt, and with FIRST_SUMMARY_PRESERVE_ADMITTED_ENABLED
(prod since BasedHardware#22099, 2026-10-18) reprocess.run raised
FirstSummaryCallbackPending: a 409, a Cloud Tasks retry with backoff, and the
same result on every attempt. After the attempt cap the sweep re-created the
wake. Before the flag the same path silently deleted the obligation.

On 2026-10-21 backend-sync logged ~3,000 callback_pending retries per hour
(2,990 of 3,000 sampled enrichment outcomes), every non-OK response on
sync-jobs-fresh was an sr- task on its 4th-10th attempt, and the outbox held
4,839 fresh-lane and 4,792 backfill-lane obligations overdue for 4h+ with no
lease and no deferral. Those retries share the queue that carries every real
first summary.

The read predicate derives `discarded` for every uncurated review row, so the
callback cannot tell a stored discard from a refused write by looking at the
row. database.conversations.rule_discard_outcome now reports the write's own
outcome: `discarded` on a write, `already_discarded` for a stored hide (no
cache or index side effects), else `refused`. discard_by_relevance keeps its
True-only-on-write contract for the relevance backfill script. The pipeline
receipts both `discarded` and `already_discarded`; a refusal (revised, curated,
deleted) still leaves the obligation for the next attempt to re-read.
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