Skip to content
Merged
Show file tree
Hide file tree
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
19 changes: 10 additions & 9 deletions docs/shell-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export CMUX_NO_GIT_WATCH=1
The shell applies it when the next cmux prompt hook runs. An already-running
command or child watcher has its previous environment until the shell regains
control; this is not an immediate process-wide stop. At that prompt, the
integration stops its tracked Git job and legacy PR loop, and zsh also stops its
integration stops its tracked Git job, and zsh also stops its legacy PR loop and
HEAD watcher. It does not discover or reap detached watchers from other sessions.

For new panes, add the same export to the startup file your interactive shell
Expand Down Expand Up @@ -56,9 +56,9 @@ Updates resume through the normal prompt/command hooks.
| --- | --- |
| Prompt-time HEAD inspection and branch refresh | Disabled in both shells, including after `cd`, a branch change, or a Git command. No new async branch-report job is started. |
| HEAD watching during a foreground command | Disabled in zsh. Bash has no equivalent active foreground HEAD loop in the current integration. |
| Legacy per-shell PR polling | Startup is blocked in both shells. Current prompt/command hooks already do **not** start this poller, even with the flag unset; retained helper definitions are not evidence of active polling. |
| Legacy per-shell PR polling | Bash no longer has this poller. In zsh, startup is blocked; current prompt/command hooks already do **not** start it, even with the flag unset, and retained helper definitions are not evidence of active polling. |
| Shell branch/PR badge messages | Suppresses `report_git_branch`, `clear_git_branch`, HEAD-change `clear_pr`, and prompt-time `report_pr_action` hints after successful `gh pr` commands. It does not send a one-time clear to hide existing badges. |
| Shell PR caches and force signals | Cleanup still runs at prompts: existing per-panel `/tmp/cmux-pr-cache-<panel>.*` cache files and the PR force signal are removed, and pending action hints are discarded. Bash also removes its action-hint file. This is local cleanup, not a GitHub refresh or invalidation of the app's cache. |
| Shell PR caches and force signals | zsh still cleans up at prompts: existing per-panel `/tmp/cmux-pr-cache-<panel>.*` cache files and the PR force signal are removed. Bash no longer writes these files and leaves any that an older integration wrote. Both shells discard pending action hints, and bash also removes its action-hint file. This is local cleanup, not a GitHub refresh or invalidation of the app's cache. |
| Git active-CWD marker | A fresh disabled shell does not create this temporary file. A marker created before enabling the flag may still be updated until shell-exit cleanup. |
| Other shell integration | CWD and TTY reporting, prompt/running activity messages, port-scan kicks, keyboard-protocol resets, terminal history, startup/PATH integration, and agent wrappers remain enabled. Commands such as `git` and `gh` still run normally. |
| App-owned metadata and watchers | Unchanged. The app can independently update branch/dirty/PR badges and poll GitHub; other panes and restored metadata can also supply badge state. |
Expand Down Expand Up @@ -92,16 +92,17 @@ python3 tests/test_shell_no_git_watch.py

It sources the shipped [zsh](../Resources/shell-integration/cmux-zsh-integration.zsh)
and [bash](../Resources/shell-integration/cmux-bash-integration.bash) integrations
in isolated shells, checks disabled reports and watcher startup, cache cleanup,
in isolated shells, checks disabled reports and watcher startup, zsh cache cleanup,
preserved messages, literal-value semantics, and re-enabling reports. It replaces
message delivery and the watcher process-creation boundary; it does not measure
production launch rates or exercise the app's metadata services.

This support contract complements the watcher repairs rather than implementing
them: [#15066](https://github.com/manaflow-ai/cmux/issues/15066) /
[#6032](https://github.com/manaflow-ai/cmux/pull/6032) cover zsh fork-free waits,
[#15067](https://github.com/manaflow-ai/cmux/issues/15067) covers bash churn and
app-level ownership, [#10926](https://github.com/manaflow-ai/cmux/issues/10926)
tracks orphan lifecycle problems, and
[#2924](https://github.com/manaflow-ai/cmux/pull/2924) removes dead per-shell PR
polling code. Those fixes are still needed; this mitigation does not replace them.
[#10926](https://github.com/manaflow-ai/cmux/issues/10926) tracked orphan lifecycle
problems, and [#2924](https://github.com/manaflow-ai/cmux/pull/2924) removes dead
per-shell PR polling code. [#15075](https://github.com/manaflow-ai/cmux/pull/15075)
already removed bash's PR poller for
[#15067](https://github.com/manaflow-ai/cmux/issues/15067). The open fixes are
still needed; this mitigation does not replace them.
19 changes: 12 additions & 7 deletions tests/test_shell_no_git_watch.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,15 @@ def test_disabled_prompt_command_and_head_change(self):
cd "$HOME"
_test_prompt
_cmux_report_git_branch_for_path "$PWD"
for file in "$CMUX_TEST_CACHE.branch" "$CMUX_TEST_CACHE.repo" \
"$CMUX_TEST_CACHE.result" "$CMUX_TEST_CACHE.timestamp" \
"$CMUX_TEST_CACHE.no-pr-branch" "$CMUX_TEST_FORCE"; do
[[ -e "$file" ]] && _cmux_send CACHE_REMAINS
done
# Bash no longer writes PR caches (#15075) and leaves files from older
# integrations alone instead of checking for them at every prompt.
if [[ -n "${ZSH_VERSION:-}" ]]; then
for file in "$CMUX_TEST_CACHE.branch" "$CMUX_TEST_CACHE.repo" \
"$CMUX_TEST_CACHE.result" "$CMUX_TEST_CACHE.timestamp" \
"$CMUX_TEST_CACHE.no-pr-branch" "$CMUX_TEST_FORCE"; do
[[ -e "$file" ]] && _cmux_send CACHE_REMAINS
done
fi
[[ -n "$_CMUX_GIT_ACTIVE_PWD_FILE" ]] && _cmux_send ACTIVE_PWD_CREATED
[[ -n "$_CMUX_GIT_JOB_PID" ]] && _cmux_send GIT_JOB_STARTED
[[ -n "$_CMUX_GIT_HEAD_PATH$_CMUX_GIT_HEAD_SIGNATURE" ]] && _cmux_send HEAD_TRACKED
Expand Down Expand Up @@ -174,9 +178,10 @@ def test_next_prompt_stops_tracked_jobs(self):
# group so the PR-loop group kill cannot touch the test runner.
jobs = {}
try:
names = ["_CMUX_GIT_JOB_PID", "_CMUX_PR_POLL_PID"]
names = ["_CMUX_GIT_JOB_PID"]
if shell == "zsh":
names.append("_CMUX_GIT_HEAD_WATCH_PID")
# Bash has no HEAD watcher, and #15075 removed its PR poller.
names += ["_CMUX_PR_POLL_PID", "_CMUX_GIT_HEAD_WATCH_PID"]
for name in names:
jobs[name] = subprocess.Popen(["/bin/sleep", "60"], start_new_session=True)
# Observe only prompt-time shutdown. zsh's normal exit hook
Expand Down
Loading