Skip to content

fix(opencode): use session cwd for command substitution#20773

Open
jeevan6996 wants to merge 3 commits intoanomalyco:devfrom
jeevan6996:fix/20735-command-substitution-cwd-win
Open

fix(opencode): use session cwd for command substitution#20773
jeevan6996 wants to merge 3 commits intoanomalyco:devfrom
jeevan6996:fix/20735-command-substitution-cwd-win

Conversation

@jeevan6996
Copy link
Copy Markdown

@jeevan6996 jeevan6996 commented Apr 3, 2026

Issue for this PR

Closes #20735

Type of change

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

What does this PR do?

This fixes slash-command shell substitutions (for ! backtick expressions) to run in the active session directory instead of the server process working directory. It adds a reusable substitution helper and keeps behavior unchanged when no substitutions exist.

It also adds regression tests and makes the assertion shell-agnostic so the test is valid across Windows PowerShell and Unix-like shells.

How did you verify your code works?

  • Ran bun test test/session/prompt.test.ts in packages/opencode
  • Pre-push hook runs bun turbo typecheck successfully

Screenshots / recordings

N/A (non-UI backend fix)

Checklist

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

Signed-off-by: jeevan6996 <jeevanpawar5890@gmail.com>
Signed-off-by: jeevan6996 <jeevanpawar5890@gmail.com>
Signed-off-by: jeevan6996 <jeevanpawar5890@gmail.com>
@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Apr 3, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

The following comment was made by an LLM, it may be inaccurate:

Related PR Found:

This PR (#20770) is the one that the current PR (#20773) is superseding due to a stale head sync issue. While they address the same fix, PR #20773 is the active version intended to replace it.

@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Apr 3, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

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

@jeevan6996
Copy link
Copy Markdown
Author

Hi maintainers - this PR is also ready for review from my side. All required checks are green (including linux/windows unit + e2e, typecheck, standards, and compliance).\n\nWould appreciate a review when you get a chance. Thank you!

@jeevan6996
Copy link
Copy Markdown
Author

Friendly ping on this session cwd command-substitution fix. Please let me know if any final changes are needed for merge.

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.

Command substitution uses wrong pwd

1 participant