← Back to PRs

#14472: fix(skills): map command-dispatch tool args to primary required param (#14326)

by lailoo open 2026-02-12 06:06 View on GitHub →
stale size: S
## Summary Fixes #14326 ## Problem When a skill exposes a tool whose primary required parameter is not named `command` (e.g. `sessions_spawn` uses `prompt`), the command-dispatch path passes `rawArgs` only as `args.command`. The tool receives an empty primary param and fails silently or produces wrong results. ## Fix Add `resolveToolPrimaryArgKey()` that inspects the tool's JSON schema to find the first required string parameter. When dispatching, map `rawArgs` to that key instead of always using `command`. ## Reproduction & Verification ### Before fix (main branch) — Bug confirmed: - No test file `get-reply-inline-actions-dispatch.test.ts` exists on main. - `rawArgs` is always mapped to `args.command`, ignoring the tool schema's actual required parameter name. ### After fix — All verified: ``` ✓ resolveToolPrimaryArgKey > returns first required string param from sessions_spawn schema (#14326) ✓ resolveToolPrimaryArgKey > returns null when tool has no parameters ✓ resolveToolPrimaryArgKey > returns null when no required params exist ✓ resolveToolPrimaryArgKey > returns first required param even if not string type ✓ resolveToolPrimaryArgKey > prefers first required string over non-string required ✓ resolveToolPrimaryArgKey > returns 'command' when command is the first required string ✓ command-dispatch tool arg mapping > maps rawArgs to primary arg key when different from 'command' ✓ command-dispatch tool arg mapping > does not duplicate when primary arg key is 'command' 8 tests pass (pnpm vitest run src/auto-reply/reply/get-reply-inline-actions-dispatch.test.ts) ``` ## Testing - ✅ 8 tests pass (`pnpm vitest run src/auto-reply/reply/get-reply-inline-actions-dispatch.test.ts`) - ✅ Lint passes

Most Similar PRs