fix(sidebar): isolate output by cmux instance#327
Conversation
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_b7565f8d-cef1-431d-b051-bdd4f523e32d) |
📝 WalkthroughWalkthroughFleet sidebar output and collapse-state paths now derive from CMUX socket or bundle identity, isolating Stable, Nightly, development, and similarly named instances. Explicit output overrides remain supported, publisher wiring uses canonical paths, and tests cover path derivation and cross-instance publishing. ChangesFleet sidebar instance isolation
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
|
@codex review |
|
@coderabbitai review |
|
@greptileai review |
|
You need to increase your spend limit or enable usage-based billing to run background agents. Go to Cursor |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3961432637
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const productionStateSocket = | ||
| dirname(upstreamSocket) === join(home, ".local", "state", "cmux") && | ||
| /^cmux-\d+\.sock$/i.test(socketName); |
There was a problem hiding this comment.
Treat legacy state cmux.sock as production
When stable cmux is pinned to the legacy state socket $HOME/.local/state/cmux/cmux.sock, this predicate does not classify it as production because it only accepts cmux-<uid>.sock; however cmuxSocketPathCandidates() still includes join(stateDir, "cmux.sock") as a production candidate. In that environment defaultFleetSidebarPath() hashes the stable socket into ~/.config/cmux-instance-.../sidebars/fleet.swift, so the stable publisher stops updating the canonical ~/.config/cmux/sidebars/fleet.swift that the change is intended to preserve.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_701a090a-7290-4eee-b15d-f27bf552d58a) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f94fa8dea7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (upstreamSocket === "/tmp/cmux-nightly.sock") return "nightly"; | ||
| if (upstreamSocket === "/tmp/cmux-dev.sock") return "dev"; | ||
| const socketStem = socketName | ||
| .replace(/\.sock$/i, "") | ||
| .replace(/^cmux(?:[-_.]+)?/i, ""); | ||
| return hashedFleetSidebarInstanceKey( |
There was a problem hiding this comment.
Keep daemon axis aligned for non-nightly instances
This adds isolated sidebar paths for /tmp/cmux-dev.sock and arbitrary named sockets, but in the normal daemon-first path I checked runDaemonFirstEntry still connects to defaultDaemonSocketPath(env), and src/daemon-socket-path.ts only creates a separate daemon socket for Nightly. If a stable daemon is already running and a dev/custom-socket cmuxlayer starts, it proxies to the existing stable daemon, so the FleetSidebarPublisher was constructed with the stable daemon's environment and continues writing the canonical Stable sidebar instead of this derived instance path. The sidebar and daemon instance axes need to match for these new non-nightly instance keys.
Useful? React with 👍 / 👎.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_489082d7-f5e4-4643-bc85-f6554a7d97d3) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0fae9f47bc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if ( | ||
| productionStateSocket || | ||
| productionTmpSocket || | ||
| productionApplicationSupportSocket | ||
| ) { |
There was a problem hiding this comment.
Treat last-socket-path stable pins as production
When CMUX_SOCKET_PATH is the stable socket recorded in ~/.local/state/cmux/last-socket-path (which cmuxSocketPathCandidates() treats as a production candidate before the uid/default paths), this guard only recognizes hardcoded state, /tmp, and legacy Application Support names. If the stable app exports an alias from last-socket-path, Stable is hashed into ~/.config/cmux-<hash>/sidebars/fleet.swift instead of continuing to update the canonical ~/.config/cmux/sidebars/fleet.swift; the last-socket-path target should be read/canonicalized here as production as well.
Useful? React with 👍 / 👎.
Summary
~/.config/cmux/sidebars/fleet.swiftoutput contractCMUX_SOCKET_PATHorCMUX_BUNDLE_IDCMUXLAYER_FLEET_SIDEBAR_OUTPUT_PATH, and hash non-canonical full identities so distinct sockets cannot collide after sanitizationTest plan
env -u CMUX_SOCKET_PATH -u CMUX_DAEMON_SOCKET bun run test— 104 files / 2,159 tests passedenv -u CMUX_SOCKET_PATH -u CMUX_DAEMON_SOCKET bun run typecheck— passedenv -u CMUX_SOCKET_PATH -u CMUX_DAEMON_SOCKET bun run build— passedscripts/run_tests.sh— exit 0Review disposition
Status: CodeRabbit local review SKIPPED — timed out after the bounded three-minute window while still reviewing; stopped with exit 130.
~/.local/state/cmux/cmux.sockwas treated as a named instance — FIXED inf94fa8dwith a RED/GREEN regression teststable,prod,production) were hashed instead of preserving the legacy path — FIXED in0fae9f4with a RED/GREEN regression testScope
MCP-side path-keying enabler only. No app-side Nightly activation, render changes, or single-writer-authority changes.
Note
Isolate Fleet sidebar output and collapse state paths by cmux instance
fleetSidebarInstanceKeyto derive a per-instance key fromCMUX_SOCKET_PATHorCMUX_BUNDLE_ID, returningnullfor stable/production and canonical or hashed keys for Nightly, Dev, and other instances.defaultFleetSidebarPathanddefaultFleetSidebarCollapseStatePathto write under~/.config/cmux-<instance>/and~/.local/state/cmuxlayer/<instance>/for non-stable instances; stable remains at the legacy paths.CMUXLAYER_FLEET_SIDEBAR_OUTPUT_PATHoverrides both paths; the collapse state is colocated as<override>.collapse.json.FleetSidebarPublishernow derives its output and collapse paths via the updated helpers instead of reading env vars directly.Macroscope summarized 0fae9f4.