Skip to content

fix: support ACP question prompts via extMethod#20017

Open
hikaruczl wants to merge 1 commit intoanomalyco:devfrom
hikaruczl:feat/acp-question-sst
Open

fix: support ACP question prompts via extMethod#20017
hikaruczl wants to merge 1 commit intoanomalyco:devfrom
hikaruczl:feat/acp-question-sst

Conversation

@hikaruczl
Copy link
Copy Markdown

@hikaruczl hikaruczl commented Mar 30, 2026

Issue for this PR

Closes #17920

Type of change

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

What does this PR do?

ACP mode was still exposing a gap around the question tool: the tool can be opt-in enabled, but ACP had no bridge for question.asked, so ACP sessions could not complete the question/reply flow.

This PR keeps the default ACP behavior unchanged and only enables ACP question prompts when both of these are true:

  • OPENCODE_ENABLE_QUESTION_TOOL=1
  • the ACP client advertises _meta["opencode/question"]

When that capability is present, packages/opencode/src/acp/agent.ts forwards question.asked to the ACP client through extMethod("opencode/question", ...), then maps the response back to the existing sdk.question.reply(...) / sdk.question.reject(...) APIs.

I also updated the ACP README with the extension contract and added targeted event-subscription coverage for both reply and reject flows.

I chose the ACP extension route instead of requestPermission() because question prompts are not the same thing as permission prompts, and I wanted the ACP bridge to use an explicit, capability-gated question path.

How did you verify your code works?

I tested locally with:

  • bun test ./test/acp/event-subscription.test.ts
  • bun test ./test/tool/question.test.ts
  • bun test ./test/acp/agent-interface.test.ts
  • bun run typecheck

Screenshots / recordings

N/A

Checklist

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

@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Mar 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Related PR Found:

Relationship: This earlier PR addresses question tool support in ACP mode. The current PR (20017) builds upon this by adding support for ACP question prompts via the extMethod mechanism and bridging question.asked events to ACP clients. They both relate to enabling question functionality in ACP contexts, though they appear to address different aspects of the feature.

@hikaruczl
Copy link
Copy Markdown
Author

Thanks — I checked #18657 and it does overlap with the same ACP question.asked gap.

The main difference is approach:

I took the extension-based approach intentionally because question is semantically different from permission, and the existing question model can include richer interactions that do not map cleanly onto requestPermission().

So this PR is meant as an alternative design for the same bug, not an independent feature. If maintainers prefer the minimal requestPermission() bridge from #18657, I am happy to close this in favor of that approach.

@github-actions github-actions bot removed needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Mar 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@kennylbj
Copy link
Copy Markdown

kennylbj commented Apr 5, 2026

I prefer extension-based way because it allows user to input custom text compared to requestPermission

hope this pr could be merged ASAP

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.

Question tool hangs in ACP mode

2 participants