Preserve live Pi panes on tmux command drift#189
Open
aserper wants to merge 2 commits into
Open
Conversation
Pi runs subagents as separate `pi` processes in the same tmux pane and loads the same status extension in parent and child. Both fire identical `agent_start` / `agent_end` hooks, and the events carry no run or parent id, so a child finishing was indistinguishable from the parent finishing and marked the pane done early. The extension now passes the emitting process id with `--from-pid`. A top-level Pi has no Pi ancestor, so `done` stays `done`; a child Pi has a live parent Pi ancestor, so its `done` is kept as `working` until the parent completes. The guard is stateless and Linux-only (reads `/proc`), matching the existing `multiplexer::tmux::process_ancestors` helper.
tmux can briefly report a Pi pane's foreground command as the shell or a transient child even while the long-lived Pi process is still alive below the pane shell. Reconciliation was treating that as agent exit and deleting the state file, which made the sidebar lose the Pi spinner during active work. Keep cached Pi state when the pane shell still has a live Pi descendant, and only delete on command drift once the Pi process is actually gone. Builds on raine#184 (process_tree module).
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.
Summary
piagent state when tmux briefly reports the pane's foreground command as the shell or a transient tool command, as long as the pane shell still has a live Pi descendantBug
tmux can transiently report a live Pi pane as
zsh(or a tool subprocess) even while the long-lived Pi process is still running below the pane shell. Reconciliation treated that foreground-command change as agent exit and deleted the state file, so the sidebar lost the Pi spinner mid-work.Tests
cargo test --bin workmux process_tree --quietcargo test --bin workmux store --quietcargo test --quiet -- --test-threads=1(a pre-existingPI_CONFIG_DIRenv-var race in config tests requires serial execution; unrelated to this change)Builds on #184 (adds
has_pi_descendantto theprocess_treemodule). Merge after #184.Split out of #184 where it was bundled with the nested-done guard.