Skip to content

perf(acp): answer a re-opened chat without waiting for user MCP servers - #35739

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
perf/reopen-no-wait
Nov 13, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
perf/reopen-no-wait

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A chat that is re-opened answers its first message without waiting for the user's own MCP servers, as a new chat already does.

A new chat starts in a server-less start agent, so Kiro Crew's own MCP servers connect first and the first prompt is not held for the user's. A re-opened chat (a saved session loaded again, for example after a restart) did not get that. The engine resumes a session in the mode it stored, which is the session's own agent, so that agent's servers queue ahead of Kiro Crew's. The first prompt then waits for Kiro Crew's servers, which are last in the queue, and so in practice for every server the user has.

Measured with 30 MCP servers (n=3, kiro-cli 3.2.1, KAS 0.66.102): a re-opened chat's first token came after 22.4 s, and 15.8 s of that was the session load. Kiro CLI on the same servers answered in 6.8 s.

Why it matters

Every chat that is re-opened pays it: after a restart or an update, and for a chat whose session was put away. With this change the same re-open answers in 9.7 s at 30 servers (12.7 s sooner) and in 10.2 s instead of 11.6 s at 10 servers.

Not a goal

  • A resume nobody is waiting on: the session_reload verb, a Bot's spec or harness change, the image repair, an app token's request, a cron run, a bulk Resume and a sub-agent. Each sends the one load it always sent and keeps its wait.
  • The start-priority rule. The focus resume prefetch keeps its BACKGROUND place in every start queue.
  • An agent that mounts the engine's sub-agent tool, which has no start agent. That is the other half of KAS: a resumed session, and an agent with the sub-agent tool, still connect Kiro Crew's MCP servers last #35261.
  • The registry-governed branch of the start wait, the idle-memory watchdog, and any gate, hook, sandbox or approval rule.
  • Other harnesses, and an engine that cannot free a session and keep its record. Their session/load is unchanged.

What changed (motivation → approach → change)

A re-opened chat now answers its first message without waiting for the user's own MCP servers, because Kiro Crew's own servers connect first, as they do on a new chat.

Why this shape: session/load ignores a mode named on it and resumes in the mode it stored, but it does take the agent definitions re-sent with the load over the ones it kept. So the stored mode is the only lever.

  • Park, then load (src/kiro_crew/acp/runtime_session_load.py, _park_in_start_agent). Before the load, three requests that start no server: a session/load in which the session's own agent declares no server and the session sends none (src/kiro_crew/acp/kas_start_agent.py, parking_load), a session/set_mode to the start agent, and the release that frees that copy and keeps the record. Only a session stored in its own agent is parked; one that was switched to another agent is freed and left in it. The load that follows resumes in the start agent, queues Kiro Crew's servers alone, and the switch to the session's own agent queues the user's servers behind them.
  • One predicate (src/kiro_crew/acp/mcp_start_wait.py, person_waits). A person is waiting when the start claimed FOREGROUND, or when it is the dashboard owner's return to a saved chat: the focus resume prefetch, marked by its origin in src/kiro_crew/dashboard/ws.py and carried through src/kiro_crew/dashboard/chat_turn/eager_spawn.py, src/kiro_crew/session_parts/claims.py, src/kiro_crew/session_allocation_parts/get_or_create.py, src/kiro_crew/providers/base.py and src/kiro_crew/providers/acp_runtime_start.py. The same predicate decides the parking step and the first-prompt wait. A message typed while that prefetch is in flight joins it and is released when Kiro Crew's servers are ready. The servers the load skipped are left to the first turn, as on a new chat (left_to_first_turn reads the same predicate): its prompt names the ones still starting, or holds for them for at most 5 s.
  • A re-open that is cut off stays whole. Between the two steps the stored mode is the start agent. So every session/load on this engine now registers the start agent (src/kiro_crew/acp/harness/kas.py), because a stored mode the batch does not carry resumes in the engine's own default mode; load_session switches a session that came back in the start agent, or in a mode the load sent no definition for, to its own agent, whoever resumes it, and refuses the load when that agent is not advertised; and a parked copy the engine did not confirm freeing fails the re-open instead of loading over it (src/kiro_crew/acp/runtime_class.py, _parked_copies). A parking load the engine refused holds nothing, so the retry past a stale session lock still works. The session is parked only in the entry Kiro Crew appended, never in another entry that carries its id.
A re-opened chat, user servers still connecting Before After
A person typed, or came back to the chat waits behind the user's servers Kiro Crew's servers first, no wait for the user's (changed)
A resume nobody waits on one load, brief wait one load, brief wait (unchanged)
A late server on that first prompt n/a, it had connected named as still starting, waited for in the turn (unchanged, from the PR this follows)
session/load on another harness or an older engine one load one load (unchanged)
Requests before the load, when parked 0 3, about 0.2 s to 0.7 s (added)

Legend: added, changed, removed, unchanged.

Specs updated in the same commit: docs/system-specs/modules/acp-client.md, docs/system-specs/modules/session.md, docs/system-specs/modules/harness-parity.md, docs/system-specs/modules/learn-cron-dashboard.md (the slot_focused paragraph spells the call), docs/architecture/mcp.md. User doc: src/kiro_crew/docs/troubleshooting.md (the section on a first message whose server tools are not there yet now names a re-opened chat too).

Merge order: #35722 owns the first-prompt wait rule, the [MCP SERVERS] block and mcp_server_wait, and has merged. This PR extends that one rule to a re-open.

Backwards compatibility

Compatible: load_session, _load_session_with_retry, get_or_create, schedule_eager_spawn, first_prompt_brief_wait and _wait_managed_mcp gain an optional focus_resume keyword that defaults to the old behaviour, and LLMProvider.focus_resume defaults to False.

Changed on purpose: a session/load on this engine carries one more agent in its batch, the start agent, under the same refusals a new session applies (left out when the agent mounts the sub-agent tool or the batch is full). A person's first prompt after a re-open can go out before the user's servers have connected, as on a new chat. A session/load whose caller names no agent, and that the engine brings back in a mode the load sent no definition for, is switched to the session's own agent, or refused when that agent is not advertised; before, such a session ran in the mode the engine brought it back in. A session the engine or another client left in one of the engine's built-in agents is put back in its own agent on such a re-open; Kiro Crew itself has no way to put a session in a built-in. A load the engine brings back in the session's own agent, or in another agent the batch carries, sends the requests it always sent.

Removes nothing: no payload key, public function, validator or record is removed or renamed.

Tests

  • test/test_kas_reopen_parking.py (new): the predicate, for the start's wait and for what is left to the first turn; the parking step (load, set mode, free; a session already parked; a session switched to another agent, which is left in it; an engine that did not register the start agent; a refused mode switch; a load the engine refused, which holds nothing; a load with no readable answer, which may still be held; a copy that was not freed); a re-open after a typed message and after the owner's return parks first, waits for Kiro Crew's servers only, and leaves the user's servers to its first turn; a background resume, an engine without the release verb, an agent with no servers and another harness are not parked; a session left in the start agent ends in its own agent or is refused, whatever the next load's batch carries and whether or not its caller names an agent (a table of nine states, each for both callers: the start agent registered again; the agent lost its servers, gained the sub-agent tool, or its batch is full, so the engine brought the session back in its own default mode; another agent carrying the start agent's id; the session's own agent not advertised, which is refused; a session never parked and one running another agent of the batch, which a caller that names no agent leaves as stored); only the owner's focus frame marks a start as the owner's return (one site in the package).
  • test/test_kas_start_agent.py: a load registers the start agent and names no mode; the parking load; a target the user named like the start agent is not parked in.
  • test/test_eager_spawn_resume_prefetch.py, test/test_eager_spawn_slot_frames.py, test/test_session_resume_prefetch_join.py: the owner's return reaches the allocation and the provider, keeps its BACKGROUND place, and a typed message joins that same session; a reload's respawn does not carry the mark.
  • test/test_acp_runtime_load_session.py, test/test_acp_bindings.py, test/test_runtime_bindings.py, test/test_acp_runtime.py, test/test_chat_runner_base_surface.py, test/test_session_allocation_bindings.py, test/test_session_bindings.py: the existing pins, updated for the start agent on a load (the batch is the projection plus exactly that one entry, and a load names no mode) and the new keyword.
  • test/test_worker_agent_load_bracket.py: the pin that every session/set_mode goes through the one bracketed helper names the parking step as its one exception and holds it to the start agent's id. test_no_kiro_crew_entry_point_switches_a_running_session pins why a built-in a session was left in may be replaced: nothing in Kiro Crew switches a running session's mode.

Determinism, on 1ab90c0097ad: the 92 new or changed tests passed 20 of 20 runs at -n0, 10 of 10 at -n 4 --dist loadgroup beside two co-tenant files, and one shuffled order (seed 8027, at PSI under 1).

Manual verification

The tests and checks of this push ran on 1ab90c0097ad, one commit on main at ddf8678ddf17. The pushed head, 99c06f088c73, is that commit rebased with no change (git range-diff shows it equal) over four later main commits that touch none of its files; the docs lint and ten pin test files (1770 tests) passed again on it.

Timed re-open (Linux, one gateway at a time; the gateway is stopped with its data kept and started again, then three prompts are sent on the same chat, typed with no focus frame). A 30-server gateway holds the shared run lock for its whole life. A run taken while memory pressure (some avg10) was above 10 is left out and re-taken.

Before is #35722 at 68b7979afe2c, after is this change (85a67a95a042) on it. Seven rebases followed: onto #35722's fix for more than 64 servers, five times onto its newer heads, and onto main once it had merged. None changed what this commit does for a 30-server re-open; the last push also changed how a cut-off re-open is resumed (above), which this timing does not exercise.

30 servers. Seconds, median (each run). Engine: before KiroCLI/3.2.1 KAS/0.66.102; after KiroCLI/3.2.1 KAS/0.66.102; kiro-cli KiroCLI/3.2.1 KAS/0.66.102.

Step Before After kiro-cli v3
Re-open: send to first token 19.0 (20.1 / 19.0 / 18.6) 8.6 (8.6 / 8.3 / 8.8) 6.8 (6.8 / 7.1 / 5.8)
of which: process start and handshake 1.4 (1.6 / 1.4 / 1.4) 1.4 (1.4 / 1.4 / 1.5) 1.5 (1.5 / 1.5 / 1.3)
of which: session load, to the prompt being sent 12.9 (13.0 / 12.9 / 12.8) 2.0 (2.1 / 2.0 / 1.9) 0.8 (0.7 / 0.8 / 0.8)
of which: model wait 4.2 (4.8 / 4.2 / 3.6) 4.7 (4.5 / 4.7 / 4.7) n/a
Prompt 2 after the re-open 4.1 (4.1 / 4.1 / 4.0) 5.2 (5.3 / 5.2 / 4.2) 4.6 (3.8 / 4.6 / 4.8)
Prompt 3 after the re-open 3.8 (3.7 / 4.0 / 3.8) 4.9 (4.9 / 4.7 / 5.1) 4.4 (4.6 / 4.4 / 3.9)

before: n=3, load 1m 11.3 to 17.8, PSI some avg10 0 to 0.54.
after: n=3, load 1m 11.3 to 17.1, PSI some avg10 0.24 to 1.16.
kiro-cli: n=3, load 1m 12.2 to 13.3, PSI some avg10 not recorded.

  • The first prompt after a re-open is 10.4 s sooner at 30 servers.
  • Prompts 2 and 3 after the re-open are about 1.1 s slower at 30 servers (4.1 to 5.2 s and 3.8 to 4.9 s) while the user's servers are still arriving. Before, they had all connected ahead of the first prompt.
  • The kiro-cli column is the run of 01:00Z on the same kiro-cli version; it does not depend on either head.

On the first heads this PR was measured on (#35722 at 9ae6ab2f35, this change on it). The Goal's numbers above are from these; the mechanism is the same, the base's own load got faster since:

30 servers. Seconds, median (each run). Engine: before KiroCLI/3.2.1 KAS/0.66.102; after KiroCLI/3.2.1 KAS/0.66.102; kiro-cli KiroCLI/3.2.1 KAS/0.66.102.

Step Before After kiro-cli v3
Re-open: send to first token 22.4 (25.3 / 22.4 / 20.8) 9.7 (9.9 / 9.0 / 9.7) 6.8 (6.8 / 7.1 / 5.8)
of which: process start and handshake 1.5 (1.5 / 1.5 / 1.6) 1.6 (1.6 / 1.6 / 1.6) 1.5 (1.5 / 1.5 / 1.3)
of which: session load, to the prompt being sent 15.8 (17.8 / 15.8 / 14.5) 2.6 (2.6 / 2.6 / 2.6) 0.8 (0.7 / 0.8 / 0.8)
of which: model wait 4.4 (4.9 / 4.4 / 4.1) 4.7 (4.8 / 3.8 / 4.7) n/a
Prompt 2 after the re-open 4.6 (4.9 / 4.5 / 4.6) 5.2 (4.5 / 5.5 / 5.2) 4.6 (3.8 / 4.6 / 4.8)
Prompt 3 after the re-open 4.2 (4.7 / 4.2 / 3.9) 4.9 (4.9 / 5.4 / 4.8) 4.4 (4.6 / 4.4 / 3.9)

before: n=3, load 1m 11.2 to 14.8, PSI some avg10 0.52 to 1.65.
after: n=3, load 1m 9.9 to 11.7, PSI some avg10 0.25 to 1.41.
kiro-cli: n=3, load 1m 12.2 to 13.3, PSI some avg10 not recorded.

10 servers. Seconds, median (each run). Engine: before KiroCLI/3.2.1 KAS/0.66.102; after KiroCLI/3.2.1 KAS/0.66.102 (not recorded for its first two runs, same install); kiro-cli KiroCLI/3.2.1 KAS/0.66.102.

Step Before After kiro-cli v3
Re-open: send to first token 11.6 (11.6 / 11.4 / 12.2) 10.2 (10.5 / 10.7 / 9.7 / 9.5 / 10.2) 6.2 (5.8 / 6.6 / 6.2)
of which: process start and handshake 1.5 (1.5 / 1.7 / 1.5) 1.6 (1.6 / 1.9 / 1.4 / 1.6 / 1.5) 1.2 (1.2 / 1.2 / 1.4)
of which: session load, to the prompt being sent 5.4 (5.2 / 5.5 / 5.4) 2.8 (3.2 / 2.8 / 3.1 / 2.6 / 2.6) 0.7 (0.7 / 0.7 / 0.7)
of which: model wait 4.5 (4.5 / 3.9 / 4.9) 4.7 (4.7 / 5.2 / 4.6 / 4.7 / 5.7) n/a
Prompt 2 after the re-open 3.8 (3.7 / 3.8 / 3.8) 4.5 (4.5 / 4.4 / 4.6 / 4.5 / 5.2) 3.5 (3.5 / 3.5 / 4.1)
Prompt 3 after the re-open 4.0 (4.0 / 4.3 / 3.9) 4.2 (3.8 / 4.2 / 3.8 / 4.3 / 4.4) 3.7 (3.2 / 3.7 / 4.0)

before: n=3, load 1m 8.3 to 12, PSI some avg10 0.6 to 1.39.
after: n=5, load 1m 10.1 to 18.1, PSI some avg10 0.15 to 2.76.
kiro-cli: n=3, load 1m 7.1 to 8.2, PSI some avg10 0.11 to 1.47.
Left out: one after run (its three prompts), taken at PSI 73.21; that cell was re-taken in full.

A real re-open, end to end (Linux, kiro-cli 3.3.0, before is main at 97b6c1d26607, which holds #35722, after is this commit, 1ab90c0097ad; one fast server and eight servers that take 4 s each; one tool call, the gateway restarted on its data, then four more turns on the same chat):

Check after the re-open Before, default After, default After, focus then type
A real tool call on the user's server PASS PASS PASS
The earlier turn is remembered PASS PASS PASS
Kiro Crew's own tool answers PASS PASS PASS
A slow user server is called too PASS PASS PASS
Kiro Crew's servers connected after 19.0 to 19.7 s 3.0 to 3.3 s 5.2 to 5.7 s
The user's first server connected after 2.7 s 3.8 s 6.3 s
The first prompt after the re-open sent after every server had connected told which servers were still starting; the model waited for the one it needed (mcp_server_wait), then called it; no hold the same
Parking step none 651 ms 754 ms

In the focus column the times count from the focus frame, and the message was typed about 3 s after it. Across the earlier runs of this check the parking step took 559 to 773 ms; one run on an earlier head of #35722 took 1642 ms, with Kiro Crew's servers at 4.2 to 4.5 s, and a re-take there took 607 ms. Memory pressure (some avg10) was under 2 at the start, at the re-open and at the end of each run. The parking step replays the stored turns once more, so it grows with the length of the chat. The Kiro CLI pick runs on the same engine path; it was run on an earlier head pair (6a43634e13ab and this change on it) with the same verdicts and Kiro Crew's servers at 19.6 to 20.3 s before and 3.7 to 4.1 s after.

Engine behaviour this rests on (kiro-cli 3.2.0 and 3.2.1, driven directly): a load ignores a mode named on it; it takes the agent definitions re-sent with it; a stored mode the batch does not carry resumes in the engine's default mode; the release of a session the engine does not hold answers success.

MCP smoke test (cases 1, 2, 8 and 12, Linux, before and after, both harness picks): before is commit fc01a4588a25, after is this change at a623f41ba046 on it, kiro-cli 3.2.1, engine 3.2.1. That is six rebases before the pushed head. The rebases after it changed no source logic of this commit; the pushed head's fix for a cut-off re-open changes only a load whose caller names no agent and that the engine brings back in a mode the load sent no definition for, which no case of this script does.

Case What OS Backend Before After
1 a fast server's tool on the first prompt Linux default PASS PASS
2 a still-loading server on the first prompt Linux default PASS PASS
8 a chat that is closed and reopened Linux default PASS PASS
12 Kiro Crew's own tools Linux default PASS PASS
1 a fast server's tool on the first prompt Linux Kiro CLI pick PASS PASS
2 a still-loading server on the first prompt Linux Kiro CLI pick PASS PASS
8 a chat that is closed and reopened Linux Kiro CLI pick PASS PASS
12 Kiro Crew's own tools Linux Kiro CLI pick PASS PASS

Case 8 of that script closes a chat and opens a new one of the same name, which starts a new session; the table above this one is the same proof for a stored session that is loaded again. Cases 3 to 7 and 9 to 11 were not run for this change, which touches only a re-open; #35722 carries them. macOS and Windows were not run.

Related Issues

Part of #35261

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 12, 2026 04:08
@bolichen97
bolichen97 requested review from iamwhatever and removed request for a team November 12, 2026 04:08
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 12, 2026
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 99c06f088c73728ce19c20fcb61741e0276b50e0 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 99c06f088c73728ce19c20fcb61741e0276b50e0 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

The approach depends on undocumented engine behaviour measured on kiro-cli 3.2.1, but the cases it covers are gated on can_release() and fail closed, so nothing blocks.

Notes

  • Parking only works because session/load resumes in the stored mode and ignores a mode named on the request, and this was measured on one engine version. If a later KAS honours the requested mode or changes what session/set_mode stores, the three extra requests do nothing and the gain disappears without any error. A test that asserts the session current == START_AGENT_ID after the caller's load would catch that drift.
  • The new switch in load_session (mode_agent is None and kas_agents and … not start_mode_ran_servers(...)) also applies to resumes where nobody is waiting. A session left in an unrecognised mode is now refused when its own agent is not advertised, where before it ran in the default mode. That change is listed as intended, and the provider can fall back to a fresh session, so it can be undone.
  • An alternative is to ask the engine to honour a mode named on session/load. That would remove the park step, the _parked_copies bookkeeping and the cut-off handling, and is worth filing upstream so this workaround can be retired later.

[DESIGN-REVIEWED] 99c06f0

Description read

[DESCRIPTION-READ] b58ccb12bd1a9e1474dddd946e81a0cde672f197305c60c10d40be31df238081

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 99c06f088c73728ce19c20fcb61741e0276b50e0 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

One rider goes beyond the Goal. It is reversible and it is declared in Backwards compatibility, so it stays a note. Every other item is backed by a measured cost and reuses the start agent that session/new already uses.

Not checked: whether KAS 0.66.102 really ignores the mode named on a session/load and takes the agent definitions re-sent with it. The author reports measuring this; I could not run it.

Notes

  • Item 4 — oversized: the post-load switch also runs when the engine brings a session back "in a mode this load sent no definition for". That covers every resume, including the unattended ones ## Not a goal says keep "the one load it always sent". Because of it, a built-in mode a session was left in gets replaced, which the diff's own # shortcut: comment admits. Subtraction: narrow the condition in runtime_session_load.load_session to _resumed_in == START_AGENT_ID and drop the active_custom_agent(load_params, _resumed_in) is None check. Clears when: that check is removed, or a human amends the Goal.

What this change ships

Inventory (8 items) — 7 justified

Intent: a re-opened chat answers its first message without waiting for the user's own MCP servers. This is an ADDITION (perf).

  1. A re-opened chat a person is waiting on is first parked in the start agent: 3 extra requests, then the normal load — justified
  2. The owner's return to a saved chat (the focus prefetch) no longer waits for the user's servers; any it skipped are named in the first prompt — justified
  3. Every KAS session/load now also carries the start agent in its batch — justified
  4. A session that comes back in a mode the load sent no definition for, or in a built-in mode, is switched to its own agent, or refused if that agent is not advertised — oversized, applies to every resume
  5. A re-open fails if this process still holds an unfreed parked copy — justified
  6. The focus_resume flag is passed from ws.py through seven layers (one producer: ws.py:754) — justified
  7. The refusal message now names the mode that was actually checked — justified
  8. The troubleshooting doc now covers re-opened chats too — justified

[FIRST-PRINCIPLES-REVIEWED] 99c06f0

Description read

[DESCRIPTION-READ] 82193884c8d73e87572c0150d34bd42390dfeedeff47e7b29cfa259e0c86c4a4

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 99c06f088c73728ce19c20fcb61741e0276b50e0 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 99c06f0

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 99c06f088c73728ce19c20fcb61741e0276b50e0 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 99c06f088c73728ce19c20fcb61741e0276b50e0 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 99c06f0

Verdict parsed from the review's SHA-scoped output markers for commit 99c06f088c73728ce19c20fcb61741e0276b50e0.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 99c06f088c73728ce19c20fcb61741e0276b50e0 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 12, 2026
@bolichen97
bolichen97 force-pushed the fix/live-mcp-session-report branch from 6a43634 to 963821c Compare November 12, 2026 04:57
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 12, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 12, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • fixed span=79b7a93b46d1

fixed in 1d308b6: parking_load now parks only when the batch ends in the entry with_start_agent appended (whole-entry equality with the module's own server-less entry), not when any entry carries the id.
A sub-agent target the user named kirocrew-session-start keeps with_start_agent from adding the entry, so the batch does not end in it and the load is sent once, as before.
Class: the start agent recognised by id alone. The other readers of the id were checked: the refusal in with_start_agent, the mode named on session/new (only after the entry was appended), and start_mode_ran_servers (reads the mode the engine reports).
Test: test/test_kas_start_agent.py::TestParkingLoad::test_a_target_the_user_named_like_the_start_agent_is_not_parked_in.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • fixed span=eaaf214720f2

fixed in 1d308b6: a parking session/load the engine answered with an error loaded nothing, so the id is no longer kept in _parked_copies and no release is sent for it. The provider's retry past a stale session lock loads the session again.
A load with no answer (AcpRequestTimeout) or an answer too large to read (AcpFrameTooLarge) may still be held, so that id stays listed until its release is confirmed, as before.
Tests: test/test_kas_reopen_parking.py::TestParkInStartAgent::test_a_load_the_engine_refused_raises_its_own_error_and_holds_nothing and ::test_a_load_with_no_readable_answer_may_still_be_held.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 12, 2026
@bolichen97
bolichen97 force-pushed the fix/live-mcp-session-report branch from 963821c to 68b7979 Compare November 12, 2026 08:34
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 12, 2026
@bolichen97
bolichen97 force-pushed the fix/live-mcp-session-report branch from 68b7979 to fc01a45 Compare November 12, 2026 09:32
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

  • No sensitive path changed; nothing to check.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision labels Nov 12, 2026
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision labels Nov 12, 2026
@bolichen97
bolichen97 enabled auto-merge (squash) November 12, 2026 22:50
@bolichen97
bolichen97 disabled auto-merge November 12, 2026 22:58
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 13, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • fixed span=eaaf214720f2

fixed in cbf1445, as a class with two sites. load_session: a load whose caller names no agent now activates the session's own agent when the engine brought it back in the start agent or in a mode the load sent no definition for (the vibe case of this finding), and guard (A) refuses the load when that agent is not advertised; its message names the agent it tried. _park_in_start_agent: only a session the engine brings back in its own agent is parked, so a re-open no longer replaces an agent the session was switched to. Pinned by test/test_kas_reopen_parking.py::TestASessionLeftParked::test_every_way_back_ends_in_its_own_agent_or_is_refused (nine states, each for a named agent and for the runtime default; five cases fail on the reviewed head) and the two test_a_session_switched_to_another_agent_* tests. The spec paragraph in docs/system-specs/modules/acp-client.md now says what the code does, including one stated limit (the start agent is known by its id).

@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 13, 2026
@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider thinks the change is probably fine but estimates a 20% chance that this change introduces a defect, above the 12% limit for approving on its own.

Approve. When someone is waiting on a re-opened KAS chat (a FOREGROUND claim or the owner refocusing it), the session is first parked in the server-less start agent with three requests (load, set mode, release), so Kiro Crew's MCP servers connect ahead of the user's. Parking is limited to the KAS branch, to that case and to engines that can release a session; every other resume still sends one load, and tests cover each exclusion. Recovery from a cut-off re-open is covered by a table of nine resume states, each run with and without a named agent. An engine refusal holds nothing; a failed parking step falls back to a fresh session with history replay. Specs and the user doc are updated in the same commit. The new switch for a session that comes back in an undefined mode when the caller names no agent is declared in Backwards compatibility. Remaining concerns are edge cases, not blockers: a session id stays marked held after an unconfirmed release, and a cancelled refocus prefetch relies on the engine handling the release after the in-flight load. Backend test shards, E2E and desktop builds were still pending at decision time; the three verdict-issuing AI review lanes passed.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit cbf14457f3 · 1463 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 13, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 13, 2026
A new chat already starts in a server-less start agent, so Kiro Crew's
own MCP servers connect first and the first prompt does not wait for the
user's. A re-opened chat did not: the engine resumes a session in the
mode it stored, its own agent, so that agent's servers queued ahead of
Kiro Crew's and the first prompt waited behind all of them.

A re-open a person is waiting on now parks the stored session in the
start agent first (a load with nothing to start, a mode switch, a
release), then loads it as before. The load resumes in the start agent,
Kiro Crew's servers connect first, and the switch to the session's own
agent queues the user's servers behind them. The first prompt is then
held for Kiro Crew's servers only, as on a new chat. Only a session
stored in its own agent is parked: one that was switched to another
agent is left in it and loaded as every other resume.

One predicate decides both, mcp_start_wait.person_waits: a start that
claimed FOREGROUND, or the dashboard owner's return to a saved chat (the
focus resume prefetch, which keeps its BACKGROUND place in the start
queues). Every other resume sends the one load it always sent and keeps
its wait.

A re-open cut off between the two steps leaves the start agent as the
stored mode, so every load on this engine registers the start agent. A
load whose caller named no agent switches the session to its own agent
when the engine brought it back in the start agent, or in a mode the
load sent no definition for (the engine's default, where a stored start
agent resumes when the batch does not carry it), and is refused when
that agent is not advertised. A session the engine or another client
left in one of the engine's built-in agents is put back the same way:
the engine answers that load as it answers the first, and Kiro Crew
itself offers no way into a built-in. The step runs only on an engine
that can free a session and keep its record.

The parking step's switch to the start agent is the one session/set_mode
sent outside the bracketed activation helper: the start agent is Kiro
Crew's own entry, with no spec to load, and a failed switch there keeps
the re-open's old order where the helper would end the session. The pin
test names that one exception and holds it to the start agent's id.
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 13, 2026

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve on 99c06f0. This change makes a re-opened KAS chat answer its first message before the user's own MCP servers have connected, as a new chat and kiro-cli already do. Since the last review only tests changed. The shared load-test helper now expects the start agent in a load batch as well as in a new session, and checks that a load names no mode. The signature and source pins now carry the new focus_resume keyword, and the new parking test patches the pooled-stub hop through the runtime facade. Product code and docs are identical to the last reviewed head. I found no data loss and no security gap. The Code change approver asks for a person to decide, so the owner should make the call once the backend test shards on this head are green. Decisive lines: test/test_acp_runtime.py:197-208, test/test_chat_runner_base_surface.py:701,711,716, test/test_session_allocation_bindings.py:69,117, test/test_session_bindings.py:253, test/test_kas_reopen_parking.py:27,89

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 13, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at the owner's request. The deep review of this head is still running, and anything it finds will be posted here as a follow-up.

@KiroCrewCaptain
KiroCrewCaptain merged commit 03416b1 into main Nov 13, 2026
103 of 111 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

readiness: passed Eligible automated validation passed for the current revision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants