Skip to content

fix(conversations-v3): stub-proof playback check, custom-STT allowance on open, keep location - #25529

Merged
Git-on-my-level merged 3 commits into
mainfrom
fix/conversations-v3-followup
Nov 16, 2026
Merged

Git-on-my-level merged 3 commits into
mainfrom
fix/conversations-v3-followup

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

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.

  • Backend unit shard 5 is green again. Home redesign: recordings and conversations (v3) #25500 imported a shared has_recording_pieces helper from
    utils/conversations/layer.py into the playback, sync and plugin-backup-audio paths. Shard 5 replaces
    utils.conversations with a stub in sys.modules, so that import failed with
    ModuleNotFoundError: utils.conversations.layer. Each caller now checks
    conversation.get('recording_pieces') is not None itself, and the shared helper is removed.
  • On-open summaries respect the custom-STT allowance. A derived conversation whose recordings used
    custom STT now goes through the same should_skip_omi_paid_postprocessing check as the background
    path before /summary/stream writes notes. Before this fix, opening the conversation could bill a
    summary that the background path had refused.
  • Derived conversations keep their location. planner.build() copies geolocation from the
    existing row, or else from the first contributing recording, so a v3 row keeps the place shown on its
    recordings.
  • Generated API clients are current again. Home redesign: recordings and conversations (v3) #25500 and feat(mcp): conversation deletion feed for agents that keep copies #25524 landed together, and main's TypeScript and
    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.py and tests/unit/test_conversations_v3_stream.py have new
    cases for the location and the custom-STT refusal.
  • The shard-5 file set and the full pre-push backend unit suite ran on push.

UI-Evidence: none -- backend only

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

Git-on-my-level and others added 2 commits November 17, 2026 02:57
…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]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 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-16T20:35:19.729314Z ebde2a4 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.

@cursor cursor 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.

Security review found one medium issue: the custom-STT paid-notes gate in prepare() is not enforced on the on-open summary stream, so exhausted sessions can still trigger Omi-paid structuring.

Open in Web View Automation 

Sent by Cursor Security Agent: Security Reviewer

Comment on lines 76 to +81
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 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.

Fix in Cursor Fix in Web

Reviewed by Cursor Security Reviewer for commit 08fa8c5. Configure here.

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.

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.

@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: 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".

Comment on lines +79 to +81
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

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 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 👍 / 👎.

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.

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

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 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 👍 / 👎.

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.

Fixed in ebde2a4: should_skip_omi_paid_postprocessing is imported at module scope; the tests patch the summary module name.

Comment on lines +162 to +163
# Places and detail read the conversation, not the hidden recording: carry its location.
'geolocation': (existing or {}).get('geolocation')

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 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 👍 / 👎.

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.

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]>
@Git-on-my-level
Git-on-my-level merged commit fd4b795 into main Nov 16, 2026
65 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/conversations-v3-followup branch November 16, 2026 20:56
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