Skip to content

Revert "Fix detection of shell built-in commands (e.g. pwd) in interactive CLI"#1254

Merged
muddlebee merged 1 commit intomainfrom
revert-1252-fix-shell-command-detection
May 3, 2026
Merged

Revert "Fix detection of shell built-in commands (e.g. pwd) in interactive CLI"#1254
muddlebee merged 1 commit intomainfrom
revert-1252-fix-shell-command-detection

Conversation

@muddlebee
Copy link
Copy Markdown
Collaborator

Reverts #1252

@muddlebee muddlebee merged commit a52a4d3 into main May 3, 2026
9 checks passed
@muddlebee muddlebee deleted the revert-1252-fix-shell-command-detection branch May 3, 2026 19:27
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 3, 2026

🛸 Aliens watching our repo just upgraded @muddlebee's threat level to: do not engage — too competent. 👽


👋 Join us on Discord - OpenSRE : hang out, contribute, or hunt for features and issues. Everyone's welcome.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 3, 2026

Greptile Summary

This PR reverts #1252, which had added a COMMON_SHELL_COMMANDS set and an early-return check in _looks_like_direct_shell_command to handle shell built-ins that shutil.which cannot locate. No reason for the revert is given in the PR description.

  • P1 regression: cd is a pure shell built-in — shutil.which('cd') always returns None, so the reverted code will silently mis-route cd <path> invocations to the natural-language path instead of executing them as shell commands. Without the original fix in place, users of the interactive CLI will be unable to reliably run built-in commands.

Confidence Score: 3/5

Not safe to merge — re-introduces a known regression in shell built-in command detection.

A P1 functional regression is re-introduced: cd and potentially pwd/echo on some platforms will no longer be detected as shell commands. The fix being reverted was explicit about solving this exact problem, and no justification for the revert is provided.

app/cli/interactive_shell/agent_actions.py — _looks_like_direct_shell_command loses the shell built-in guard.

Important Files Changed

Filename Overview
app/cli/interactive_shell/agent_actions.py Reverts the COMMON_SHELL_COMMANDS early-return guard, re-introducing the regression where shell built-ins (especially cd, and conditionally pwd/echo on macOS) are not detected as shell commands by _looks_like_direct_shell_command.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["User input text"] --> B["_looks_like_direct_shell_command(text)"]
    B --> C{"first token is None?"}
    C -- Yes --> D["return False"]
    C -- No --> E{"first in _NON_COMMAND_STARTS?"}
    E -- Yes --> D
    E -- No --> F{"starts with ./ ../ /?"}
    F -- Yes --> G{"Path exists?"}
    G -- Yes --> H["return True"]
    G -- No --> I["return False"]
    F -- No --> J["shutil.which(first)"]
    J -- found --> H
    J -- "not found (always for cd)" --> I
    style I fill:#f88,stroke:#c00
Loading

Reviews (1): Last reviewed commit: "Revert "Fix detection of shell built-in ..." | Re-trigger Greptile

Comment on lines 208 to 210
if first.startswith(("./", "../", "/")):
return Path(first).exists()
return shutil.which(first) is not None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Shell built-ins (cd) silently broken again

shutil.which('cd') always returns None because cd is a pure shell built-in with no external binary. After this revert, _looks_like_direct_shell_command will return False for any invocation of cd (e.g. cd /tmp), so the interactive CLI will route it to the natural-language path instead of executing it as a shell command. The same issue may affect echo/pwd on macOS where the external binaries are absent from $PATH. PR #1252 existed specifically to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant