Skip to content

fix(nemotron-super): OpenRouter readiness: inlined video above 8 MiB, JSON response format with tools - #1560

Merged
Gajesh2007 merged 6 commits into
masterfrom
fix/nemotron-super-video-body-cap
Oct 23, 2026
Merged

Gajesh2007 merged 6 commits into
masterfrom
fix/nemotron-super-video-body-cap

Conversation

@jonathan308

@jonathan308 jonathan308 commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Consolidated Nemotron Super OpenRouter PR (owner decision: one PR per model). Part 1 (below) is the inlined-video body cap for input-video-url, proven on the real checkpoint. Part 2, at the end, serves a JSON response format together with tools, so every OpenRouter capability shape (tool-call step 1/5, tool_choice auto/none/required/function, json_object, strict json_schema, reasoning on and off) returns 200 on the real checkpoint (20/20).

Summary

OpenRouter's provider-readiness test input-video-url fails on nvidia-nemotron-3.5-super with 400 invalid_request_error "invalid media input". The coordinator fetches the linked 6,934,922-byte MP4 and inlines it as data:video/mp4;base64,…, which makes a request body of about 9.25 MB. The Super media binding's ingress quote (NemotronSuperLocalImageBinding.encodedHeaderQuote) refused any body over a hard-coded 8 MiB as Failure.invalidInput. SuperHTTPErrors maps that to multimodalRejected, so the provider sent invalid_media, which the coordinator returns as "invalid media input".

Fix

  • NemotronSuperServingPolicy.maximumEncodedBodyBytes is now 40 MiB (was 8 MiB). That holds one part at the shared MediaIngest.maxMediaDecodedBytes default (25 MiB decoded, 33.3 MiB as base64) plus the rest of the request. It also covers every body the provider's transports can deliver (localInferenceMaxUploadBytes and CoordinatorClient.maxInboundMessageBytes, both 32 MiB).
  • encodedHeaderQuote now takes its bound from that policy constant instead of its own literal. The charge formula is unchanged: body*32 + template*4 + 16 MiB.
  • A body over the bound throws the new Failure.bodyTooLarge. SuperHTTPErrors maps it to MediaIngest.MediaError.mediaTooLarge with fixed text, so the wire code is media_too_large (the coordinator returns 413) instead of invalid_media. All other refusals keep their current mapping.
  • The worst-case media charges follow the new bound, and the tests that pin them are updated with re-derived values. Details are under Merge Danger.
 runEncoded(body)
-  encodedHeaderQuote: body <= 8 MiB (literal)           else invalidInput -> invalid_media (400)
+  encodedHeaderQuote: body <= Policy.maximumEncodedBodyBytes (40 MiB)
+                                                         else bodyTooLarge -> media_too_large (413 at coordinator)
   parseEncodedBody -> NemotronSuperVideoDecode.inspect -> localVideoPrompt -> encodedVideoPlan
   reserve(plan.totalBytes) -> Frames -> tower/EVS -> bridge

Before

flowchart LR
  OR["OpenRouter<br/>input-video-url"]:::client --> C["Coordinator<br/>fetch 6.9 MB MP4,<br/>inline as data:video/mp4"]:::coord
  C -->|"9.25 MB body"| Q{"encodedHeaderQuote<br/>body <= 8 MiB?"}:::gate
  Q -->|"no"| E["Failure.invalidInput<br/>→ multimodalRejected<br/>→ invalid_media"]:::bad
  E --> R["400 'invalid media input'"]:::bad
  Q -.->|"yes (≤ 8 MiB only)"| P["inspect → prompt → plan<br/>→ frames → tower → generate"]:::ok
  classDef client fill:#dbeafe,stroke:#1d4ed8,color:#0b1b3f
  classDef coord fill:#ede9fe,stroke:#6d28d9,color:#1e0b4f
  classDef gate fill:#fef9c3,stroke:#a16207,color:#3b2a00
  classDef bad fill:#fee2e2,stroke:#b91c1c,color:#450a0a
  classDef ok fill:#dcfce7,stroke:#15803d,color:#052e16
Loading

After

flowchart LR
  OR["OpenRouter<br/>input-video-url"]:::client --> C["Coordinator<br/>fetch 6.9 MB MP4,<br/>inline as data:video/mp4"]:::coord
  C -->|"9.25 MB body"| Q{"encodedHeaderQuote<br/>body <= Policy.maximumEncodedBodyBytes<br/>(40 MiB)?"}:::gate
  Q -->|"yes"| P["inspect → prompt → plan<br/>→ frames → tower → generate"]:::ok
  P --> S["200 streamed answer"]:::ok
  Q -.->|"no (> 40 MiB)"| T["Failure.bodyTooLarge<br/>→ MediaError.mediaTooLarge<br/>→ media_too_large (413)"]:::warn
  classDef client fill:#dbeafe,stroke:#1d4ed8,color:#0b1b3f
  classDef coord fill:#ede9fe,stroke:#6d28d9,color:#1e0b4f
  classDef gate fill:#fef9c3,stroke:#a16207,color:#3b2a00
  classDef warn fill:#ffedd5,stroke:#c2410c,color:#431407
  classDef ok fill:#dcfce7,stroke:#15803d,color:#052e16
Loading

Legend: green = served path, red = the refusal this PR removes, orange = what an over-bound body now returns.

Evidence

The new NemotronSuperOpenRouterVideoTests use OpenRouter's real readiness clips. They are the SDK's committed MiMoOpenRouter resources at the pinned libs/mlx-swift-lm revision, checked by SHA-256 and read through the source tree, so no new binaries are added.

Clip Label Bytes Plan checked
input-video-url.mp4 (H.264 1280x720, 24 fps, 121 frames, edit list, AAC track) data:video/mp4;base64, 6,934,922 → 9.25 MB body 10 frames [0,13,26,…,120], 5 tubelets, 42x24-patch grid
input-video-base64.mov (H.264 1490x534 QuickTime, VFR, 211 frames) data:video/quicktime;base64, 502,411 21 frames [0,10,21,…,210], 11 tubelets, 52x18-patch grid
  • Before (pristine master cf3c45107, new tests only):
    ✘ inlinedLinkVideoPassesIngress()        Caught error: .invalidInput   (encodedHeaderQuote)
    ✘ bothClipsPlanAndDecodeAtTheirGrid()    Caught error: .invalidInput   (mp4 inspect/prompt/plan passed, ingress refused)
    
    With only the bound set back to 8 MiB on this branch, bothClipsServeOnTheInstalledFixture() fails with .bodyTooLarge on the first clip.
  • After:
    ✔ inlinedLinkVideoPassesIngress()
    ✔ bothClipsPlanAndDecodeAtTheirGrid()      ingress, parse, inspect, real pinned template render, encodedVideoPlan
                                               within videoMediaChargeBytes, every sampled frame decoded (finite, at grid)
    ✔ bothClipsServeOnTheInstalledFixture()    runEncoded end to end on the tiny installed fixture for both clips:
                                               2 completion tokens each, no errors, every charge returned
    ✔ oversizeBodyIsMediaTooLarge()            bodyTooLarge → media_too_large/400; invalidInput still invalid_media
    ✔ bodyBoundHoldsOneSharedIngestPart()      a 25 MiB-decoded part + 2 MB of text passes ingress; bound ≥ both 32 MiB transports
    
  • Focused run, from provider-swift/ after swift build --build-tests and ../scripts/stage-test-metallib.sh, with isolated DARKBLOOM_STATE_FILE/DARKBLOOM_LOADED_MODELS_FILE:
    swift test --skip-build --no-parallel --filter 'NemotronSuper|InferenceFailure|ErrorMapping|MediaIngest' → 274 Swift Testing tests in 31 suites passed (plus the XCTest cases; only the gated pinned-checkpoint and reference-tokenizer cases skipped).
  • make docs-check, make docs-impact-check BASE=origin/master, make changelog-check, make changelog-preview: all OK.

No other check rejects either clip on the Super video path. The edit list and AAC track (URL clip), and VFR timing (base64 clip), all pass. So do the sampling plan, the grid (1,008 and 936 patches, both under 1,088), the decoded-pixel budget, the per-frame validation and the decode allowance.

Merge Danger

Door: two-way. This is a constant and an error mapping, with no wire, protocol or storage change. media_too_large is an existing InferenceFailureCode.

Blast Radius: Super media quotes.

  • Runtime reservations still use each request's actual body size. Only the static worst case grows:

    Charge Before After
    mediaChargeBytes(1) 3,888,385,020 B (3.62 GiB) 5,012,458,492 B (4.67 GiB)
    mediaChargeBytes(16) 26,317,356,540 B (24.5 GiB) 27,441,430,012 B (25.6 GiB)
    videoMediaChargeBytes 3,751,221,756 B (3.49 GiB) 4,875,295,228 B (4.54 GiB)

    The ingress at the maximum body grows by exactly 1 GiB, and the two encoded copies grow by 48 MiB. A video stays under one largest image.

  • Capacity quotes for Super media probes need about 1.05 GiB more room.

  • defaultPrefixBankBytes keeps one image's charge free. Where serving / 2 binds (KV grants of about 34–50 GiB), the default bank is 512 MiB smaller: 3 → 2.5 GiB at 34 GiB, 8.5 → 8 GiB at 45 GiB. The 128 GiB default owner's bank (5.25 GiB) and the 256/512 GB banks (16 GiB) are unchanged, and the 128 GiB claim and gate tests still pass.

  • The coordinator has no mirror of the 8 MiB bound or of these charges (checked on platform master f512258), so no companion platform PR is needed.

Components touched

  • provider-swift (Swift CLI)
  • native runtime / MLX
  • docs

Protocol / interface changes

  • No protocol/interface changes. The existing media_too_large failure code is now used for an over-bound Super body.

Documentation impact

  • Canonical documentation updated: docs/architecture/inference.md, docs/architecture/hardware-support.md (charges), docs/reference/nemotron-super-image-formats.md, docs/provider/direct-mode.md, docs/developer/test.md.

Changelog

  • Added changelog.d/nemotron-super-video-body-bound.md and ran make changelog-check.

Notes for reviewers

  • Base64 label: OpenRouter's fixture manifest records request_bytes 670,210 for input-video-base64 and 93,577 for input-image-base64. Subtracting each payload's base64 length and an equal JSON skeleton leaves a 28-character data-URI label for the video. That matches data:video/quicktime;base64,, which Super and MediaIngest.decodeVideo already admit, so admittedVideoDataURIPrefixes is unchanged. If a data:video/mov;base64, label is ever needed, the shared MediaIngest.decodeVideo must accept it first, because Super's inspect calls it. Super's prefix list would then mirror that change.
  • MediaIngest.MediaError.mediaTooLarge errors raised inside the Super path, such as a part over 25 MiB decoded or a video over 600 s, still map to invalid_media. That is the existing invalidVideosTakeTheInvalidMediaPath contract. MediaIngest also uses mediaTooLarge for unreadable metadata, so passing it through would mislabel those cases.
  • The coordinator's own caps (16 MiB forwarded body, 8 MiB per fetched file, 10 MiB per request) still bind before this bound on the coordinator path.

Refactor Pass

Outcome: one behavior-preserving test cleanup, signed commit a2a51d5 ("refactor: share the Super video test owner with the OpenRouter clip tests"). A dedicated refactor subagent reviewed the whole diff against origin/master, editing only files already in it. This replaces the earlier "Not run" status: the worker that wrote the fix could not spawn subagents, so the coordinating session ran this gate.

Changed (tests only; no source, docs, changelog, wire or charge change):

  • NemotronSuperOpenRouterVideoTests.bothClipsServeOnTheInstalledFixture had copied NemotronSuperVideoBindingTests' tiny-fixture video owner line for line (same tower, 16 GiB budget, pending-load lease, 4,096-token context and teardown checks), plus its event recorder. It now uses NemotronSuperVideoBindingTests.videoOwner(contextLength:), VideoOwner.close() and SuperVideoEvents, which are no longer private. The copied OpenRouterVideoEvents actor and the unused MLXLMCommon import are gone. The assertions are unchanged.
  • Two test comments are corrected:
    • The inlined link now "makes a body of more than 9 MB" instead of "is a 9.3 MB body". This test's JSONSerialization body is 9,393,454 B because slashes are escaped; the coordinator's body is about 9.25 MB.
    • oversizeBodyIsMediaTooLarge now says only invalid input still leaves as invalid_media. Capacity, busy and closed refusals map elsewhere.

Reviewed, no change needed:

  • encodedHeaderQuote's guards, Failure.bodyTooLarge, SuperHTTPErrors.map and the maximumEncodedBodyBytes comment match the invariants:
    • 40 MiB is the only body bound, and the charge formula is unchanged.
    • An over-bound body maps to media_too_large; any other bad body or template maps to invalid_media.
  • The re-derived charges (5,012,458,492, 27,441,430,012 and 4,875,295,228 B) are each the old value plus 1 GiB of ingress and 48 MiB of encoded copies. The prefix-bank comments, docs and changelog agree with them.
  • The remaining "8 MiB" mentions are intentional: the former bound in the changelog and in inlinedLinkVideoPassesIngress, the image decoder's unrelated scratch, and the frozen CHANGELOG.md.
  • The clips are still read by path from the SDK's committed MiMoOpenRouter resources, with SHA-256 checks. I re-verified both digests, and no binaries were added.

Outside this pass's files, resolved by the coordinating session in signed commit fceb642 ("test: drop the stale 8 MiB body case from the Super HTTP bounds test"):

  • NemotronSuperLocalHTTPTests.imageRequestsOutsideTheirBoundsAreRefusedWith400 had a case labelled "body over the 8 MiB encoded ceiling". Its 8.4 MB body now passes the 40 MiB bound, and the case was refused only by the context bound that the next case already covers.
  • The case is removed, its now-unused text: helper parameter dropped and the test comment corrected. Over local HTTP the body bound can't be reached: the 32 MiB upload limit returns 413 first, which the same file already tests (contentTooLarge). The binding's over-cap refusal is covered by oversizeBodyIsMediaTooLarge.
  • Rerun after the change: run-nested-suite.sh 'NemotronSuper|InferenceFailure|ErrorMapping|MediaIngest' --no-parallel reported ✔ Test run with 274 tests in 31 suites passed with 0 failures; the edited test passed. Skips are the same gated cases, and the runner's any-skip tripwire still exits 1. make docs-impact-check BASE=origin/master passes.

Validation after the refactor (from provider-swift/, reusing the worktree build):

  • swift build --build-tests, then ../scripts/stage-test-metallib.sh "$(swift build --show-bin-path)": OK.
  • ../scripts/run-nested-suite.sh 'NemotronSuper|InferenceFailure|ErrorMapping|MediaIngest' --no-parallel, with isolated DARKBLOOM_STATE_FILE/DARKBLOOM_LOADED_MODELS_FILE, reported ✔ Test run with 274 tests in 31 suites passed with 0 failures. XCTest ran 36 cases, also with 0 failures.
  • The only skips are gated cases: 12 pinned-checkpoint cases and the two reference-tokenizer cases (realTokenizerReproducesTheReferencePromptIDs, testRealTokenizerReproducesGoldenTokenIDs). Swift Testing's aggregate counts its 13 skips as passed.
  • The runner still exits 1 on its any-skip tripwire, because this selector includes those gated cases.
  • From the repo root: make docs-check (192 files OK), make docs-impact-check BASE=origin/master (coverage OK), make changelog-check (2 valid fragments) and make changelog-preview all pass.
  • swift-format was not run: the repo has no swift-format configuration or CI step.

Part 2 — OpenRouter capability shapes (merged via 9403e76f8 from feat/super-openrouter-capabilities 587e123b9)

Before / After

flowchart LR
  subgraph Before
    A1[relayed request: json_object or json_schema + tools] --> B1[NemotronSuperRequestPlan.validateWireControls]
    B1 -->|unsupportedControl| C1[400 invalid inference request]
  end
  subgraph After
    A2[relayed request: json_object or json_schema + tools] --> B2[NemotronSuperRequestPlan]
    B2 --> D2[pinned template: tools + JSON instruction]
    D2 --> E2[NemotronSuperLocalOutput.finish]
    E2 -->|tool calls| F2[200 tool_calls; text unchanged]
    E2 -->|answer without calls| G2{normalizedContent: JSON for the format?}
    G2 -->|yes| H2[200 JSON content]
    G2 -->|no| I2[422]
  end
Loading

What changed

  • NemotronSuperRequestPlan.validateWireControls no longer refuses a JSON
    response format combined with tools.
  • NemotronSuperLocalOutput.finish validates the response format only for an
    answer without calls; a call turn returns its calls with its text unchanged.
    A required/named tool_choice still needs its call.

Evidence

  • Probe (CPU, NemotronSuperOpenRouterCapabilityTests.everyCapabilityShapeIsServed):
    20 shapes = 10 OpenRouter capability tests x reasoning enabled/disabled,
    built from the captured OpenRouter request (SHA-256 d63598aa…229844b,
    pinned to the platform conformance fixture), through inbound decode, native
    controls, response-format preparation, request plan, pinned template render
    and output parser.
    • master cf3c45107: 16/20 served; the 4 JSON-format-with-tools shapes
      refused at the request plan (unsupportedControl).
    • branch: 20/20 served.
  • compliantResponsesPassTheOwnersParser: a compliant response for every
    shape validates streamed and complete (calls with schema-valid arguments,
    JSON objects, schema-conforming structured output, reasoning split off when
    enabled).
  • jsonFormatWithToolsValidatesTheAnswerNotTheCall: call -> calls; JSON
    answer -> content; prose answer -> 422; forced choice without a call -> error.
  • Live loopback HTTP on the tiny native fixture
    (liveHTTPTextReasoningToolsAndStructuredOutput): JSON format with tools
    returns a call as tool_calls and a JSON answer as content, streamed and
    not; prose returns 422.
  • Focused suites: NemotronSuperOpenRouterCapabilityTests 4/4,
    NemotronSuperLocalHTTPTests 5/5, NemotronSuperLocalOutputTests 13/13 XCTest.
  • Regression, run-nested-suite.sh 'NemotronSuper' --no-parallel: 213 Swift
    Testing tests in 29 suites passed; XCTest 36 executed, 0 failures, 1 skipped.
    The runner exits 1 only for the 13 gated checkpoint/reference skips. With
    NEMOTRON_SUPER_REFERENCE_DIR (pinned tokenizer and template): prompt golden
    4/4 XCTest and 12 Swift Testing tests passed, no skips.
  • Real checkpoint (NemotronSuperRunner Release from this branch, runner
    SHA-256 fa8e8001…, metallib 156f2624…, M3 Ultra emulating 128 GiB, KV 43
    GiB, production engine settings incl. MTP 3,2,2,2,1, checkpoint
    2026-10-20-nvfp4-r2): 20/20 OpenRouter shapes streamed as the relay
    delivers them returned 200 and passed their checks, reasoning enabled
    (160-1,243 reasoning chars) and disabled (none): every call shape returned
    get_current_weather {"location":"Boston, MA","unit":"fahrenheit"}
    (including JSON format with tools, auto and required), tool_choice: none
    answered without a call, the 5-step history summarized all four cities,
    json_object returned an object and strict json_schema exactly
    location/temperature/conditions. Load 83 s; clean retirement (exit 0).
  • docs-impact OK, docs-check OK, changelog-check OK; merges cleanly into
    fix/nemotron-super-video-body-cap (git merge-tree, no conflicts).

Limitations

  • No sampler grammar: forced choice and JSON stay prompt-forced with withheld
    validation (unchanged). The prompt sidecar still declines to plan a JSON
    format with tools for Super, so such requests use heuristic prompt work.

Refactor pass (Super capabilities)

Outcome: small behavior-preserving cleanup, signed commit a86de72c3 ("refactor: tidy the Super JSON-format-with-tools output and tests"). A dedicated refactor subagent reviewed Part 2 (587e123b9) and edited only files from that commit. The request plan, wire behavior, docs and changelog are unchanged.

Changed:

  • NemotronSuperLocalOutput.finish: the variable holding a call turn's text was named answer, but the comment above it says a call turn is not an answer. It is now text, and the conditional format check is split over three lines. Control flow and values are unchanged.
  • NemotronSuperOpenRouterCapabilityTests.check: the "tool-call-step-5" name check appeared in both compliantAnswer and check. check now expects the call whenever the test answered with the call (compliantAnswer(shape) == call), so the step-5 special case is defined only once. Each shape gets the same assertions as before.
  • liveHTTPTextReasoningToolsAndStructuredOutput: the JSON-format-with-tools options are declared once and reused for the 422 case.
  • The SuperOpenRouterCapabilityShapes.all() comment now describes the shapes instead of what the owner "used to refuse".

Reviewed, no change needed:

  • validateWireControls still refuses logprobs, top_logprobs, prompt_cache_key, n > 1, logit_bias, min_p, tool_call_parser and reasoning_parser. Its comment explains why JSON with tools is not refused.
  • A required or named tool_choice still needs its call. route refuses visible text, and finish refuses a non-whitespace residual before the format check.
  • An answer without calls still goes through normalizedContent (422 for invalid JSON). Without a JSON format, the text passes through unchanged, as before.
  • The 20-shape corpus, its SHA-256 pin and all four capability tests keep their coverage. inference.md, direct-mode.md, test.md and the changelog fragment match the code.

Validation (fresh detached worktree at 9403e76f8 plus the commit, run from provider-swift/):

  • Deleted the staged metallibs, then ran swift build --build-tests and ../scripts/stage-test-metallib.sh "$(swift build --show-bin-path)". The metallib SHA-256 is 156f2624….
  • ../scripts/run-nested-suite.sh 'NemotronSuper' --no-parallel ran with isolated DARKBLOOM_STATE_FILE and DARKBLOOM_LOADED_MODELS_FILE:
    • Swift Testing: ✔ Test run with 218 tests in 30 suites passed. This branch has one more suite than the 213/29 figure above, NemotronSuperOpenRouterVideoTests from Part 1.
    • XCTest: 36 executed, 1 skipped, 0 failures.
    • everyCapabilityShapeIsServed: 20/20 shapes served.
    • The only skips are gated cases: 12 pinned-checkpoint cases and the two reference-tokenizer cases. The runner's any-skip tripwire still exits 1, as before.
  • make docs-check (192 files OK), make docs-impact-check BASE=origin/master (coverage OK), make changelog-check (3 valid fragments) and make changelog-preview all pass.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

The Super media binding refused any encoded body over 8 MiB as invalid
input, so OpenRouter's input-video-url readiness test (a 6.9 MB MP4 the
coordinator inlines into a 9.3 MB body) failed with invalid_media.

Raise NemotronSuperServingPolicy.maximumEncodedBodyBytes to 40 MiB, which
holds one part at the shared 25 MiB inline-media cap as base64 and any body
the provider's transports deliver, and make encodedHeaderQuote use it as
its single bound. A body above it now fails as media_too_large. The media
charge quotes and the default prefix bank follow the larger bound.

Add NemotronSuperOpenRouterVideoTests: both OpenRouter readiness clips
pass ingress, inspection, the pinned template's prompt, the media plan and
every frame's decode, and serve on the tiny installed fixture.
@vercel

vercel Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
d-inference Ready Ready Preview Oct 23, 2026 3:57am UTC
d-inference-console-ui-dev Ready Ready Preview Oct 23, 2026 3:57am UTC
d-inference-landing Ready Ready Preview Oct 23, 2026 3:57am UTC
darkbloom-status Ready Ready Preview Oct 23, 2026 3:57am UTC
eigen-homepages-darkbloom Ready Ready Preview Oct 23, 2026 3:57am UTC

Request Review

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Threat model review — advisory

Reviewed head a86de72c37f9 against base cf3c4510722a.

Review not completed for this head. Previous findings are superseded, not confirmed resolved.
First pass completed; selected deeper review is pending

Reviewers: anthropic/claude-sonnet-5.5: first pass completed

LOW: Image/video media memory charge quintupled with the 40 MiB body bound; admission and sizing assumptions need review

provider-swift/Sources/ProviderCore/Inference/Engine/Factory/NemotronSuperServingPolicy.swift:369 · ADV-002, TB-007

maximumEncodedBodyBytes rises from 8 MiB to 40 MiB (NemotronSuperServingPolicy.swift:369). It feeds encodedHeaderQuote, encodedCopies (UInt64(bodyBytes/4*3)*2 at line 406) and videoChargeBytes (lines 445-448). Every image or video request is therefore charged a much larger ledger reservation, and defaultPrefixBankBytes subtracts mediaChargeBytes(imageCount: 1) (line 293), which shrinks the default prefix bank. A consumer can submit a single large media body, up to the 32 MiB transport cap, and reserve far more shared memory than before. This can starve or refuse concurrent requests and could trigger the Super load/serving admission. The hardcoded pinned constants and the 'video charge stays within one image charge' comment were not re-verified against the new bound. The consumer-controlled memory reservation is availability-relevant (ADV-002), and the effect is bounded by the ledger.

Raised by: anthropic/claude-sonnet-5.5

Models: budgeted Sonnet / selective Opus / selective Sol 6.1. Findings require human validation; this review never requests changes or blocks merging.

Coverage: 111/111 source units; cross-file integration complete. 9 selected depth batch(es) pending. All threat definitions indexed; relevant full definitions selected. Unchanged callers are not scanned.

Cost this run: $0.0000 reported, $0.0000 reserved with unknown cost; 0 paid request(s), 18 reused batch(es), 0 provider cache-hit tokens.

Saved findings and earlier report · Historical findings are not confirmed resolved.

Bedrock: 7 request(s), 353405 uncached + 0 cache-read + 0 cache-write input / 6508 output tokens; 0 request(s) with unknown usage. OpenRouter backup used 0 time(s). Dollar amounts above cover OpenRouter only; AWS billing is reconciled separately.
Workload allowance: 34 native request(s), including one shared response repair; 500 emergency ceiling. Selected depth and integration rounds are admitted as their scope becomes known.

…ests

NemotronSuperOpenRouterVideoTests copied NemotronSuperVideoBindingTests' tiny-fixture video owner (same tower, budget, load lease, context and teardown checks) and its generation-event recorder. Reuse videoOwner(contextLength:), VideoOwner.close() and SuperVideoEvents instead, and drop the unused MLXLMCommon import.

Correct two test comments: the inlined link makes a body of more than 9 MB here (9.39 MB once JSONSerialization escapes slashes, not 9.3), and only invalid input, not every other binding refusal, still leaves as invalid_media.
The 40 MiB encoded-body bound made the 8 MiB case pass ingress; it was refused only by the context bound the next case already covers. Over local HTTP the body bound is unreachable because the 32 MiB upload limit answers 413 first (tested above), and the binding's over-cap refusal is covered by oversizeBodyIsMediaTooLarge.
@jonathan308

Copy link
Copy Markdown
Collaborator Author

M5 Ultra combined build that includes this PR: GLM-5.3-Flash unaffected (no Super run here)

For cross-reference with the Nemotron Super real-model before/after, which runs on the M5 Max.

  • Binary. Local scratch merge 8eeee2739 (never pushed) = fix(glm): GLM-5.3-Flash OpenRouter readiness: VFR video, strict tools and returned reasoning #1561 head 35d266de2 (now carrying fix(provider): serve OpenRouter's variable-frame-rate readiness video on GLM-5.3-Flash #1559) + this PR's head fceb6425a, onto master cf3c45107. Release build (swift build --build-system native --sdk MacOSX27.0.sdk -c release, Xcode 27.1, Swift 6.4, dev install identity). darkbloom e57f3bd0df97aef32581130a5d24d1210e0199cbbd86e7564427815f50c374a5, mlx.metallib 156f2624f9f1b1413dfabd8b6e16423121b0e5b18e2573c23c4e023b606a462d (identical to v0.10.0's).
  • What ran. On Apple M5 Ultra 256 GB (macOS 27.0.1), the production GLM-5.3-Flash checkpoint served through the provider's local endpoint. All OpenRouter GLM scenarios passed on this binary: both readiness videos, OpenRouter's captured strict tool requests verbatim, tool_choice: "none", and the 5-step returned-reasoning tool conversation. Details and the master baseline are in fix(glm): GLM-5.3-Flash OpenRouter readiness: VFR video, strict tools and returned reasoning #1561 (comment). This PR changes only Nemotron Super files, and this run shows no GLM regression from carrying it.
  • Not run here. Scenarios (e) input-video-url (~9.25 MB inlined body) and (f) input-video-base64 on Nemotron Super were moved to the M5 Max by owner decision. This comment is not Super evidence.
  • Reusable harness. or_proof.py has the Super set ready: --set super-or for (e)/(f) and --set super-features for tools, JSON and logprobs. Point it at a NemotronSuperRunner endpoint with --base-url … --token-file … (see README.md in ~/m5-proof on M5 Ultra DGInf: Decentralized private AI inference platform #1, mirrored at /Users/jonathanspangler/Documents/Codex/2026-10-20/task/m5-proof/).

@jonathan308

Copy link
Copy Markdown
Collaborator Author

Real-checkpoint before/after: Nemotron 3.5 Super, OpenRouter input-video-url (all pass on this PR)

Real Nemotron 3.5 Super NVFP4 weights (nvidia/NVIDIA-Nemotron-3.5-Super-VL-120B-A12B-NVFP4, R2-verified, 98/98 files), served by NemotronSuperRunner Release builds on an M3 Ultra configured to emulate a 128 GB Mac. Loopback only, with no coordinator. BEFORE = master cf3c45107; AFTER = this PR's head fceb6425a. mlx.metallib 156f2624… on both. The request bodies are identical on both arms. The OpenRouter URL clip is inlined as data:video/mp4;base64,…, as the coordinator does (9,246,821-byte body).

Runner SHA-256
BEFORE 27649794c864c99d8ec73eb580dc88764b1c1e4d7c879fa858229f0285115cc0
AFTER af15a3baf531e18365cf8a87dbab2f557dccfa2d89302c7c724d44da9f5275e3
Case Body bytes BEFORE AFTER AFTER excerpt
text 223 200 (5.74 s) 200 (7.02 s) 323
text_stream 262 200 (2.27 s) 200 (2.263 s) 323
image_jpeg 93558 200 (9.198 s) 200 (9.015 s) A close-up view shows clusters of small blue and pink flowers with yellow centers growing among fuzzy green le…
image_jpeg_stream 93597 200 (7.147 s) 200 (7.584 s) A close-up view shows clusters of small blue and pink flowers with yellow centers growing among fuzzy green le…
video_mp4_url_clip 9246847 400 (0.059 s) 200 (13.591 s) A blue neon sign reading "OpenRouter" glows brightly in a window. As the camera slowly pans to the right, the …
video_mp4_url_clip_stream 9246886 400 (0.055 s) 200 (16.136 s) A blue neon sign reading "OpenRouter" glows brightly in a window. As the camera slowly pans to the right, the …
video_mov_base64_clip 670173 200 (31.981 s) 200 (32.062 s) The video shows a screen recording of a developer working in a code editor with a dark theme. The code appears…
video_mov_base64_clip_stream 670212 200 (43.382 s) 200 (31.911 s) The video shows a screen recording of a developer working in a code editor with a dark theme. The code appears…
tools_auto 565 200 (3.289 s) 200 (3.278 s) tool_calls: [{"function": {"arguments": "{"location":"Paris","unit":"celsius"}", "name": "get_…
tools_required 543 200 (2.668 s) 200 (2.729 s) tool_calls: [{"function": {"arguments": "{"location":"Tokyo"}", "name": "get_weather"}, "id": "cal…
tools_forced 590 200 (3.529 s) 200 (3.116 s) tool_calls: [{"function": {"arguments": "{"location":"Berlin"}", "name": "get_weather"}, "id": "ca…
tools_none 558 200 (2.131 s) 200 (1.854 s) Bonjour
json_object 292 200 (5.181 s) 200 (4.307 s) {"name": "Alice", "age": 30}
json_schema 559 200 (3.631 s) 200 (3.22 s) {"name":"Ada","age":36,"languages":["English","French"]}
logprobs 245 400 (0.001 s) 400 (0.001 s)

Result. BEFORE reproduces the production failure: OpenRouter's input-video-url clip, inlined, is refused with 400 "Invalid media input." in about 0.06 s, streaming and non-streaming, because the 8 MiB encoded-body cap rejects the 9.25 MB body. AFTER serves it (200) with a correct description of the clip. Every other case is unchanged. logprobs is unsupported on both arms; that's separate work, not part of this PR.

Receipts: m5max-proof/m3u-emu128/runs/{before,after}/receipt.json on the qualification host.

OpenRouter tests every capability on our Super endpoint (tools, all
tool_choice modes, json_object, strict json_schema, reasoning on and off).
Replaying each test shape, derived from the captured OpenRouter tool request,
through the owner's relay path (inbound decode, native controls, response
format preparation, request plan, pinned template, output parser) admits all
of them except a JSON response format combined with tools: the request plan
refused that pair with 400 (unsupportedControl).

Serve it. The plan no longer refuses the pair, and the output validates the
format only for an answer: a turn that calls tools returns its calls, with
any text unchanged, and an answer without calls must be JSON for the format
(422 otherwise). A required or named tool_choice still needs its call.

NemotronSuperOpenRouterCapabilityTests replays all 20 shapes (10 tests,
reasoning enabled and disabled) and validates a compliant response for each,
streamed and complete; the captured request's SHA-256 is pinned to the
platform conformance fixture. The live HTTP test now serves both a call and a
JSON answer for a JSON format with tools, and refuses prose with 422.
…mat with tools) into the consolidated Super PR
@jonathan308 jonathan308 changed the title fix(provider): admit inlined Nemotron Super videos above 8 MiB (OpenRouter input-video-url) fix(nemotron-super): OpenRouter readiness: inlined video above 8 MiB, JSON response format with tools Oct 23, 2026
Behavior-preserving cleanup of the Nemotron Super JSON response format
with tools change:

- NemotronSuperLocalOutput.finish named the text a call turn passes through
  unchanged `answer`, which the comment above it says a call turn is not.
  Name it `text` and lay the conditional validation out on three lines.
- NemotronSuperOpenRouterCapabilityTests.check repeated compliantAnswer's
  "tool-call-step-5" name test; it now asserts the call when the shape was
  answered with the call, so the step-5 choice lives in one place.
- The live HTTP test declares its JSON-format-with-tools options once and
  reuses them for the 422 case.
- The shape corpus comment describes the shapes instead of what the owner
  used to refuse.

Same control flow, values and assertions.
@Gajesh2007
Gajesh2007 merged commit e483dcc into master Oct 23, 2026
25 checks passed
@jonathan308 jonathan308 mentioned this pull request Oct 23, 2026
5 of 8 tasks
Gajesh2007 pushed a commit that referenced this pull request Oct 23, 2026
* chore(release): prepare provider 0.10.1

Set ProviderCore.version to 0.10.1 and render the v0.10.1 changelog
entry from the 13 fragments added since v0.10.0: the GLM-5.3-Flash and
Nemotron 3.5 Super OpenRouter readiness work (#1561, #1560) and the
many-file download progress display (#1558), plus already-merged
installer, sign-in and release-note fixes (#1505, #1493, #1482). Order
the entries by theme behind an upgrade and rollout section. Logprobs are
deferred, so the native-engine entry keeps the typed refusal and calls
the GLM logprob code disabled groundwork. Drop the forced-tool-choice
refusal that the GLM JSON and forced-choice entry supersedes, and
clarify the GLM startup savings and the wired-limit notice.

Mark v0.10.0 as published on 2026-10-23. Record in the provider release
runbook that darkbloom-platform#411 must be deployed before tagging,
that no catalog row gains the logprobs capability for 0.10.1, and that
#1561 re-pins mlx-swift-lm to the #340 squash commit before it merges.
No tag, registration, upload or deployment is performed.

* chore(release): render the desktop app entries into provider 0.10.1

The desktop app (#1518) merged to master after this preparation was rendered, so its six changelog fragments were still pending. Render them verbatim into the v0.10.1 entry and remove them: the desktop control API and hardware report ship in the provider CLI. Note in the rollout notes and the runbook that the provider release does not build, sign or publish the Electron desktop app, whose public distribution still needs a signed, notarized build and an update feed.

* chore(release): render the Autopilot entry into provider 0.10.1

Autopilot placements, downloads and busy reasons (#1565) merged to master after the desktop update. Render its fragment into the v0.10.1 entry and remove it, correcting "startup is not slower": with consent, start first fetches the catalog, waiting up to 10 s. Add rollout notes: changes apply only to Macs with saved consent; the wider selected_models also counts toward reward qualification, approval counts and operation victims on the current coordinator; one reconnect after start; holds, adopted routing and downloads need darkbloom-platform#439.

---------

Co-authored-by: Jonathan Spangler <5055076+jonathan308@users.noreply.github.com>
jonathan308 added a commit that referenced this pull request Oct 24, 2026
…probs follow-up

master squash-merged #1561 (9389559) and #1560 (e483dcc), whose
original heads this branch merged, then prepared provider 0.10.1, which
rendered and deleted their changelog fragments. restack-after-squash.py
refuses this stack (#1564 targets master and the squash trees differ from
the original heads), so this is the content-aware signed merge.

The resolution is master plus this branch's own diff (598af60..e74c482):
- changelog.d: drop the GLM and Super fragments 0.10.1 rendered; keep
  nemotron-super-logprobs.md, which describes only this follow-up.
- Conflicted docs, Super plan and tests, GLM logprobs tests: master's
  squashed content with this branch's hunks applied.
- libs/mlx-swift-lm stays at 54a1004a (mlx-swift-lm #342 head; SDK main is
  still 6148b6da).

This branch was successfully deployed

5 active deployments
Preview – d-inference-console-ui-dev — a86de72c Deployed Oct 23, 2026 by vercel[bot]
Preview – eigen-homepages-darkbloom — a86de72c Deployed Oct 23, 2026 by vercel[bot]
Preview – d-inference — a86de72c Deployed Oct 23, 2026 by vercel[bot]
Preview – d-inference-landing — a86de72c Deployed Oct 23, 2026 by vercel[bot]
Preview – darkbloom-status — a86de72c Deployed Oct 23, 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.

2 participants