Skip to content

Tighten shell validation in bash.ts to handle shells installed in non-standard paths #5190

Closed

Description

@ayatofrench

Description

Problem

The current shell detection logic in bash.ts contains a guard that returns the SHELL environment variable if it doesn't match a specific set of paths. When running in a Nix environment (or other shells installed by nix), the dynamically generated paths do not match the Set and are returned as valid.

Technical Detail

The check currently relies on an exact string match:

if (s) {
    if (!new Set(["/bin/fish", "/bin/nu", "/usr/bin/fish", "/usr/bin/nu"]).has(s)) {
       return s
    }
}

Proposed Solution

I recommend refactoring this guard to detect shells installed in non-standard paths (such as checking the base name of the path).

I’ve noticed other open PRs that add broader shell support, but I wanted to open this PR just in case such support might take some more time. I am happy to submit a PR with a fix.

OpenCode version

1.0.133

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

macOS

Terminal

Ghostty

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Dec 7, 2025
  2. changed the title [-]Tighten Shell Validation in bash.ts to Handle Nix-managed Environments[/-] [+]Tighten Shell Validation in bash.ts to Handle shells installed in non-standard paths[/+] on Dec 7, 2025
  3. changed the title [-]Tighten Shell Validation in bash.ts to Handle shells installed in non-standard paths[/-] [+]Tighten shell validation in bash.ts to handle shells installed in non-standard paths[/+] on Dec 7, 2025
  4. github-actions commented on Dec 7, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  5. hsachdeva9 commented on Dec 7, 2025

    @hsachdeva9

    hey @ayatofrench, I would like to work on this issue, Could you please assign it to me?

  6. self-assigned this
    on Dec 7, 2025
  7. rekram1-node commented on Dec 7, 2025

    @rekram1-node
    Collaborator

    @ayatofrench sure thing!

  8. rekram1-node commented on Dec 7, 2025

    @rekram1-node
    Collaborator

    @hsachdeva9 ayato already volunteered

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingnixopentuiThis relates to changes in v1.0, now that opencode uses opentui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions