Repository navigation
SCA-4146 Preserve keyed from-segments uploads across the HTTP deadline - #26207
Conversation
Co-authored-by: multica-agent <[email protected]>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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".
|
|
||
| context = contextvars.copy_context() | ||
| context.run(_deadline.set, None) | ||
| future = from_segments_executor.submit(context.run, fn, *args, **kwargs) |
There was a problem hiding this comment.
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 👍 / 👎.
| if remaining <= 0.0: | ||
| raise RequestDeadlineExceeded('request budget spent before transcript processing') | ||
|
|
||
| from utils.executors import from_segments_executor |
There was a problem hiding this comment.
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 👍 / 👎.
| 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 |
There was a problem hiding this comment.
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 👍 / 👎.
Co-authored-by: multica-agent <[email protected]>
Co-authored-by: multica-agent <[email protected]>
Git-on-my-level
left a comment
There was a problem hiding this comment.
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.
…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. -->
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. -->
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_exhaustedfromconversation_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
git diff --checkpassed on the control host.test_developer_from_segments_idempotency.py,test_from_segments_request_deadline.py, andtest_from_segments_503_attribution.pyon m1 or multica-worker-1 throughbin/omi-heavywith a bounded timeout. The control host could not resolve either worker alias.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