Skip to content

fix(batch): let recording admission catch up with pending work - #24494

Merged
Git-on-my-level merged 4 commits into
mainfrom
lane/draincap
Nov 3, 2026
Merged

Git-on-my-level merged 4 commits into
mainfrom
lane/draincap

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Recording admission drains only ten rows before a 20-second idle wait, allowing transcripts to accumulate while batch workers are idle. Default to 100 rows and 16 admission workers, with process configuration clamped to 1..500 (RECORD_DRAIN_BATCH) and 1..64 (RECORD_DRAIN_CONCURRENCY). Malformed settings use the defaults.

A full unfenced page yields to the event loop and immediately starts another pass. Partial/empty pages, failed passes, and passes encountering a privacy fence retain the 20-second wait. Privacy-fenced rows remain untouched. Transactionally defer any row still in record_pending after an ordinary return or exception, preserving admitted rows and longer existing deferrals. Exceptions retry after 60 seconds even for completed partial captures; successful completed inventory polling retains its existing interval.

store.due already orders by available_at. Raise its cap to 500 only for record_pending and cover the limits in the existing query driver. Put the capacity environment reader in config/record_drain.py to preserve the batch-stage policy-snapshot boundary. Defaults carry the fix to backend-integration at deployment.

Validation at 5511f64c09fc: 201 targeted tests pass (77 live, 53 serving, 65 partial, 6 environment-ratchet). Canonical pre-push passes its 130 changed tests, 817 Firestore guards, type checking, runtime source closure and selected repository checks. These are local source/test checks; deployment throughput remains to be measured. Luna delta review and GitHub CI are pending.

Failure-Class: FC-drain-rate-equals-arrival-rate

Drain bounded configurable pages with configurable concurrency and immediately
repeat full pages after yielding. Defer no-op admission results transactionally
so they cannot pin the due head; preserve retry and partial polling delays.

Failure-Class: FC-drain-rate-equals-arrival-rate
Drain bounded configurable pages with configurable concurrency and immediately
repeat full pages after yielding. Defer no-op admission results transactionally
so they cannot pin the due head; preserve retry and partial polling delays.

Failure-Class: FC-drain-rate-equals-arrival-rate
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-03T10:07:11.341492Z
We couldn’t complete this review. Comment @codex review to try again.
f5d5922 PR opened
ℹ️ 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

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 6 files

Confidence score: 3/5

  • In backend/utils/batch_pipeline/live.py, the 16-worker default can occupy all of the shared sync_executor during GCS reads in admit_recording, starving other sync work; the 64-worker maximum increases that contention. Keep drain concurrency below the executor capacity or isolate these reads.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="backend/utils/batch_pipeline/live.py">

<violation number="1" location="backend/utils/batch_pipeline/live.py:62">
P1: The new default of 16 drain workers equals the entire shared `sync_executor`, and the max of 64 is four times its size. Each worker holds a sync thread during GCS reads in `admit_recording`. That can starve the sync pipeline and the serving supervisor, which run in the same process. Keep the drain well below the pool size, as the removed comment required.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread backend/utils/batch_pipeline/serving.py Resolved
Comment thread backend/utils/batch_pipeline/live.py Resolved
Comment thread backend/utils/batch_pipeline/live.py Resolved
Keep the idle wait after a privacy-fenced pass without writing fenced rows.
Transient admission failures always retry after 60 seconds, including completed
partial captures; successful inventory polling retains its existing interval.

Failure-Class: FC-drain-rate-equals-arrival-rate
Move environment reads out of the batch stage so the admission policy snapshot
boundary remains intact. Drain capacity is process scheduling configuration.

Failure-Class: FC-drain-rate-equals-arrival-rate
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Addressed the Luna R1 findings in 5511f64c09fc:

  • A privacy-fenced pass retains the idle wait without writing fenced rows. Added mixed-page and fully fenced page regressions.
  • Ordinary admission exceptions use the 60-second retry even when partial_run.complete is true. Successful completed inventory polling retains its interval; admitted rows and longer deferrals remain protected.
  • The old CI environment-ratchet failure is fixed by moving process capacity reads into config/record_drain.py, without changing the ratchet baseline.

The targeted backend shard passes 201 tests, including all six environment-ratchet tests. The canonical pre-push gate also passes at this head. R2 delta review and new-head CI are being collected.

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