Skip to content

fix: preserve admitted first summaries across batch rollback - #22083

Merged
Git-on-my-level merged 13 commits into
mainfrom
lane/sol-projection-tail
Oct 18, 2026
Merged

Git-on-my-level merged 13 commits into
mainfrom
lane/sol-projection-tail

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

What changed and why

After a batch percentage rollback, an existing first-summary outbox deadline loses its short scheduling/lease/output policy when its owner leaves the current cohort. A callback returning no output can then delete that obligation while the conversation still carries overdue summary debt. Add a default-off FIRST_SUMMARY_PRESERVE_ADMITTED_ENABLED control that retains the policy for existing finite deadlines, scopes eligibility through processing/persistence, and retains missing-output debt without consuming the empty-model-result budget. New out-of-cohort conversations, effects-only work and later revisions keep existing behavior; the deadline master switch remains authoritative.

Also add independent dark controls to stop authenticated metrics scrapes from invoking the full reconciler while the supervised drain is enabled, and emit content-free projection phase timings. These reduce a source of overlapping projection contention and expose the remaining bridge/playback/assignment wait. Predecessor ordering, sibling completion, privacy fences, provider recovery and worker silence policy are unchanged. All controls default off in the runtime manifest and Helm values.

Read-only incident evidence separates settlement→ordered commit (up to 494s in retry), commit→persistence (up to 681s), and scheduling debt lost after a task had already been armed. The same cohort gate also controls summary receipt writes, so absent receipts after rollback do not prove body absence; no body was read. This PR preserves the admitted callback receipt policy too. This PR is a bounded mitigation and scheduling correctness fix; it does not establish a production p95 or qualify the ramp. No production writes, deploy, replay, provider calls or account-content reads were performed.

Product invariants affected

INV-MEM-4: processing and persistence keep the existing canonical promotion, privacy and ownership fences; summary eligibility changes scheduling only.

How it was verified

  • Worktree-local Python 3.11, omi-heavy run -- nice -n 19, file-isolated pytest from backend/: reprocess/cohort rollback, projection, serving HTTP route, summary delivery.
  • The real FastAPI metrics route refreshes queue gauges and returns while a concurrent reconciler is blocked; no second enrichment/queue mutation occurs.
  • The real reprocess state machine reproduces lost debt with the control off and retains the original deadline/token and 120s lease with it on. The callback sees scoped owner eligibility; exceptions reset it. A no-output callback keeps retry debt; a confirmed rule discard settles it. New out-of-cohort work stays on its 600s quiet window.
  • Hermetic backend/scripts/pre-deploy-check.sh, focused Python type checks, and repository make preflight.
  • Live acceptance and improved p95 are unmeasured; the controls have not been deployed or enabled.

Tests

test_sync_reprocess_coalesce.py covers rollback/no-output retention, context cleanup, invalid deadline rejection, demand bypass and short repair without token rotation. test_batch_pipeline_serving.py covers the concurrent HTTP scrape and default-off/serving-off rollback behavior. test_batch_pipeline_projection.py covers error-preserving phase timing with no private exception or binding output. Runtime-env fixtures include the new dark defaults. Job-identity fixtures use the safe C YAML loader, and the speaker deadline fixture uses a deterministic virtual clock; assertions and timing limits remain intact. The rendered pusher contract explicitly pins all three new controls false.

UI-Evidence: none -- backend scheduling and diagnostics only

Failure-Class: FC-split-mutation-authority

Line-Count-Exception: backend/utils/sync/pipeline.py | 3415 -> 3418 | Carry the already-persisted rule discard into the summary callback context so admitted debt can settle without another database read.

@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-18T04:52:11.799720Z 228fcb4 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: 1a8c66da38

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

Comment on lines +1098 to +1100
context = PROCESS_CONTEXT.get()
if context is not None:
context['discarded'] = True

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 Receipt already-completed rule discards

When preservation is enabled after a cohort rollback, a rule discard that was committed by another worker—or committed before this process crashed—is not treated as terminal because discard_by_relevance returns False for an already-discarded row and this context flag is set only for a new write. The callback then returns None, reprocess.run raises FirstSummaryCallbackPending, and every retry encounters the same already-discarded state, leaving the outbox on its short retry cadence indefinitely. Verify the latest lifecycle state when the conditional write returns false and receipt an already-discarded matching revision while still retaining debt for revision or user-curation conflicts.

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: b79c15af86

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

Comment on lines +397 to +398
if output is None and preserves_admitted(row) and not discarded and not blocked:
raise FirstSummaryCallbackPending('first-summary callback has no output yet')

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 Settle preserved debt when its conversation is deleted

When preservation is enabled after a cohort rollback and the conversation is deleted between outbox admission and processing, _reprocess_conversation_after_update returns None for that terminal lifecycle state, but this condition treats it as a pending callback and raises before finish can remove the outbox. Because the deleted conversation can never produce output, every sweep will keep redispatching the obligation indefinitely; distinguish terminal missing/deleted rows from genuinely pending callbacks and settle their debt.

Useful? React with 👍 / 👎.

@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!

@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: fdd11c3edc

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

Comment thread config/feature-flags.yaml Outdated
- {"key":"BATCH_PIPELINE_PROJECTION_TIMING_ENABLED","aliases":[],"kind":"env","lifecycle":"rollout","surfaces":["backend"],"summary":"Default false; content-free monotonic start finish and error timings for batch projection phases","fail":"closed","owner":"dazheng","created":"2026-10-18","review_by":"2026-11-17","decision":"pending"}
- {"key":"FIRST_SUMMARY_PRESERVE_ADMITTED_ENABLED","aliases":[],"kind":"env","lifecycle":"rollout","surfaces":["backend"],"summary":"Default false; preserve existing first-summary deadlines and output obligations across cohort rollback while the deadline master remains on","fail":"closed","owner":"dazheng","created":"2026-10-18","review_by":"2026-11-17","decision":"pending"}

- {"key":"BATCH_PIPELINE_WORKER_SILENCE_DISPOSITION_ENABLED","aliases":[],"kind":"env","lifecycle":"rollout","surfaces":["backend"],"summary":"Default off; empty-ASR worker jobs reuse integration strict local VAD to commit confirmed silence before quarantine","fail":"closed","owner":"dazheng","created":"2026-10-18","review_by":"2026-11-17","decision":"pending","notes":"Worker-only Helm worker.workerSilenceDispositionEnabled=false. Reuses recovery_disposition.inspect_audio and silence_payload; speech-positive or invalid inspection retains quarantine and multilingual recovery. Rollback sets the worker flag false. See backend/diarizer/batch_pipeline_runtime.md."}

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 Restore the flag entry's list indentation

Indent this entry beneath flags: like the surrounding items. At column zero it starts a root-level sequence immediately after the root mapping, so standards-compliant YAML parsers reject the entire registry; for example, backend/tests/unit/test_conversation_smart_merge_wallclock_runtime.py loads this file with yaml.safe_load, which now fails before the test can run.

Useful? React with 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit 9041958 into main Oct 18, 2026
58 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/sol-projection-tail branch October 18, 2026 05:17
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