Repository navigation
fix(provider): drop chunk frames processed while disconnected - #1646
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Threat model review — advisoryReviewed head Review not completed for this head. Previous findings are superseded, not confirmed resolved. Reviewers: anthropic/claude-sonnet-5.5: first pass completed Models: budgeted Sonnet / selective Opus / selective Sol 6.1. Findings require human validation; this review never requests changes or blocks merging. Human review required: CI did not complete the security review. A maintainer must review the saved findings and remaining scope. A green advisory job is not security clearance; do not manually rerun the paid scan. Failure diagnostics: Coverage: 28/28 source units; cross-file integration complete. 2 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), 0 reused batch(es), 0 provider cache-hit tokens. Saved findings and earlier report · Historical findings are not confirmed resolved. Bedrock: 10 request(s), 471841 uncached + 0 cache-read + 0 cache-write input / 7409 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. |
Brings in the SSD cache changes merged since this branch's base (#1642, #1647, #1648, #1649, #1651) plus #1639, #1640 and #1646. The only conflict was the docs/reference/ssd-kv-cache.md table: keep this PR's victim selection row and master's updated maintenance sweep row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When
ChunkBatcherprocesses a small response frame between the old session's unbind and a replacement bind, it can retain that frame until a later flush sends it through the replacement connection. Reject frames at the queue's admission point whenever no sink is bound, matching the existing disconnected-flush drop behavior.The check runs on the existing serial queue. Bound-session batching, the 1,400-byte flush threshold, frame order, terminal barriers and stale-connection teardown behavior are unchanged. This fixes the demonstrated unbound interval; it is not a request/session-generation fence. An old request's frame processed after a replacement has already bound still passes the check.
Before
flowchart TD A["Old sink holds the serial queue"] --> B["Queue: unbind old → enqueue frame → bind new"] B --> C["Release old sink; unbind clears pending"] C --> D["enqueue: append while sink is nil"] D --> E["bind replacement before deferred flush"] E --> F["flushPendingOnQueue sends old frame to replacement"] classDef queue fill:#dbeafe,stroke:#2563eb,color:#172554 classDef defect fill:#fee2e2,stroke:#dc2626,color:#450a0a class A,B,C,E queue class D,F defectAfter
flowchart TD A["enqueue closure executes on serial queue"] --> B{"Session sink bound?"} B -- No --> C["Drop frame before pending append"] B -- Yes --> D["Existing append and threshold/deferred flush"] C --> E["Replacement bind receives only later admitted frames"] D --> F["Existing sink and terminal ordering"] classDef queue fill:#dbeafe,stroke:#2563eb,color:#172554 classDef safe fill:#dcfce7,stroke:#16a34a,color:#052e16 class A,B,D queue class C,E,F safeEvidence and validation
ChunkBatcher, realNWConnectionidentity objects and a semaphore-controlled sink. The baseline delivers stale frames for sizes 0, 1, 64 and 1,399 bytes; 1,400/4,096-byte controls already drop them. The fixed source passes all cases. The reproduction controls the real queue without sleeps or private queue access.swift build --build-tests --package-path provider-swift --build-system native --scratch-path <isolated-scratch> --jobs 4. Staged source-matched resources usingscripts/stage-test-metallib.sh <isolated-scratch>/arm64-apple-macosx/debug.ChunkBatcherLifecycleTests|ChunkSenderTests|CoordinatorIntegrationTests|cancellationRegistryCancelsAndRemovesToken|CancelledSettlementLifecycleTests, usingswift test --skip-build --disable-automatic-resolution --no-parallelwith the same package/scratch/build-system arguments. This includes real loopback WebSocket delivery/reconnect, NaCl encryption/cancellation, terminal ordering and control-path fallback.make docs-impact-check BASE=8effff7f7067fec70b2e3b58de0a4ba47ea3986c,make docs-check,make changelog-check,make changelog-preview, andgit diff --checkpass.Local validation used Apple Swift 6.4 on arm64 macOS, provider base
8effff7f, MLX host/kernel source31f550af, and metallib SHA-2566ccc62966bb452b767fbd7261175b06c7653259a25f657524f1c1ef71f556d45. No full-model GPU inference, production latency or throughput claim is made. This PR remains in draft for review.CI status
At commit
bc67c1a2, Provider Unit Tests, Provider SDK Tests, Provider Prompt Parity, the aggregate Provider Tests gate, Release Integrity, Commit Signatures, Docs Lint and Docs Impact all pass. No code-review findings are present in the checked GitHub snapshot.Outstanding external statuses: Darkbloom sandbox integrity reports successful execution but no verified execution receipt; the two Vercel projects
d-inferenceandd-inference-console-ui-devreport failures. These checks have not been disabled or bypassed. This is a draft with validated source behavior and passing provider CI, not a claim that every repository gate is green.Need help on this PR? Tag
@codesmith-botwith what you need.