📏 fix: Make create_file Missing-Content Error Truncation-Aware (#14043)

A large SKILL.md/file authored in one create_file call can exceed the model's
max output token budget; the response is cut off before the content argument
finishes, the arg is dropped, and the handler returns a bare 'content is
required'. The model reads that as a forgotten field and retries the same
oversized write, looping.

Make the error actionable: tell the model the response may have been truncated
and to keep the main file lean, moving bulky sections into separate files
written in their own calls.
This commit is contained in:
Danny Avila 2026-06-30 19:31:48 -04:00 committed by GitHub
parent 9f8b6d92c0
commit 927a5957cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2274,7 +2274,12 @@ async function handleCreateFileCall(
return errorResult(tc, 'path is required');
}
if (typeof args.content !== 'string') {
return errorResult(tc, 'content is required');
return errorResult(
tc,
'content is required. If the file is large, your response may have been cut off at the ' +
'output token limit before content finished. Keep the main file lean and move bulky ' +
'sections (templates, schemas, long docs) into separate files written in their own calls.',
);
}
if (Buffer.byteLength(args.content, 'utf8') > MAX_AUTHORING_BYTES) {
return errorResult(tc, `content exceeds ${MAX_AUTHORING_BYTES} byte limit`);