Repository navigation
fix(provider): local batch count before decoding, Super video drain-wait warning, two test follow-ups (security) - #2188
Merged
Conversation
ReaderQueue.afterQueuedReads now returns whether its body ran within the wait. When a video's cleanup stops waiting with a frame read still decoding, the binding logs one fixed public warning (ProviderOperationalMessage.superVideoChargesHeldPastDrainWait); the charges still return when the read ends. The binding's log is a task-local, so the drain test reads the line. The cancelled-video test now checks that the charges return (chargesReturned) instead of an exact ledger count right after the request ends, which a slow runner could reach before the released read returned.
…lay reader that keeps up A /v1/chat/completions/batch body is refused with batch_too_large when its top-level array holds more than 64 items, counted by one scan that skips strings and nested values, before any parse reads the items; the decoded count stays the authority. A new test sends a 128 MiB answer through the relay transport to a reader that keeps up and expects it whole, guarding the backlog's decrement on each pulled chunk.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… the limit may count as late
…limit test does (Swift 6 sendability)
…to its baseline The owner's own reservations stay while it serves, so the request's charges are back when the ledger returns to the count before the request, polled for up to 10 s; chargesReturned (an empty snapshot) fits only after a drain.
jonathan308
marked this pull request as ready for review
November 16, 2026 23:32
This was referenced Nov 17, 2026
Merged
This branch was successfully deployed
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.
Summary
Review follow-ups to #2143 and #2144 (security scan findings 212 and 293), for provider 0.10.14:
/v1/chat/completions/batchbody whose top-level array holds more than 64 items is refused withbatch_too_largebefore any parse reads its items. One scan counts the array's own items, skipping strings and nested values; the decoded count stays the authority.URLSessionLocalRouterTransportto a reader that keeps up and expects it whole, so the backlog's decrement on each pulled chunk cannot be lost unnoticed.ReaderQueue.afterQueuedReadsreturns whether its body ran within the wait; when a cancelled or drained video's cleanup stops waiting with a frame read still decoding, the provider logs one fixed public warning (superVideoChargesHeldPastDrainWait). The charges still return when the read ends.Before
flowchart LR classDef old fill:#fde2e1,stroke:#c0392b,color:#1b1b1b B["POST /v1/chat/completions/batch"] --> D["decode every item"]:::old --> C{"count <= 64?"} C -- no --> X["400 batch_too_large"] V["Super video cleanup"] --> W{"reads done within 1 s?"} W -- no --> E["stop waiting, silently"]:::oldAfter
flowchart LR classDef ok fill:#e3f4e1,stroke:#2e7d32,color:#1b1b1b B["POST /v1/chat/completions/batch"] --> S{"scan: items <= 64?"}:::ok S -- no --> X["400 batch_too_large"] S -- yes --> D["decode every item"] --> C{"count <= 64?"} V["Super video cleanup"] --> W{"reads done within 1 s?"} W -- no --> E["log one fixed warning; charges return when the read ends"]:::okCode path:
LocalChatUploadResponder.respond→batchItemCount(beforeToolSchemaRefResolutionand the decode) →batchTooLargeRefusal;NemotronSuperLocalImageBinding.settle→ReaderQueue.afterQueuedReads(returnsBool) →NemotronSuperLocalImageBinding.log.warning(.superVideoChargesHeldPastDrainWait).Validation
LocalChatBatchLimitTests.aBatchIsCountedBeforeItsItemsAreDecodedbatch_too_large; 64 → the decoder's 400; 64 requests with commas and brackets in their text → served (acquisition reached)LocalRouterStreamingTests.aReaderThatKeepsUpGetsAnAnswerPastTheBacklogCeilingNemotronSuperVideoBindingTests.drainLeavesAStuckFrameReadItsChargeUntilItReturnsNemotronSuperVideoBindingTests.aCancelledVideoKeepsItsChargeUntilItsFrameReadReturnslines.allempty); shard 2, the batch count (the decoder's 400 instead ofbatch_too_large) and the keeps-up reader (readerFellBehindat 32 MiB)python3 scripts/changelog.py check,python3 scripts/docs-impact-check.py --base origin/dev0bbe0bc9ddLimitations
Security stack
Intact: end-to-end encryption, attestation, signing and weight hashes are unchanged. Provider-only: the local API's batch path, the Super video binding's cleanup log, tests and docs.
Refactor pass
Small, single-purpose changes following the reviews' suggestions; an independent review checks this head.
🤖 Generated with Claude Code