Skip to content

Fix/kiro model switch session set model#3

Closed
yxzwayne-wgcg wants to merge 3 commits into
hrishikeshmane:mainfrom
yxzwayne-wgcg:fix/kiro-model-switch-session-set-model
Closed

Fix/kiro model switch session set model#3
yxzwayne-wgcg wants to merge 3 commits into
hrishikeshmane:mainfrom
yxzwayne-wgcg:fix/kiro-model-switch-session-set-model

Conversation

@yxzwayne-wgcg
Copy link
Copy Markdown

@yxzwayne-wgcg yxzwayne-wgcg commented Apr 21, 2026

What Changed

AcpSessionRuntime.setModel calls session/set_model directly instead of going through session/set_config_option. Error handling on the call changed from Effect.catch to Effect.catchCause.

Why

Switching models mid-session in Kiro crashed the turn with "Method not found" because kiro ACP doesn't really support session/set_config_option. It does support session/set_model. The error was also uncatchable since Effect's ndJsonRpc parser wraps standard JSON-RPC errors as Die defects, which Effect.catch doesn't handle. Effect.catchCause does though.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes N/A
  • I included a video for animation/interaction changes: coming soon

hrishi mane and others added 3 commits April 20, 2026 18:56
Kiro multiplexes `session/update` for the main session and every
spawned subagent crew over one ACP channel, each tagged with its
originating sessionId. Previously every subagent tool call, assistant
message, and content delta landed on the main chat as flat inline
rows — the "chaotic" UX relative to Claude Code's native Work-log
grouping.

Match Claude Code's behavior: subagent work appears as a collapsible
Work-log group with live per-tool activity inside, and the main
thread stays clean.

- Thread `sessionId` through every `AcpParsedSessionEvent` variant and
  through `AcpAssistantSegmentState` in `AcpSessionRuntime`, so
  KiroAdapter can tell main-session events apart from subagent events.
- Track in-flight subagents in `KiroSessionContext.subagentTasks`,
  keyed by ACP sessionId, and translate `_kiro.dev/subagent/list_update`
  roster transitions into `task.started` / `task.completed` envelopes.
  On session teardown, flush dangling tasks as `status: "stopped"` so
  the Work-log spinner doesn't hang.
- Emit one `task.progress` per distinct subagent `toolCallId` (tracked
  per-subagent in `seenToolCallIds`) so the Work-log shows live
  activity inside the group while the crew is running, instead of
  sitting silent between start and end markers.
- Format each progress row as `"{title}: {detail}"` via a new exported
  `formatSubagentToolLabel` helper so rows read "Read file: src/foo.ts"
  or "Ran command: bun test" instead of the bare category.
- Drop subagent ContentDelta / AssistantItem / PlanUpdated / ModeChanged
  events from the main thread — they're subagent internals the user
  shouldn't see.

The UI needs no changes — `deriveWorkLogEntries` already groups
task.progress/task.completed under a collapsible Work-log widget.

PATCH.md updated: new integration-points row for AcpRuntimeModel,
bumped AcpSessionRuntime row, added a user-facing feature bullet, new
row in the conflict-zones table, and a session-reflection entry.

Tests: 18 new cases — 10 around roster parsing + diff semantics
(missing sessionId, unknown status, started/completed emission,
idempotence on re-sends, implicit termination on disappearance) and
8 on `formatSubagentToolLabel` (title+detail combining, command
fallback, title-only, detail-only, identical dedup, kind fallback,
empty "Working" fallback, whitespace trimming).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…-grouping

feat(kiro): group subagent activity into Work-log entries
AcpSessionRuntime.setModel now calls acp.agent.setSessionModel()
(session/set_model RPC) directly instead of routing through
setConfigOption (session/set_config_option), which kiro-cli does not
support and returns -32601 Method not found.

KiroAdapter.sendTurn error handling changed from Effect.catch to
Effect.catchCause as defense-in-depth, since the ndJsonRpc parser wraps
standard JSON-RPC errors as Die defects that bypass Effect.catch.
@github-actions github-actions Bot added size:L vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Apr 21, 2026
@yxzwayne-wgcg
Copy link
Copy Markdown
Author

Since this is a Kiro ACP handling bug, it's better to fix the model switching problem fully-within Kiro ACP adapter. See fork author's PR.

@yxzwayne-wgcg yxzwayne-wgcg deleted the fix/kiro-model-switch-session-set-model branch April 21, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants