[BUG] Remote Control: AskUserQuestion answered from the web reaches PostToolUse hooks without the call's `metadata`
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Observed (hook log, same session, same agent call shape)
| Answered in | Agent's tool_use input keys (transcript) | Hook tool_input keys | Hook tool_response keys | Key order |
|---|---|---|---|---|
| Terminal | questions, metadata | questions, metadata, answers, annotations | questions, answers, annotations | as authored |
| Web | questions, metadata | answers, questions | questions, answers | alphabetical (header, multiSelect, options, question; description, label) |
The hook runs in both cases, but for the web answer the metadata the agent passed is missing from the hook's tool_input, annotations are missing, and the questions are re-serialized. The transcript's toolUseResult has the same difference. Records identify the client nowhere (entrypoint is cli for both).
Impact
Hooks that use AskUserQuestion's metadata to identify what a question was about (for example to record a decision) silently lose web answers. Requests: keep the original tool_input fields (at least metadata) when an answer arrives from Remote Control; optionally record the answering client.
What Should Happen?
In both cases the hook's tool_input contains the input the agent passed to the call (including metadata), as it does when the question is answered in the terminal, so a hook can tell which call was answered.
Error Messages/Logs
Steps to Reproduce
- In an empty directory, add
.claude/settings.jsonwith a PostToolUse hook (matcher*) that logs the key names of the hook input'stool_inputandtool_response. - Start
claudethere. Have the agent call AskUserQuestion with one question andmetadata: { "source": "probe-1" }. Answer it in the terminal. - Connect the session to Remote Control. Have the agent make the same call with
metadata: { "source": "probe-3" }. Answer it in the web interface.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.296
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
_No response_