Repository navigation
fix(conversations-v3): stub-proof playback check, custom-STT allowance on open, keep location - #25529
Conversation
…ance on open; keep location - Each playback module checks recording_pieces locally instead of importing a shared helper, so test harnesses that stub utils.conversations or utils.sync.playback keep importing them. - The on-open summary stream applies the same custom-STT paid-notes allowance as process_conversation: an exhausted custom-STT conversation serves its stored row. - Derived conversations carry the recording's geolocation (and keep their own), so detail and Places keep showing located conversations. Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
… landed together Main's generated TypeScript and Swift clients counted 553 methods; the merged routes make 554. Regenerated with backend/scripts/generate_ts_openapi_types.py and generate_swift_openapi_types.py; only the total lines change. Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[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. |
| async def prepare(uid, row): | ||
| if fresh(row) or not summary_eligible(row): | ||
| return None | ||
| if await run_blocking(db_executor, paid_notes_refused, uid, row): | ||
| # No foreground model work: the stream serves the stored row, as processing would. | ||
| return None |
There was a problem hiding this comment.
🔒 Agentic Security Review
Severity: MEDIUM
The new custom-STT paid-notes check only lives in prepare(). Returning None is the same signal as “ineligible / no lease yet,” but GET /v1/conversations/{id}/summary/stream always calls stream() afterward, and stream() only short-circuits for freshness or eligibility. An exhausted custom-STT user can still start Omi-paid write() / _get_structured on open; persistence later fails the lease check, so the cost is spent without a durable skip.
Impact: Users over the conversation-processing allowance can still burn company-paid LLM and shared llm_executor capacity by opening a summary-eligible conversation, which is the quota this change is meant to close.
Reviewed by Cursor Security Reviewer for commit 08fa8c5. Configure here.
There was a problem hiding this comment.
Fixed in ebde2a4: when prepare() refuses on the custom-STT allowance, stream() now ends with the stored row's done frame and takes no lease and makes no notes call. test_refused_custom_stt_stream_serves_stored_row_without_model_work consumes the refused stream with write() and lease acquire set to fail.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 08fa8c53ed
ℹ️ 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".
| if await run_blocking(db_executor, paid_notes_refused, uid, row): | ||
| # No foreground model work: the stream serves the stored row, as processing would. | ||
| return None |
There was a problem hiding this comment.
Stop the summary stream when paid processing is refused
For a stale, eligible custom-STT conversation whose allowance is exhausted, returning None here does not serve the stored summary. conversation_summary_stream passes that value to stream(), which calls prepare() again and then proceeds to write() even when the token remains None. This still incurs the refused model work, now without a writer lease, and store_summary() subsequently rejects persistence because no valid lease exists. Make the refusal terminate the stream with the stored done frame, and test consumption of the stream rather than only the return value of prepare().
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in ebde2a4 (same change as the security review thread): a refused open now terminates with the stored done frame, and the new test consumes the stream instead of only checking prepare().
| """The custom-STT allowance that process_conversation applies before Omi-paid notes.""" | ||
| if row.get('uses_custom_stt') is not True: | ||
| return False | ||
| from utils.subscription import should_skip_omi_paid_postprocessing |
There was a problem hiding this comment.
Move the subscription import to module scope
The newly added function-local import violates the backend guide's explicit requirement, “All imports at module top level — never inside functions.” Move this dependency to the module's import section so the new helper follows the documented backend import convention.
AGENTS.md reference: backend/AGENTS.md:L166-L168
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in ebde2a4: should_skip_omi_paid_postprocessing is imported at module scope; the tests patch the summary module name.
| # Places and detail read the conversation, not the hidden recording: carry its location. | ||
| 'geolocation': (existing or {}).get('geolocation') |
There was a problem hiding this comment.
Add the required conversation-lifecycle change note
This commit changes conversation lifecycle behavior, including foreground summary authorization and propagation of recording locations, but its changed-file list contains no pipeline change note. The backend guide requires a note under backend/docs/listen_pusher_pipeline/changes/ for conversation lifecycle changes in the same PR; add one describing the behavior changes, rollout state, and verification evidence.
AGENTS.md reference: backend/AGENTS.md:L164-L164
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Added in ebde2a4: backend/docs/listen_pusher_pipeline/changes/2026-11-17-conversations-v3-followup.md (behavior, flag state, evidence).
…used prepare() returned no lease for a refused custom-STT open, but stream() then ran the notes model anyway and failed to persist. stream() now ends with the stored row's done frame when no lease was granted. The subscription import moves to module scope, and the change note records the follow-up behavior. Verified: pytest tests/unit/test_conversations_v3_stream.py tests/unit/test_conversations_v3_engine.py (69 passed), including a test that consumes the refused stream with write() and lease acquire failing. Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>




Conversations v3 follow-up: stub-proof playback check, custom-STT allowance on open, keep location
Failure-Class: none
Three small fixes, plus a regenerated-client catch-up, that came after #25500 was approved. #25500 merged at its approved head, and this PR
lands them on top.
has_recording_pieceshelper fromutils/conversations/layer.pyinto the playback, sync and plugin-backup-audio paths. Shard 5 replacesutils.conversationswith a stub insys.modules, so that import failed withModuleNotFoundError: utils.conversations.layer. Each caller now checksconversation.get('recording_pieces') is not Noneitself, and the shared helper is removed.custom STT now goes through the same
should_skip_omi_paid_postprocessingcheck as the backgroundpath before
/summary/streamwrites notes. Before this fix, opening the conversation could bill asummary that the background path had refused.
planner.build()copiesgeolocationfrom theexisting row, or else from the first contributing recording, so a v3 row keeps the place shown on its
recordings.
Swift clients still counted 553 methods instead of 554, which failed the OpenAPI check on every push.
They are regenerated in a separate commit; only the total lines change.
Verification
tests/unit/test_conversations_v3_engine.pyandtests/unit/test_conversations_v3_stream.pyhave newcases for the location and the custom-STT refusal.
UI-Evidence: none -- backend only
🤖 Generated with Claude Code