Skip to content

fix(session): a plain session is the default template, never the default crewmate - #18342

Merged
CrysisDeu merged 1 commit into
mainfrom
fix/session-template-vs-crewmate
Oct 13, 2026
Merged

CrysisDeu merged 1 commit into
mainfrom
fix/session-template-vs-crewmate

Conversation

@CrysisDeu

@CrysisDeu CrysisDeu commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: a session is started from a custom agent (a kiro-cli agent template), a folder and a memory store; a crewmate is a durable identity with its own three, talked to in its DM thread. The two must not be confused at the seams that start a session or credit a chat.

Today a plain session — one that picked nobody — is the default crewmate: the agent-less create stamps the default alias, the resolver answers an empty or template name with the default row's workspace and model pin, and the recency record credits every such chat to that crewmate. The owner's rule (#18328): a session's default is the default custom agent (a template; agent.default_agent, kirocrew when unset), never the default crewmate; picking a crewmate to open a plain session stays possible; a crewmate's main conversation is its DM thread.

Backwards compatibility

Removed: crew_recency.json, last_chat_ts, the Members page's ['default-agent'] read, plain sessions' inheritance of the default crewmate, the "first available alias" fallback. Readers on origin/main:

Reader: src/kiro_crew/dashboard/handlers/members.py:api_members -- crew page -- lists by has_dm_message, orders by last_active_ts (test_members_dm_thread.py)
Reader: src/kiro_crew/dashboard/chat_handlers.py:api_chat -- chat -- record_user_chat call removed; a send is the DM's newest message via the crew log (test_chat_agent_selection.py)
Reader: src/kiro_crew/dashboard/agent_admin/crew_records.py:api_kirocrew_agents_create -- crew page -- create-time record removed; the crewmate lists once its greeting lands (MembersPage.test.tsx)
Reader: website/src/api/client/agents.ts:MemberRosterRow.last_chat_ts -- crew page -- field removed, no consumer left (tsc)
Reader: website/src/api/membersQuery.ts:noteUserChat -- chat -- stamps has_dm_message + last_active_ts (membersQuery.test.ts)
Reader: website/src/pages/members/rosterFilter.ts:listedByDefault,chatRecency -- crew page -- read has_dm_message / last_active_ts; defaultAgent dropped from RosterQuery (rosterFilter.test.ts)
Reader: website/src/hooks/useAgents.ts:withoutCoveredCrewmates -- chat -- defaultAgent parameter removed (useAgents.hideCrewmates.test.tsx)
Reader: src/kiro_crew/dashboard/agent_admin/default_agent.py:api_default_agent -- chat, crew page -- a template name writes agent.default_agent; an alias still writes the roster default; enrollment path gone (TestDefaultAgentGuard)
Reader: website/src/pages/members/CrewmateSwitcher.tsx:CrewmateSwitcher,CrewmateUnreadColumn -- crew page -- defaultAgent prop removed from both; feed rosterPopulation without it (CrewmateSwitcher.test.tsx)
Reader: website/src/pages/members/MembersPage.tsx:resolveDefaultMember -- crew page -- remembered, else newestConversation; chat mark and ['default-agent'] read gone (MembersPage.test.tsx)
Reader: website/src/pages/SchedulePage.tsx, website/src/hooks/useAgentSync.ts (via api/defaultAgentQuery.ts) -- cron, chat -- agentOrDefaultLabel reads default_template from GET /api/config/default-agent, the agent an agent-less job or agent:'' slot runs (SchedulePage.agentDefaultLabel.test.tsx, useAgentSync.defaultLabel.test.tsx)
Reader: website/src/pages/ChatPage.tsx, ChatPane.tsx, ChatSidebar.tsx agentOrDefaultLabel callers -- chat -- unchanged: defaultAgent is useAgents()'s, the execution catalog's default_template
Reader: src/kiro_crew/mcp_core.py:_do_select_crew,_do_route_crew -- chat -- unchanged: the default crewmate stays out of routing per RFC rule 5; comments say it is a routing rule, not "the caller itself" (test_select_crew.py)
Reader: src/kiro_crew/dashboard/chat_handlers.py:_slot_next_agent_autocompact_default -- chat -- an unbound slot is a template session: agent_pct/agent null, not the default crewmate's (test_agent_autocompact_pct.py)
Reader: src/kiro_crew/dashboard/slot_projection.py:effective_agent (via loader.resolve_effective_agent) -- chat -- the divergence marker names the default template; the snapshot's fallback slot is default_template(config) (TestSlotEffectiveAgent)
Reader: website/src/apps/mochi/panel/panelBridge.ts:ensureSlot -- app -- unchanged: compares effective_agent to the bound agent
Reader: src/kiro_crew/config/loader.py:resolve_agent_bindings callers (chat_runner, chat_handlers, session_pool, cli_doctor, subagent) -- chat, cron, subagent, app -- an empty or unknown name is the default template (declared name via dispatch_kiro_agent) on Global, never the default crewmate (test_config_loader.py, test_eager_spawn.py, test_session_pool.py)
Reader: src/kiro_crew/chat_runner.py eager spawn, src/kiro_crew/dashboard/session_agent_selection.py (legacy slots stamped default, kind member) -- chat, cron -- unchanged: default is an alias, so the alias hit still binds that crewmate row (test_config_loader.py, test_eager_spawn.py)

  • Template kept on upgrade. When agent.default_agent is unset and the roster default's row (config.default_agent: the default crewmate, a ★-enrolled alias, or an existing crewmate the ★ pointed at) binds a template other than kirocrew, that template is written to agent.default_agent once on first load (MIGRATE_STAR_DEFAULT_TEMPLATE), so new plain sessions keep running it; a stored value, kirocrew included, is never overwritten. Changes: only the template is carried, so new plain sessions use the default workspace, Global memory and no crewmate model pin (the template's own pinned model, else agent.model, still applies). Live sessions keep their recorded ExecutionContext.
  • A cron, subagent or channel session that names no agent runs the default template on the default folder and Global memory, not the default crewmate record (identical for a stock config).
  • A plain session no longer takes the default crewmate's model pin.
  • Memory is either the shared store (Global) or a crewmate's own private store; the reserved default row is always shared. When a crewmate with a private store (e.g. atlas) is the roster default (config.default_agent = atlas), plain, cron, channel and subagent sessions no longer borrow that store; they use the shared one. kirocrew doctor says so beside the binding; earlier memories stay where they were written.
  • crew_recency.json under the data home is no longer read or written; a stale file is harmless. The recency change ships with the split because the old record credited every plain chat to the default crewmate, which the split makes false (RFC rules 3–4). The Crewmates page lists a thread with any message, whoever sent it, newest first; a crewmate only a cron ever ran now appears.
  • Removed refusal codes on PUT /api/config/default-agent: default_agent_ambiguous and teams_unavailable (both belonged to the enrollment path); lineage_unverifiable stays. No in-tree client branches on them (grep).
  • Pre-fix(session): a plain session is the default template, never the default crewmate #18328 plain slots (stamped default, kind member) run as before and are not credited to the default crewmate's roster recency.
  • PUT /api/config/default-agent: unreadable config → 503 config_unreadable; background-only managed spec → 409 default_template_background_only. The warm pool resolves a blank session.pool_agent as a plain session does, never through a same-named alias.

What ships (inventory)

  1. A session that names no agent (dashboard New chat, /agent with no name, cron, channel, subagent, CLI) runs the default custom agent on the default workspace and Global memory, no crewmate model pin.
  2. An agent-less create and an empty switch record that template as the selection (agent_kind: template).
  3. Crewmates list = threads holding a message, ordered by newest message; crew_recency.json / last_chat_ts removed (RFC rules 3–4).
  4. Crewmates landing: remembered crewmate, else newest conversation.
  5. Picker Default badge marks the default custom agent's template row (RFC rule 6, merged in docs: rfc, the picker's default-for-new-sessions row follows the template #18478).
  6. Picker ★ writes agent.default_agent, enrolls no crewmate; once the row's agent IS the default the row is a plain-text status caption (not a button), and a refused write shows the reason for its code (not installed / pinned by config.local.json / changed underneath / background-only / unreadable config); PUT /api/config/default-agent adds default_template_not_installed / default_template_overlaid / stale_binding refusals (RFC rule 6, merged in docs: rfc, the picker's default-for-new-sessions row follows the template #18478).
  7. The ★ row is hidden in a crewmate's chat (stamped member, or kind-less with a crewmate's name); its set state is a status line naming the agent, not a button.
  8. The ★ failure line says why and what to do (three reason strings, 13 catalogs).
  9. The default crewmate is no longer exempt from the picker's covered-crewmate hiding.
  10. A removed default template falls back to kirocrew; the display resolver names the template; doctor notes when the roster default is a crewmate with a private store (plain sessions no longer borrow it); GET /api/config/default-agent returns default_agent (the alias) and default_template (what an agent-less session runs); the Schedule page and the Worlds agent rail label an agent-less job or slot with the latter. A main-era ★ pick is carried into agent.default_agent on first load.
  11. Copy re-minted in 13 catalogs (Custom agents hint, failed-write line, Developer → Config Default crewmate hint, named ✓ row).

Why it matters

A user who pins a model, a workspace or private memory on the default crewmate changes every plain chat without knowing it, and every plain chat moves the default crewmate to the top of the Crewmates page over the crewmate they actually talked to. Both are the same conflation; fixing only the roster symptom (#17972) left the cause in place.

Not a goal

What changed (motivation → approach → change)

Observed: four seams read "no crewmate picked" as "the default crewmate". Root cause: the resolver had no notion of a template session of its own — every non-alias selection borrowed the default row. Change: a template session is first-class, and a plain session is one.

  • config/loader.py: default_template(config) (= agent.default_agent, else DEFAULT_KIRO_TEMPLATE kirocrew; a configured name the landed, complete materialized snapshot shows REMOVED and the edition does not supply falls back to kirocrew, so an uninstall or hand delete never leaves every plain session refused with an unavailable agent mode — absence alone is not evidence, as reset_dangling_default_agent reads it). _resolve_agent_selection returns (record, alias, template, requested_resolved): an alias hit is the crewmate; everything else is a template session — the materialized template the name declares, else the default template, which always resolves (an agent-less session resolved before the name was ever stamped, so stamping must not make it refusable). resolve_agent_bindings binds a template session to default_workspace + Global Memory V1 with no crewmate model pin, resolved_alias="", selection_kind="template". The "first available alias" fallback and its next() are gone. resolve_agent_identity / resolve_effective_model follow.
  • dashboard/chat_handlers.py: an agent-less create stamps the default custom agent (the template) with agent_kind="template" (the namespace travels with the slot from birth for every caller); an empty /agent switch does the same; a template session with no name of its own records its template as the selection (_record_explicit_agent_selection, session_agent_selection.record_agent_selection).
  • website/src/pages/ChatPage.tsx, chat-sidebar/create.ts, chat/useChatPageSessionController.ts: the dashboard's New chat, auto-create, first-send create, mobile New-here, ephemeral create and memory-mode recreate no longer pass the default crewmate alias as the agent; a folder's own default_agent pin is still passed. Agent-less, so the server stamps the default custom agent. (Found by the live screenshot run: with the client still passing the alias, a new chat was default / member again.)
  • session_agent_selection.py, dashboard/chat_persistence.py, chat_turn/model_fallback.py: agent or config.default_agent → agent; an empty name is the default template, not the alias.
  • PUT /api/config/default-agent (UX blocker on R6): the picker's Default for new sessions row now controls what new sessions use. A name in the template namespace (agent_kind: "template"), or an unqualified name that is no crewmate alias, is written to agent.default_agent; agent_kind: "member" with no such alias is 400 default_agent_not_alias, never rerouted. The write is read back through default_template and enrolls no crewmate; an installed user-level template is required (400 default_template_not_installed), an app's agent and another crew's private copy are refused as before, a config.local.json pin naming another template is refused BEFORE the write (409 default_template_overlaid, nothing lands that would take effect the day the pin goes), and the template is re-read under the agents-spec lock inside the config lock: the same owned file must still declare the name, else 409 stale_binding. A crewmate alias still sets the roster's default crewmate. GET returns both default_agent (the crewmate alias, the Kiro Crew config tab's select) and default_template; the shared ['default-agent'] query (defaultAgentQuery.ts) now resolves to default_template, so agentOrDefaultLabel on the Schedule page's agent column and the Worlds agent rail (useAgentSync) names the template an agent-less job or legacy agent:'' slot runs, never the alias (Design BLOCK on R27: a default crewmate radar over agent.default_agent kirocrew labelled every agent-less cron radar · default). ChatPage, ChatPane and ChatSidebar already read useAgents().defaultAgent, the execution catalog's default_template. The template-into-alias enrollment path (_alias_binding_template, _AmbiguousDefaultTarget) is removed with its tests. The execution catalog's default_agent is default_template(config), the picker badge marks the template row of that name, the row is hidden in a crewmate's own chat, and withoutCoveredCrewmates no longer exempts "the default" crewmate (a new session runs the default template, whose own row is the way back from any switch; AgentPicker.defaultStaysSelectable.test.tsx removed with that premise).
  • config/loader.py: the display resolver agrees with the runtime one. publish_agent_alias_snapshot publishes (aliases, default_template(config), ready) and resolve_effective_agent names that template for an unhonored name — never the default crewmate, whose store and model pin a template session does not use; the template's own name and every alias report "". Pinned in test_dashboard_state_ws.py (test_the_fallback_named_is_the_default_template_not_the_default_crewmate), spec in config.md § Effective-agent report.
  • The locked recheck reads the directory under agents_spec_lock; when the lock FILE cannot be opened (a read-only ~/.kiro/agents, probed before the lock, which also stops every spec writer) the recheck runs unlocked instead of surfacing a 500; a lock that opens but is not acquired within the bounded wait still propagates, since that holder is a writer at work (_spec_lock_or_unlocked_read; found by the evidence gateway, pinned by test_a_read_only_agents_dir_still_lets_the_default_be_set and test_a_spec_lock_held_past_the_ceiling_refuses_the_write).
  • A slot's agent_kind stamp decides the runtime read of a slot with no execution record yet (resolve_session_agent_bindings(..., agent_kind=), passed by the first send, the eager spawn and the agent-conflict compare): a non-owner (app-token) create writes no record, and its template stamp must never resolve a same-named crewmate's private store and pin; the kind is part of every binding tuple the race guards compare (test_a_record_less_template_stamp_never_resolves_a_same_named_crewmate).
  • The ✓ state of the default row is a status line (role=status), not a disabled button: a dead button read as a switch that might undo the default. Clearing still lives on the Templates page.
  • The ★ row on a chat of unknown kind (saved before agent_kind, or created through the API without one): isCrewmateChat hides the row when the name-folded roster lists the slot's agent as a crewmate, and defaultWriteKind sends the template namespace only for a slot stamped template -- a kind-less write lets the server route the name (alias → roster default, non-alias → template), never a same-named template behind a crewmate's back. The ✓ row names its agent (agent_is_the_default_for_new_sessions, 13 catalogs). playwright/member-memory.spec.ts pins an agent-less create as a template session and opens the legacy member by name.
  • The picker's failed-write line says what to do: the server's reason code (default_template_not_installed, default_template_overlaid, stale_binding) picks one localized line (default_write_failed_*, 13 catalogs) via defaultWriteFailureOf / defaultWriteFailureText; an unknown code keeps the plain line.
  • Picker and Config copy that this change made false is re-minted under new keys in all 13 catalogs (i18n:pseudo regenerated): the Custom agents hint now reads "Uses your default workspace and shared memory; no new crewmate is created." (group_templates_hint_default_workspace), the failed-write line "Could not change the default custom agent" (could_not_change_the_default_custom_agent), and the Developer → Config Default crewmate hint says what that setting still controls (the badge, the undeletable row) and that new sessions run the default custom agent set by the composer's ★ (default_crewmate_hint_badge). The old keys are removed; pages.membersPage.default_agent_failed_title (dead since R5) is removed too.
  • Crewmates list like a messages app (owner's rule, 2026-10-09: "就像 iMessage 一样 … 不管是谁回复的,只要有消息就要参与排序"): src/kiro_crew/crew_recency.py, its seed (_seed_from_dm_threads), the ""→default fold in handlers/members.py, the send-time record in chat_handlers.py and the create-time record in crew_records.py are removed; last_chat_ts leaves the roster row. Listing is has_dm_message (the thread holds a message, whoever sent it) or starred, plus Mate (feat: welcome users with Mate, a first crewmate they get to name #18406, merged under this PR) listed from the start so its first-visit welcome has a row to open; resolveMateLanding stays ahead of the remembered-else-newest landing; Recent order is last_active_ts (the crew log's fold of the thread's newest message). The roster no longer reads the default crew's name; MembersPage drops the ['default-agent'] read and its error notices.
  • website/src/pages/members/MembersPage.tsx + rosterFilter.ts + membersQuery.ts: the fix(members): restore the default crewmate when it was opened last #17972 workaround (mc-members-last-member-chat-mark, rememberedDefaultPick, chatMarkOf, restoredRef) and lastChattedMember are removed. Landing: the remembered crewmate, else newestConversation (greatest last_active_ts, ties keep roster order); default is a row like any other; a default-only roster still lands on the hero; the fallback stands aside while a create's follow-up opens the new crewmate. noteUserChat stamps the send as the thread's newest message (has_dm_message, last_active_ts).
  • cli_doctor.py: the Model section reads the default template (and reports a non-string agent.default_agent), not the default crewmate's binding; a broken default crewmate store no longer fails the plain-session report. doctor_checks/agents.py: when config.default_agent names a crewmate with a store of its own, the binding line says plain sessions use the default template on Global and that store serves the crewmate's DM and explicit picks (the remedy the Design review asked for).
  • chat_handlers.py (switch_slot_agent): the stamped empty switch runs the durable member pin check even when the default template carries the slot's own name, so a private member's conversation is never rebound to Global by "use the default" (GPT finding, test_empty_switch_under_the_members_own_name_is_refused). An explicit same-name template pick keeps its existing path.
  • Specs in the same commit: docs/system-specs/modules/crew-mode.md (binding order, recency rule, Crewmates landing), docs/system-specs/modules/config.md (resolve_agent_bindings rungs).

Ride-along (main-side red)

website/src/pages/chat/AskAnswersCard.tsx:41: focus-visible:ring-2 focus-visible:ring-accent/50 focus-visible:outline-hidden → the shared focus-ring-accent utility. #15250 landed that class and #17705 landed the source scan that forbids it; main's own CI ran a reduced frontend scope on the commits since, so the red surfaced only here, where the full suite runs. One class string, same shape as every call site #17705 converted.

Tests

  • test/test_config_loader.py: no-name and unknown-name resolve as the default template on default workspace + Global, selection_kind="template", no alias, no pin; the alias of the same name as the default template is still its own binding; the next() branch cannot return (test_resolution_raises_synchronously_and_never_stopiteration).
  • test/test_config_loader.py::TestStarDefaultTemplateCarry: the roster default row's template is carried into agent.default_agent in memory and on disk whatever the row is called (★-enrolled atlas; an existing crewmate Rusty on rust-expert; own folder / store / model pin, of which only the template is carried; the default crewmate on default-2; a seeded roster default), a stored value (nova, kirocrew) is never overwritten, the stock template is a no-op, and the carry runs once.
  • test/test_session_pool.py: a blank pool_agent with agent.default_agent spelling an alias that binds another template prewarms the template, not the alias's binding.
  • test/test_config_api.py: unreadable config → 503 config_unreadable; background-only spec → 409 default_template_background_only.
  • test/test_slot_create_default_agent.py: an agent-less create stamps the default template (kirocrew, or agent.default_agent), kind template, never the alias.
  • test/test_chat_agent_selection.py: an empty /agent switch records the default template. test/test_agent_default_model.py: blank / unknown names take the global, not the default crewmate's pin. test/test_member_memory_ownership.py, test/test_member_memory_runtime.py, test/test_eager_spawn.py, test/test_members_dm_thread.py, test/test_pruned_crewmate_records.py, test/test_session_pool.py, test/test_title_refresh.py, test/test_chat_slot_create_folder.py, test/test_cli_doctor.py: the "empty slot inherits the default member" premise replaced by an explicit pick where the test is about a member, by the template session where it is about the default.
  • website/src/pages/members/MembersPage.test.tsx: remembered thread wins; else newest conversation whoever wrote it; default restored and ranked like any row; default-only roster → hero; empty threads hidden until searched; create follow-up opens the new crewmate over a newer thread. 20 pages/members + hook files, 543 tests, green; tsc --noEmit, eslint on touched files, scripts/docs-lint.sh clean.
  • Backend: full python -m pytest run locally: 169110 passed, 65 failed -- every failure also fails on main in this environment (test_file_explorer_app, test_design_tweak_*, botocore-less test_stt_transcribe_vocabulary, installer/signal and home-pin host checks), none in the agent-selection surface; flake8, mypy src/kiro_crew (linux) clean, black on touched files only.

Manual verification

Code-level: the three stamping sites (api_chat_slot_create, api_chat_slot_agent, send-created slot) traced to the same default_template + template namespace; recency traced from POST /api/chat (noteUserChat stamp) and the crew log's last_active_ts fold to /api/members.

Screenshots / video

A fresh chat's footer agent chip and the open agent picker, before (main-era gateway) and after (this branch), same fresh data home, same install. Captured with Playwright against live gateways.

chip picker
before default (the crewmate alias, kind member) the kirocrew custom-agent row, unmarked; the default crewmate row is withheld (covered)
after kirocrew (the default custom agent, kind template) the kirocrew row wears the Default badge and is the current row; the "Default for new sessions" footer row reads ✓ for it

Crewmates page with a cron-only thread (the UX Watch): two crewmates seeded on each gateway -- the user messaged scribe, then a background row landed in patrol-bot's thread a few seconds later.

listed order opens
before scribe, patrol-bot, default (3; creation and the default-crew name list rows) by the user's last send scribe
after patrol-bot, scribe (2; default has an empty thread) by the thread's newest message patrol-bot

Before (OLD state, origin/main): before chip before picker

After (R7-era picker; the R10–R13 shots below carry the final copy): after chip after picker with the Default badge on the kirocrew row

R10 (final copy) — a plain session's picker: the ✓ row is a status line that NAMES the default custom agent ("kirocrew is the default for new sessions"), the Default badge on the same row, the re-minted Custom agents hint above the rows: picker, kirocrew is the default for new sessions

R10 — switched to atlas: the ★ row offers "Set atlas as the default for new sessions": set atlas as the default

R12 — a plain session with the crewmate patrol-bot picked, picker open: no default-for-new-sessions row (a crewmate is never the default for a new session): picker with a crewmate active, no default row

R12 — after a successful "Set atlas as the default for new sessions": the row is the status line "atlas is the default for new sessions ✓" and the Default badge sits on atlas: after a successful set

R10 — the failed write (a config.local.json pin answered 409 default_template_overlaid) says why and what to do: could not change the default custom agent

R9 — a crewmate's chat (scribe's DM thread): its composer has no agent picker at all, so no default-for-new-sessions row exists there: crewmate chat composer

R13 — Developer → Config, the Default crewmate row's hint (final copy): default crewmate hint

Crewmates before: crewmates before

Crewmates after: crewmates after

Related Issues

Closes #18328. Decision record: #18355, merged on main as docs/request-for-change/rfc-session-template-vs-crewmate.md (this branch is rebased onto it); amendment #18478 (rule 6: the picker's Default for new sessions row follows the template) merged as 8bfb09d4ed; this branch is rebased onto it. Refs #17210, #17808, #17972, #17591.

Pattern harvest

Rule candidate: review-prompt
Pattern: "an empty selection falls back to a named default record" — a plain x or config.default_thing that silently makes the unselected case inherit a configured entity's bindings (store, pin, recency) instead of a neutral default.

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

@CrysisDeu
CrysisDeu requested review from a team and KiroCrewCaptain as code owners October 9, 2026 05:41
@CrysisDeu
CrysisDeu requested a review from buluoray October 9, 2026 05:41
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — 🟡 CONCERNS

UX-level review of ca374563c6233be39985ffd6b2443f1721d89212 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: CONCERNS

"Default" still means four things on screen, and the new Settings hint has to explain the difference instead of the labels showing it.

Watch

  • "Default" is overloaded. The Settings row is still labelled "Default crewmate", and its new default_crewmate_hint_badge hint has to say "It does not pick what a new chat runs". The blind reader: "I could not keep them apart without that hint." The ★ Default tag, the "default" composer chip and the model's "Default" sit right beside it, so users will set the wrong one. This hits every user who touches either setting, and it's a lasting point of confusion. Fix: rename the Settings label to what it does, e.g. "Crewmates page default", so the label carries the difference instead of the hint.
  • The default_write_failed_overlaid error can't be acted on. "your local settings file (config.local.json) sets it. Change it there" gives no location and no link. The reader had "no idea where that file is or how to edit it" and would not dare press "Ask the agent". This is rare but blocks the task when it happens. Fix: show the full path of the file in the data home, or link to the setting.
  • The new group hint doesn't land. For "A custom agent is a reusable agent setup. Picking one uses your default workspace and shared memory; no new crewmate is created.", the reader rated their reading of what it means "a guess". It sits under a list whose footer says "Manage crewmates…". Fix: open with the effect a user cares about, e.g. "Runs in your default workspace with shared memory."

Suggestions

  • default_write_failed_not_installed and default_write_failed_stale appear in no screenshot. Attach one of each so the copy is checked against the real layout.

[UX-REVIEWED] ca37456

Description read

[DESCRIPTION-READ] 9c237dce3c1c8fdd9de455182072516dced030a3a89df0fba89d1857ca4e54f4

That sha256 names everything this verdict read: the PR description, plus the 16 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 Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — 🟡 CONCERNS

Premise-level review of ca374563c6233be39985ffd6b2443f1721d89212 — 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/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

The automatic MIGRATE_STAR_DEFAULT_TEMPLATE write overrides the base RFC's recorded upgrade path ("Set agent.default_agent to keep the old template"), and the diff itself rewrites that RFC.

Not justified as shipped

  • Item 5 — inherited: base RFC §5 says upgraders "Set agent.default_agent to keep the old template"; the diff swaps that for a load-time config write and edits the accepted RFC to match. An RFC change inside the diff is a proposal, not a recorded decision.
    Subtraction: delete MIGRATE_STAR_DEFAULT_TEMPLATE, star_default_template_due and apply_document_migrations's dispatch parameter; revert the §5 edit.
    Clears when: the migration is removed, or a maintainer records the automatic carry (/ai-review override first-principles ca374563c6233be39985ffd6b2443f1721d89212: …, or a non-draft RFC amendment on base, then push or rebase).
  • Item 8 — undeclared: _spec_lock_or_unlocked_read re-checks without the lock when the lock file can't be opened. It's the only one of 25 agents_spec_lock( callers that degrades this way, and no defect is cited.
    Subtraction: use agents_spec_lock(agents_dir) directly, as the deleted enrollment path did.
    Clears when: a reported failure on a read-only ~/.kiro/agents is linked, or the fallback is deleted.

What this change ships

Inventory (10 items) — 7 justified

Intent: a session that picks nobody runs the default custom agent, never the default crewmate. FIX.

  1. Plain/cron/channel/subagent sessions run the default template on the default workspace and Global memory, with no crewmate model pin — justified
  2. An agent-less create or an empty switch records agent_kind: template — justified
  3. The Crewmates list shows threads holding a message, newest first; crew_recency.json removed — justified
  4. Crewmates landing: the remembered crewmate, else the newest conversation — justified
  5. On upgrade, the roster default's template is written to agent.default_agent — inherited
  6. ★ "Default for new sessions" writes agent.default_agent and no longer enrolls a crewmate — justified
  7. The warm pool resolves a blank pool_agent as a plain session — justified
  8. The template write re-checks unlocked when the lock file can't be opened — undeclared
  9. New refusal codes: 503 config_unreadable, default_template_background_only, default_template_overlaid — rides along
  10. doctor notes that a roster default's private store is no longer lent — justified

[FIRST-PRINCIPLES-REVIEWED] ca37456

Description read

[DESCRIPTION-READ] b8286c7334cbf778c68c714958a684e81b112bdfde73cc02c88147112167ef60

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 Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — 🟡 CONCERNS

Design-level review of ca374563c6233be39985ffd6b2443f1721d89212 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

On upgrade, a roster default whose folder isn't default_workspace silently moves new plain sessions to another directory, and nothing reports it.

Watch

  • Only the memory move is reported on upgrade, not the folder move. The new migration copies only the template: "only the template is carried, so new plain sessions use the default workspace, Global memory and no crewmate model pin."
    • The memory change is reported: "kirocrew doctor says so beside the binding."
    • The folder change is not. When the roster default's row (the default crewmate, a ★ alias, or atlas) binds a workspace other than config.default_workspace, resolve_agent_bindings now returns config.workspaces.get(config.default_workspace).
    • Result: the next New chat, cron, channel or subagent session with no agent named runs in a different directory. Its relative paths, project files and .kiro scope change, with no doctor line, log or UI notice.
    • It can be undone (the operator can repoint default_workspace), but only if they work out why.
    • Clears when: kirocrew doctor (or the MIGRATE_STAR_DEFAULT_TEMPLATE load) also reports a roster-default row whose workspace differs from default_workspace, with a test pinning that line.

[DESIGN-REVIEWED] ca37456

Description read

[DESCRIPTION-READ] 6317c62cf0a6095768820f6d6d54249666b8c75542153753a7ae3ef893349bc8

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 added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] ca37456

False positive or not applicable? A repository writer can comment:
/ai-review override gpt ca374563c6233be39985ffd6b2443f1721d89212: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings block this merge. One advisory finding.

FINDING — src/kiro_crew/config/migration.py:175 — star_default_template_due is not one-shot. On any install where agent.default_agent was never written (the dataclass default is "", and nothing seeds it), suppose Settings › KiroCrewCfgTab calls api.setDefaultAgent(name) with no kind for a crewmate alice bound to custom-x. The PUT alias branch writes only the top-level default_agent. The next persist_write_back then sees star_default_template_due("", "alice", rows) → "custom-x", sets it in memory and persists it to agent.default_agent. From then on, every plain chat, cron, channel message and subagent runs alice's template, even though the operator only changed the roster default. → Fix: gate the carry on evidence that the document predates the rule, such as a release-line stamp or a one-shot marker. Alternatively, have the roster-default PUT seed agent.default_agent with the current default_template(cfg) when it is unset, so the predicate is false afterwards.

[OPUS-REVIEWED] ca37456

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable ca374563c6233be39985ffd6b2443f1721d89212: <one-sentence reason>

@CrysisDeu
CrysisDeu force-pushed the fix/session-template-vs-crewmate branch from 092752f to 1cc88bb Compare October 9, 2026 06:03
@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 readiness: checking Automated validation is still running labels Oct 9, 2026
@CrysisDeu
CrysisDeu force-pushed the fix/session-template-vs-crewmate branch from 1cc88bb to f2782f5 Compare October 9, 2026 06:52
@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 Oct 9, 2026
@CrysisDeu

Copy link
Copy Markdown
Contributor Author
  • Item 1: what a plain session binds to — needs-a-decision (span=27ac1fc3e129)

The product owner (@zezhexu) decided this on 2026-10-09: a session is started from a custom agent (template), a folder and a memory store; a chat that picked no crewmate is the default custom agent on the default folder and Global memory, never the default crewmate. The decision is recorded as an accepted RFC in #18355 (docs/request-for-change/rfc-session-template-vs-crewmate.md), which amends the one sentence of rfc-crewmates-chatted-list.md and of rfc-crewmate-guides-and-mate.md this item cites.
Question to the maintainer: merge #18355 and I rebase, or post /ai-review override first-principles f2782f5a98d59438c2fc896f6322ef1a189a769b: <decision>.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author
  • Item 3: who a plain chat is credited to — needs-a-decision (span=6321d6eced1d)

Same decision record (#18355, rule 3): a chat with a crewmate is its DM thread or an explicit pick; a template session is nobody's. The accepted sentence "A chat with no crew picked counts for the default crew" is the one that RFC replaces.
Question to the maintainer: merge #18355 and I rebase, or post the override line for f2782f5.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author
  • product-shape change without accepted RFC — needs-a-decision (span=484f62b01632)

The RFC exists and is open as #18355 (status accepted, author the product owner's decision of 2026-10-09). The lane reads RFCs off the base branch, so it clears once #18355 merges and this branch is rebased.
Question to the maintainer: merge #18355, or post /ai-review override first-principles f2782f5a98d59438c2fc896f6322ef1a189a769b: <decision>.

CrysisDeu added a commit that referenced this pull request Oct 9, 2026
… crewmate

Records the product owner's decision of 2026-10-09: a session that picked
no crewmate runs the default template on the default folder and Global
memory, a crewmate is credited only for its DM thread and explicit picks,
and the `default` crewmate is one roster row like any other. Amends one
sentence each of rfc-crewmates-chatted-list.md and
rfc-crewmate-guides-and-mate.md. Implementation is #18342.

Refs #18328
@CrysisDeu
CrysisDeu force-pushed the fix/session-template-vs-crewmate branch from f2782f5 to 756d651 Compare October 9, 2026 07:09
@CrysisDeu

Copy link
Copy Markdown
Contributor Author
  • Item 1: what a plain session binds to — needs-a-decision (span=27ac1fc3e129)

The product owner (@zezhexu) decided this on 2026-10-09; recorded as an accepted RFC in #18355 (docs/request-for-change/rfc-session-template-vs-crewmate.md), amending the one sentence of rfc-crewmates-chatted-list.md and of rfc-crewmate-guides-and-mate.md this item cites.
Question to the maintainer: merge #18355 and I rebase, or post /ai-review override first-principles 756d65190794b5e6c1b396862801b579655cc090: <decision>.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author
  • Item 3: who a plain chat is credited to — needs-a-decision (span=6321d6eced1d)

Same decision record (#18355, rule 3): a chat with a crewmate is its DM thread or an explicit pick; a template session is nobody's.
Question to the maintainer: merge #18355 and I rebase, or post the override line for 756d651.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author
  • product-shape change without accepted RFC — needs-a-decision (span=484f62b01632)

The RFC is open as #18355 (status accepted). The lane reads RFCs off the base branch, so it clears once #18355 merges and this branch is rebased.
Question to the maintainer: merge #18355, or post /ai-review override first-principles 756d65190794b5e6c1b396862801b579655cc090: <decision>.

@CrysisDeu
CrysisDeu force-pushed the fix/session-template-vs-crewmate branch from 756d651 to 9b85633 Compare October 9, 2026 07:24
@CrysisDeu

Copy link
Copy Markdown
Contributor Author
  • Item 1: what a plain session binds to — needs-a-decision (span=27ac1fc3e129)

Decided by the product owner (@zezhexu) 2026-10-09, recorded as an accepted RFC in #18355 amending the sentence this item cites.
Question to the maintainer: merge #18355 and I rebase, or post /ai-review override first-principles 9b8563355e032c155c9ed422e0c40a23879a8a56: <decision>.

@cruisercohen cruisercohen 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.

Re-review at ac257f7297: no blocking defect found. Approval held for a maintainer, because this changes how sessions resolve their identity and default.

Since 2783ce3ef1, the branch was rebased twice and changed in three ways:

  • default_template() now maps a file-stem agent.default_agent to the declared name, the same mapping a crewmate row gets (test_a_filename_stem_default_template_dispatches_the_declared_name).
  • An agent-less create and a blank /agent switch now stamp dispatch_kiro_agent(default_template(cfg)). Last round's GPT finding was that a stem stamp strands the slot once the default changes. I reproduced that on bce74ffc0a, and with a warm snapshot it is fixed here. test_agentless_create_stamps_the_declared_name_not_a_file_stem passes.
  • select_crew / route_crew keep the roster's default crewmate out of routing, with a new test. The autocompact read for an unbound slot no longer follows the default crewmate. The rest is rebase fit-up (CrewmateUnreadColumn drops defaultAgent).

Earlier points:

  • The template-vs-crewmate split on PUT /api/config/default-agent still holds. Both picker callers send agent_kind. The Settings default-crewmate control still sends the kind-less form, which takes the crewmate path for a roster name, as intended.
  • The star-pick carry the maintainer asked for (MIGRATE_STAR_DEFAULT_TEMPLATE) is in. TestStarDefaultTemplateCarry passes locally. The change request on 0a96132dd9 has not been re-reviewed yet, so it still stands.
  • CI on ac257f7297: 96 pass, 8 skipped, none failing. The GPT 6.1 and Opus lanes report no blocking findings.

Non-blocking (reproduced)

  1. A cold snapshot still stamps the stem. dispatch_kiro_agent returns its input unchanged when it runs on the event loop before the materialized snapshot is warm, and both stamp sites call it on the loop. Repro: run the new create test with _MATERIALIZED_AGENTS_READY=False, _MATERIALIZED_AGENTS=frozenset() and _MATERIALIZED_STEMS={}. It stamps slot.agent == "KiroPkg-captain", and that slot strands the same way once the default moves. This happens only in the boot window and only with a stem-spelled default, so it is not blocking. Either change would close it:
    • take the template stamp from the off-loop resolve_agent_bindings result (bindings.kiro_agent), which the create route already computes;
    • have _resolve_agent_selection map a template selection through dispatch_kiro_agent before the passthrough lookup. This would also heal any stem already stamped.
  2. The blank-agent switch stamp has no test of its own. Only the create path is covered.

For a maintainer

The design and first-principles lanes both raise this, and it is not mine to settle. RFC §5 records a manual agent.default_agent step, but this PR migrates star picks automatically, at the maintainer's request. Also, plain sessions move off a default crewmate's private store, and only kirocrew doctor tells the user. Recording the automatic carry in RFC §5 and naming the store split in the release notes would settle both.

@CrysisDeu

CrysisDeu commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

@cruisercohen thanks, both non-blocking items are in on 95d0ce6176:

  1. Cold snapshot. Both implicit-default stamps (agent-less create, blank /agent) now go through one helper, _default_template_stamp, run via asyncio.to_thread, so dispatch_kiro_agent can warm a cold materialized snapshot instead of returning the stem unchanged on the loop. test_agentless_create_warms_a_cold_snapshot_before_stamping is your repro (_MATERIALIZED_AGENTS_READY=False, empty sets) and asserts captain.
  2. Switch stamp test. test_the_blank_switch_stamp_is_the_declared_name_too pins the helper's result for a stem and for the stock default, and pins by source that the blank switch stamps through it off-loop.

The RFC §5 note on the automatic star carry and the store-split release note are the maintainer items you flagged; I have left them for buluoray's call.

@cruisercohen cruisercohen 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.

Re-review at 1b1f95c (a rebase of 95d0ce6 onto current main).

Both of the earlier non-blocking points are addressed:

  • Cold snapshot. An agent-less create and a blank /agent switch now both stamp through _default_template_stamp, off the loop. I reproduced this against a cold snapshot, with the real refresh scanning a spec whose file stem differs from its declared name. Create and blank switch both stamp the declared name, and the stock default stamps kirocrew. As a negative control, the same helper called on the loop still returns the stem, so the off-loop hop is what makes the fix work.
  • Switch test. test_the_blank_switch_stamp_is_the_declared_name_too pins the helper's result and the off-loop call. test_slot_create_default_agent.py passes locally (22 tests).

The 95d0ce6 -> 1b1f95c delta only resolves rebase conflicts:

  • the shape digest and the name count
  • main's sessionFolder argument, kept on the agent-less create call
  • main's renamed roster fields in the tests

It adds no new behaviour, and I found no new defect.

One macOS backend failure, test_cancellation_during_the_spawn_still_reaps, is outside this diff. The PR does not touch provider spawn code, the test passes locally on this head, and it also failed today on an unrelated PR's run.

I'm holding APPROVE because this PR changes config migration, the default agent and session identity, and the maintainer's change request is still open. Two items are left for the maintainer: the RFC §5 note on the automatic star carry, and the release note for the store split.

@cruisercohen cruisercohen 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.

Re-review at 15a0236, the rebase of 1b1f95c onto main at c4c51aa (#19346, which fixed #19341).

A range-diff of the two heads, each against its own merge-base, shows that the rebase changes four things, all in the conflict area:

  • the landing rule in the crew-mode spec
  • the §6 note in rfc-session-template-vs-crewmate.md
  • the restore effect in MembersPage.tsx
  • that file's landing tests

The rest of the patch is unchanged from the head I reviewed last.

The resolution keeps both sides. A bare /members lands in this order:

  1. Mate's first visit.
  2. The remembered row. This is #19346's memory-first rule: any row still on the roster, default included, looked up on the whole roster so hidden rows count, and a default-only roster still shows the hero.
  3. Otherwise, this PR's newest-conversation fallback (last_active_ts) takes the place of main's last_chat_ts step. That fits this PR removing the server-side send record.

Things I checked:

  • The chat-mark key, chatMarkOf, rememberedDefaultPick and restoredRef stay removed. The defaultAgentSettled gate is gone on both sides, and the followUp hold is kept.
  • Nothing left in the website source or the system specs names lastChattedMember, rememberedMember or last_chat_ts.
  • I found no lost hunk and no behaviour regression.

Tests run locally on this head:

  • Vitest, 6 files: MembersPage, .filters, .firstPaint, rosterFilter, CrewmateSwitcher, membersQuery. 356 passed.
  • tsc -p tsconfig.app.json: clean.
  • Backend docs, roster and config tests, with this head's source first on the path. 2537 passed.

CI on 15a0236: 92 checks pass, 9 are skipped, none fail. That includes PR Readiness, Opus, GPT, First Principles, Security Scope, Sensitive Change and CodeQL.

Non-blocking points, all optional:

  1. resolveDefaultMember(remembered, ordered) (MembersPage.tsx:241) still takes remembered. #19346 dropped that parameter because every production caller passes null, and that is still true here. The restore effect looks the memory up inline (rememberedRow, line 3408). So the memory lookup lives in two places, and the unit tests at MembersPage.test.tsx:4950-4966 test a branch production never calls. Dropping the parameter, as main did, would leave one lookup.
  2. The comment at MembersPage.tsx:3390 says the remembered crewmate is restored "if it is still listed". The code, and the comment's own next paragraph, restore it from the whole roster, hidden rows included. "if it is still on the roster" would match.
  3. rfc-mate-landing-once.md (lines 43, 63 and 119) still names lastChattedMember / "last-chatted" as the step after the remembered crewmate. This PR's §6 note amends rfc-crewmates-chatted-list.md §3.1 but not this RFC. A one-line pointer would keep the two records in agreement.
  4. Main's page-level #19341 test, which clicks a non-default row, leaves and returns, was replaced. The default version at MembersPage.test.tsx:5096 covers the same code path now that default gets no special case, so coverage holds. A non-default case that names #19341 is optional.

I'm still holding APPROVE. This PR changes config migration, the default agent and session identity, and the maintainer's change request is still open.

@iamwhatever

Copy link
Copy Markdown
Contributor

This PR makes a session with no picked crewmate run the default template (agent.default_agent, else kirocrew) on the default workspace and Global memory, instead of borrowing the default crewmate's bindings, which fixes the root cause of plain chats picking up a crewmate's identity and store. I checked buluoray's blocking point from 0a96132 against head 15a0236: star_default_template_due (config/migration.py) and its in-memory twin in config/loader.py now carry a pre-rule ★ pick into agent.default_agent, and test_a_pre_rule_star_pick_still_drives_a_plain_session loads the exact config from the change request and gets atlas. The pool's blank pool_agent also stops going through the alias table (session_pool.py), which closes the warm-pool point. One small difference from the suggested fix: a stored agent.default_agent of kirocrew counts as a deliberate choice and is never overwritten (test_an_explicit_template_default_is_not_overwritten). That is the right call so a later reset is not undone, but a main user who stored kirocrew by hand and also had a ★ alias will switch templates. RFC §5 (rfc-session-template-vs-crewmate.md) still describes only the manual agent.default_agent step and does not mention the automatic carry. I read the migration, resolver and pool changes, not all 95 files. The open question that decides the merge: @buluoray, does this carry settle your change request, and do you want RFC §5 and the release note to record the automatic carry and the store split before merge? — crew-pr-reviewer (deep re-check)

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

@cruisercohen thanks. All four optional points are in on 6a4db9934a (rebased onto main ebe8a183b5; the earlier rebase onto 65df088e39 resolved #19086's phone-drawer restore effect, keeping its every-width landing and this PR's rule):

  1. resolveDefaultMember(ordered) drops remembered, as main did. It is now the newest-conversation rule itself (newestConversation folded in), so the memory is looked up once, in the restore effect. The unit tests for the unreached branch are gone.
  2. The restore comment says "if it is still on the roster".
  3. rfc-mate-landing-once.md (the three spots) points at rule 4, and this PR's RFC §6 lists it.
  4. Added the non-default page test: a crewmate opened but not messaged since is the one a return lands on (#19341).

Also fixed a stale reference in matesProvider.ts (it named resolveDefaultMember as spelling 'default' inline; it no longer does). Local: tsc clean, vitest 738 passed (members + command-bar), pytest 877 passed, docs/comment/brand gates green.

@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.

Re-reviewed at 6a4db9934a. This supersedes my earlier request-changes on 0a96132dd9.

Most of the earlier concern is fixed: a user whose star added a new template keeps it after upgrade, a stored agent.default_agent (including kirocrew) is never overwritten, and an empty string is treated as unset. The warm pool no longer goes through the alias table (session_pool.py:55). The rebase onto main resolved the conflicts.

One blocking upgrade regression remains. star_default_template_due (config/migration.py) only carries the template when the alias is spelled the same as the template it binds (kiro != default_alias -> None). But on main, starring a template that an existing crewmate already uses does not mint a new alias -- it points the top-level default_agent at that crewmate (default_agent.py). Those users are not migrated:

Existing user main today after this PR
never starred kirocrew kirocrew
starred a new template atlas atlas atlas
starred existing crewmate "Rusty" (template-only binding to rust-master) rust-master kirocrew
starred "Rusty", which has its own memory store rust-master + its memory kirocrew + Global

The third row loses nothing by being migrated: same shared folder, same store, no model pin, so carrying the template reproduces main exactly. Today it silently switches every plain chat to a different template with no notice. The fourth row's memory split is what RFC §5 accepts, but the star's intent was "use this template", so carrying only the template still fits the RFC's rule.

Requested fix: when agent.default_agent is unset and the top-level default_agent names any alias other than default, carry that row's kiro_agent into agent.default_agent (skipping the stock template). Do not carry the memory store, folder or model. Drop the kiro != default_alias condition, and the template-only-binding conditions for the template carry, and flip the named-unlike-its-template test to expect the carry. Please apply it to both halves (merged config and on-disk document), since they share this function.

Still open, not blocking this review on its own: RFC §5 does not describe the automatic migration, and the store split is not yet in a release note. Those two need the owner's call before merge.

CI on this head at review time: 71 passed, 0 failed, 17 still running.

@cruisercohen cruisercohen 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.

Re-review at 7c02517. My last review was a COMMENT on 15a0236. Since then the branch went through 6a4db99 (@buluoray's 21:32Z change request), 5141f91, 9d227ee and now 7c02517.

What changed since 15a0236:

  • 6a4db99: all four of my optional points are in. resolveDefaultMember(ordered) drops remembered, the restore comment says "still on the roster", rfc-mate-landing-once.md points at the new rule, and the non-default #19341 page test is back.
  • 5141f91: star_default_template_due also carries the reserved default crewmate's template, with only the template carried. A seeded default is carried and a seeded first alias is not.
  • 9d227ee: a rebase, which resolves useAgents.ts, its two tests and the crew-mode spec against main's change to how the picker withholds same-name crewmates. This PR's "no crewmate is exempt for being the default" rule is kept.
  • 7c02517: a rebase only. The range-diff from 9d227ee differs in the restore effect's dependency list, which keeps main's draftRequest from #18805 and this PR's followUp, and in test import context. The draftRequest early return and its effect match main.

Blocking 1: the upgrade regression from the 21:32Z change request still reproduces on this head. migration.py:192 (kiro != default_alias -> None) and the template-only conditions at lines 194-199 are unchanged. The named-unlike-its-template case of test_a_real_crewmate_promoted_to_default_is_left_alone still expects no carry. I ran a throwaway probe, not pushed, on this config: top-level default_agent: "Rusty", agents.Rusty = {kiro_agent: "rust-master", workspace: "default", memory_store: "default"}, and agent.default_agent unset. This is the shape main's star writes when a crewmate already runs the chosen template.

  • On main (merge-base 7ca644d), resolve_agent_bindings(cfg, None).kiro_agent is rust-master.
  • On 7c02517 it is kirocrew, and agent.default_agent stays empty after the load.

So every plain chat for that user switches template on upgrade, with no notice. The requested fix still applies: when agent.default_agent is unset and the top-level default_agent names any alias, carry that row's kiro_agent and nothing else, skipping the stock template, in both the merged and on-disk halves. Then flip that test case to expect the carry. If you read this case differently, please answer the change request in a reply so the maintainer can rule on it.

Blocking 2: RFC §5 now contradicts the code. The first bullet of §5 in rfc-session-template-vs-crewmate.md still says a default crewmate bound to another template changes plain sessions to agent.default_agent (kirocrew when unset), and tells the user to set it by hand. Since 5141f91 the load carries that template on its own (test_the_default_crewmates_template_still_drives_a_plain_session, and the config spec's MIGRATE_STAR_DEFAULT_TEMPLATE paragraph). §5 should describe the automatic carry and what it leaves behind: the row's folder, store and model, and with them the memory split. The 21:32Z review also asked for this before merge.

Tests run locally on this head:

  • Vitest, 17 files (every changed spec plus MembersPage.firstPaint): 537 passed.
  • tsc -p tsconfig.app.json: clean.
  • pytest on the 19 changed backend test files: 2176 passed.

CI on 7c02517: 92 checks pass, 9 are skipped and none fail. Three macOS backend shards are still running.

Non-blocking: MembersPage.firstPaint.test.tsx:61 still sets last_chat_ts on its roster fixture. This PR removes that field everywhere else, so the line can go.

Requesting changes for the two points above. Even once they are fixed, approval stays with a maintainer, because this PR changes config migration, the default agent and session identity.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

@buluoray @cruisercohen thanks, both change requests are addressed on 93ad7551d2 (rebased onto main de2d143dcf). Sorry the 21:32Z review slipped past the previous two pushes.

Blocking 1 (upgrade regression). star_default_template_due now carries the roster default row's kiro_agent whatever the row is called: agent.default_agent unset, top-level default_agent names a row, template is not kirocrew -> carry the template only. The kiro != default_alias and template-only-binding conditions are gone; the folder, store and model pin are never carried. Both halves share the function. The loader's "seeded first alias is not carried" exception is gone too: a seeded roster default is the row a plain session read on main, and once stored it reads as a pick, so the next load carried it anyway.

  • test_a_crewmate_promoted_to_default_keeps_its_template: own-folder / own-store / model-pin / named-unlike-its-template (Rusty -> rust-master) all carry, the bound store stays default, no model pin, the row is untouched. Stock template is a no-op (test_a_promoted_crewmate_on_the_stock_template_is_a_no_op).
  • test_a_seeded_first_alias_is_carried_on_the_same_load, the pure-predicate cases, and the Hypothesis round trip now expect the carry.
  • Three test_agent_templates_endpoint.py cases now also list the default reference, which is right: after the carry that template IS the default custom agent, so deleting it is refused with that reason.

Blocking 2 (RFC §5). The first two §5 bullets now describe the automatic carry, that a stored value is never overwritten, and what stays behind: the row's folder, store and model pin, the memory split, and that earlier memories stay where they were written. config.md and the PR body's compat section say the same.

Non-blocking: MembersPage.firstPaint.test.tsx no longer sets last_chat_ts.

The release note for the store split is written at version bump (the changelog rule keeps feature PRs out of CHANGELOG.md); the compat section here is the source for it. Local: pytest 12862 passed over every test file naming default_agent, vitest + tsc clean, mypy/black/comment-history/docs-lint green.

…ult crewmate

A session is started from a custom agent (a kiro-cli template), a folder
and a memory store; a crewmate is a durable identity with its own three,
talked to in its DM thread. Four seams read "no crewmate picked" as "the
default crewmate": the agent-less create stamped the `default` alias, the
resolver answered an empty or template name with the `default` row's
workspace and model pin, the dashboard passed the alias on every New chat,
and the roster credited every plain chat to the `default` crewmate.

A template session is now first-class in `resolve_agent_bindings`: an
alias hit is the crewmate; anything else binds the named materialized
template, else `default_template(config)` (`agent.default_agent`, then
`kirocrew`), to `default_workspace` and Global Memory V1 with no crewmate
pin, `resolved_alias` empty and `selection_kind="template"`. The default
template always resolves; the "first available alias" fallback is gone.
An agent-less create and an empty `/agent` switch stamp the default
template in the template namespace, the empty switch still runs the
durable member-pin check, and a template session with no name of its own
records its template as the selection. The dashboard's New chat paths
send no agent unless a folder pins one.

The Crewmates page lists and orders conversations like a messages app:
a crewmate is listed when its DM thread holds a message, whoever sent
it, or is starred; Recent order is the thread's newest message
(`last_active_ts`, the crew log's fold); the landing opens the
remembered crewmate, else the newest conversation, the `default` row
taking part like any other. The record of the user's own sends
(`crew_recency.json`), its seed, the plain-chat fold and the chat-mark
workaround are removed, and the roster no longer reads the default
crew's name. The doctor's Model section reads the default template.

A config whose `default` crewmate binds another template than
`agent.default_agent` changes: new plain sessions run
`agent.default_agent`; existing sessions keep their recorded execution.
Specs updated in `crew-mode.md` and `config.md`.

Closes #18328

@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.

🤖 Kiro Crew Auto-Pipeline [operator: buluoray#18342]: Approving at ca37456. This supersedes my change request on 6a4db99.

Both blocking points are fixed.

  • The upgrade carry now covers a star that pointed at an existing crewmate whose name differs from its template. star_default_template_due (migration.py) no longer requires kiro == default_alias, and carries only kiro_agent, skipping the stock template. The named-unlike-its-template case of test_a_crewmate_promoted_to_default_keeps_its_template now expects rust-expert to be carried, the row to stay untouched, and the plain session to bind Global memory.
  • RFC §5 now describes the automatic carry, and says what stays with the crewmate: its folder, memory store and model pin, with the memory split stated and surfaced by kirocrew doctor. That answers the open RFC question from @cruisercohen and me. The release note is the release PR's job, so nothing is needed here.

What I ran on this head:

  • test_config_loader.py -k "star or promoted or carry or default_template": 33 passed, 1 skipped.
  • Mutation: put back if kiro != default_alias: return None after the stock-template check. named-unlike-its-template goes red (1 failed, 3 passed). Restored, tree clean.

CI: 88 pass, 10 skipped, 0 fail. The 7 cancelled rows each have a later successful run. PR Readiness is success.

Non-blocking, from @cruisercohen: MembersPage.firstPaint.test.tsx:61 still sets last_chat_ts, which this PR removes elsewhere.

#18469 can follow once this lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(session): a plain session is the default template, never the default crewmate

4 participants