Repository navigation
v3 fast finish: reserve each long-pass retry before it sends (SCA-4434) - #26379
Merged
Merged
Conversation
A long pass reserved every chunk twice (its one retry) plus the probe at admission, so at the 7,200 s default only one 30-minute pass fit at a time and about two a day. Admission now reserves every chunk once plus the 30 s probe clip; each chunk retry reserves its own seconds on the pass's key just before it sends, after the sticky privacy and stop checks and with at least 3 s of the deadline left. A retry that does not fit, or meets a Redis error or stall, is not sent: the chunk fails and the pass yields to batch as retry_cap. No audio leaves unreserved, so the cap stays strict; settle still charges what was sent and refunds the rest, reserved retries included. About three 30-minute passes now fit a day at 7,200 s. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-long-retry-reserve # Conflicts: # backend/utils/conversations/v3/fast_finish.py
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. |
…serve (SCA-4434) Review of #26379 at a7bf71c: - P2: a _run-level test holds three long chunks just before their send until run() has returned and settled; they then send and charge nothing. It fails when _run reads _Sent instead of closing it. - P3: a retry whose reservation returns past the deadline ends as _Expired; its reserved seconds are refunded at settle. - P3: outcome pre-initialisation is checked in a fresh process, so test order cannot create the label. - P3: the RESERVE_MIN_SECONDS comment states the 3-4 s worst case and why the slot bound still holds. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-long-retry-reserve
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Review of #26379 at 1753873 (P3s): - A retry whose reservation returns with under RETRY_SEND_MIN_SECONDS (1 s) of the deadline left is not sent (_Expired, refunded at settle), not only one past the deadline. The test covers 0.1 s left and past. - The RESERVE_MIN_SECONDS comment covers the admission reserve's worst case (about 5 s, ending within STOP_GRACE_SECONDS past the deadline) as well as a retry's. - The abandoned-chunk test releases its gate in a finally. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level
added a commit
that referenced
this pull request
Nov 27, 2026
Resolve backend/docs/feature-flag-registry.md by re-rendering it from the auto-merged config/feature-flags.yaml with scripts/render_feature_flag_registry.py: main's CONVERSATIONS_V3_FAST_FINISH_LONG_DAILY_SECONDS row (retry_cap text from #26379) followed by this branch's CONVERSATIONS_V3_FINISH_HOME_SLI row. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
Follow-up to #26344, which is now merged; the base is
main. SCA-4434: about 1.5× as many long manual Finishes fit under the same daily fast-STT cap, and the cap stays strict.Before, a long pass (over 20 min) reserved
2 × planned + 30 sat admission, so its one retry per chunk was paid for up front. At the 7,200 s default (CONVERSATIONS_V3_FAST_FINISH_LONG_DAILY_SECONDS), only one 30-minute pass (3,666 s) fit at a time, and about two fit in a day.Now:
planned + 30 s(each chunk once, plus the probe clip). Admission screening (screen/room) checks against the same amount.v3_fast_finish:long_audio_seconds:<day>. It uses the sameINCRBYFLOATwith an immediate take-back over the cap, in one pipelined round trip on the existing bounded (1 s) client, and only on the retry path. The reserve runs only:RESERVE_MIN_SECONDS) of the deadline left.retry_cap. With under 3 s left, the chunk fails with its first error, as before._Sentcloses when the pass settles. After that, nothing more is sent or reserved, and a retry reserve that lands after the settle gives its seconds back. A settle can therefore only refund, never undercharge.RETRY_SEND_MIN_SECONDS) of the deadline left is not sent (_Expired, which counts asdeadline). Its reserved seconds are refunded at settle. A retry's reservation can take about 3–4 s in the worst case (AUTH on a new connection, the health-check PING, the pipeline and the give-back). The admission reservation can take about 5 s, so it ends withinSTOP_GRACE_SECONDSpast the deadline. The slot bound holds because every wait on these calls is bounded.omi_conversations_v3_fast_finish_total{outcome="retry_cap"}is pre-initialised and kept by the existing GMP keep regex (conversations_v3_fast_finish_total).At 7,200 s, about three 30-minute passes fit a day, versus two, and two fit at once. The bound is unchanged.
Ramp: move
CONVERSATIONS_V3_FAST_FINISH_LONG_PERCENT25 → 100 after the first 24 h readback of long-pass latency (first card within 60 s) and long audio seconds. Any cap raise is David's spend decision. Flag notes, the runbook and the change note say the same.This PR does not deploy, set any env or merge anything.
Product invariants affected
backend/deploy/runtime_env.yaml, which only v3: fast finish long and multi-unit recordings in concurrent chunks (SCA-4434) #26344 changes, because it compares againstmain. This PR changes no deploy, memory or projection path, onlyfast_finish.py, its tests, docs and flag notes.How it was verified
The worktree is on head
cbc8142a113, which includesorigin/mainatcb15ebd4fa5(#26344 merged as4e5dfdb1088). All runs went throughomi-heavy:test_conversations_v3_fast_finish_chunked.pyplustest_conversations_v3_fast_finish.py: 243 passed. Withtest_real_clock_budget_ratchet.pyadded: 254 passed.python -m testing.pipeline_lab scenario run --jobs 4 --repeat 2 --json --stt replay: overall outcomepassed. 12 of 13 scenarios passed andfinish_after_second_closewas xfail, as it is declaredexpected_failure(v3: Finish a sealed recording before its first live window #26288)._runreading_Sentinstead ofclose()fails the abandoned-chunk test.retry_capfrom the pre-init list fails the fresh-process test.scripts/check_feature_flag_registry.py: OK.These are unit and lab results only. Nothing was deployed.
Tests
In
test_conversations_v3_fast_finish_chunked.py:planned + 30, and that is all the counter holds while the pass runs.retry_cap, nothing is written, and nothing beyond the reservation is sent._FleetBudgetinstances (two processes) racing 40 takes on one counter keep at most the cap. A second process taking the last room makes the pass's retryretry_cap.long_cap._run-level: three abandoned long chunks are held just before their send untilrun()has returned and settled. After that they make no provider call and charge nothing. The language probe cannot reachaddafter settle, because the pass waits on its resolution until the deadline and the probe rechecks the deadline before charging.retry_capincluded, is pre-initialised at import. This is checked in a fresh process, so test order cannot create the label. All outcomes are also kept by the GMP regex.UI-Evidence: none -- backend only
Failure class (fixes)
Failure-Class: none
🤖 Generated with Claude Code