Repository navigation
cmux-tui: status indicators (loading fields, owned auto-clear, terminal busy, cmux status) - #16819
lawrencecchen wants to merge 4 commits into
Conversation
…ear; terminal busy facts
Loading indicators (plans/cmux-next/status-indicators.md section 5):
- workspace_status.set takes optional state (busy|success|error|waiting|info),
progress, style, ttl_ms, owner {pid, terminal, agent_session},
target_terminal, exit_code, duration_ms, stored in the additive table
workspace_status_meta (state::status_meta); old callers stay plain lines.
- The daemon removes an owned entry in its own commit when the TTL passes
(one expiry thread sleeping until the earliest deadline), the owner
terminal exits (session host exit subscription) or the owner process exits
(kqueue NOTE_EXIT / pidfd); watches resume at daemon start
(state::status_owners). A process owner must be running, is accepted only
from a trusted local connection (server) and is scoped to the machine id.
- terminal-activity-v1: terminal records carry extra.busy {since_ms} while a
shell command runs between OSC 133 C and D; a new prompt clears stale OSC
9;4 progress; an exited terminal publishes neither (terminal_activity).
- advertised_capabilities moved to server/capabilities.rs.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ce status set - workspace status set takes --state, --progress (0.4 or 40%), --style, --ttl (30s, 5m, 1500ms), --pid, --owner terminal|none, --target-terminal, --exit-code, --duration-ms (cli/command/state/status_flags.rs). Inside a cmux terminal the entry is owned by and about that terminal unless --owner none. - cmux status set [KEY] --label T | clear [KEY] [--all] | list | run -- CMD (cli/status.rs): KEY defaults to cli:<terminal>; run marks the entry busy and owned by its own pid, runs CMD with the terminal's stdio, ignores SIGINT/SIGQUIT itself, forwards SIGTERM/SIGHUP, then records success or error with exit code and duration for --badge-ttl (default 8s) and exits with CMD's status (128 + signal). The app decides about notifications. - Parity: the transport coverage test exercises every new catalog field; binding descriptors carry the new catalog sha. - run_coderouter moved into cli/coderouter.rs (run_args); godfile baseline lowered for server.rs and cli.rs. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…signals, routing) From the review subagent: - A process owner is recorded with its kernel start time (unix_process_scope::process_identity) and checked at resume, so a reused pid never stands in for the owner; process_is_running needs kill(pid,0) to succeed (no EPERM processes we cannot watch). - A watch that cannot be armed or fails (kqueue EV_ERROR via EV_RECEIPT, pidfd ENOSYS, unsupported platform) keeps the entry instead of clearing it; terminal watches retry transient registry errors with backoff and clear only when the session host no longer knows the terminal. Process watches hold a Weak<Mux>. - The expiry thread backs off after a failed commit instead of spinning on a past deadline. - The owner-process check runs inside the commit, after the replay check: a retry of a committed set returns its stored result. A plain set keeps its old request fingerprint (meta skipped when plain). - Activity facts are hidden only for exited and tombstoned terminals. - Catalog: ttl_ms maximum 604800000. - CLI: a plain status line from inside a terminal stays plain (no caller terminal); a set routed with --socket/--session drops the caller terminal; status run keys each write, forwards SIGINT/SIGQUIT only when another process sent them (si_pid) and SIGTERM/SIGHUP always, installs handlers before spawn, re-raises the child's terminating signal after the final write, clamps durations to uint32; status run rejects set flags with a clear message. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…at-cmux-next-acpmux Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
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 |
|
Found 3 test failures on Blacksmith runners: Failures
|
|
|
CI failure attributionCI failed on
Matched log linesNot re-run automatically: Written by |
Status indicators, daemon and CLI side (plans/cmux-next/status-indicators.md section 5; spec decisions U5-U9). The app only renders; these are the facts it renders.
What changes
workspace_status.settakes optionalstate(busy|success|error|waiting|info),progress,style,ttl_ms,owner {pid, terminal, agent_session},target_terminal,exit_code,duration_ms. Stored in the additive tableworkspace_status_meta(state/status_meta.rs). Callers that send only text, icon and color are unchanged, and their request fingerprint is the same as before.The daemon removes an owned entry in its own commit (
workspace_status.auto_clear, astate_upsertof the workspace status) when:NOTE_EXITor pidfd.A process owner must be running, is accepted only from a trusted local connection (
server.rs), and is recorded with the machine id and the kernel start time, so a reused pid never stands in for it. Watches resume at daemon start (state/status_owners.rs).terminal-activity-v1: terminal records carryextra.busy {since_ms}while a shell command runs between OSC 133 C and D. A new prompt clears stale OSC 9;4 progress. An exited terminal publishes neither (terminal_activity.rs). The client applies the "show after N s" setting.CLI (
cli/status.rs,cli/command/state/status_flags.rs):workspace status settakes--state,--progress 0.4|40%,--style,--ttl 30s,--pid,--owner terminal|none,--target-terminal,--exit-codeand--duration-ms.cmux status set [KEY] --label T | clear [KEY] [--all] | list | run [--label] [--badge-ttl 8s] -- CMD.runmarks the entry busy, owned by its own pid, and runs CMD with the terminal's stdio. It forwards signals that another process sent, then records success or error with the exit code and duration. It exits with CMD's status, and re-raises CMD's terminating signal so a shell loop around it stops too.Catalog fields and binding descriptors are updated. The transport coverage test exercises every new field.
The owner's three changes from #16174 are applied:
Not in this PR
cmux status wait KEY, andcmux terminal <term> wait --until idle|prompt. Both need a new connection-owned wait op.exitandoutputalready exist asterminal <t> process waitandterminal <t> screen wait --pattern.busyis not restored after a daemon restart: it shows idle until the next OSC 133 mark.Verification (Blacksmith Testbox, Linux)
cargo test --lockedfor the whole workspace: all pass exceptsession_shutdown_exits_an_interactive_detached_owner_client. That test flakes on the base commit too (1 of 6 failed there).cargo clippy -p cmux-tui-core -p cmux-tui --all-targets -D warningsis clean.cargo fmt --checkis clean for this diff. The remaining diffs are incmux-tasksfrom the base branch.cmux status run --label Tests --badge-ttl 2s -- sh -c 'sleep 2; exit 3'shows busy with a pid owner while it runs, then error with exit code 3 and duration 2001 ms. The CLI exits 3, and the entry is gone after 2 s.printf '\e]9;4;1;40\a\e]133;C\a'in a terminal showsextra {busy: {since_ms}, progress: {state: normal, value: 40}}.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Adds loading-indicator metadata to workspace status entries with daemon-side auto-clear, plus a
cmux statusCLI and terminal busy facts from OSC 133 marks. Entries written by older clients (text/icon/color only) are unaffected, and the new data is stored in an additive table that older binaries ignore.Status entries and auto-clear
workspace_status.setaccepts optionalstate,progress,style,ttl_ms,owner(pid, terminal, agent session),target_terminal,exit_code, andduration_ms, persisted in a newworkspace_status_metatable.CLI and terminal facts
cmux status set | clear | list | run:runmarks the entry busy and owned by its own pid, runs the command with the terminal's stdio, records success or error with exit code and duration, propagates the child's exit status and signals, and keeps the entry for a configurable badge TTL (default 8s).workspace status setgains matching flags (--state,--progress,--style,--ttl,--pid,--owner,--target-terminal,--exit-code,--duration-ms).extra.busy {since_ms}between OSC 133 C and D; exited terminals publish neither busy nor progress. A new prompt clears stale OSC 9;4 progress.Written for commit 896d36f. Summary will update on new commits.