Skip to content

The agent that grows with you

fix(copilot-acp): open the ACP session in the turn's workspace, not the process cwd

teknium1bbbc4b7f416e
diff --git a/agent/copilot_acp_client.py b/agent/copilot_acp_client.py
index 4ad491d1c12..52b5dbc01b9 100644
--- a/agent/copilot_acp_client.py
+++ b/agent/copilot_acp_client.py
@@ -31,6 +31,7 @@ from agent.acp_openai_bridge import (
from agent.file_safety import (
get_nt_namespace_error, get_read_block_error, get_write_denied_error, is_write_approval_required)
from agent.redact import redact_sensitive_text
+from agent.runtime_cwd import resolve_agent_cwd
from tools.environments.local import hermes_subprocess_env
ACP_MARKER_BASE_URL = "acp://copilot"
@@ -292,7 +293,9 @@ class CopilotACPClient:
self._default_headers = dict(default_headers or {})
self._acp_command = acp_command or command or _resolve_command()
self._acp_args = list(acp_args or args or _resolve_args())
- self._acp_cwd = str(Path(acp_cwd or os.getcwd()).resolve())
+ # The session's workspace, not the process cwd: under the gateway every turn runs in
+ # the daemon (or a managed worker) whose own cwd is unrelated to the client's.
+ self._acp_cwd = str(Path(acp_cwd or resolve_agent_cwd()).resolve())
self.chat = SimpleNamespace(completions=SimpleNamespace(create=self._create_chat_completion))
self.is_closed = False
# Clients are cached and shared across concurrent callers (auxiliary tasks, async