Skip to content

SCA-4146 Preserve keyed from-segments uploads across the HTTP deadline - #26207

Merged
Git-on-my-level merged 3 commits into
mainfrom
agent/omi-control-owners-sol/98a5e90c000c
Nov 24, 2026
Merged

Git-on-my-level merged 3 commits into
mainfrom
agent/omi-control-owners-sol/98a5e90c000c

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

SCA-4146

Keyed Firebase-authenticated from-segments uploads now stop waiting at the existing 25-second deadline. The bounded processing pool owns the existing Firestore claim and continues enrichment with the normal model timeouts. The deadline response preserves the existing retryable 503 body and header. An active retry receives a retryable 503, and a retry after completion reads the original result through the existing idempotency lookup.

The deadline covers the HTTP wait for geolocation, prefix building, relevance, notes and derived effects as a group. The worker is process-local. A process restart still relies on the existing stale-claim recovery, which can rerun work. Uploads without a session ID retain inline processing to preserve unkeyed create semantics. The current serving backend allocates CPU between requests.

The stderr attribution line distinguishes request_budget_exhausted from conversation_processing_retryable:timeout. Worker capacity and a retry during active processing have their own tags. The patch uses the existing Firestore read/write paths and 429 policy.

Verification

  • Python syntax and git diff --check passed on the control host.
  • Run test_developer_from_segments_idempotency.py, test_from_segments_request_deadline.py, and test_from_segments_503_attribution.py on m1 or multica-worker-1 through bin/omi-heavy with a bounded timeout. The control host could not resolve either worker alias.
  • Post-release acceptance is pending. Check a 30-minute window on the serving revision for 503s below 10% of non-422 traffic, a previously failing iOS retry with a 200 trace, the new stderr tags, and two consecutive healthy ticks. The patch still returns a 503 on a first attempt whose processing exceeds 25 seconds, so the 503 rate must be measured on live traffic.

View guided diff Turn on auto-fix

Line-Count-Exception: backend/routers/developer.py | 2868 -> 2897 | from-segments budget cut must retain the keyed claim and re-admit it on retry, and must tag the budget cut apart from provider timeouts

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 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-24T07:55:16.672221Z 7350583 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: cb9d160368

ℹ️ 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 backend/utils/other/request_deadline.py Outdated

context = contextvars.copy_context()
context.run(_deadline.set, None)
future = from_segments_executor.submit(context.run, fn, *args, **kwargs)

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 Avoid holding processing-pool slots for the entire pipeline

When notes processing takes more than 60 seconds, this submission keeps a from_segments_executor slot occupied for the entire pipeline, even after the HTTP waiter expires. Eight slow uploads exhaust the zero-queue pool, and subsequent requests—including retries for already-completed conversations—receive capacity 503s before reaching the idempotency lookup inside _process_validated_segments. The backend guide explicitly requires long-running pipelines to use async coordinators and borrow worker threads per blocking step; restructure this ownership path accordingly rather than holding a worker throughout enrichment.

AGENTS.md reference: backend/AGENTS.md:L275-L279

Useful? React with 👍 / 👎.

Comment thread backend/utils/other/request_deadline.py Outdated
if remaining <= 0.0:
raise RequestDeadlineExceeded('request budget spent before transcript processing')

from utils.executors import from_segments_executor

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 new executor import to module scope

The new function-local import violates the explicit import convention in backend/AGENTS.md: all imports must be at module scope, never inside functions. Move this dependency to module scope, resolving any initialization dependency structurally rather than extending the existing local-import pattern.

AGENTS.md reference: backend/AGENTS.md:L166-L174

Useful? React with 👍 / 👎.

Comment thread backend/routers/developer.py Outdated
Comment on lines +2132 to +2136
return wait_for_from_segments_processing(_process_validated_segments, *args, **kwargs)
except RequestDeadlineExceeded as error:
raise retryable_processing_response('request_budget_exhausted') from error
except ExecutorSaturatedError as error:
raise retryable_processing_response('from_segments_processing_capacity') from error

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 conversation lifecycle behavior: keyed uploads now continue processing after the HTTP deadline, and active retries receive a retryable 503 instead of the existing processing response. The changed-file list contains no accompanying note under backend/docs/listen_pusher_pipeline/changes/. Add the required lifecycle note documenting the ownership change, retry behavior, rollout state, and verification evidence; backend/AGENTS.md requires that note in the same change.

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

Useful? React with 👍 / 👎.

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

REVIEW: SHIP

Manual review of exact head ce0154db8b6c5376305eaf3e7ce67e35d90d7164: no blocking findings. Budget cuts retain the keyed row, roll admission back to in_progress, and use compare-and-swap admission to resume the stored transcript; non-budget processing failures retain their cleanup path. The regression test covers the tagged 503, retained claim, original transcript on retry, and successful creation event. The prior client_kind/app_build NameError is absent from this scoped diff. All applicable checks pass and the PR is clean/mergeable.

Recorded as a COMMENT review because this connected GitHub identity is the PR author and cannot submit an approval.

@Git-on-my-level
Git-on-my-level merged commit fe7a91f into main Nov 24, 2026
72 of 73 checks passed
@Git-on-my-level
Git-on-my-level deleted the agent/omi-control-owners-sol/98a5e90c000c branch November 24, 2026 09:54
Git-on-my-level added a commit that referenced this pull request Nov 24, 2026
…26228)

## Change

Pin the exact `(routers/developer.py,
_ingest_conversation_from_segments, client_processing)` reference. This
scope already allows projection plumbing.

The read restores the original stored display projection when a keyed
from-segments upload resumes after a budget cut. It passes the value
through the existing `client_projection` argument for display attachment
and budget-waiting persistence. The argument does not feed canonical
structuring, memory extraction, retrieval, or integration payloads.
Generic persistence still strips the field, and integration redaction
still removes all projection-family fields.

S4 reviews every reference even inside an allowed scope. Pinning this
display-only read in place keeps it visible to that review. The allowed
scopes, exact-set assertions, dump pins, and sink tests are untouched.

## Attribution

`ce0154db8b6` added the read in the budget-retry branch. It reached main
in `fe7a91f1f8` via #26207. That main run used changed-file selection
plus rotation 4/8 and reported success without exercising the
trust-boundary test file. The first observed failure was on `51999ee2ef`
after #26018. The router and pin set were identical across that merge.
The same single extra reference failed again at `bc6a3d3ecd`.

- [Introducing
commit](ce0154db8b6)
- [Green run after
#26207](https://github.com/BasedHardware/omi/actions/runs/45369587657)
- [First observed
failure](https://github.com/BasedHardware/omi/actions/runs/45374917522/job/138378765073)
- [Failure on the PR
base](https://github.com/BasedHardware/omi/actions/runs/45377866733/job/138389128851)

## Verification

- Reproduced the extra reference on the base with `bash test.sh
tests/unit/test_client_processing_trust_boundary.py::test_pinned_reference_set_is_exact`.
- Passed the full S4 proof and from-segments idempotency modules with
`bash test.sh tests/unit/test_client_processing_trust_boundary.py
tests/unit/test_developer_from_segments_idempotency.py` from `backend/`.

## Product invariants affected

None. This change updates the test inventory only.

Failure-Class: none

Multica: SCA-4202.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/26228?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/26228?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F26228&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 25, 2026
Reverts #26215 at `3e1a54b0b924fcd460db162507ee4c9429a34162` under
Shipping’s R26 ruling on SCA-1819. Deleting one conversation in a shared
upload currently erases staging audio that a live sibling still
references. The PR also expanded default delete audio erasure without
durable retry on the regular request path.

The patch is byte-for-byte the inverse of #26215 relative to its first
parent. The tree diff from that parent to this PR head matches #26207’s
first-parent patch byte-for-byte, preserving keyed from-segments
uploads. `git diff --check` passed.

Release owns merge after green exact-head CI. The re-land requires a
full custody review of the repaired head.

Line-Count-Exception: backend/routers/conversations.py | 3197 -> 3199 |
Restore the pre-#26215 cascade-only audio deletion block and its storage
guard to preserve shared-upload custody.

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