Repository navigation
fix(crew): list a legacy binding once its thread holds a message - #23739
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: legacy bindings now go through the roster's existing Notes
[DESIGN-REVIEWED] 968260a Description read[DESCRIPTION-READ] 833a0398277c96abe812340b51b20b481c67cfc9fc5ad5b18de03c0b79d48912 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The fix applies the existing Notes
What this change shipsInventory (5 items) — 3 justifiedIntent: a legacy agent the user chatted with comes back to the Mate list and the rosters, with no agent special-cased by name. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 968260a Description read[DESCRIPTION-READ] b27b0084bd6842d340108e7b754f32afe4eb61f1ef69a5a914060892ee9d4a6f That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findings (all downgraded on adjudication)GPT 6.1 flagged blocking issues on This comment is updated in place on each push. Review detailsBLOCKING -- src/kiro_crew/dashboard/handlers/agents.py:1659 -- Filtering unchatted bindings breaks their profile editor
Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1: LOW harm. Before this PR, a legacy binding never appeared on the Mates page at all, so nothing that used to work stops working. What's new is a dead Edit click on a row that only a typed search brings up. Every condition is confirmed in code:
The user sees nothing open and nothing breaks. It fixes itself: once the thread holds any message, False positive or not applicable? A repository writer can comment: |
bolichen97
left a comment
There was a problem hiding this comment.
Thanks for folding the legacy bindings into the one listing rule; the members roster side reads well and the shared _transcript_holds_message / _live_slot_has_rows helpers are a nice cleanup.
Two things block this head (fde1b9f):
GET /api/agentsnow hideskirocrew-conductoruntil a member DM binding exists for it. That binding is only written when the member DM thread is opened (members_thread.pyis the onlywrite_dm_bindingcaller on main). A fresh install, and every user who talks to the conductor through the agent picker, a cron job, or a channel, never gets one, so the conductor disappears from AgentSelector, Schedule, Channel and the command bar. The decision recorddocs/decisions/2026-10-02-conductor-introduces-itself-in-every-chat.mdnames the agent picker and cron as places the conductor is opened, and this reverses the pickability that #23685 restored. The same evidence gap applies to an older install'sassistantif its history lives in a picker session rather than a member DM, so the PR's stated goal ("a legacy agent the user has chatted with shows in the pickers") is only met for member DM chats. Suggest keeping a small positive set of user facing built-ins thatunchatted_legacy_bindingsnever hides, and keep thehas_dm_messagerule for the Members page as is.- The new autouse fixture
_owner_callerrequests the sharedmonkeypatch, which the Semgrep ruletest-autouse-shared-monkeypatchand the deterministic-tests rule both reject. Request_floor_monkeypatchinstead.
One smaller note inline about test coverage for the picker path. Verified by reading the diff, the head files, write_dm_binding callers on main, the decision record, and the Semgrep log. I did not run the test suite locally.
| # Through the members facade, so a patch on it reaches this read too. | ||
| from kiro_crew.dashboard.handlers.members import unchatted_legacy_bindings | ||
|
|
||
| hidden = await unchatted_legacy_bindings(cfg, state) |
There was a problem hiding this comment.
The conductor drops out of every agent picker until a member DM thread exists for it.
kirocrew-conductor syncs into cfg.agents as source: builtin with no member_id, so with USER_FACING_BUILTIN_BINDINGS gone is_legacy_binding now returns True for it. read_dm_thread_message_state then returns ("", False) unless a members/<slug> DM binding names it, and that binding is only written when the member DM thread is opened (members_thread.py is the sole write_dm_binding caller). Chats started from the agent picker, cron, or a channel never write it, so unchatted_legacy_bindings puts the conductor in hidden and useAgents stops offering it in AgentSelector, Schedule, Channel and the command bar.
hidden = await unchatted_legacy_bindings(cfg, state)
...
if name not in hiddenConsequence: on a fresh install the conductor cannot be picked at all until the user finds it in Crewmates search and sends a DM, which contradicts docs/decisions/2026-10-02-conductor-introduces-itself-in-every-chat.md (opened from the agent picker and cron) and undoes #23685.
Suggestion: keep a positive allow set of user facing built-ins (at least kirocrew-conductor) that unchatted_legacy_bindings skips, so /api/agents always lists them; the Members page can keep deciding by has_dm_message.
Rule: a fix must not remove a surface a recorded decision depends on.
There was a problem hiding this comment.
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#38930179]: Pushed 968260afbdec5089236248cd17447fb522eeef9b. Still one commit; agents.py is unchanged and there is no name list.
- Autouse fixture:
_owner_callernow requests_floor_monkeypatchinstead of the sharedmonkeypatch. - Picker coverage: new
test_the_picker_catalog_offers_the_conductor_template_without_a_threaddrivesGET /api/agents/catalogwith an installedkirocrew-conductorspec and a legacykirocrew-conductorbinding that has no DM binding (the fresh-install shape). It asserts the catalog still listskirocrew-conductoras atemplaterow, whileGET /api/agentsleaves the un-chatted binding out.
|
|
||
|
|
||
| @pytest.fixture(autouse=True) | ||
| def _owner_caller(monkeypatch): |
There was a problem hiding this comment.
New autouse fixture patches through the shared monkeypatch.
Any test in this module that calls monkeypatch.undo() would lift the owner caller override for the rest of that test. Semgrep test-autouse-shared-monkeypatch is red on this line and the GPT lane upheld the same finding.
@pytest.fixture(autouse=True)
def _owner_caller(monkeypatch):Suggestion: def _owner_caller(_floor_monkeypatch): and call _floor_monkeypatch.setattr(...).
Rule: tests are deterministic (D11, autouse fixtures use _floor_monkeypatch).
| with patch("kiro_crew.config.loader.KiroCrewConfig.load", return_value=fake): | ||
| for name in (*CHATTED, "opened"): | ||
| slug = members_mod.member_slug(name, fake) | ||
| members_mod.write_dm_binding(slug, member=name, slot_key=f"member-{slug}") |
There was a problem hiding this comment.
The fixture only seeds the member DM path, so the picker regression above is invisible to the tests.
seeded writes a DM binding for every chatted name, which is exactly the evidence unchatted_legacy_bindings reads. A test where kirocrew-conductor has no DM binding (fresh install, or a picker only chat) and GET /api/agents still lists it would pin the behavior #23685 restored.
Rule: a regression test pins the case the previous fix existed for.
|
@bolichen97 thanks for the careful read. On point 1, I think the pickers are not affected:
That is from reading the code on main ( |
fde1b9f to
968260a
Compare
Withdrawn at 968260a: the pickers read the catalog, the autouse fixture now uses _floor_monkeypatch, and a new test pins the fresh-install conductor.
bolichen97
left a comment
There was a problem hiding this comment.
Re-reviewed at 968260a. I am withdrawing my earlier request for changes.
- Picker finding: withdrawn. I checked
website/src/hooks/useAgents.ts. AgentSelector, the schedule form, the channel page and the command bar readGET /api/agents/catalog, notGET /api/agents.kirocrew-conductoris not in_BACKGROUND_ONLY_FILES, so the catalog still offers it as a template on a fresh install. My comment assumed the wrong endpoint. - Autouse fixture: fixed.
_owner_callernow requests_floor_monkeypatch. - Missing test: fixed.
test_the_picker_catalog_offers_the_conductor_template_without_a_threadpins that the catalog lists the conductor with no DM binding whileGET /api/agentsleaves it out.
Verified locally on this head: test/test_legacy_binding_roster.py and test/test_members_welcome_claimed.py pass (7 tests), and the roster, agent order, chat agent selection, composition contract, welcome and avatar suites pass (431 tests).
One small follow-up (non-blocking): the first Reader line in the description still says the pickers read GET /api/agents and that an un-chatted conductor is no longer offered. Per the new test, the pickers read the catalog and keep offering it. The surfaces that read GET /api/agents are the Agents page, the crew editors and the chat model settings. Please correct that line so the description matches the code.
The code looks clean to me. Approval waits on the readiness signal, which is still checking on this head, and on the required checks still running.
bolichen97
left a comment
There was a problem hiding this comment.
Approving at 968260a. Gates checked on this head: readiness passed, required checks green, all AI review lanes pass (the one cancelled Sensitive Change Review run was superseded by passing reruns), no merge conflict, base is main. Earlier review findings are addressed. Thanks!
Problem / Motivation
Goal: A legacy built-in agent the user has chatted with shows in the Mate list and the crewmate pickers, and one they never chatted with stays out of the way, with no agent named as a special case.
A legacy built-in binding (
source: builtin, nomember_id, such as an older install'sassistant) is dropped by both rosters before any other rule runs. A user who chatted with such an agent loses it from the Mate list and the pickers, even though its DM thread is still on disk. #23685 brought back one of them,kirocrew-conductor, by name; every other legacy binding with real history is still hidden.Why it matters
Users who upgrade lose the agents they actually talked to from the Mate list, and a name list only fixes the names someone thought to add. The roster already has a rule for rows the dashboard did not create (listed once the thread holds a message, otherwise reached by search), so legacy bindings can follow it instead.
Not a goal
mate_config_migration,crewmate_prune_migration).has_dm_messagerule is reused as is.What changed (motivation → approach → change)
kirocrew-conductorlisted, by name)GET /api/membersandGET /api/agentskirocrew-conductorlisted anyway)default, dashboard-created matesSymptom: a chatted legacy agent is missing from the Mate list. Cause:
members_roster.api_membersandagents.api_kirocrew_agentsboth skipis_legacy_bindingrows up front, so thehas_dm_message+dashboard_createdlisting rule never sees them.Change:
GET /api/membersno longer skips legacy bindings. Such a row ships withdashboard_created: false, andhas_dm_messagedecides on the Crewmates page (listedByDefaultinwebsite/src/pages/members/rosterFilter.tslists a row whenhas_dm_messageis true and hides it when false). No frontend change is needed.GET /api/agentslists a legacy binding only when its DM thread holds a message.members_roster.unchatted_legacy_bindingsreads each candidate's DM binding and transcript the same way the members roster computeshas_dm_message(read_dm_thread_message_state, oneasyncio.to_threadhop for all candidates), then checks the live slot on the loop. The two rosters share_transcript_holds_messageand_live_slot_has_rows, so the rule is defined once.agents.pyreaches it through themembersfacade.USER_FACING_BUILTIN_BINDINGSand its special case inmate_worker.is_legacy_bindingare removed.is_legacy_bindingstays: it names the candidates the pickers check.docs/system-specs/modules/crew-mode.mdstates the rule for legacy bindings.Backwards compatibility
Compatible: no record, route or key changes;
GET /api/membersgains rows the page already knows how to hide, andGET /api/agentskeeps the same row shape.Reader: website/src/pages/KiroCrewAgentsPage.tsx, website/src/pages/members/useMembersPageCrewEditor.ts, website/src/components/crew/useCrewEditor.ts and website/src/pages/settings/useChatPanelModels.ts:api.kirocrewAgents -- crew page -- these read GET /api/agents, which now lists a legacy built-in only once its thread holds a message; an un-chatted one is not a crewmate there. The pickers (AgentSelector, schedule form, channel page, command bar) read GET /api/agents/catalog through hooks/useAgents.ts and keep offering kirocrew-conductor as a template (test_the_picker_catalog_offers_the_conductor_template_without_a_thread)
Reader: website/src/pages/members/rosterFilter.ts:listedByDefault -- crew page -- legacy rows now arrive with
has_dm_message, so an un-chatted one is hidden and a chatted one listed (test_the_members_roster_lets_the_thread_decide)Reader: src/kiro_crew/dashboard/handlers/members_roster.py:api_members -- crew page --
has_dm_messageis computed for legacy rows exactly as for other rows (test_the_members_roster_lets_the_thread_decide)Tests
test/test_legacy_binding_roster.py:test_only_a_builtin_binding_without_an_id_is_legacy:kirocrew-conductorwith no id is legacy like any other built-in;default, Mate and a shared-memory crewmate are not.test_the_members_roster_lets_the_thread_decide: legacy rows appear inGET /api/memberswithdashboard_created: false; chatted ones (helper,kirocrew-conductor) carryhas_dm_message: true, un-chatted and metadata-only ones carryfalse; a dashboard-created mate anddefaultare unaffected.test_the_agents_roster_lists_a_legacy_binding_once_chatted:GET /api/agentslists the chatted legacy bindings, leaves out the un-chatted and metadata-only ones, and still listsdefaultand the dashboard-created mate.test_a_live_slot_row_lists_an_unflushed_legacy_thread: a message still in the live slot lists the row before it reaches disk.Proof: PROVEN test/test_legacy_binding_roster.py::test_only_a_builtin_binding_without_an_id_is_legacy, test/test_legacy_binding_roster.py::test_the_agents_roster_lists_a_legacy_binding_once_chatted, test/test_legacy_binding_roster.py::test_a_live_slot_row_lists_an_unflushed_legacy_thread, test/test_legacy_binding_roster.py::test_the_picker_catalog_offers_the_conductor_template_without_a_thread (head 968260a)
Manual verification
N/A — unit coverage sufficient: both routes are exercised end to end over HTTP with a real DM binding and a real conversation log, and the frontend rule they feed is unchanged.
Related Issues
Refs #23685
Sibling sweep
Swept: git grep -n "is_legacy_binding" -- src website
Sibling: src/kiro_crew/dashboard/handlers/members_roster.py -- changed here -- the early skip is removed
Sibling: src/kiro_crew/dashboard/handlers/agents.py -- changed here -- the skip is replaced by the thread check
Pattern harvest
Not generalizable: the roster already had a general listing rule; this defect was one filter that ran ahead of it, and both such filters are removed here.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.