Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,6 @@ opencode-pilot test-mapping MCP # Test field mappings

## Known Issues

### Sessions attached to global server run in wrong directory

When using `server_port` to attach sessions to a global OpenCode server (e.g., OpenCode Desktop with worktree="/"), sessions are created in the server's working directory (typically home) instead of the project directory. This means:

- File tools resolve paths relative to home, not the project
- The agent sees the wrong `Working directory` in system prompt
- Git operations may target the wrong repository

**Workaround**: Don't set `server_port` in your config. Sessions will run in the correct directory but won't appear in OpenCode Desktop.

**Upstream issue**: [anomalyco/opencode#7376](https://github.com/anomalyco/opencode/issues/7376)

### Working directory doesn't switch when templates create worktrees/devcontainers

When a template instructs the agent to create a git worktree or switch to a devcontainer, OpenCode's internal working directory context (`Instance.directory`) doesn't update. This means:
Expand Down
3 changes: 2 additions & 1 deletion service/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,10 @@ export function getCommandInfoNew(item, config, templatesDir, serverUrl) {
// Build command args
const args = ["opencode", "run"];

// Add --attach if server URL is provided
// Add --attach and --dir if server URL is provided
if (serverUrl) {
args.push("--attach", serverUrl);
args.push("--dir", cwd);
}

// Add session title
Expand Down
4 changes: 3 additions & 1 deletion test/unit/actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ describe('actions.js', () => {
assert.ok(lastArg.includes('Fix bug'), 'Prompt should include title');
});

test('includes --attach when serverUrl is provided', async () => {
test('includes --attach and --dir when serverUrl is provided', async () => {
const { getCommandInfoNew } = await import('../../service/actions.js');

const item = { number: 123, title: 'Fix bug' };
Expand All @@ -245,6 +245,8 @@ describe('actions.js', () => {

assert.ok(cmdInfo.args.includes('--attach'), 'Should include --attach flag');
assert.ok(cmdInfo.args.includes('http://localhost:4096'), 'Should include server URL');
assert.ok(cmdInfo.args.includes('--dir'), 'Should include --dir flag');
assert.ok(cmdInfo.args.includes(cmdInfo.cwd), 'Should include working directory');
});

test('does not include --attach when serverUrl is null', async () => {
Expand Down