Skip to content

fix(copilot): parse toolArgs JSON string into canonical object#212

Open
swjng wants to merge 1 commit into
symposium-dev:mainfrom
swjng:feat/parse-copilot-tool-args
Open

fix(copilot): parse toolArgs JSON string into canonical object#212
swjng wants to merge 1 commit into
symposium-dev:mainfrom
swjng:feat/parse-copilot-tool-args

Conversation

@swjng
Copy link
Copy Markdown
Contributor

@swjng swjng commented May 12, 2026

What does this PR do?

Fixes the "toolArgs not parsed (Copilot)" entry in md/design/common-issues.md.

Copilot sends toolArgs as a JSON-encoded string (per its protocol). The current CopilotPreToolUseInput::to_symposium passes that Value::String straight into the canonical PreToolUseInput.tool_input, which other agents populate as an object. Downstream builtin handlers and cross-agent plugins doing tool_input.get("command") silently miss.

This PR:

  • Parses toolArgs at the to_symposium boundary for both PreToolUse and PostToolUse.
  • Mirrors the inverse in from_symposium so Copilot wire format is preserved on the way out.
  • Adds parse + roundtrip tests for both events.
  • Removes the resolved entry from 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-use into a real plugin script's stdin:

Branch plugin tool_input type
main "{\"command\":\"ls\"}" string
this PR {"command":"ls"} object
Disclosure questions

AI disclosure. The AI tool authored large parts of the code

Confidence level. I am very happy with it

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>
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.

1 participant