mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-20 21:23:23 +00:00
fix(agents): preserve missing markers under tight bootstrap caps
This commit is contained in:
@@ -89,4 +89,14 @@ describe("buildBootstrapContextFiles", () => {
|
||||
});
|
||||
expect(result).toEqual([]);
|
||||
});
|
||||
|
||||
it("keeps missing markers under small total budgets", () => {
|
||||
const files = [makeFile({ missing: true, content: undefined })];
|
||||
const result = buildBootstrapContextFiles(files, {
|
||||
totalMaxChars: 20,
|
||||
});
|
||||
expect(result).toHaveLength(1);
|
||||
expect(result[0]?.content.length).toBeLessThanOrEqual(20);
|
||||
expect(result[0]?.content.startsWith("[MISSING]")).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -198,12 +198,6 @@ export function buildBootstrapContextFiles(
|
||||
if (remainingTotalChars <= 0) {
|
||||
break;
|
||||
}
|
||||
if (remainingTotalChars < MIN_BOOTSTRAP_FILE_BUDGET_CHARS) {
|
||||
opts?.warn?.(
|
||||
`remaining bootstrap budget is ${remainingTotalChars} chars (<${MIN_BOOTSTRAP_FILE_BUDGET_CHARS}); skipping additional bootstrap files`,
|
||||
);
|
||||
break;
|
||||
}
|
||||
if (file.missing) {
|
||||
const missingText = `[MISSING] Expected at: ${file.path}`;
|
||||
const cappedMissingText = clampToBudget(missingText, remainingTotalChars);
|
||||
@@ -217,6 +211,12 @@ export function buildBootstrapContextFiles(
|
||||
});
|
||||
continue;
|
||||
}
|
||||
if (remainingTotalChars < MIN_BOOTSTRAP_FILE_BUDGET_CHARS) {
|
||||
opts?.warn?.(
|
||||
`remaining bootstrap budget is ${remainingTotalChars} chars (<${MIN_BOOTSTRAP_FILE_BUDGET_CHARS}); skipping additional bootstrap files`,
|
||||
);
|
||||
break;
|
||||
}
|
||||
const fileMaxChars = Math.max(1, Math.min(maxChars, remainingTotalChars));
|
||||
const trimmed = trimBootstrapContent(file.content ?? "", file.name, fileMaxChars);
|
||||
const contentWithinBudget = clampToBudget(trimmed.content, remainingTotalChars);
|
||||
|
||||
Reference in New Issue
Block a user