Skip to content

Commit ad1627d

Browse files
junjun
authored andcommitted
test(kiro): assert the byte budget holds when exec is reserved
The byte-budget regression asserted only that the serialized name list was non-empty, which passes even if exec were admitted on top of an already-full catalog -- the exact failure mode the projected-array measurement exists to prevent. Assert the real invariant instead: exec is present, the catalog is genuinely truncated, and the emitted specs stay within MAX_KIRO_TOOL_CATALOG_BYTES. Found by the pre-merge review lane.
1 parent 605c07b commit ad1627d

2 files changed

Lines changed: 70 additions & 5 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# wp3 — ship: branch, gates, PR against `dev`
2+
3+
Unit: `260827_kiro_subagent_delegation_unblock` · work-phase `wp3`
4+
5+
## What is being shipped
6+
7+
Branch `codex/kiro-subagent-delegation-unblock`, cut from `origin/dev`
8+
`a57b9620`, three commits:
9+
10+
| commit | content |
11+
|---|---|
12+
| `0cfbb394a` | wp1 — enable the code-mode catalog nudge for Kiro |
13+
| `e1019d30d` | wp2 — reserve catalog room for the code-mode execution path |
14+
| `605c07bd5` | wp2 evidence devlog |
15+
16+
## Pre-flight state
17+
18+
| check | result |
19+
|---|---|
20+
| `bun x tsc --noEmit` | exit 0 |
21+
| `bun run test` | exit 0, 15185 tests / 951 files |
22+
| `bun run privacy:scan` | `Privacy scan passed` |
23+
| working tree | clean |
24+
| `gh auth status` | logged in as `lidge-jun` |
25+
26+
`privacy:scan` is run because `src/AGENTS.md:27` requires it for changes touching
27+
requests or logging, and this unit changes what is injected into an upstream
28+
request body.
29+
30+
## PR requirements this repo enforces
31+
32+
From `AGENTS.md` and `.github/PULL_REQUEST_TEMPLATE.md`:
33+
34+
- Target `dev`. `main` is release-only, and the `enforce-target` check rejects
35+
wrong-base PRs.
36+
- Fill every template section: Summary, Verification, Checklist. `enforce-target`
37+
also rejects empty, thin, or malformed descriptions.
38+
- No GUI screenshot needed: nothing under `gui/` is touched.
39+
- No `Closes #N`: this unit has no filed issue.
40+
41+
## Push authorization
42+
43+
`DEV-GIT-PUSH-01` makes pushing an ESCALATE action requiring explicit user
44+
approval. Granted in the originating request: *"구현완료하고 pr 올려놔 별도 브랜치
45+
잡고 출발"* — that names the branch and the PR, so the approval covers pushing
46+
this branch and opening this PR. It does not extend to promoting to `main`,
47+
merging, or any other remote mutation.
48+
49+
## Sequence
50+
51+
1. `git push -u origin codex/kiro-subagent-delegation-unblock`
52+
2. `gh pr create --base dev` with the filled template
53+
3. Verify the PR renders, targets `dev`, and reports its checks
54+
55+
## Acceptance
56+
57+
PR exists, targets `dev`, description carries all three template sections with
58+
real verification output, and the URL is reported to the user.

‎tests/kiro-adapter.test.ts‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,19 +1394,26 @@ describe("kiro code-mode exec survives the catalog budget", () => {
13941394
expect(notice).not.toContain(gateway.name);
13951395
});
13961396

1397-
test("a byte-budget catalog still reserves room for exec", async () => {
1397+
test("a byte-budget catalog reserves room for exec without breaching the budget", async () => {
13981398
// The count budget is the easy case. Bytes are where a naive reservation breaks: the budget is
13991399
// measured over the serialized ARRAY, so exec must be projected into every fit check rather
1400-
// than subtracted as a standalone size.
1400+
// than subtracted as a standalone size. Admitting exec on top of an already-full catalog would
1401+
// satisfy "exec survives" while blowing the ceiling, so both halves are asserted here.
14011402
const heavy = Array.from({ length: 40 }, (_, index) => ({
14021403
name: `heavy_${String(index).padStart(3, "0")}`,
14031404
description: `Heavy ${index}`,
14041405
parameters: { type: "object", properties: { blob: { type: "string", description: "x".repeat(8_000) } } },
14051406
}));
1406-
const { names } = await emitted([...heavy, codeModeExec]);
1407-
const serialized = new TextEncoder().encode(JSON.stringify(names)).byteLength;
1407+
const { body } = await createKiroAdapter(provider).buildRequest(
1408+
parsedWith([{ role: "user", content: "hi" }], [...heavy, codeModeExec]),
1409+
);
1410+
const current = JSON.parse(body).conversationState.currentMessage.userInputMessage;
1411+
const specs = current.userInputMessageContext.tools.slice(0, -1);
1412+
const names = specs.map((tool: { toolSpecification: { name: string } }) => tool.toolSpecification.name);
1413+
const serializedBytes = new TextEncoder().encode(JSON.stringify(specs)).byteLength;
14081414

14091415
expect(names).toContain("exec");
1410-
expect(serialized).toBeGreaterThan(0);
1416+
expect(names.length).toBeLessThan(heavy.length + 1);
1417+
expect(serializedBytes).toBeLessThanOrEqual(MAX_KIRO_TOOL_CATALOG_BYTES);
14111418
});
14121419
});

0 commit comments

Comments
 (0)