feat(tui): route /diff through workspace commands#21001
Merged
Conversation
Contributor
|
Tested locally. Inside a Git worktree, One note: staged changes did not appear in |
canvrno-oai
approved these changes
May 5, 2026
df1aaba to
12a669c
Compare
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Stacked on #20892.
Why
#20892 adds the TUI workspace command abstraction so branch status metadata can run through app-server instead of assuming the CLI process has the active workspace locally.
/diffstill used direct local process execution, which means remote app-server sessions could compute the diff against the wrong machine or fail to see the active workspace at all.This PR moves
/diffonto that same app-server-backed command path so Git runs wherever the active workspace lives.What Changed
/diffthrough the TUIWorkspaceCommandExecutorusing the active chat cwd.tokio::process::Commandusage inget_git_diffwith argv-based workspace command requests./diffbehavior: tracked diff output, untracked file diffs, treating Git diff exit code1as success, and showing the existing non-git-repository message.WorkspaceCommandwith caller-set timeouts and an explicit uncapped-output opt-out. Metadata probes remain capped by default;/diffopts out because its full output is the user-visible payload.How to Test
Manual reviewer path:
/diff./diff./diffnot-inside-a-git-repository message.Targeted tests run:
cargo test -p codex-tui get_git_diff -- --nocapturecargo test -p codex-tui branch_summary -- --nocapturecargo test -p codex-tui