Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(large-pages): an over-ceiling brain_put_page is refused before admission

garrytanb47ed1b26db1
diff --git a/test/brain-allowlist.test.ts b/test/brain-allowlist.test.ts
index 6377d661e0..44a67bcfc5 100644
--- a/test/brain-allowlist.test.ts
+++ b/test/brain-allowlist.test.ts
@@ -349,7 +349,9 @@ describe('brain_put_page pins undeclared model-authored types (#4852)', () => {
]) {
const error = await tool.execute({ slug: 'wiki/personal/patterns/rejected', content, request_id: randomUUID() },
{ engine, jobId: 1, remote: true }).then(() => null, error => error);
- expect(error).toMatchObject({ code, writeRequest: { state: 'failed' } });
+ // Invalid YAML fails its admitted request; an over-ceiling body is refused before admission (no request).
+ if (code === 'request_too_large') expect(error).toMatchObject({ code, writeRequest: undefined });
+ else expect(error).toMatchObject({ code, writeRequest: { state: 'failed' } });
expect(error.message).not.toContain('private_marker');
expect(await engine.getPage('wiki/personal/patterns/rejected', { sourceId: 'default' })).toBeNull();
}
diff --git a/test/subagent-put-page-rejection.serial.test.ts b/test/subagent-put-page-rejection.serial.test.ts
index c77e196feb..525feb2826 100644
--- a/test/subagent-put-page-rejection.serial.test.ts
+++ b/test/subagent-put-page-rejection.serial.test.ts
@@ -73,7 +73,9 @@ describe('put_page result normalization', () => {
for (const [content, code] of [['---\ntitle: [\n---\nbody', 'invalid_params'], ['x'.repeat(MAX_FILE_SIZE + 1), 'request_too_large']]) {
const failure = await tool.execute({ slug: 'wiki/agents/1/rejected', content, request_id: randomUUID() }, { engine, jobId: 1, remote: true })
.then(() => null, error => error);
- expect(failure).toMatchObject({ code, writeRequest: { state: 'failed' } });
+ // Invalid YAML fails its admitted request; an over-ceiling body is refused before admission (no request).
+ if (code === 'request_too_large') expect(failure).toMatchObject({ code, writeRequest: undefined });
+ else expect(failure).toMatchObject({ code, writeRequest: { state: 'failed' } });
expect(failure.message).not.toContain(content);
expect(await engine.getPage('wiki/agents/1/rejected', { sourceId: 'default' })).toBeNull();
}