Skip to content

Commit 2881f1c

Browse files
committed
fix(providers): make the tool-call id argument required, not optional
The TSDoc claimed a provider that cannot supply an id would fail to compile, but the parameter was declared `toolCallId?: string` — so a new call site could omit it entirely, typecheck, and silently take the unstable-token path the positional parameter exists to close. The comment promised a guarantee the type did not enforce. It is now `string | undefined`: required in position, nullable in value. A provider with no model-supplied id must pass `undefined` explicitly and take the loud fallback, rather than being able to forget the argument. All 27 existing call sites already pass it, so this is enforcement only. Verified by deleting the argument at one site: `tsc` rejects it.
1 parent 63e1b28 commit 2881f1c

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

apps/sim/providers/utils.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,12 +1574,13 @@ export function prepareToolExecution(
15741574
/**
15751575
* The model's own id for this tool call, read from the provider's response.
15761576
*
1577-
* Passed positionally because every provider already has the tool call in
1578-
* scope at this point but names it differently, and because a provider that
1579-
* cannot supply one should fail to compile rather than silently fall through
1580-
* to the unstable-token path.
1577+
* Required rather than optional — `string | undefined` — so the argument
1578+
* cannot be forgotten. A provider with no model-supplied id must pass
1579+
* `undefined` explicitly and take the loud fallback; omitting it entirely
1580+
* would silently leave `invocationId` unset, which is the unstable-token path
1581+
* this parameter exists to close.
15811582
*/
1582-
toolCallId?: string
1583+
toolCallId: string | undefined
15831584
): {
15841585
toolParams: Record<string, any>
15851586
executionParams: Record<string, any>

0 commit comments

Comments
 (0)