#8874: Fix parameter order in execute function
docs
agents
stale
Cluster:
Error Handling in Agent Tools
Fix parameter order in execute function
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates the `ToolDefinition.execute` adapter to use a new parameter order (passing `signal` before `onUpdate`), and removes the previous runtime/type-level compatibility layer that supported multiple execute signatures. It also drops a session-file repair call in the embedded compaction path and includes some formatting-only churn in generated zh-CN doc templates.
The adapter change is central: `splitSdkTools` routes all agent tools through `toToolDefinitions`, and embedded runs also wrap client tools via `toClientToolDefinitions`, so any mismatch in execute parameter ordering affects tool abort handling and update callbacks across providers.
<h3>Confidence Score: 3/5</h3>
- Moderate risk: likely fine if the upstream execute signature is exactly as assumed, but the adapter change removes safeguards that previously prevented silent argument-order breakage.
- Core functionality is small and localized, but `toToolDefinitions` sits on a hot path for all tool calls. The new hard-coded execute signature can silently swap `signal`/`onUpdate` if upstream or any caller still uses the older order, which would impact abort behavior and tool updates. Docs/comment churn is low risk.
- src/agents/pi-tool-definition-adapter.ts (execute signature/compat), src/agents/pi-embedded-runner/compact.ts (removed repair + stray comment), src/agents/pi-embedded-runner/run/attempt.ts (stray comment)
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#9861: fix(agents): re-run tool_use/tool_result repair after limitHistoryT...
by CyberSinister · 2026-02-05
76.6%
#10975: fix: add missing clientTools parameter to runEmbeddedAttempt call
by xamdel · 2026-02-07
76.3%
#11854: fix: resolve per-agent tools.exec config in pi-tools
by Yida-Dev · 2026-02-08
75.7%
#7760: fix(agents): resolve message ordering conflict during tool execution
by aryan877 · 2026-02-03
75.7%
#11274: fix(tools): truncate overly long tool names for API compatibility
by avirweb · 2026-02-07
75.6%
#20382: fix: move suppressToolErrors check before mutating tool check
by klawdius-noodle · 2026-02-18
75.3%
#8332: fix: add per-tool-call timeout to prevent agent hangs (v2 - fixes m...
by vishaltandale00 · 2026-02-03
75.2%
#7525: Agents: skip errored tool calls during pairing
by justinhuangcode · 2026-02-02
75.0%
#9085: fix: improve stability for terminated responses and telegram retries
by vladdick88 · 2026-02-04
75.0%
#9339: fix: enhance OpenAI compatibility for tool calling
by 0xrushi · 2026-02-05
75.0%