Repository navigation
CmuxNext: status set waits for a new terminal to join its workspace (cx-odyw4) - #20750
Merged
Merged
Conversation
A new terminal's shell can run cmux status set before the daemon commits its tab; the set must still land and exit 0. A caller terminal the session never shows must exit non-zero with a clear message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…yw4) A new tab's shell starts before the daemon commits the tab, so a cmux status set at its first prompt looked up a terminal the daemon did not show yet and failed with: no terminal matches "term_...". The caller lookup now follows the session's event stream on a second connection and looks again after each event, for up to 3 s. A terminal that never joins fails non-zero with a message naming it and how to target a workspace instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
teamleaderleo
temporarily deployed
to
cmux-tui-merge-tree
October 14, 2026 22:17 — with
GitHub Actions
Inactive
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
Review: an unknown --machine also fails with selector.not_found; report it as it is instead of waiting 3 s and blaming the terminal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
teamleaderleo
temporarily deployed
to
cmux-tui-merge-tree
October 14, 2026 22:20 — with
GitHub Actions
Inactive
teamleaderleo
temporarily deployed
to
artifacts
October 14, 2026 23:15 — with
GitHub Actions
Inactive
teamleaderleo
temporarily deployed
to
artifacts
October 14, 2026 23:18 — with
GitHub Actions
Inactive
teamleaderleo
temporarily deployed
to
cmux-tui-merge-tree
October 14, 2026 23:38 — with
GitHub Actions
Inactive
teamleaderleo
temporarily deployed
to
artifacts
October 15, 2026 00:02 — with
GitHub Actions
Inactive
teamleaderleo
temporarily deployed
to
artifacts
October 15, 2026 00:05 — with
GitHub Actions
Inactive
teamleaderleo
temporarily deployed
to
cmux-tui-merge-tree
October 15, 2026 00:50 — with
GitHub Actions
Inactive
teamleaderleo
temporarily deployed
to
artifacts
October 15, 2026 01:13 — with
GitHub Actions
Inactive
teamleaderleo
temporarily deployed
to
artifacts
October 15, 2026 01:16 — with
GitHub Actions
Inactive
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bead cx-odyw4.
cmux status setrun the moment a new tab's shell starts could fail withno terminal matches "term_...", so the status never showed (seen while seeding #20637's captures).Cause
activate_hosted_launch_stream), not the shell itself.status setwith no workspace finds the caller's workspace fromCMUX_TUI_TERMINAL_ID: terminal, tab, pane, screen (cli/resolve.rs). Before the commit the daemon shows no such terminal, so the first lookup failed at once.Failure::Resource). I found no path incmux status setthat turns it into 0. The one designed exit 0 iscmux status run, which runs its command even when it cannot mark the status busy and exits with the command's status. The seed's 0 most likely came from how the seed ran the command. The new test pins exit 1.Fix
When the caller's terminal is missing, the CLI opens
session.eventson a second connection to the same socket and looks again after each event. The wait ends when the terminal is in a workspace, or after 3 s.The stream starts with a snapshot, so a commit between the first look and the subscription still wakes the wait. Each event is buffered on its own connection, so no wake is lost while a lookup runs.
A terminal that never joins exits 1 with
selector.not_found: "the caller's terminal term_... did not join a workspace of this cmux session within 3s; name one: cmux workspace …".No daemon or protocol change;
session.eventsis an existing read. No new CLI case, so the case coverage and relay policy are untouched.Only a miss of the caller's own terminal waits. Any other miss, such as an unknown
--machine, is reported at once as it is.Cost: a stale
CMUX_TUI_TERMINAL_ID, such as a closed terminal's, now fails after 3 s rather than at once. Only the caller-workspace lookup waits.status set --target ws_...from a brand-new terminal can still be refused with "owner.terminal ... is not a terminal of this session"; that path is not covered here.Tests
tests/cli/status.rs, through the CLI and a real headless daemon:status_set_from_a_terminal_at_its_first_command_reaches_its_workspace: fiveworkspace runterminals each runcmux status setas their first command. Each must exit 0, and its entry must be in the workspace.status_set_from_an_unknown_terminal_exits_non_zero_after_a_bounded_wait: a caller terminal the session never shows exits non-zero within 15 s, withselector.not_foundand a message naming the terminal andcmux workspace <workspace>.Receipts
Red, tests on base code (
fdf692516ab8, branchop-next-icons/status-set-race-red: the PR's tests, formatted, with no fix; hosted run 38648294325):status set in new terminal term_9550… failed: {"code":"selector.not_found",…,"message":"no terminal matches \"term_9550…\""}, exit1. The unknown-terminal test fails on the message: nocmux workspace <workspace>hint.7ebc98dfe82f, run 38646000057) never reached the tests: rustfmt failed on that commit, and the macOS lane was refused by a host lock.Green and Windows on the head (
e32be89cd9e3, this branch merged with feat-cmux-next38c5c3c7f0a9; full hosted run 38655302576):test (linux): both new testsok. The job fails later insmoke-tui.pyline 953, a workspace-order assertion. That is a base red: the same assertion fails in another branch's full run (38650424161).macOS lint and tests: success.test (windows): success, andrelease-path dogfood artifacts / build x86_64-pc-windows-gnu: success. Both covercmux-tui-coreandcmux-tui. The earlier full run (38651591314, before the base merge) failed these two oncrate::app_identityincli/wire/socket.rs, which this PR does not touch; base has fixed that since.Merge state: held.
cmux-next checksis red on two base reds this PR does not touch: literal state root inchief_brains.rsand a concurrency violation inIdleOwnerRestart.swift. #20767 fixes both.cmux-next fast tierwas cancelled.Other checks: crash ratchet ok; Opus review found no blocking issues. Its one low finding is fixed in this PR: an unrelated
selector.not_foundno longer waits.Changelog
cmux status setrun as a new tab's first command now waits for the tab to be ready and sets the status, instead of failing with "no terminal matches".🤖 Generated with Claude Code