Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions Resources/shell-integration/cmux-bash-integration.bash
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,7 @@ _cmux_report_tty_once() {
payload="$(_cmux_report_tty_payload)"
[[ -n "$payload" ]] || return 0
_CMUX_TTY_REPORTED=1
{
_cmux_send "$payload"
} >/dev/null 2>&1 & disown
( _cmux_send "$payload" >/dev/null 2>&1 & )
else
[[ -n "$_CMUX_TTY_NAME" ]] || return 0
# Keep the first relay TTY report synchronous so the server can resolve
Expand All @@ -400,9 +398,7 @@ _cmux_report_shell_activity_state() {
[[ -n "$CMUX_PANEL_ID" ]] || return 0
[[ "$_CMUX_SHELL_ACTIVITY_LAST" == "$state" ]] && return 0
_CMUX_SHELL_ACTIVITY_LAST="$state"
{
_cmux_send "report_shell_state $state --tab=$CMUX_TAB_ID --panel=$CMUX_PANEL_ID"
} >/dev/null 2>&1 & disown
( _cmux_send "report_shell_state $state --tab=$CMUX_TAB_ID --panel=$CMUX_PANEL_ID" >/dev/null 2>&1 & )
}

_cmux_ports_kick() {
Expand All @@ -416,9 +412,7 @@ _cmux_ports_kick() {
fi
_CMUX_PORTS_LAST_RUN="$(_cmux_now)"
if _cmux_socket_is_unix; then
{
_cmux_send "ports_kick --tab=$CMUX_TAB_ID --panel=$CMUX_PANEL_ID --reason=$reason"
} >/dev/null 2>&1 & disown
( _cmux_send "ports_kick --tab=$CMUX_TAB_ID --panel=$CMUX_PANEL_ID --reason=$reason" >/dev/null 2>&1 & )
else
_cmux_ports_kick_via_relay "$reason"
fi
Expand Down Expand Up @@ -1004,10 +998,10 @@ _cmux_prompt_command() {
# CWD: keep the app in sync with the actual shell directory.
if [[ "$pwd" != "$_CMUX_PWD_LAST_PWD" ]]; then
_CMUX_PWD_LAST_PWD="$pwd"
{
(
local qpwd="${pwd//\"/\\\"}"
_cmux_send "report_pwd \"${qpwd}\" --tab=$CMUX_TAB_ID --panel=$CMUX_PANEL_ID"
} >/dev/null 2>&1 & disown
_cmux_send "report_pwd \"${qpwd}\" --tab=$CMUX_TAB_ID --panel=$CMUX_PANEL_ID" >/dev/null 2>&1 &
)
Comment on lines +1001 to +1004

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

file="Resources/shell-integration/cmux-bash-integration.bash"

# Expectation:
# - Lines 383, 401, 415, and 1001-1004 show the new subshell pattern.
# - Lines 511-513 still show the old brace-group + disown pattern.

printf 'Changed async send sites:\n'
nl -ba "$file" | sed -n '372,418p'

printf '\nRemaining brace-group + disown send site:\n'
nl -ba "$file" | sed -n '500,516p'

Repository: manaflow-ai/cmux

Length of output: 1781


🏁 Script executed:

# Fallback: attempt to list the repository details to understand availability
git ls-remote https://github.com/manaflow-ai/cmux.git HEAD

Repository: manaflow-ai/cmux

Length of output: 105


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file="Resources/shell-integration/cmux-bash-integration.bash"

printf 'Changed async send sites (expecting new subshell pattern):\n'
printf '\nLines 383:\n'
sed -n '380,386p' "$file" | cat -n

printf '\nLines 401:\n'
sed -n '398,404p' "$file" | cat -n

printf '\nLines 415:\n'
sed -n '412,418p' "$file" | cat -n

printf '\nLines 1001-1004:\n'
sed -n '999,1006p' "$file" | cat -n

printf '\n\nRemaining brace-group + disown send site (should be at 511-513):\n'
sed -n '508,516p' "$file" | cat -n

Repository: manaflow-ai/cmux

Length of output: 1843


Convert remaining _cmux_emit_pr_command_hint() sender to subshell pattern to complete the fix.

This PR converts several async-send sites to the safer subshell form ( _cmux_send ... >/dev/null 2>&1 & ), but lines 511–513 in _cmux_emit_pr_command_hint() still use { _cmux_send ...; } >/dev/null 2>&1 & disown. Since _cmux_prompt_command() invokes this helper after successful gh pr ... commands, the bash job-control [n] Done ... notification leak persists. Apply the same conversion pattern to lines 511–513 to complete the fix.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Resources/shell-integration/cmux-bash-integration.bash` around lines 1001 -
1004, In _cmux_emit_pr_command_hint(), replace the current async send block that
uses the braces/disown pattern (the `{ _cmux_send ...; } >/dev/null 2>&1 &
disown` code) with the subshell background pattern used elsewhere: wrap the
_cmux_send invocation in a subshell like `( _cmux_send ... >/dev/null 2>&1 & )`
so it is spawned in the background without causing bash job-control “[n] Done …”
notifications; ensure you preserve the same arguments (e.g. the `report_...`
string and `--tab=$CMUX_TAB_ID --panel=$CMUX_PANEL_ID`) and quoting behavior
used in _cmux_emit_pr_command_hint().

fi

# Branch can change via aliases/tools while an older probe is still in flight.
Expand Down