feat(acp): configurable per-agent working directory (cwd) for remote-acp#975
Draft
aatchison wants to merge 1 commit into
Draft
feat(acp): configurable per-agent working directory (cwd) for remote-acp#975aatchison wants to merge 1 commit into
aatchison wants to merge 1 commit into
Conversation
The ACP adapter hardcoded the session cwd to '/' (src/acp/acp-adapter.ts). That's invalid for a remote-acp agent with a real filesystem (e.g. a containerized Cline): the agent derives a workspace "hint" from the cwd basename, and '/' yields an empty string, so the agent rejects the session (`-32602 "workspaces"/"/"/"hint": too small`). Connection + chat work, but every filesystem/tool action fails. Adds an optional `cwd` to remote-acp/managed-acp agents, end to end: - agents table: nullable `cwd` column (backend Postgres + client SQLite), Drizzle migration 0019. Sync rules use SELECT * so the column auto-syncs. - Agent type + DAL (CreateAgentInput, mappers, UpdateAgentPatch). - Add-custom-agent dialog: optional "Working Directory" field (default '/'). - acp-adapter: session/new + session/load use `agent.cwd ?? '/'` (the hardcoded value becomes the fallback; browser/built-in/managed agents that don't set it are unchanged). Backwards compatible: cwd unset => previous '/' behavior. NOTE (deployment): per the two-PR synced-table process, the backend migration must run before the frontend writes the column — this branch contains both halves for review; split/stage on merge. Authored without /thunderpush (unavailable in this environment) — committed directly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The ACP adapter hardcodes the session cwd to
'/'(src/acp/acp-adapter.ts). For aremote-acpagent with a real filesystem (e.g. a containerized Cline/Codex), that's invalid: the agent derives a workspace "hint" (name) from the cwd basename, and'/'→ empty string, so the agent rejects the session:The WebSocket connects and chat/inference work, but every filesystem/tool action fails (the model declines: "I can't create files, do it yourself"). Confirmed against a real remote Cline over
wss://: withcwd:/workspacethe same prompt works; with'/'it errors.Change — optional per-agent
cwd, end to endcwdcolumn on theagentstable — backend Postgres (backend/src/db/powersync-schema.ts) + client SQLite (src/db/tables.ts), Drizzle migration0019_smart_genesis. Sync rules useSELECT *, so the column auto-syncs (no sync-rule edit).Agent.cwd,CreateAgentInput.cwd,UpdateAgentPatch, row mappers./).session/new+session/loaduseagent.cwd ?? '/'— the hardcoded value becomes the fallback. Browser / built-in / managed agents that don't set it are unchanged.Backwards compatible:
cwdunset ⇒ prior'/'behavior.Tests / checks
bun run type-checkclean;lint,format-check,license:checkpass.createAgentpersists/defaultscwd(DAL); dialog passescwdin payload. 497 tests pass across the touched dirs (acp/chats/components/dal). Many existing Agent-literal fixtures updated for the new required field.Per
CLAUDE.md, a synced-column add must land backend-first: run migration0019(+ confirm PowerSync Cloud rules) before the frontend writes the column, or older clients silently fail to sync it. This branch contains both halves for review — please split/stage into the backend-then-frontend order on merge (or advise and I'll split it).Notes
SESSION_CWDrewrite) so this works today without waiting on a Thunderbolt deploy — thunderbird/thunderbolt-coding-agent#75. This PR is the proper upstream fix; also benefits managed-acp (feat(coding-agent): managed-acp provider + per-user GitHub token provisioning (draft) #967)./thunderpushwasn't available in my environment, so this was committed directly via git (pre-commit hooks ran: license-headers +make format). Flagging in case the team wants it re-pushed through the standard flow.