Skip to content

Fallback to available shell when run_terminal_command shell is missing#11131

Open
siewcapital wants to merge 2 commits intocontinuedev:mainfrom
Siew-s-Capital:fix/devcontainer-shell-fallback-11129
Open

Fallback to available shell when run_terminal_command shell is missing#11131
siewcapital wants to merge 2 commits intocontinuedev:mainfrom
Siew-s-Capital:fix/devcontainer-shell-fallback-11129

Conversation

@siewcapital
Copy link
Contributor

@siewcapital siewcapital commented Mar 6, 2026

Summary

  • make the terminal tool choose the first available Unix shell from SHELL, /bin/bash, /bin/sh, and /bin/ash
  • avoid hard-failing when SHELL points to a missing path or /bin/bash is not installed
  • add a regression test that verifies command execution still succeeds when SHELL is invalid

Why

In remote/devcontainer setups, some environments do not expose the expected shell path. Falling back to an available shell prevents spawn ... ENOENT failures and keeps terminal tooling usable.

Closes #11129


Summary by cubic

Gracefully fall back to an available Unix shell in runTerminalCommand when SHELL is invalid or /bin/bash is missing, preventing spawn ENOENT errors in remote/devcontainer environments. Fixes #11129.

  • Bug Fixes
    • Select the first available shell from $SHELL, /bin/bash, /bin/sh, or /bin/ash (non-absolute shells are resolved via PATH).
    • Added a regression test for invalid SHELL and ensured tests restore SHELL cleanly when it was unset.

Written for commit 63cef14. Summary will update on new commits.

@siewcapital siewcapital requested a review from a team as a code owner March 6, 2026 17:05
@siewcapital siewcapital requested review from RomneyDa and removed request for a team March 6, 2026 17:05
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Mar 6, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="core/tools/implementations/runTerminalCommand.vitest.ts">

<violation number="1" location="core/tools/implementations/runTerminalCommand.vitest.ts:162">
P1: Environment variable cleanup may leak SHELL state - assigning undefined to process.env creates string 'undefined'</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@RomneyDa RomneyDa closed this Mar 19, 2026
@github-project-automation github-project-automation bot moved this from Todo to Done in Issues and PRs Mar 19, 2026
@RomneyDa RomneyDa reopened this Mar 19, 2026
@github-project-automation github-project-automation bot moved this from Done to In Progress in Issues and PRs Mar 19, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Mar 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

ai-merge size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Terminal tool fails in devcontainer with "spawn /bin/bash ENOENT"

2 participants