Skip to content

feat(acp): emit plan session updates from todowrite tool calls - #31834

Closed
smagnuso wants to merge 7 commits into
anomalyco:devfrom
smagnuso:fix/acp-plan-todowrite
Closed

smagnuso wants to merge 7 commits into
anomalyco:devfrom
smagnuso:fix/acp-plan-todowrite

Conversation

@smagnuso

@smagnuso smagnuso commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

(I reopened this because I somehow got #30658 closed)

When working on hydra-acp I noticed that I was not getting plans rendered in opencode as I had in claude.

Closes #30659

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Translates todowrite tool calls into ACP SessionUpdate::Plan notifications so ACP clients (Zed, JetBrains, Hydra, etc.) can render a live plan/todo panel. This is the same data ACP clients receive from Claude Code today; opencode already produces the structured input but the ACP bridge never forwarded it.

How did you verify your code works?

Ran a prompt in in hydra-acp that created a plan:

create a plan with 5 items in it each run ping -c 1 www.google.com check off items as you complete them

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@axel7083 axel7083 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I've tested this very needed feature by building the branch, and got successfully the expected sessionUpdate: "plan" here is the message received asking the model to write a dummy plan.

{
  "jsonrpc": "2.0",
  "method": "session/update",
  "params": {
    "sessionId": "ses_11070d3a4ffe3x3imKODsXLp0q",
    "update": {
      "sessionUpdate": "plan",
      "entries": [
        {
          "content": "Explore the codebase to understand project structure",
          "status": "pending",
          "priority": "high"
        },
        {
          "content": "Identify relevant files for implementing the new feature",
          "status": "pending",
          "priority": "medium"
        },
        {
          "content": "Implement the new feature according to specifications",
          "status": "pending",
          "priority": "high"
        },
        {
          "content": "Write unit tests for the newly implemented feature",
          "status": "pending",
          "priority": "medium"
        },
        {
          "content": "Run all tests and lint checks to verify changes",
          "status": "pending",
          "priority": "high"
        }
      ]
    }
  }
}

ℹ️ We still receive the event tool_call for the todowrite, but I guess its fine?

Comment thread packages/opencode/src/acp/event.ts Outdated
Comment on lines +366 to +372
// When a turn ends, any entry the agent ever started during the session
// should be considered done — either it really was finished (model forgot to
// mark it completed) or the model demoted it back to pending without
// updating it again before stopping. Both render as a non-checked item in
// ACP clients, which contradicts the visible reality that work stopped.
// Genuinely planned-but-never-started entries (status: pending and never
// in_progress) are left alone so future plans still render correctly.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It is not specified in the official spec https://agentclientprotocol.com/protocol/v1/agent-plan that on end turn / idle the plan must be completed.

Looking at the claude-agent-acp implementation (this is the project made by Zed maintainer, to wrap the Claude Agent sdk for the ACP protocol), they don't seems to be doing the cleanup, only updating the plan based on the SDK TaskCreated and TaskCompleted hooks[^1].

[^1] https://github.com/agentclientprotocol/claude-agent-acp/blob/e9140a035a3465da02b3f55873bc6f6ec193c83a/src/acp-agent.ts#L1943-L1961
I would say that the "cleanup" is probably not needed 🤔

The agent may require user input, and ask something by ending the turn, with the current implementation all the plan would be marked as completed, which is probably not expected

cc @smagnuso

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I thought I had observed that it was happening on other agents, is it possible claude sends it internally and thus claude-agent-acp doesn't have to? Either way I'm not against removing it if unnecessary just seemed like it should close out.

@Petr28

Petr28 commented Aug 5, 2026

Copy link
Copy Markdown

Came here from the same gap — I independently arrived at the same core (todo.updated → sessionUpdate: "plan"), which makes me confident the approach is right. +1 to ship this.

On the open thread: I'd drop the session.idle cleanup. The ACP plan spec only describes the agent reporting status, not finalizing it at turn end. @axel7083's concern is real — a turn that ends to ask the user something would mark every started item completed, which is misleading. The todo.updated mapping + fingerprint dedup already give correct live progress; the cleanup adds risk for no spec benefit.

If you're low on bandwidth I'm happy to open a PR against this branch that removes the idle cleanup and rebases onto current dev, so this can move. Just say the word.

@smagnuso
smagnuso force-pushed the fix/acp-plan-todowrite branch from 262d150 to 72ea856 Compare August 5, 2026 23:14
@smagnuso

smagnuso commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Updated the PR

@Petr28

Petr28 commented Aug 19, 2026 •

Copy link
Copy Markdown

Hello,

CI checks are green ✅ and all open discussions seem to be resolved.

Could someone with merge permissions (e.g., @nexxeln, @thdxr, or other maintainers) take a final look and approve if everything looks good?

Also, could a maintainer please approve the workflows so that the CI checks (e2e, typecheck, unit) can run?

This feature would be a valuable addition for ACP clients.

Thanks!

@ArcticLampyrid

Copy link
Copy Markdown

I need this too.

@thdxr

thdxr commented Oct 10, 2026

Copy link
Copy Markdown
Member

This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2.

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] ACP: emit SessionUpdate::Plan from todowrite tool calls

5 participants