Repository navigation
Decode a video again when its reader fails, and keep the cause - #1851
Merged
Merged
Conversation
A failed AVAssetReader pass on a valid video was refused as a client fault: GLM 5.3 mapped it to invalid_media (400), the coordinator did not retry it, and no log showed the reader's error (#1847). - Pin libs/mlx-swift-lm to Layr-Labs/mlx-swift-lm#389, which keeps the reader status and error codes (VideoReaderFailure) and runs a failed GLM 5.3, MiMo V2.6 or Qwen4 reader pass once more with a new reader. - Nemotron Super: the timing pass runs again once, and the frame reader replaces its reader once and decodes from the first frame again. - Refusal after two failed passes: a transient decoder, hardware or interruption code is a retryable 503 (requestRejected, capacity); any other failure stays the deterministic invalid_media 400. GLM keeps its refusal text; Qwen4 now refuses such a failure as invalid_media. - Each failed pass logs a WARN engine_health event video_reader_failed with the reader status and error codes only. - Correct the multimodal_rejected doc comment, name both clips in the readiness test's doc comment, and add fault-injection tests on the real in-memory resource loaders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
AVError.Code.operationInterrupted is declared on iOS only. The tests now inject decoderTemporarilyUnavailable, and libs/mlx-swift-lm moves to the fork head that keeps the iOS-only codes by value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeps dev's removal of the .disabled trait and this branch's doc comment naming both readiness clips. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI showed that AVFoundation requests a failed range again, so one failed data request never failed a reader pass. The tests now keep the fault armed until the first pass fails and disarm it from the failed-pass report; the Super frame-reader tests arm it after inspection. Pins libs/mlx-swift-lm to the fork head with the armed fault. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The frame reader reads bytes the timing pass already loaded through the same asset, so a loader fault armed after inspection never reached it (CI: no data request at the offset). A test hook runs on the reader's queue before each read, as readerCancelledForTesting does after a stop, and the tests cancel a real reader partway there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reverted before review. Echoes each failed reader pass to the test log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pins libs/mlx-swift-lm to the fork head whose decoders read through VideoReaderRetry.nextSample and its test hook. The Super SerialReader captures that same hook at setup and runs it on its queue, so the Super tests end the timing-pass reader or the frame reader partway the same way as the fork tests. The Super loader's fault hook, which no test needs now, is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The loop ran 50 iterations on each of two Darkbloom VMs: 100 passes, and no video reader failure in any iteration. This reverts commit 192ea87. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SuperHTTPErrors.map keeps only the transient reader failure as its own case. Any other VideoReaderFailure joins the Super video failures that refuse with the one multimodalRejected message, which it repeated before. No behavior change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 6, 2026
Merged
Merged
This branch had an error being 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
A failed
AVAssetReaderpass on a valid video was refused as a client fault: GLM 5.3 mapped any reader end state except.completedtoinvalid_media(400) and droppedreader.error. So the coordinator did not retry the request on another provider, and no log showed the cause. This PR, with Layr-Labs/mlx-swift-lm#389, keeps the reader's error codes and decodes the video once more with a new reader before it refuses. When the reader fails twice, a transient decoder fault is refused as a retryable 503, and every other failure is stillinvalid_media(400).Linked issue
Closes #1847
Test plan
GLM5NextMediaRoutingTests(the readiness test, plus three tests with the in-memory loader failing partway through the MP4),VideoReaderFailureMappingTestsandNemotronSuperVideoReaderRetryTestspass. The final head206b31a0passes in CI (dev) run 42173742752: Build provider test products, both Provider Unit Tests shards and the Provider Tests gate.darkbloom-3b28f3ec…(shard 1) and 50 of 50 ondarkbloom-ec55826e…(shard 2), run 42170865597. No iteration logged a failed reader pass.video reader status 3: NSURLErrorDomain -1100 < NSPOSIXErrorDomain 2(retrying=true, once); the truncated video the same, thenretrying=false; the transient caseAVFoundationErrorDomain -11839 < NSOSStatusErrorDomain -11839, twice.bb7fa8b0(VideoReaderRetryTests, 8 tests).python3 scripts/docs-impact-check.py(with the changed files) andpython3 scripts/changelog.py checkpass. Nothing was built or tested on the laptop.Vercel – d-inferenceandVercel – d-inference-console-ui-devdeployments, which failed the same way on test: disable the flaky GLM video readiness test (#1847) #1848.Components touched
libs/mlx-swift-lmpin)Protocol / interface changes
capacity503 (requestRejected), which the coordinator already retries. The PR adds no new wire code. A new WARNengine_healthtelemetry event, operationvideo_reader_failed, carriesretrying,transient,reader_statusandreader_error(status and error domains and codes only).Documentation impact
docs/architecture/inference.md(Vision constraints, Failure modes) anddocs/provider/direct-mode.md(refusal table).Changelog
changelog.d/video-decode-transient.md. I ranpython3 scripts/changelog.py check; I did not runmake changelog-checkon the laptop.Notes for reviewers
libs/mlx-swift-lmpoints to the head of Keep the video reader error and retry a failed reader pass once mlx-swift-lm#389. After that PR merges, the pin moves to its merge commit.decodeFrames, MiMo V2.6inspectVideoand the sampled-frame pass, and the Qwen4 count and decode passes. In this repo: Nemotron SupersampleTiming(run again once) andFrames. If its frame reader fails,SerialReader.reopenAfterFailure()replaces that reader once and decodes from the first frame again; the frames already produced are skipped, so the output does not change.VideoReaderFailure.isTransient: AVFoundationoutOfMemory(-11801),decoderTemporarilyUnavailable(-11839), and by valuemediaServicesWereReset(-11819) andoperationInterrupted(-11847); VideoToolboxkVTInvalidSessionErr,kVTAllocationFailedErr,kVTVideoDecoderMalfunctionErr,kVTVideoDecoderNotAvailableNowErr,kVTVideoDecoderRemovedErr, as the error or an underlying error) refuses asrequestRejected(503,capacity). The shared media funnel does this through the retryable construction refusal, and MiMo and Super throughrequestRejected. Every other failure isinvalid_media(400). GLM, MiMo and Super keep their refusal text.invalid_media.streamChatCompletionand the Super video path bindVideoReaderRetry.failedPassObserver. Each failed pass sends one telemetry event and one private provider log line..disabledtrait on dev, and this branch merges dev in (signed merge 98f3072). I changed only the test's doc comment, which now names both clips.VideoDataRequestFaultarmed until the first pass fails, and disarm it from the failed-pass report. A compressed-sample pass (Super timing, MiMo, Qwen4) that loses its bytes can end.completedwith fewer samples, not.failed. It did so once on a Darkbloom VM and on both clips on the fork's macOS 26 runners. A later pass also reads bytes that an earlier pass already loaded. So the Super tests, like the fork's MiMo and Qwen4 tests, end a real reader partway through the test-onlyVideoReaderRetry.beforeReadForTestinghook.SerialReadercaptures that hook at setup and runs it on its queue, between reads. The production loader serves bytes from memory and cannot fail this way. A short compressed-sample count still ends in a refusal there (the decoded pass disagrees), never in wrong frames.MiMoV26EncodedAudiovisualDecoder(audio pass),MiMoV26EncodedAACAudio, andUserInput+Audioin the fork.Before And After
Before
After
flowchart LR A[Video request] --> B[AVAssetReader pass] B -- completed --> C[Frames reach the engine] B -- failed --> L1[WARN video_reader_failed: status and codes] L1 --> R[Second pass, new reader, same asset] R -- completed --> C R -- failed --> L2[WARN video_reader_failed] L2 --> T{Transient decoder code?} T -- yes --> S["503 capacity: coordinator retries on another provider"] T -- no --> D[invalid_media 400]Refactor Pass
Not run. This agent cannot start a subagent, so the dedicated refactor pass is open. The coordinator runs it, as the brief says.
🤖 Generated with Claude Code