Skip to content

Lay Sonny's work out in cmux - #300

Merged
lydakis merged 2 commits into
mainfrom
claude/project-thread-tacqoq
Oct 29, 2026
Merged

lydakis merged 2 commits into
mainfrom
claude/project-thread-tacqoq

Conversation

@lydakis

@lydakis lydakis commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

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).

  • Tasks: each task the lead starts gets a tab in the lead's pane running Sonny on it, titled with the bot's name, without taking focus. run_in_pane and show_agent open tabs and splits there; another project's lead gets a workspace of its own.
  • Status and notifications: cmux already reads the OSC 7501 program status and OSC 777 notifications Sonny writes, so the workspace's sidebar row shows which task is working, waiting or done, and the tab that needs you rings. Nothing new was needed for that.
  • Resume after a relaunch: each Sonny gives its tab a resume command (cmux surface resume set, shown as Sonny: NAME), so cmux reopens it on the same bot once you allow sonny commands from the tab's Resume Commands menu. Until you do, cmux offers it to run by hand. Quitting Sonny clears it.
  • Agents: a new cmux-tabs skill (like herdr-panes) covers reading, waiting on, typing into and closing tabs with the cmux CLI.
  • Daemon: tools' shells no longer inherit the daemon's own cmux tab variables (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.rs is a new mux::Backend. Every call goes through cmux rpc with v2 socket methods: system.tree, workspace.create, surface.create, surface.split, surface.close (with force), tab.action rename, and pane.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

  • 7 new unit tests against a stand-in cmux. They cover:
    • which workspace is chosen
    • the moved-tab lookup
    • a new workspace that ends up holding only the lead
    • the kept workspace
    • tasks landing in the lead's pane
    • splits, including divider and cwd
    • closing with the owner
    • places and sides
    • the resume set/clear arguments
  • The mux place round-trip test now covers cmux.
  • tests/test_approvals.py::test_the_daemons_own_terminal_never_reaches_a_tool now covers the cmux variables and passes against a release build.
  • cargo fmt --check and cargo clippy --workspace --all-targets -D warnings are clean. All 320 cargo test -p sonny unit tests pass. Three SandFS tests in sonny/tests/task.rs fail in this container on main as well, so they are unrelated to this change.
  • Not yet done: a live check in cmux on a Mac, so there are no screenshots yet. That needs cmux installed on the test machine.

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
@lydakis lydakis self-assigned this Oct 28, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T23:40:31.704243Z 7e88081 New commits
🔒 Security Review ✅ Completed 2026-10-28T23:45:38.201592Z 7e88081 New commits

Security findings

Advisory findings (1)

ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread sonny/src/main.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ 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.

Comment thread src/tools.rs
Comment on lines +1787 to +1790
"CMUX_WORKSPACE_ID",
"CMUX_SURFACE_ID",
"CMUX_TAB_ID",
"CMUX_PANEL_ID",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants