← Back to PRs

#8874: Fix parameter order in execute function

by andycaihello open 2026-02-04 14:47 View on GitHub →
docs agents stale
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