Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(mcp): batching-clause allowance on the instruction size gate (round 4 instruction 7, DEV-RECORD.md on gbrain-evals#93), recorded sizes, and query param pins on the served wording

garrytan3e4ff61ce1ac
diff --git a/test/mcp-initialize-instructions.test.ts b/test/mcp-initialize-instructions.test.ts
index 0ff162ecdf..12af80746c 100644
--- a/test/mcp-initialize-instructions.test.ts
+++ b/test/mcp-initialize-instructions.test.ts
@@ -37,7 +37,14 @@ function namedTools(text: string): string[] {
const PRE_F1_BYTES = 4042;
/** #6007: the issue's acceptance criteria require write guidance (put_pages, wait_ms) in initialize. */
const WRITING_CLAUSE_BYTES = 240;
-const LANE_I_CEILING = Math.floor(PRE_F1_BYTES * 1.15) + WRITING_CLAUSE_BYTES;
+/**
+ * Cat 40 Hard round 4 (fa520b72b): instruction 7's batching clause (resolve many
+ * names or codes in one call, issue independent calls together) added 194 bytes
+ * on every surface serving `entity` and `search`; measured in DEV-RECORD.md on
+ * gbrain-evals#93 (round 4, pooled +4.9 points over fs).
+ */
+const BATCHING_CLAUSE_BYTES = 200;
+const LANE_I_CEILING = Math.floor(PRE_F1_BYTES * 1.15) + WRITING_CLAUSE_BYTES + BATCHING_CLAUSE_BYTES;
/** Claude Code reads only the first 2,048 characters of a server's initialize instructions. */
const HARNESS_READ_LIMIT = 2_048;
@@ -84,7 +91,8 @@ describe('F1 generated instructions', () => {
test('recorded tail-free instruction sizes per surface', () => {
// #6007: starter +140 and full +230 for the write guidance (wait_ms; put_pages where it is served), within WRITING_CLAUSE_BYTES.
// #6170: the error clause was shortened and the forget caveat moved; every surface shrank (2_243 / 4_686 / 4_837 before).
- const recorded = { verbs: 2_186, starter: 4_630, full: 4_781 };
+ // Cat 40 Hard round 4: instruction 7's batching clause (BATCHING_CLAUSE_BYTES); starter 4_630 -> 4_824 and full 4_781 -> 4_975.
+ const recorded = { verbs: 2_186, starter: 4_824, full: 4_975 };
for (const surface of SURFACES) {
const listed = new Set(filterOpsForSurface(operations, surface).map(o => o.name));
const size = buildMcpInstructions({ tools: { callable: n => listed.has(n) } }).length;
diff --git a/test/search/query-op-adaptive-return.test.ts b/test/search/query-op-adaptive-return.test.ts
index be1c5a3421..a778c4a30c 100644
--- a/test/search/query-op-adaptive-return.test.ts
+++ b/test/search/query-op-adaptive-return.test.ts
@@ -21,9 +21,10 @@ describe('query op — adaptive_return agent surface', () => {
test('description teaches the agent WHEN to use it (single-answer vs breadth)', () => {
const desc = (query.params?.adaptive_return as { description?: string })?.description ?? '';
// Must instruct the agent on both directions of the decision.
- expect(desc.toLowerCase()).toContain('true when');
+ // When to set it: true for one answer; omit for breadth.
+ expect(desc.toLowerCase()).toContain('true for one answer');
expect(desc.toLowerCase()).toContain('breadth');
// Must reassure the safety contract so the agent isn't afraid to use it.
- expect(desc.toLowerCase()).toContain('never returns empty');
+ expect(desc.toLowerCase()).toContain('never empty');
});
});
diff --git a/test/search/query-op-autocut.test.ts b/test/search/query-op-autocut.test.ts
index 35a73dd90c..73529662ec 100644
--- a/test/search/query-op-autocut.test.ts
+++ b/test/search/query-op-autocut.test.ts
@@ -26,10 +26,13 @@ describe('query op — autocut agent surface', () => {
// The actionable direction is FALSE for breadth.
expect(desc).toContain('false');
expect(desc).toContain('breadth');
- // Safety contract so the agent trusts it.
- expect(desc).toContain('never returns empty');
- // Distinguish from adaptive_return so the agent picks the right knob.
- expect(desc).toContain('adaptive_return');
+ // Safety contract so the agent trusts it: the result is never empty.
+ expect(desc).toContain('never empty');
+ // Distinguish from adaptive_return so the agent picks the right knob: autocut's
+ // override is false for breadth, adaptive_return's is true for one answer.
+ const adaptive = ((query.params?.adaptive_return as { description?: string })?.description ?? '').toLowerCase();
+ expect(desc).toContain('false: full top-k for breadth');
+ expect(adaptive).toContain('true for one answer');
});
test('search op (keyword-only) does NOT carry autocut (no reranker there)', () => {