Skip to content

fix: prune generated crewmates bound to skill-view aliases - #15103

Merged
iamwhatever merged 2 commits into
mainfrom
fix/crewmate-prune-skill-view-aliases
Sep 30, 2026
Merged

iamwhatever merged 2 commits into
mainfrom
fix/crewmate-prune-skill-view-aliases

Conversation

@buluoray

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The startup crewmate prune also removes the never-chatted crewmates an older sync generated for skill-view alias files.

Users still see dozens of crewmates named kirocrew-skill-view-<hex> on the Crewmates page after the prune has run, and clearing the marker and re-running removes none of them. Each row is exactly what the old sync wrote: no member_id, the shared default store, a builtin stamp and the spec's description.

Why it matters

The prune exists so the Crewmates page shows only crewmates the person made or talked to. On installs with many skill-bearing agents, the alias rows are most of the roster, so the page stays cluttered and the prune looks broken.

Not a goal

  • Changing which rows count as the owner's: member_id, a config.local.json leaf, a team, a non-default field or a Crewmates-page DM turn still keep a row.
  • Pruning rows bound to the runtime's own agents, private copies or other uninstalled specs.
  • Touching the alias files under the agents directory.

What changed (motivation → approach → change)

Before After
Row bound to a kirocrew-skill-view-* alias, fresh sync shape, never chatted kept removed
Same row with member_id, overlay leaf, team, tuned field or a DM turn kept kept
Same row stamped kirocrew kept kept
Marker crewmate_prune_v2_migrated.json crewmate_prune_v3_migrated.json

The prune only judges a row whose spec discovery lists. Discovery never lists a skill-view alias (agent_spec_format.is_native_skill_alias_name), because the runtime writes those files to project another spec's skills. So every alias row looked like a crewmate whose agent was uninstalled, and the prune skipped it.

crewmate_prune_migration.py now judges an alias row on the row alone: its string stamp must be builtin, package or aim and its shape a fresh sync row. The delete re-checks the row's identity and shape under the same locks and skips the spec re-read, since there is no spec. The marker moves to v3, so installs that already wrote the v1 or v2 marker run the pass once more. The crew-mode.md spec, the feature map and RFC crewmates-launch §03 say that an alias row is a generated row, not an uninstalled spec.

Backwards compatibility

Compatible: only config.json rows the old sync wrote for alias files are removed, under the same keep rules as every other generated row; no agent file or transcript is touched.

Tests

  • test_rows_bound_to_skill_view_aliases_are_removed: both row shapes seen in the field (with and without model/display_name) are removed when discovery lists no spec.
  • test_a_skill_view_row_the_owner_chatted_with_or_claimed_is_kept: a DM turn, a member_id, a tuned field or a kirocrew stamp keeps an alias row, and nothing is refused.
  • test_the_first_passes_marker_does_not_stop_this_one now also leaves a v2 marker in place and expects the pass to run.
  • Mutation check: dropping the alias branch, its source check, its shape check, the delete-side alias branch, or reverting the marker name each turns a test red. Related backend tests: 222 passed.

Manual verification

N/A -- unit coverage sufficient: the change is a config-row filter, and the tests use the exact rows a user reported.

Related Issues

no linked issue: reported directly by a user on the internal edition.

Pattern harvest

Not generalizable: the miss came from one filter (discovery's alias exclusion) that this pass relied on as its spec inventory.

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

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.
@buluoray
buluoray requested a review from a team as a code owner September 29, 2026 19:32
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 29, 2026
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

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

Design-Verdict: PASS

Nothing to check.

The alias-name pin (prefix + 24 hex) is duplicated from skill_projection._LEGACY_ALIAS_NAME_RE rather than shared, but that mirrors the projection's own deliberate rule that a delete pass pins its shape independently of the writer — and since the sync that wrote these rows is gone (#12224), the historical shape is frozen, so drift is impossible. Keep rules, lock discipline, doubt handling, and the marker-bump seam are all reused unchanged; docs updated in the same commit; no rendered surface changes.

[DESIGN-REVIEWED] f32819a

Description read

[DESCRIPTION-READ] 8e5d41ef738741ea867f64a7b542b3c5ce8139523bc5fe477991d2f2a58669dd

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

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of f32819adb101873036f93911017219d9c4b3eebc — 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: PASS

Confirm on an affected install the alias rows carry a sync-source stamp and fresh-sync shape; a mismatch makes this pass a third silent no-op.

What this change ships

Inventory (5 items) — 5 justified

Intent: FIX — the startup prune also removes the never-chatted crewmates an older sync generated for skill-view alias files, so the Crewmates page stops showing dozens of kirocrew-skill-view-<hex> rows.

  1. Never-chatted rows bound to exact skill-view alias names are now removed by the startup prune — justified
  2. The prune runs once more on installs that already completed it (marker moves to v3) — justified
  3. An alias row's delete re-checks the row's own name and shape instead of re-reading a spec — justified
  4. A prefixed name with any other tail stays an ordinary row needing an installed spec — justified
  5. The prune's docs (crew-mode spec, feature map, crewmates-launch RFC) now record the alias-row rule — justified

Evidence checked: the new tests fail on base (base skips alias rows because iter_agent_spec_files filters them, agent_spec_format.py:219); the projection mints exactly prefix + 24 hex (skill_projection.py:1877), so the exact-match regex is right and the existing prefix-only is_native_skill_alias_name would over-match a person-named row; the identical regex at skill_projection.py:83 is deliberately pinned per-deleter by its own comment, so no shared-symbol subtraction applies; keep rules (member_id, overlay, team, chat, kirocrew stamp) still apply to alias rows. The 4.6MB workflow diff also carries base-drift already merged to main (design_tweak log bounding, chat-sidebar split, cron mirror-backend tests); that content is not this PR's and is not inventoried.

[FIRST-PRINCIPLES-REVIEWED] f32819a

Description read

[DESCRIPTION-READ] 33dd6192efc2fbad44c0f54cae67b65f4a5b8443a6da7ea2a738b36e8fb3223e

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 Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of f32819adb101873036f93911017219d9c4b3eebc and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] f32819a

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

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] f32819a

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

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

@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 Sep 29, 2026
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.
@buluoray

Copy link
Copy Markdown
Contributor Author

GPT F1 (crewmate_prune_migration.py:349, prefix match too broad): fixed in f32819a. A row is judged on the row alone only when its name fully matches kirocrew-skill-view- + 24 lowercase hex, the name the projection writes. Any other prefixed tail is an ordinary row and needs an installed spec, so it is kept. New parametrized test covers 5 near-miss names; reverting the predicate to the bare prefix turns all 5 red.

Opus advisory (docstrings say the spec is always re-read before a delete): both docstrings now scope the re-read to rows bound to an installed spec.

@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 Sep 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — ✅ PASS

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

UX-Verdict: PASS

Nothing to check.

[UX-REVIEWED] f32819a

Description read

[DESCRIPTION-READ] 363c5a128e9565076420a01f8ceaeb605bd1327be6628c6175765dcc3dd54f03

That sha256 names everything this verdict read: the PR description, plus the 9 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: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Sep 30, 2026

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

Reviewed. A row is deleted only if its name fullmatches kirocrew-skill-view-<24 hex>, its source is builtin/package/aim, it has the fresh sync shape (any member_id, model, memory_store or extra key keeps it), it is not in the overlay or a team, and it has no Crewmates DM turn (unreadable history keeps it). Delete time re-checks under the config lock; no agent files or transcripts are touched; v3 marker makes it run once. No path to losing a user-authored or chatted crewmate.

Non-blocking: _SKILL_VIEW_ALIAS_NAME_RE duplicates skill_projection._LEGACY_ALIAS_NAME_RE, importing it would stop drift.

@iamwhatever
iamwhatever enabled auto-merge (squash) September 30, 2026 05:28
@iamwhatever
iamwhatever merged commit 6fb9523 into main Sep 30, 2026
97 checks passed
@iamwhatever
iamwhatever deleted the fix/crewmate-prune-skill-view-aliases branch September 30, 2026 05:32
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 30, 2026
bolichen97 added a commit that referenced this pull request Sep 30, 2026
…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>
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.

3 participants