cmux NEXT: Subagent Limit… on a chat, and a Running Sub-sessions setting
Leo: "I want cmux next to be able to increase or decrease subagent amounts ad hoc, with the acpmux daemon and all that. Slide it, even per workspace. Right-click, edit subagent count."
Right-click a chat and pick Subagent Limit… to change how many sub-sessions (chats an agent started) it runs at once. The global default is a new row in Settings > Agents > Sub-sessions.
- Chat: on the chat's tab and its sidebar row, under More > Options > Subagent Limit…. It doesn't appear on non-chat tabs or on another Mac's chats.
- Palette: Chat Subagent Limit…. There's no shortcut and no CLI verb, because
acpmux session limitsalready covers the shell. - Workspace: left out of this PR. Until #24306 lands, chats started in the app carry no workspace id, so a workspace limit would not reach them. A small follow-up adds the workspace row's Subagent Limit… after #24306 lands.
The dialog is a CmuxDialogSpec with a field that takes 1 to 1000, and Cancel, Use Default and Set buttons.
- It reads the current value first. The field shows the chat's own value (empty when it has none), and the placeholder shows the value in effect. It also shows how many sub-sessions are running and how many are waiting.
- Set sends
_acpmux/subsession/limits {sessionId, maxRunning: n}. Use Default, or Set with an empty field, sendsmaxRunning: null. - Each request goes over a short connection proven as the person (
AcpmuxPersonLine).
If the read gets no answer (no acpmux, a connection that failed the person proof, or a refusal), the dialog says the limit could not be read. If acpmux answers without maxRunning, it says "This version of acpmux has no subagent limit."
Setting: agents.subsessions.maxRunning, titled "Running Sub-sessions per Session".
- Default 16, range 1 to 1000,
.userOnlyin the agent policy. - Parsed into
SubsessionSettings.maxRunning, with strings in all 21 locales. - acpmux (#23963, landed) embeds
schemas/settings/source/subsessions.jsonand reads its default and range from this row.
Generated files: SettingsSchema+Subsessions.generated.swift comes from gen-settings-sources.py. The exports (settings-schema.json, docs/mdm/*, schemas/defaults/cmux-next.json, plans/cmux-next/actions.md, action-surfaces.json) are the PR autofix's pr-autofix-patch from run 39840725847, applied unchanged. The settings source stamp is no longer committed (gitignored since #23915; defaults_guard.py source-stamp derives it). After the latest base merge, the action exports (actions.md, action-surfaces.json, schemas/defaults/cmux-next.json) are CI's cmux-next-generated-patch at that head, applied unchanged.
Observed / Not run
cmux-ci compile-check --apppassed at a16171a0d2 (fleet, 88 s). The compile at the current head is in the review receipt.- Added
SubagentLimitTests, which cover the params, the reply parsing, the dialog spec, answer validation, and the read-then-set flow against a fake person line. They run in PR CI. - These CI reds are not from this PR; each also fails on base or in files this PR doesn't touch:
- namespace-type conventions (
CloudDiagnosticsReport,AppsPageNativeOps,ChiefReplyWatchdog) - crash-class selectors (
HoverCardIconSlot,HoverCardRow) - checks job structure (
web-bundlessubmodule reset, Swift canary coverage) - release rails (web migrations)
- release-notary, Guard status
- same-tree cmux-tui
- namespace-type conventions (
- The defaults-snapshot red and the fast gates' defaults stamp red were this PR's, from stale exports. The regenerated exports fix them.
No capture: the dialog opens only against a live acpmux on a Mac, and CI minis never show the window.
Changelog
- Added: Subagent Limit… on a chat's right-click menu, and a Running Sub-sessions per Session setting, to change how many subagents run at once.
Agent session: cosmic-gray
🤖 Generated with Claude Code