fix(copilot): parse toolArgs JSON string into canonical object#212
Open
swjng wants to merge 1 commit into
Open
fix(copilot): parse toolArgs JSON string into canonical object#212swjng wants to merge 1 commit into
toolArgs JSON string into canonical object#212swjng wants to merge 1 commit into
Conversation
Copilot's hook protocol sends `toolArgs` as a JSON-encoded string
(e.g. `"{\"command\":\"ls\"}"`), but the canonical
`PreToolUseInput.tool_input` is a structured `Value` populated as an
object by every other agent. `CopilotPreToolUseInput::to_symposium`
passed the raw `Value::String` straight through, so downstream
builtin handlers and cross-agent plugins reading
`tool_input.get("command")` silently missed.
Parse the string at the `to_symposium` boundary, and re-stringify in
`from_symposium` so the Copilot wire format is preserved on the way
out. Cover Pre/Post-ToolUse in both directions, plus tests.
Removes the matching entry from `md/design/common-issues.md`.
Co-authored-by: Claude <claude@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes the "
toolArgsnot parsed (Copilot)" entry inmd/design/common-issues.md.Copilot sends
toolArgsas a JSON-encoded string (per its protocol). The currentCopilotPreToolUseInput::to_symposiumpasses thatValue::Stringstraight into the canonicalPreToolUseInput.tool_input, which other agents populate as an object. Downstream builtin handlers and cross-agent plugins doingtool_input.get("command")silently miss.This PR:
toolArgsat theto_symposiumboundary for bothPreToolUseandPostToolUse.from_symposiumso Copilot wire format is preserved on the way out.common-issues.md.Same-agent passthrough (
hook.rs:388) is unaffected; only the cross-agent / canonical paths change.End-to-end verification
Piped the GitHub-documented Copilot payload through
cargo-agents hook copilot pre-tool-useinto a real plugin script's stdin:tool_inputmain"{\"command\":\"ls\"}"{"command":"ls"}Disclosure questions
AI disclosure. The AI tool authored large parts of the code
Confidence level. I am very happy with it