Skip to content

fix(provider): local batch count before decoding, Super video drain-wait warning, two test follow-ups (security) - #2188

Merged
jonathan308 merged 5 commits into
devfrom
fix/local-api-and-super-video-followups
Nov 16, 2026
Merged

jonathan308 merged 5 commits into
devfrom
fix/local-api-and-super-video-followups

Conversation

@jonathan308

@jonathan308 jonathan308 commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Review follow-ups to #2143 and #2144 (security scan findings 212 and 293), for provider 0.10.14:

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"]:::old
Loading

After

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"]:::ok
Loading

Code path: LocalChatUploadResponder.respond → batchItemCount (before ToolSchemaRefResolution and the decode) → batchTooLargeRefusal; NemotronSuperLocalImageBinding.settle → ReaderQueue.afterQueuedReads (returns Bool) → NemotronSuperLocalImageBinding.log.warning(.superVideoChargesHeldPastDrainWait).

Validation

Check Result
LocalChatBatchLimitTests.aBatchIsCountedBeforeItsItemsAreDecoded 65 non-request values → batch_too_large; 64 → the decoder's 400; 64 requests with commas and brackets in their text → served (acquisition reached)
LocalRouterStreamingTests.aReaderThatKeepsUpGetsAnAnswerPastTheBacklogCeiling 128 MiB received whole, the stand-in's answer not cut
NemotronSuperVideoBindingTests.drainLeavesAStuckFrameReadItsChargeUntilItReturns now also expects exactly one public warning with the fixed text
NemotronSuperVideoBindingTests.aCancelledVideoKeepsItsChargeUntilItsFrameReadReturns the ledger back at its baseline, polled for up to 10 s
Red control #2189 (draft, never merged): the three behaviours switched off exactly the three new assertions fail and nothing else: shard 1, the drain warning (lines.all empty); shard 2, the batch count (the decoder's 400 instead of batch_too_large) and the keeps-up reader (readerFellBehind at 32 MiB)
The scan, compiled alone against 12 shapes (empty, nested, strings with commas/brackets, objects, scalars, unterminated) all counts as expected
python3 scripts/changelog.py check, python3 scripts/docs-impact-check.py --base origin/dev pass
CI on 0bbe0bc9dd run 43974569456: success (build, both unit-test shards, Provider Tests; cluster jobs skipped, no cluster change)
Independent review (fresh context) SHIP WITH NITS; the nits (a doc comment's place, a comment on the limit) fixed

Limitations

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

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

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference-landing Ready Ready Preview Nov 16, 2026 10:56pm UTC
darkbloom-status Ready Ready Preview Nov 16, 2026 10:56pm UTC
eigen-homepages-darkbloom Ready Ready Preview Nov 16, 2026 10:56pm UTC

Request Review

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

This branch was successfully deployed

3 active deployments
Preview – eigen-homepages-darkbloom — 0bbe0bc9 Deployed Nov 16, 2026 by vercel[bot]
Preview – d-inference-landing — 0bbe0bc9 Deployed Nov 16, 2026 by vercel[bot]
Preview – darkbloom-status — 0bbe0bc9 Deployed Nov 16, 2026 by vercel[bot]
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