Repository navigation
fix(next): the remote-localhost proxy's trust scan runs one at a time off the cooperative pool - #32423
Conversation
… off the cooperative pool Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-1d26303068661ea54f28
|
cmux status (one comment, edited in place; each line is updated by the job that owns it) Review App of this head (app.zip, kept 1 day)
Shipped in:
The feat-cmux-next push run https://github.com/manaflow-ai/cmux/actions/runs/41497919334 at f6b340f failed: cmux-next crash ends the app, cmux-next daemon tests. |
|
Review (codex gpt-6-astra high, router-review): BLOCK at d82809e BLOCK at d82809e Visual verdict: no images; Leo tries the build
|
…the scan test builds Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-1d26303068661ea54f28
|
Review (codex gpt-6.1-sol high, sweep, via the review router; full diff from merge base d94d657 to this head): BLOCK at d82809e [P2] [blocking] Packages/macOS/CmuxNext/Sources/CmuxNextRemoteLocalhost/PeerProcess.swift:45 - Every machine-listener request queues an uncancellable process scan on one global serial queue; because |
|
Review (codex, router-review): SHIP at f5169b8 Reviewer: codex gpt-6-astra high, fast tier. Follow-ups: 1. Each lands as an issue in this repo that links this receipt; the lane that opened the PR fixes it forward. SHIP at f5169b8 Visual verdict: unchanged by this diff
Follow-ups:
|
… stalled-scan tests wait for the stall Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-1d26303068661ea54f28
|
Review (codex gpt-6.1-sol xhigh, next-review): BLOCK at e8fa32a BLOCK at e8fa32a Visual verdict: no images; Leo tries the build
Follow-ups: 2. Bound the pending scan queue to prevent unbounded memory growth during a stalled or overloaded scan. |
…und the scans pending behind a stall Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-1d26303068661ea54f28
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-1d26303068661ea54f28
|
Review (codex gpt-6.1-sol xhigh, router-review): BLOCK at fe6989f BLOCK at fe6989f Visual verdict: no images; Leo tries the build
|
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-1d26303068661ea54f28
|
Swift logic follow-up (tip watcher swift-logic row, STATUS 13027 "SWIFT LOGIC CULPRITS"; lead order). This PR raised
plans/cmux-next/layer-ownership.md says Rust owns every state, list and rule and Swift is the platform shell. Please move the new logic of this PR in a follow-up: to Rust (the crate that owns the area; the owner lists in STATUS 12147-12165 name the target per area), or at least out of the app into its package. If a declaration above is platform code (AppKit, Core Animation, OS calls, strings, tokens, DEBUG tooling), reply here and the table gets a PLATFORM row with your reason instead. The swift-logic row is a report, not a gate: nothing blocks on this comment. |
What
The remote-localhost proxy decides whether a connection on a machine's listener comes from this app or one of its Chromium helpers by scanning the process table:
proc_pidinfo(PROC_PIDLISTFDS)plus oneproc_pidfdinfoper socket of the app and of every child. That scan ran as plain blocking code inside the connection's task, once per connection, with up to 256 connections allowed. A busy app with thousands of fds, plus a local process opening connections to the listener port, could hold cooperative-pool threads in those calls and stall unrelated async work.PeerScan(owned by the proxy) now runs the scan on its own serial queue: one scan at a time, none on the cooperative pool. At most 32 scans are queued or running; past that a caller is untrusted at once. The queue's label is listed inplans/cmux-next/threading-model.mdwith an owner row. The connection awaits it. The trust decision and its order against the credential check are unchanged.Tests
PeerProcessScanTests(6 tests): scans never overlap (peak 1 across 32 callers), a canary task on the cooperative pool finishes while 64 scans are pending, a stalled scan does not hold the callers behind it (they answer false at the timeout and their scans are skipped), a cancelled caller answers at once and its scan is skipped, callers past the pending limit answer at once, and a peer that is not this process is not trusted.No capture: no visible change; the check's result is the same.
Risk
Small, in
CmuxNextRemoteLocalhost. A connection's trust check can now wait behind earlier scans (each a few milliseconds). The wait is bounded at 2 s and cancellation-aware: a timed-out or cancelled caller answers "not trusted" at once and its queued scan is skipped, so a stalled scan cannot hold connection slots. The 10 s head deadline stays armed through the wait. No new timer or observer: the queue is a single static serial queue with no loop.🤖 Generated with Claude Code
Agent session: agent session
Need help on this PR? Tag
@codesmith-botwith what you need.Summary by cubic
Fixes the remote-localhost proxy's trust scan so it no longer runs on the cooperative pool, where a flood of local connections could stall unrelated async work.
PeerScaninstance.PeerProcessScanTestscovering non-overlapping scans, cooperative-pool liveness, stalled-scan timeouts, cancellations, the pending limit, and untrusted peers.Written for commit f8f62a7. Summary will update on new commits.