Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/asil-runners/src/__tests__/wiring.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ describe('wiring', () => {
{ role: 'system', content: 'sys' },
{ role: 'user', content: 'user' },
]);
// Default max_tokens must be high enough for whole-file rewrites —
// 4096 truncated large files mid-output and the patch was rejected.
// A live gpt-4o grind surfaced this. (Matches the Anthropic caller.)
expect(body.max_tokens).toBe(8192);
});

it('omits Authorization header when apiKey is unset (many local servers ignore auth)', async () => {
Expand Down
7 changes: 5 additions & 2 deletions packages/asil-runners/src/wiring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ export interface OpenAICompatibleOptions {
apiKey?: string;
/** Path appended to baseUrl. Default `/chat/completions`. */
endpoint?: string;
/** Max output tokens per call. Default 4096. */
/** Max output tokens per call. Default 8192 — matches the Anthropic
* caller. The executor rewrites WHOLE files, so a low cap truncates
* large-file rewrites mid-output (the closing `<<<END FILE>>>`
* sentinel gets cut), and the patch is rejected. 4096 was too low. */
maxTokens?: number;
/** Injectable fetch for tests. Defaults to global fetch. */
fetchImpl?: typeof fetch;
Expand Down Expand Up @@ -233,7 +236,7 @@ function postOpenAICompatible(
headers,
body: JSON.stringify({
...body,
max_tokens: opts.maxTokens ?? 4096,
max_tokens: opts.maxTokens ?? 8192,
}),
}).then(async (response) => {
if (!response.ok) {
Expand Down
Loading