Skip to content

fix(opencode): bridge question tool to ACP elicitation - #42158

Closed
pjaol wants to merge 2 commits into
anomalyco:devfrom
thevgergroup:acp-elicitation-support
Closed

pjaol wants to merge 2 commits into
anomalyco:devfrom
thevgergroup:acp-elicitation-support

Conversation

@pjaol

@pjaol pjaol commented Aug 12, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #38121

Type of change

  • Bug fix

What does this PR do?

The question tool blocked indefinitely in ACP mode. The root cause: question.asked events carry a QuestionV2 request ID that must be passed to sdk.question.reply/reject to unblock the waiting deferred — but the event subscription never handled these events at all, so the deferred never settled.

The fix wires question.asked and question.v2.asked into the existing event handler switch and forwards them to a new ACPElicitation.Handler. The handler calls unstable_createElicitation when the connected client advertises elicitation support (set during initialize), and falls back to auto-reject otherwise — preserving current behaviour for non-elicitation clients.

How did you verify your code works?

Unit tests cover: accept, decline, cancel, unsupported client auto-reject, elicitation error, multi-question form, multi-select array schema, empty question list, unknown session, message.part.updated not triggering elicitation, missing toolCallId, and question.v2.asked.

Integration tests (subprocess) cover the accept path end-to-end with a real opencode process, auto-reject when the client omits elicitation capability, and the decline path.

Also verified against a live Docker Compose environment with nsjail: create_elicitation arrives over the ACP wire with the correct schema, the form renders, and the accepted answer is injected back into the model turn.

Checklist

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

pjaol added 2 commits August 12, 2026 17:59
The question tool blocked indefinitely in ACP mode because the event
handler was never wired up. question.asked events carry a QuestionV2
request ID that must be used for reply/reject — the tool call ID from
message.part.updated is different and using it never unblocked the
waiting Deferred.

Fix: listen for question.asked and question.v2.asked events in the
event subscription and forward them to a new ACPElicitation.Handler.
The handler calls unstable_createElicitation when the client advertises
elicitation support, and falls back to auto-reject otherwise.

Fixes anomalyco#38121
@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

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.

ACP: support elicitation for V2 forms and questions

1 participant