Skip to content

fix(opencode): guard shell permission parse failures - #39938

Open
nikitakot wants to merge 1 commit into
anomalyco:devfrom
nikitakot:shell-permission-fallback
Open

fix(opencode): guard shell permission parse failures#39938
nikitakot wants to merge 1 commit into
anomalyco:devfrom
nikitakot:shell-permission-fallback

Conversation

@nikitakot

@nikitakotnikitakot commented Jul 31, 2026

Copy link
Copy Markdown

Issue for this PR

Closes#39931

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

PowerShell parsing can return an error tree with no command patterns, causing the shell permission check to be skipped. When the syntax tree contains errors, this change checks the raw command instead and avoids deriving a reusable approval pattern from the invalid tree.

How did you verify your code works?

  • bun test test/tool/shell.test.ts --timeout 30000 -t "falls back to the raw command"
  • bun typecheck
  • bunx prettier --check src/tool/shell.ts test/tool/shell.test.ts

Screenshots / recordings

Not applicable.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actionsgithub-actionsBot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Jul 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@nikitakot

Copy link
Copy Markdown
Author

@Hona@rekram1-node hey folks can someone have a look at it? the issue is also present in V2

tldr.: permissions should not be escaped completely when shell command parsing fails, this PR tries to fix it

@opencode-agentopencode-agentBot left a comment

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.

Reviewed the parse-error fallback and regression coverage. No blocking findings.

Sign up for freeto 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.

bash permission escape via -- double hyphen

1 participant

@nikitakot