Skip to content

ACP get working dir from args.cwd#6653

Merged
zanesq merged 1 commit intomainfrom
zane/acp-working-dir
Jan 23, 2026
Merged

ACP get working dir from args.cwd#6653
zanesq merged 1 commit intomainfrom
zane/acp-working-dir

Conversation

@zanesq
Copy link
Copy Markdown
Contributor

@zanesq zanesq commented Jan 23, 2026

Summary

Goose found and fixed the bug in the ACP client's working_dir handling:

The Problem

In crates/goose-acp/src/server.rs, the on_new_session function was ignoring the cwd field from the NewSessionRequest and instead using std::env::current_dir():

// Before (buggy):
let goose_session = manager
    .create_session(
        std::env::current_dir().unwrap_or_default(),  // Wrong!
        "ACP Session".to_string(),
        SessionType::User,
    )

The Fix

Changed it to use args.cwd from the ACP request:

// After (fixed):
let goose_session = manager
    .create_session(
        args.cwd.clone(),  // Correct - uses the cwd from the ACP client
        "ACP Session".to_string(),
        SessionType::User,
    )

Additional Cleanup

I also removed the unused work_dir field from GooseAcpConfig since:

  1. It was never used anywhere in the code
  2. The working directory should come from the ACP protocol's NewSessionRequest.cwd field, not from a config
  3. The on_load_session function was already correctly using args.cwd to update the working directory

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where the ACP server's on_new_session function was ignoring the client-provided working directory and using the server's current directory instead.

Changes:

  • Fixed on_new_session to use args.cwd from the ACP protocol request instead of std::env::current_dir()
  • Removed unused work_dir field from GooseAcpConfig struct

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
crates/goose-acp/src/server.rs Fixed working directory bug by using args.cwd instead of std::env::current_dir(), removed unused work_dir field from GooseAcpConfig
crates/goose-acp/tests/server_test.rs Updated test to remove work_dir from GooseAcpConfig initialization

@zanesq zanesq merged commit 003aaa1 into main Jan 23, 2026
23 of 24 checks passed
@zanesq zanesq deleted the zane/acp-working-dir branch January 23, 2026 17:14
zanesq added a commit that referenced this pull request Jan 26, 2026
* origin/main:
  fix: dispatch ADD_ACTIVE_SESSION event before navigating from "View All" (#6679)
  Speed up Databricks provider init by removing fetch of supported models (#6616)
  fix: correct typos in documentation and Justfile (#6686)
  docs: frameDomains and baseUriDomains for mcp apps (#6684)
  docs: add Remotion video creation tutorial (#6675)
  docs: export recipe and copy yaml (#6680)
  Test against fastmcp (#6666)
  docs: mid-session changes (#6672)
  Fix MCP elicitation deadlock and improve UX (#6650)
  chore: upgrade to rmcp 0.14.0 (#6674)
  [docs] add MCP-UI to MCP Apps blog (#6664)
  ACP get working dir from args.cwd (#6653)
  Optimise load config in UI (#6662)

# Conflicts:
#	ui/desktop/src/components/Layout/AppLayout.tsx
katzdave added a commit that referenced this pull request Jan 26, 2026
…o dkatz/canonical-context

* 'dkatz/canonical-provider' of github.com:block/goose: (27 commits)
  docs: add Remotion video creation tutorial (#6675)
  docs: export recipe and copy yaml (#6680)
  Test against fastmcp (#6666)
  docs: mid-session changes (#6672)
  Fix MCP elicitation deadlock and improve UX (#6650)
  chore: upgrade to rmcp 0.14.0 (#6674)
  [docs] add MCP-UI to MCP Apps blog (#6664)
  ACP get working dir from args.cwd (#6653)
  Optimise load config in UI (#6662)
  Fix GCP Vertex AI global endpoint support for Gemini 3 models (#6187)
  fix: macOS keychain infinite prompt loop    (#6620)
  chore: reduce duplicate or unused cargo deps (#6630)
  feat: codex subscription support (#6600)
  smoke test allow pass for flaky providers (#6638)
  feat: Add built-in skill for goose documentation reference (#6534)
  Native images (#6619)
  docs: ml-based prompt injection detection (#6627)
  Strip the audience for compacting (#6646)
  chore(release): release version 1.21.0 (minor) (#6634)
  add collapsable chat nav (#6649)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants