From 3d38eb5651b1788a172cfba0735b84d666287ce7 Mon Sep 17 00:00:00 2001 From: forrestlinfeng Date: Sat, 10 Oct 2026 17:55:14 +0800 Subject: [PATCH] Let the Hub default decide how many assets a recall returns Strategy recall sent `limit: 5` to /asset/fetch. It now sends only the prompt text, so the Hub's default applies (two assets today). Checked against the live Proxy: three sample prompts each came back with two assets in 2.3-3.7s, and each still had one priming would inject. Co-Authored-By: Claude Opus 5.5 --- src/prime.js | 9 +++------ test/prime.test.js | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/prime.js b/src/prime.js index 2913013..16808b0 100644 --- a/src/prime.js +++ b/src/prime.js @@ -3,11 +3,8 @@ // One round trip, not two: since evolver 2.0.39 `/asset/fetch` recalls by text // when it is given no ids, so selecting a candidate and materialising it are the -// same call. The pair it replaces had to buy its second hop out of the wait -// budget, and that budget only ever afforded two candidates; a recall returns -// whole assets, so this limit is about how many the Hub should rank, not about -// what the step can afford to wait for. -const RECALL_LIMIT = 5; +// same call. No `limit` is sent, so the Hub's own default decides how many come +// back (two at present). const MIN_PROMPT_CHARS = 8; const PROMPT_MAX_CHARS = 400; const STEP_MAX_CHARS = 400; @@ -132,7 +129,7 @@ export async function hubGene(proxyFetch, text, { return EMPTY_MATCH; } - const recalled = await proxyJson(proxyFetch, '/asset/fetch', { text, limit: RECALL_LIMIT }, signal); + const recalled = await proxyJson(proxyFetch, '/asset/fetch', { text }, signal); if (recalled.error) { onOutcome({ status: 'proxy_error', error: recalled.error }); return EMPTY_MATCH; diff --git a/test/prime.test.js b/test/prime.test.js index d12fc70..eb625ad 100644 --- a/test/prime.test.js +++ b/test/prime.test.js @@ -38,7 +38,7 @@ test('one call recalls by text and injects that asset\'s strategy alone', async const { ids, text } = await hubGene(proxyFetch, 'add a retry to the uploader', { signal: controller.signal }); assert.deepEqual(calls.map((call) => call.path), ['/asset/fetch']); - assert.deepEqual(calls[0].body, { text: 'add a retry to the uploader', limit: 5 }); + assert.deepEqual(calls[0].body, { text: 'add a retry to the uploader' }, 'no limit: the Hub default decides'); assert.ok(!('asset_ids' in calls[0].body), 'ids would turn the recall back into a lookup'); assert.equal(calls[0].signal, controller.signal); assert.deepEqual(ids, ['sha256:abc']); @@ -54,7 +54,7 @@ test('a bounded prompt reaches the Hub, and a trivial one never does', async () const long = stubProxy({ assets: [] }); await hubGene(long.proxyFetch, 'x'.repeat(5_000)); assert.ok(long.calls[0].body.text.length <= 5_000); - assert.equal(long.calls[0].body.limit, 5); + assert.equal('limit' in long.calls[0].body, false); const trivial = stubProxy({ assets: [ASSET] }); assert.deepEqual(await hubGene(trivial.proxyFetch, 'hi'), { ids: [], text: '' });