Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(grok): name the tool-call limit instead of reporting an outage

Alfredo Lopez125b6c51feb4
diff --git a/grok-llm-proxy/src/grokTransport.ts b/grok-llm-proxy/src/grokTransport.ts
index 21bc70362..b394f3c01 100644
--- a/grok-llm-proxy/src/grokTransport.ts
+++ b/grok-llm-proxy/src/grokTransport.ts
@@ -51,7 +51,8 @@ export const GROK_UPSTREAM_TEMPERATURE_PROBE_CONFIRMED: boolean = false
export class GrokTransportError extends Error {
constructor(
readonly code: string,
- message: string
+ message: string,
+ readonly details?: Readonly<Record<string, number | string>>
) {
super(message)
this.name = 'GrokTransportError'
@@ -385,15 +386,17 @@ async function consumeSse(
const acceptFrame = async (frame?: StreamFrame): Promise<void> => {
if (pending.size > LIMITS.maxToolCalls) {
throw new GrokTransportError(
- 'provider_unavailable',
- `tool calls exceed ${LIMITS.maxToolCalls}`
+ 'tool_call_limit_exceeded',
+ `tool calls exceed ${LIMITS.maxToolCalls}`,
+ { limit: LIMITS.maxToolCalls, observed: pending.size }
)
}
if (frame?.type === 'tool_call') {
if (toolFrames.length >= LIMITS.maxToolCalls) {
throw new GrokTransportError(
- 'provider_unavailable',
- `tool calls exceed ${LIMITS.maxToolCalls}`
+ 'tool_call_limit_exceeded',
+ `tool calls exceed ${LIMITS.maxToolCalls}`,
+ { limit: LIMITS.maxToolCalls, observed: toolFrames.length + 1 }
)
}
const canonicalName = names.fromWire(frame.name)