fix(subagent-acp): resolve child cwd from the parent session

The ACP backend resolved an unset cwd to the harness process's launch
directory, so a delegated child ran — and announced its ACP session —
in the server's cwd instead of the delegating session's workspace.
Resolve the working directory explicitly: the config cwd override
(made absolute and validated at load), else the parent session
header's cwd (validated at start), failing loud before spawning when
neither exists.
This commit is contained in:
Yichen Jiang
2026-07-19 15:21:33 +08:00
parent 7747aa450c
commit c432f85c07
6 changed files with 226 additions and 20 deletions

View File

@@ -860,8 +860,11 @@ export interface Config {
/** Arguments passed to {@link command}. */
args: string[]
/**
* Working directory for the child process and its ACP session. Defaults to
* the parent process's cwd when omitted.
* Working directory override for the child process and its ACP session. A
* relative path resolves against the harness launch directory at load, and
* the result must be an existing directory. When omitted, each child
* inherits its delegating parent session's cwd — and starting one from a
* parent session that has no cwd fails.
*/
cwd?: string
/**
@@ -891,7 +894,7 @@ export interface Config {
export type PermissionPolicy = 'allow' | 'reject'
```
Source: [`packages/subagent/subagent-acp/src/index.ts:18`](../packages/subagent/subagent-acp/src/index.ts)
Source: [`packages/subagent/subagent-acp/src/index.ts:21`](../packages/subagent/subagent-acp/src/index.ts)
## `@deepseek-ai/dsh-subagent-fork`