From 6ab41c6e37b79757b7e62ae5199a2ef1b9778058 Mon Sep 17 00:00:00 2001 From: Lily Shen <115414357+lilyshen0722@users.noreply.github.com> Date: Thu, 15 Oct 2026 19:34:18 -0700 Subject: [PATCH 1/2] test(hosted): pin that the hosted offer's limits come from the cap source, not a literal Sprint Review's finding on #2250 (review 5542338255): the arm "states the limits the meter enforces" compares the tool description with hostedCaps(), the same source it is built from, so a hardcoded literal matching today's caps passes it. Measured there: literal swapped in, 22/22 still green. The new arm loads nativeRuntimeService in isolation under other caps (HOSTED_TURNS_PER_DAY=7, _PRO=70, HOSTED_AGENTS_PER_USER=2) and asserts the description follows them. Mutation: the hardcoded literal from the review fails it (1 failed, 9 passed); the derived line passes. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0157AG2wo8mJYqKezXNs48Ya --- .../nativeRuntimeService.toolGating.test.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/backend/__tests__/unit/services/nativeRuntimeService.toolGating.test.js b/backend/__tests__/unit/services/nativeRuntimeService.toolGating.test.js index 252ae3871c..dc308fee32 100644 --- a/backend/__tests__/unit/services/nativeRuntimeService.toolGating.test.js +++ b/backend/__tests__/unit/services/nativeRuntimeService.toolGating.test.js @@ -93,6 +93,22 @@ describe('toolsForConfig', () => { expect(offer.function.description).toMatch(/no invitation code/); }); + // Sprint Review on #2250: the arm above compares the description with + // hostedCaps(), the source it is built from, so a hardcoded literal matching + // today's caps passes it too. Loaded under other caps, only a description + // derived from the cap source follows. + test('the hosted offer follows the cap source, so it cannot be a copied literal', () => { + const caps = { HOSTED_TURNS_PER_DAY: '7', HOSTED_TURNS_PER_DAY_PRO: '70', HOSTED_AGENTS_PER_USER: '2' }; + withEnv(caps, () => { + jest.isolateModules(() => { + // eslint-disable-next-line global-require + const { TOOLS: reloaded } = require('../../../services/nativeRuntimeService'); + const offer = reloaded.find((t) => t.function.name === 'commonly_offer_hosted_agent'); + expect(offer.function.description).toContain('2 hosted agents per account and 7 turns a day (70 on Pro)'); + }); + }); + }); + test('agent_status is declaration-gated like every other tool', () => { // Scout declares it; a legacy config or a minimal allowlist does not // receive it implicitly. From 020641add2a353230febbc8f0c5096804f666415 Mon Sep 17 00:00:00 2001 From: Lily Shen <115414357+lilyshen0722@users.noreply.github.com> Date: Thu, 15 Oct 2026 20:00:34 -0700 Subject: [PATCH 2/2] test(hosted): pin the label on the "Connect your first agent" card, and mock only the writer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sprint Review's two findings on #2252 (review 5542388348): - `expect(agentLabel).toBeTruthy()` passed with the whole fallback chain replaced by 'x' (96/96 green), yet the label is user-visible in the card's "Completed automatically —