Skip to content

Conversation

@OhadRubin
Copy link

Consolidate ACP Tool Call Events from 3 to 2

Summary

Reduce tool call event emissions from 3 events (pending → running → completed) to 2 events (running → completed) by removing the redundant pending event.

Problem

Currently, we send 3 ACP events per tool call:

  • pending: tool_call event with no input parameters (empty {})
  • running: tool_call_update event with the actual input parameters
  • completed: tool_call_update event with results

The pending event provides no useful information since part.state.input is empty by design, creating unnecessary noise in the ACP event stream.

Root Cause Analysis

The pending event has no input content by design. In src/session/prompt.ts:1076, when the "tool-input-start" event occurs, the tool part is created with:

state: {
  status: "pending",
  input: {},  // Empty object - no parameters yet
  raw: "",
}

The input parameters are only populated when the tool transitions to "running" status. This means:

  • pending state: Tool is queued, but part.state.input is empty ({})
  • running state: Tool is executing, part.state.input contains actual parameters

In src/acp/agent.ts, when we receive the pending event via this.config.sdk.event.subscribe, the part.state.input field is empty.

Conclusion: The pending event is inherently empty and provides no useful information beyond the tool ID. The original 2-event approach (skip pending, only send running + completed) is correct.

Solution

Skip the pending state and only emit 2 events:

  • running: tool_call event with input parameters and status: "in_progress"
  • completed: tool_call_update event with results

Changes

In src/acp/agent.ts:150-165:

  • Add break in pending case (no-op)
  • Consolidate tool call emission into running case with actual input parameters
  • Send status: "in_progress" instead of separate pending/running events

Testing

Tested with the latest version of Zed and it works.

OhadRubin and others added 2 commits November 10, 2025 14:42
Remove redundant pending event emission. The pending state has no input parameters by design (part.state.input is empty {} when status is "pending"). Only emit tool call events during running and completed states when actual data is available.

This reduces noise in the ACP event stream without losing any information.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…sage

- Include locations via toLocations() when sending running event
- Fix error message to say "in_progress" instead of "pending"
- Remove trailing whitespace

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@rekram1-node
Copy link
Collaborator

@OhadRubin but the first party supported agents by zed set this, so why shouldn't we do the same to be consistent with them?

Also it is part of the spec to set it isn't it

@OhadRubin
Copy link
Author

OhadRubin commented Nov 10, 2025 via email

@OhadRubin
Copy link
Author

OhadRubin commented Nov 10, 2025 via email

Use GITHUB_HEAD_REF or GITHUB_REF_NAME to push to the correct branch when in detached HEAD state in CI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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