Skip to content

More acp tools#7843

Merged
codefromthecrypt merged 9 commits intomainfrom
more-acp-tools
Mar 13, 2026
Merged

More acp tools#7843
codefromthecrypt merged 9 commits intomainfrom
more-acp-tools

Conversation

@jamadeo
Copy link
Copy Markdown
Collaborator

@jamadeo jamadeo commented Mar 12, 2026

Summary

Continuation of #7668 with changes from (un-merged) #7388 and feedback from @rabi.

This PR:

  • adds a shell tool over ACP terminal methods
  • emits ToolCallUpdates from within the ACP tools themselves for a richer client experience
  • adds a metadata field to tool call results that indicates it came from an ACP-aware tool, so we don't overwrite fields on the tool call in the client
  • passes cwd, outputByteLimit, and timeout to the terminal — matching what cline, autohand-acp, fast-agent, and Code Assistant all do

Type of Change

  • Feature
  • Tests

AI Assistance

  • This PR was created or reviewed with AI assistance

Testing

No ACP:
No ACP client, so DeveloperClient handles shell directly via subprocess.

$ just release-binary
$ GOOSE_MODE=auto target/release/goose run \                                                                                                                         
>   --with-builtin developer \
>   -t "run echo hello"

    __( O)>  ● new session · tetrate gpt-5-nano
   \____)    20260313_21 · /Users/codefromthecrypt/oss/goose-2
     L L     goose is ready

  ▸ shell
    command: echo hello

helloHello
$ GOOSE_MODE=auto target/release/goose run \                                                                                                                         
>   --with-builtin developer \
>   -t 'run "exit 1"'

    __( O)>  ● new session · tetrate gpt-5-nano
   \____)    20260313_22 · /Users/codefromthecrypt/oss/goose-2
     L L     goose is ready

  ▸ shell
    command: bash -lc 'exit 1'

(no output)

Command exited with code 1Command executed: exit 1
- Exit status: 1
- stdout: (none)
- stderr: (none)

If you’re testing error handling, here are quick options:
- Simple check in shell:
  - if a command fails: if ! some_command; then echo "command failed with exit code $?"; fi
- Propagate errors in a script:
  - set -euo pipefail
  - trap 'echo "Error on line $LINENO"; exit 1' ERR

Would you like me to run another command, or set up a small script to handle non-zero exit codes and report them?

Zed

Clear logs and session/thread state:

$ pkill -f goose
$ rm -rf ~/.local/state/goose/logs ~/.local/share/goose/sessions
$ rm -rf ~/Library/Logs/Zed/ ~/Library/Application\ Support/Zed/threads/

Build the release binary:

$ just release-binary

Add to ~/.config/zed/settings.json:

"agent_servers": {
  "goose": {
    "type": "custom",
    "command": "/Users/codefromthecrypt/oss/goose-2/target/release/goose",
    "args": ["acp", "--with-builtin", "developer"],
    "env": {
      "GOOSE_MODE": "auto",
      "RUST_LOG": "debug"
    }
  }
}

Terminal delegation:

Prompt in Zed:

run echo hello world

Verify the terminal appears embedded in the tool call UI (not just text output).

Verify the ACP interactions in Goose. Zed has no telemetry or logs about ACP:

$ grep -h "terminal/create\|terminal/wait_for_exit\|terminal/output\|terminal/release" ~/.local/state/goose/logs/cli/*/*.log
{"timestamp":"2026-03-13T08:20:09.649823Z","level":"DEBUG","fields":{"message":"outgoing_protocol_actor","message":"Request { method: \"terminal/create\", params: Some(Object({\"sessionId\": String(\"20260313_1\"), \"command\": String(\"echo hello world\"), \"cwd\": String(\"/Users/codefromthecrypt\"), \"outputByteLimit\": Number(50000)})), response_tx: Sender { complete: false } }"},"target":"sacp::jsonrpc::outgoing_actor","span":{"name":"goose-acp","name":"connection"},"spans":[{"name":"goose-acp","name":"connection"}]}
{"timestamp":"2026-03-13T08:20:09.813017Z","level":"DEBUG","fields":{"message":"outgoing_protocol_actor","message":"Request { method: \"terminal/wait_for_exit\", params: Some(Object({\"sessionId\": String(\"20260313_1\"), \"terminalId\": String(\"082f9644-dde3-40ff-9ba4-ee60499bd480\")})), response_tx: Sender { complete: false } }"},"target":"sacp::jsonrpc::outgoing_actor","span":{"name":"goose-acp","name":"connection"},"spans":[{"name":"goose-acp","name":"connection"}]}
{"timestamp":"2026-03-13T08:20:09.816954Z","level":"DEBUG","fields":{"message":"outgoing_protocol_actor","message":"Request { method: \"terminal/output\", params: Some(Object({\"sessionId\": String(\"20260313_1\"), \"terminalId\": String(\"082f9644-dde3-40ff-9ba4-ee60499bd480\")})), response_tx: Sender { complete: false } }"},"target":"sacp::jsonrpc::outgoing_actor","span":{"name":"goose-acp","name":"connection"},"spans":[{"name":"goose-acp","name":"connection"}]}
{"timestamp":"2026-03-13T08:20:09.817061Z","level":"DEBUG","fields":{"message":"outgoing_protocol_actor","message":"Request { method: \"terminal/release\", params: Some(Object({\"sessionId\": String(\"20260313_1\"), \"terminalId\": String(\"082f9644-dde3-40ff-9ba4-ee60499bd480\")})), response_tx: Sender { complete: false } }"},"target":"sacp::jsonrpc::outgoing_actor","span":{"name":"goose-acp","name":"connection"},"spans":[{"name":"goose-acp","name":"connection"}]}

Non-zero exit:

Prompt in Zed:

run "exit 1"

Verify the tool call shows as failed (exit code 1).

Related Issues

Continuation of #7668
Uses design from #7388

Screenshots

Screenshot 2026-03-13 at 4 22 07 PM Screenshot 2026-03-13 at 4 20 49 PM

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a31fec4fc5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@codefromthecrypt
Copy link
Copy Markdown
Collaborator

taking a look now

@codefromthecrypt codefromthecrypt self-assigned this Mar 13, 2026
Copy link
Copy Markdown
Collaborator

@codefromthecrypt codefromthecrypt left a comment

Choose a reason for hiding this comment

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

I filled some tiny gaps on this, based on what other agents do: pass cwd, outputByteLimit, and timeout to ACP terminal.

Then, I updated the PR desc with manual instructions that I ran and it works.

Testing the terminal with integration tests will be more thinking than can be done in this PR.

Thanks a lot!

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a6b5836e56

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +293 to +296
let exit_code = output_res
.exit_status
.and_then(|s| s.exit_code)
.unwrap_or_default();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Treat unknown terminal exit status as failure

This path maps a missing ACP terminal exit_code to 0, so commands that do not report an explicit code (for example, timeout/kill paths or signal-terminated commands) are marked successful. In those cases the tool call returns CallToolResult::success(...), which can make the agent continue after a failed shell execution instead of handling it as an error.

Useful? React with 👍 / 👎.

let ctx = crate::agents::ToolCallContext::new(
session_id,
None,
Some("tool-request-id".to_string()),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remove hard-coded tool call id from callback context

The callback context always sets tool_call_request_id to the literal "tool-request-id"; when this callback invokes ACP-aware tools, they emit ToolCallUpdate events keyed to that id. This callback dispatch path does not create a matching tool-call record, so updates are associated with an unknown id and cannot be reliably attached/rendered by ACP clients.

Useful? React with 👍 / 👎.

Merged via the queue into main with commit c947620 Mar 13, 2026
19 checks passed
@codefromthecrypt codefromthecrypt deleted the more-acp-tools branch March 13, 2026 08:33
michaelneale added a commit that referenced this pull request Mar 15, 2026
* origin/main:
  fix: tool confirmation handling for multiple requests (#7856)
  Remove dead OllamaSetup onboarding flow (#7861)
  fix: resolve tokio::sync::Mutex deadlock in recipe retry path (#7832)
  Upgrade Electron 40.6.0 → 41.0.0 (#7851)
  Only show up to 50 lines of source code (#7578)
  fix: stop writing without error when hitting broken pipe for goose session list (#7858)
  feat(acp): add session/set_mode handler (#7801)
  Keep messages in sync (#7850)
  More acp tools (#7843)
lifeizhou-ap added a commit that referenced this pull request Mar 16, 2026
* main: (191 commits)
  fix: add tool_choice and parallel_tool_calls to chatgpt_codex provider (#7867)
  fix: tool confirmation handling for multiple requests (#7856)
  Remove dead OllamaSetup onboarding flow (#7861)
  fix: resolve tokio::sync::Mutex deadlock in recipe retry path (#7832)
  Upgrade Electron 40.6.0 → 41.0.0 (#7851)
  Only show up to 50 lines of source code (#7578)
  fix: stop writing without error when hitting broken pipe for goose session list (#7858)
  feat(acp): add session/set_mode handler (#7801)
  Keep messages in sync (#7850)
  More acp tools (#7843)
  fix: skip upgrade-insecure-requests CSP for external HTTP backends (#7714)
  fix(shell): prevent hang when command backgrounds a child process (#7689)
  Remove include from Cargo.toml in goose-mcp (#7838)
  Exit agent loop when tool call JSON fails to parse (#7840)
  chore: remove redundant husky prepare script (#7829)
  Add github actions workflow for unused deps (#7681)
  fix: prevent SSE connection drops from silently truncating responses (#7831)
  doc: Added notes in contribution guide for pnpm (#7833)
  add prefer-offline to pnpm config to skip unnecessary registry lookups (#7828)
  fix: remove dead read handler from DeveloperClient (#7821)
  ...
@codefromthecrypt
Copy link
Copy Markdown
Collaborator

#7923 polish and acp tests for shell

jh-block added a commit that referenced this pull request Mar 16, 2026
* main: (65 commits)
  feat(otel): propagate session.id to spans and log records (#7490)
  fix(test): add env_lock to is_openai_reasoning_model tests (#7917)
  fix(acp): pass session_id when loading extensions so skills are discovered (#7868)
  updated canonical models (#7920)
  feat(autovisualiser): Migrate the autovisualiser extension to MCP Apps  (#7852)
  fix: add tool_choice and parallel_tool_calls to chatgpt_codex provider (#7867)
  fix: tool confirmation handling for multiple requests (#7856)
  Remove dead OllamaSetup onboarding flow (#7861)
  fix: resolve tokio::sync::Mutex deadlock in recipe retry path (#7832)
  Upgrade Electron 40.6.0 → 41.0.0 (#7851)
  Only show up to 50 lines of source code (#7578)
  fix: stop writing without error when hitting broken pipe for goose session list (#7858)
  feat(acp): add session/set_mode handler (#7801)
  Keep messages in sync (#7850)
  More acp tools (#7843)
  fix: skip upgrade-insecure-requests CSP for external HTTP backends (#7714)
  fix(shell): prevent hang when command backgrounds a child process (#7689)
  Remove include from Cargo.toml in goose-mcp (#7838)
  Exit agent loop when tool call JSON fails to parse (#7840)
  chore: remove redundant husky prepare script (#7829)
  ...
wpfleger96 added a commit that referenced this pull request Mar 16, 2026
…oken-retry

* origin/main: (21 commits)
  Remove java/.ai-usage-marker directory (#7925)
  test(acp): add terminal delegation fixtures and fix shell singleton (#7923)
  fix: bump pctx_code_mode to 0.3.0 for iterator type checking fix (#7892)
  feat: persist GooseMode per-session via session DB (#7854)
  feat(otel): propagate session.id to spans and log records (#7490)
  fix(test): add env_lock to is_openai_reasoning_model tests (#7917)
  fix(acp): pass session_id when loading extensions so skills are discovered (#7868)
  updated canonical models (#7920)
  feat(autovisualiser): Migrate the autovisualiser extension to MCP Apps  (#7852)
  fix: add tool_choice and parallel_tool_calls to chatgpt_codex provider (#7867)
  fix: tool confirmation handling for multiple requests (#7856)
  Remove dead OllamaSetup onboarding flow (#7861)
  fix: resolve tokio::sync::Mutex deadlock in recipe retry path (#7832)
  Upgrade Electron 40.6.0 → 41.0.0 (#7851)
  Only show up to 50 lines of source code (#7578)
  fix: stop writing without error when hitting broken pipe for goose session list (#7858)
  feat(acp): add session/set_mode handler (#7801)
  Keep messages in sync (#7850)
  More acp tools (#7843)
  fix: skip upgrade-insecure-requests CSP for external HTTP backends (#7714)
  ...
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.

2 participants