Repository navigation
Lay Sonny's work out in cmux - #300
Conversation
Sonny run in a cmux tab now makes the project's cmux workspace its home, as it does a Herdr workspace or a Rex session: each task the lead starts gets a tab in the lead's pane running Sonny on it, titled with the bot's name; run_in_pane and show_agent open tabs and splits there; another project's lead gets a workspace of its own. Every call goes through `cmux rpc` (system.tree, workspace.create, surface.create, surface.split, surface.close, tab.action), and the workspace is kept in ~/.agent/sonny/places so the lookout's calls land in it. cmux already reads the OSC 7501 status and OSC 777 notifications Sonny writes, so its sidebar shows each task's state and rings the tab that needs the person. Each Sonny also gives its tab a resume command (`cmux surface resume set`, `Sonny: NAME`), so cmux reopens it after a relaunch once the person allows `sonny` commands; quitting clears it. Agents get a cmux-tabs skill like herdr-panes, and the daemon keeps a cmux tab's own place variables (CMUX_WORKSPACE_ID, CMUX_SURFACE_ID, CMUX_TAB_ID, CMUX_PANEL_ID) out of its tools' shells, as it does Herdr's. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGFMvxuKK3qzEb4j48d
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
Security findingsAdvisory findings (1)ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec13489a70
ℹ️ 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".
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGFMvxuKK3qzEb4j48d
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: 7e88081038
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
| "CMUX_WORKSPACE_ID", | ||
| "CMUX_SURFACE_ID", | ||
| "CMUX_TAB_ID", | ||
| "CMUX_PANEL_ID", |
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Security: Strip cmux connection capabilities from bot shells
When Sonny runs inside cmux and a task has an ungated shell (/approvals full, or the shell call is approved), this filter removes only surface/location IDs; the task still inherits the cmux socket/capability and the installed skill supplies the CLI path. Because tasks have network-enabled workspace-write, hostile repository/model input can call cmux rpc surface.create with initial_input (or send to a shell tab), executing as the user outside the sandbox and reading other tabs. Strip cmux connection credentials from bot environments and broker scoped read/send/create operations through Sonny's gated tool.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The path is real: a daemon started inside cmux passes the socket capability on to bot shells. Herdr already works the same way, though. The herdr-panes skill has agents drive Herdr from their shell, and the cmux-tabs skill depends on this on purpose for read, send and close. Fixing it means brokering those calls through Sonny's gated tools for both multiplexers, which is bigger than this PR, so it's logged in #304. I'm leaving this thread open for the owner to decide.
Generated by Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGFMvxuKK3qzEb4j48d
What
Sonny run in a cmux tab now treats cmux the way it treats Herdr and Rex: the project gets one cmux workspace (the one Sonny was opened in, else the lead's, else one titled with the project, made when needed).
run_in_paneandshow_agentopen tabs and splits there; another project's lead gets a workspace of its own.cmux surface resume set, shown asSonny: NAME), so cmux reopens it on the same bot once you allowsonnycommands from the tab's Resume Commands menu. Until you do, cmux offers it to run by hand. Quitting Sonny clears it.cmux-tabsskill (likeherdr-panes) covers reading, waiting on, typing into and closing tabs with thecmuxCLI.CMUX_WORKSPACE_ID,CMUX_SURFACE_ID,CMUX_TAB_ID,CMUX_PANEL_ID), just as with Herdr's and Rex's. The socket path and capability stay.How
sonny/src/cmux.rsis a newmux::Backend. Every call goes throughcmux rpcwith v2 socket methods:system.tree,workspace.create,surface.create,surface.split,surface.close(withforce),tab.actionrename, andpane.list. I checked the method names, parameters and reply shapes against cmux's source (manaflow-ai/cmux at ab900c3, 0.65.x). A custom tab title stays above the title a program sets, so the bot's name is a stable label. The workspace is kept in~/.agent/sonny/places, so the lookout's calls land there. Inside a cmux tab, Herdr still wins when Sonny runs in a Herdr pane, because Herdr is the innermost multiplexer.One cmux constraint: by default its socket lets only processes started in cmux tabs connect. A lookout that Sonny started inside cmux qualifies, because it inherits the tab's socket capability, even after it is reparented. A lookout started elsewhere needs Settings > Automation set to allow local automation. In that case cmux's own error says so, and the README covers it.
Tests
cmux. They cover:muxplace round-trip test now covers cmux.tests/test_approvals.py::test_the_daemons_own_terminal_never_reaches_a_toolnow covers the cmux variables and passes against a release build.cargo fmt --checkandcargo clippy --workspace --all-targets -D warningsare clean. All 320cargo test -p sonnyunit tests pass. Three SandFS tests insonny/tests/task.rsfail in this container onmainas well, so they are unrelated to this change.