Skip to content

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

TypeScript

fix(contract): raise Codex maxToolCalls to 64 and maxMessages to 256

Alfredo Lopez50ca0cab49da
diff --git a/packages/llm-provider-attempt-contract/index.cjs b/packages/llm-provider-attempt-contract/index.cjs
index 884c5e951..958fd2884 100644
--- a/packages/llm-provider-attempt-contract/index.cjs
+++ b/packages/llm-provider-attempt-contract/index.cjs
@@ -14,9 +14,10 @@ const TICKET_TYP = 'codex-execution-ticket'
const LIMITS = Object.freeze({
maxRequestBodyBytes: 1048576,
- maxMessages: 128,
+ maxMessages: 256,
// Bound calls in each assistant message independently of advertised definitions.
- maxToolCalls: 32,
+ // 64 matches the Grok contract; a turn of N calls adds N+1 messages, so N stays <= maxMessages/4.
+ maxToolCalls: 64,
maxOutputTokens: 16384,
maxDeadlineMs: 300000,
maxIdLength: 128,
diff --git a/packages/llm-provider-attempt-contract/index.d.ts b/packages/llm-provider-attempt-contract/index.d.ts
index c87ee6092..34c3626fb 100644
--- a/packages/llm-provider-attempt-contract/index.d.ts
+++ b/packages/llm-provider-attempt-contract/index.d.ts
@@ -15,8 +15,8 @@ export declare const TICKET_TYP: 'codex-execution-ticket'
export declare const LIMITS: {
readonly maxRequestBodyBytes: 1048576
- readonly maxMessages: 128
- readonly maxToolCalls: 32
+ readonly maxMessages: 256
+ readonly maxToolCalls: 64
readonly maxOutputTokens: 16384
readonly maxDeadlineMs: 300000
readonly maxIdLength: 128
diff --git a/packages/llm-provider-attempt-contract/index.test.cjs b/packages/llm-provider-attempt-contract/index.test.cjs
index f19287964..69d256c25 100644
--- a/packages/llm-provider-attempt-contract/index.test.cjs
+++ b/packages/llm-provider-attempt-contract/index.test.cjs
@@ -275,9 +275,9 @@ for (const count of [1, 32, 33, 83, 150, 250]) {
}
test('tool definition count never widens the independent assistant call limit', () => {
- assert.equal(contract.LIMITS.maxToolCalls, 32)
+ assert.equal(contract.LIMITS.maxToolCalls, 64)
assert.equal(Object.hasOwn(contract.LIMITS, 'maxTools'), false)
- for (const count of [32, 33]) {
+ for (const count of [64, 65]) {
const parsed = contract.parseCodexCompletionRequestV1({
...BASE,
tools: catalog(250),
@@ -285,8 +285,20 @@ test('tool definition count never widens the independent assistant call limit',
id: `call-${index}`, name: `eventasks__read_${index}`, arguments: {},
})) }],
})
- assert.equal(parsed.ok, count === 32)
- if (!parsed.ok) assert.equal(parsed.message, 'messages[0].toolCalls exceed 32')
+ assert.equal(parsed.ok, count === 64)
+ if (!parsed.ok) assert.equal(parsed.message, 'messages[0].toolCalls exceed 64')
+ }
+})
+
+test('message count is bounded at maxMessages', () => {
+ assert.equal(contract.LIMITS.maxMessages, 256)
+ for (const count of [256, 257]) {
+ const parsed = contract.parseCodexCompletionRequestV1({
+ ...BASE,
+ messages: Array.from({ length: count }, (_, index) => ({ role: 'user', content: `m${index}` })),
+ })
+ assert.equal(parsed.ok, count === 256)
+ if (!parsed.ok) assert.equal(parsed.message, 'messages exceed 256')
}
})