Repository navigation
fix: admit relay bulk frames once under backpressure - #26333
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The changed tests exercise failed-admission wakes and producer retirement, with no remaining concrete admission failure established. No specific merge blocker is indicated. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ELI5
An SSH Git operation could receive the same chunk twice and fail with “Out-of-order chunk.” A filesystem stream waiting for capacity could also make the relay spin when its output connection failed. This change retires each chunk's retry after acceptance or settlement, while preserving completion through the original write callback.
What Changed
Bulk admission and retry-listener bookkeeping now use the existing publication transaction. Capacity notifications wait until the retry listener has been installed or removed. A completion flag prevents stale retries and prevents a synchronously rejected write from rearming its listener.
The production change is confined to one transport method, with 12 net added lines. Four test files exercise real Writable backpressure, retirement during admission, teardown, and defensive retry contracts.
Why
Removing a listener after enqueue was insufficient: retiring queued terminal output can synchronously notify capacity before enqueue returns. The existing transaction covers that interval without introducing another queue, timer, polling loop, or protocol change. The completion flag also covers the real closed-writer/client-still-open teardown interval.
Linked Issue
No separate issue; internal reliability fix.
Visual Proof
N/A — relay chunk ordering and callback settlement have no rendered UI change. Real-stream regressions and failing old-code controls provide the behavior evidence.
Testing
Final published commit:
8583700fffb5be4e4e8c383c0089a6b35f538946.Independent exact-commit run: 2,231 relay tests passed, 7 skipped; 245 files passed, 2 skipped. Node typecheck passed.
9 focused tests passed across three suites. They cover callback-owned completion, sink errors/disposal, real writer teardown, eight valid filesystem frames in order, and defensive stale-callback/failed-admission contracts.
The retirement regression sweeps 121 positions and asserts that a capacity wake actually occurs inside admission with a retry armed. A changed schedule therefore cannot silently make the regression vacuous.
The teardown test uses a real Writable with one held native write. It observes the writer closing before the client, synchronous error settlement, and rejected admission. The original transport fails a bounded negative control; the fixed version rejects cleanly with no retained retry or lease.
Independent exhaustive sweeps on the unchanged production code covered every retirement position across normal/filesystem lanes, two frame sizes, and three queue layouts, plus 22 lifecycle probes. The original transport duplicated a chunk at the critical position; the fix did not.
The final test-only watchdog counts consecutive rejected admissions and resets on acceptance. Substituting its earlier implementation fails the new eight-valid-frame test.
Changed-file code-quality checks and normal commit hooks passed. The existing terminal output-backpressure gate's 20 deterministic command groups passed on the primary audit worktree; its native/Docker rows were not run in this review.
Executed on macOS/Node with
ORCA_BACKGROUND_LAUNCH=1; no visible app was launched. Physical Linux/Windows/ConPTY and live SSH latency were not exercised locally. Published-head CI covers the remaining automated checks.Exercised the real-stream scenarios locally
Automated tests added/updated
Review
Independent normal review approves the exact final commit as low risk, with no remaining concrete correctness caveat or negative user-facing tradeoff identified.
Claude Opus 5.5 independently approved the unchanged production fix and the strengthened regression tests. Its final harness-only followup could not start after an Orca runtime restart; that correction received independent normal review, the full exact-commit relay run, and both negative controls above.
The final correction addresses Opus's remaining watchdog maintainability nit. Synthetic callback and failed-admission tests are defensive contract coverage, not claims that those injected paths occur naturally. The retirement test remains calibrated to the harness but explicitly verifies that it hits the relevant wake.
Agent skill upstream boundary
Notes
Reliability class:
terminal-performance.output-backpressure-budget(existing experimental, partial gate). Invariant: a bulk frame is admitted once, completion belongs to its original sink callback, and failed admission retains its wake until settlement or closure. Failure source: duplicate SSH Git chunks and a real waiting-filesystem-stream teardown loop. Oracle: decoded frame order/count, completion timing, positive in-admission wake coverage, and zero retained retry/lease state after teardown. Diagnostics: focused test failures, full relay logs, and old-code negative controls identify the failing lifecycle boundary.No new polling, queue limits, protocol fields, host-status rules, dependencies, or platform-specific behavior. Existing peers remain compatible. Relay/SSH consumers are covered through dispatcher contracts; folder workspaces and mobile use the same unchanged wire format.
Pre-existing teardown notification cost and exceptional throwing-admission cleanup are outside this change. Neither is a new user-facing tradeoff introduced here. The final pre-merge audit independently reran all nine focused tests and confirmed clean integration with current main. Recommendation: merge, low risk; no new user-facing tradeoff identified.
Checklist