Skip to main content

deriveCallIdempotencyKey

@forge/monorepo


@forge/monorepo / backend/src / deriveCallIdempotencyKey

Function: deriveCallIdempotencyKey()

deriveCallIdempotencyKey(input): IdempotencyKey

Defined in: backend/src/idempotency/index.ts:65

The key for a call the runtime identifies by its arguments rather than by a provider tool-call id (docs/04 → Approvals, Idempotency).

A resumed approval has no tool-call id to derive from: the call it executes came off a stored interaction, not out of a model stream. Two properties matter, and they pull in opposite directions. It is run-scoped, so "publish this" today and the same call next week do not collide — a key shared across runs would return the first result and never publish the second. And it is argument-derived, so within one run the same logical call collides with itself: the model re-asking for a publish it already asked for finds the same approval and the same stored result, rather than a second approval and a second publish.

Derive it from normalised arguments. A schema that lowercases a channel would otherwise give one logical call two keys, and the second would not see the first's result.

Parameters

input

args

unknown

runId

RunId

tenantId

TenantId

toolName

string

Returns

IdempotencyKey