fix(opencode): pass workspace dir explicitly

The remote environment could start OpenCode runs under /opt/claudecodeui.

That happened even when the selected project path was correct.

The integration relied on child-process cwd alone.

OpenCode run resolves its workspace through the explicit --dir contract.

Pass --dir with the resolved working directory.

Assert in the CLI test that launch args include the workspace dir.
This commit is contained in:
Haileyesus
2026-06-12 22:45:22 +03:00
parent 3bbb42c233
commit 416a737d76
2 changed files with 24 additions and 1 deletions

View File

@@ -194,6 +194,10 @@ async function spawnOpenCode(command, options = {}, ws) {
void providerModelsService.resolveResumeModel('opencode', sessionId, model).then((resolvedModel) => {
const args = ['run', '--format', 'json'];
// OpenCode's `run` command owns workspace selection through `--dir`.
// Relying on the child-process cwd alone is not enough on Linux, where
// the CLI can still resolve the session under the server install dir.
args.push('--dir', workingDir);
if (sessionId) {
args.push('--session', sessionId);
}