Repository navigation
fix(crew): prune generated crewmates never chatted with on their page - #14897
Conversation
Design Review (Fable 5) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS The PR itself authors the RFC revision it relies on: pinned keep-behaviours (description edits, agent-run sessions) now delete rows with no named human decider. WatchThe old test [DESIGN-REVIEWED] 6f13609 Description read[DESCRIPTION-READ] 3a4cbda2df3ac20376c520d50f4b91bccf75e66e6d619cc651d6d1db703f4cc7 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 (Fable 5) — ✅ human override accepted@buluoray overrode this lane for |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
b333f83 to
5edc75d
Compare
|
|
|
|
|
5edc75d to
752aa58
Compare
|
|
|
|
Opus 5 Review — ✅ no blocking findingsReviewed Review detailsStrict fork-sidecar read turns an unreadable FINDING — src/kiro_crew/crewmate_prune_migration.py:369 — [OPUS-REVIEWED] 6f13609 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
752aa58 to
ce490b6
Compare
f2eea79 to
d811cde
Compare
|
d811cde to
3958dd4
Compare
|
|
/ai-review override first-principles 3958dd4: Product owner decision: RFC crewmates-launch §03 is amended in this same PR to cover package-installed specs, define chatted as a Crewmates-page DM turn, and keep created, teamed and runtime-owned crewmates. |
Human judgment recorded@buluoray marked the first-principles AI finding as false positive, not applicable, or explicitly accepted for
This decision applies only to this commit. A new push requires a new judgment. |
The startup prune only accepted rows stamped source "builtin", but the old agent sync stamped each row with its spec's own source, so installs whose agents came from packages had every row skipped and kept a roster full of templates. Its "chatted" rule also counted any session that ran the agent (subagent, cron, app slot) and a DM thread merely opened. A row bound to an installed user or package spec, whose source stamp matches that spec's, is now a candidate, and it counts as chatted only when its own Crewmates page DM transcript holds a turn past the metadata line, archived compaction segments included. The marker moves to crewmate_prune_v2_migrated.json so installs the first pass left untouched get one more run. The crewmates launch RFC's section 03 records the rule: package-installed specs are covered, the runtime's own, private and uninstalled specs are left alone, and "chatted with" means a turn in the crewmate's own Crewmates-page thread.
3958dd4 to
6f13609
Compare
|
|
/ai-review override first-principles 6f13609: Product owner decision: RFC crewmates-launch §03 is amended in this same PR to cover package-installed specs, define chatted as a Crewmates-page DM turn, and keep created, teamed and runtime-owned crewmates. |
Human judgment recorded@buluoray marked the first-principles AI finding as false positive, not applicable, or explicitly accepted for
This decision applies only to this commit. A new push requires a new judgment. |
…15576) * fix(crew): prune generated crewmates never chatted with on their page (#14897) The startup prune only accepted rows stamped source "builtin", but the old agent sync stamped each row with its spec's own source, so installs whose agents came from packages had every row skipped and kept a roster full of templates. Its "chatted" rule also counted any session that ran the agent (subagent, cron, app slot) and a DM thread merely opened. A row bound to an installed user or package spec, whose source stamp matches that spec's, is now a candidate, and it counts as chatted only when its own Crewmates page DM transcript holds a turn past the metadata line, archived compaction segments included. The marker moves to crewmate_prune_v2_migrated.json so installs the first pass left untouched get one more run. The crewmates launch RFC's section 03 records the rule: package-installed specs are covered, the runtime's own, private and uninstalled specs are left alone, and "chatted with" means a turn in the crewmate's own Crewmates-page thread. (cherry picked from commit c5c307c) * fix: prune generated crewmates bound to skill-view aliases (#15103) * fix: prune generated crewmates bound to skill-view aliases An older agent sync walked the agents directory before discovery learned to leave skill-view aliases out, so it enrolled one crewmate per alias file. The startup prune only judges rows whose spec discovery lists, and discovery never lists an alias, so every such row was kept as if its agent were uninstalled and the roster stayed full of them. A row bound to an alias is now judged on its own sync stamp and fresh-sync shape. The member_id, overlay, team and chatted rules still apply, the delete re-checks the row under the same locks, and the marker moves to v3 so installs the earlier passes left untouched run once more. * fix: judge only exact alias names on the row alone A row is judged as a skill-view alias row only when its name is exactly what the projection writes: the prefix plus 24 lowercase hex digits. A crewmate named with the prefix and any other tail is an ordinary row and needs an installed spec, so with none it is kept. The pre-delete docstrings now say the spec re-read applies to rows bound to an installed spec; an alias row has no spec to re-read. (cherry picked from commit 6fb9523) --------- Co-authored-by: Ray Xu <38930179+buluoray@users.noreply.github.com>
Problem / Motivation
Goal: a crewmate the user never chatted with on the Crewmates page is pruned at startup, so the roster stops showing a wall of agent templates.
The one-time startup prune from #12798 runs and writes its marker, but on installs whose agents come from packages it removes nothing. Every row the old agent sync wrote carries the spec's own source (
package,aim), and the prune only acceptedbuiltin. On one real install all 28 generated rows were skipped. Rows it did look at were often kept anyway, because a subagent, cron or app slot that ran the agent, or a DM thread that was only opened, counted as "chatted".Why it matters
Anyone who upgraded from a build that ran
POST /api/agents/synckeeps a Crewmates roster full of templates they never used, and the v1 marker means the prune never tries again.Not a goal
What changed (motivation → approach → change)
In
src/kiro_crew/crewmate_prune_migration.py, a generated crewmate is now pruned unless you actually talked to it on its own Crewmates page.source == "builtin"onlysourcestamp matching that spec's (packageandaimare one source); never a Kiro Crew-owned spec or akirocrewstamp, a private copy, a spec that is gone, a crewmate on a team, or a row with amember_iddashboard_member-<slug>transcript, archived compaction segments includedcrewmate_prune_migrated.jsoncrewmate_prune_v2_migrated.jsonThis PR amends §03 of
docs/request-for-change/rfc-crewmates-launch.mdto record this rule: package-installed specs are covered, the runtime's own, private and uninstalled specs are left alone, and "chatted with" means a turn in the crewmate's own Crewmates-page thread. A description edit does not protect a never-chatted generated row, as the RFC states; the delete re-reads the spec under the locks and refuses if its name, source, private or Kiro Crew-owned status changed. Crewmates whose names map to the same Crewmates-page thread are judged by that shared thread. The transcript read goes throughjsonl_util.strict_raw_records; a row too long to buffer still counts as a turn, and any other unreadable row, or an archive directory that cannot be listed, keeps the crewmate. The locking, the refusal checks and the rule that any doubt keeps the row are the same. The new marker name gives installs the first pass left untouched one more run. The comments indashboard/server.py, the crew-mode spec and the feature map describe the new rule.Backwards compatibility
Compatible: the pass only deletes rows whose every field still equals what the sync wrote from the spec and that have no DM turn; hand-made, owner-edited and unreadable rows are kept, and the pass removes roster rows only, never agent spec files.
Tests
test/test_crewmate_prune_migration.pyis rewritten around the new rule (79 tests): user and package rows are candidates; Kiro Crew-owned,kirocrew, spec-less, source-mismatched, non-string-source and created (member_id) and teamed rows are kept (including one teamed mid-pass); an edited-description row with no DM turn is removed; a spec renamed, made private, re-sourced or made Kiro Crew-owned mid-pass keeps its row; only a DM transcript turn counts as chatted (not subagent, cron, app or plain-chat sessions, not an empty or metadata-only thread); archived segments count; a torn or over-cap row still counts; an unlistable archive directory keeps the row; the v2 marker re-runs after v1. Each guard (source type, source match, spec-less skip, over-cap row, archive listing) was broken on purpose one at a time and each broke a test.Manual verification
Checked on a real install with 29 generated crewmates, none of which except
defaulthad a Crewmates-page DM turn. An earlier revision of the pass ran there and removed 19. Under this revision the 4 rows whose description had drifted from the spec are removed too, and the 5 rows whose spec is no longer installed stay.Related Issues
no linked issue: follow-up to #12798, whose filter missed package-sourced rows.
Pattern harvest
Not generalizable: the defect is one migration matching a single literal source value that the historical writer never stamped.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)