Skip to content

fix(members): accept free-form display names - #11121

Merged
CrysisDeu merged 2 commits into
kirodotdev:mainfrom
vinayshah1998:fix/member-display-names
Sep 27, 2026
Merged

CrysisDeu merged 2 commits into
kirodotdev:mainfrom
vinayshah1998:fix/member-display-names

Conversation

@vinayshah1998

@vinayshah1998 vinayshah1998 commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Crew Member names are display text, but several member paths applied the strict agent-identifier grammar. A configured member such as dr. eggbot disappeared from the roster, and its activity, rules, chat, panel, and restore paths rejected or mishandled the exact name.

Why it matters

Members with spaces, periods, international text, or emoji could be configured but not managed from the Members page. Mixed name domains also created unsafe fallback paths for malformed legacy bindings, prompt assembly, event-log ownership, template policy lookup, and operator recovery.

What changed

Crew Member display names now use members.validate_member_name. The exact display name remains separate from the stable member ID, derived path slug, slot key, and kiro_agent template identifier.

Roster, thread, activity, rules, briefing, teams, CLI creation, dashboard creation, panel, pinned chat, reset, resume, and OpenAI-compatible paths preserve safe free-form names. The teams registry view (handlers/teams.py) applies the roster's own eligibility filter, and crew_teams.MEMBER_NAME_MAX_CHARS is the display-name cap, so every crew the roster lists can be placed on a team. The agent-choice guards (chat send, slot agent switch, OpenAI-compatible model) admit a configured, dispatchable free-form member on an ordinary slot through members.is_configured_dispatchable_member; an off-grammar string that is not a configured member is still refused. is_dispatchable_member_name rejects stored names that fail display-name validation or require external-text redaction. Legacy NFD spellings remain dispatchable when NFC normalization is their only validation difference and neither form requires redaction. The stored identity and pin comparison remain byte-exact.

Activity and rules require dispatch eligibility because those routes return or store member data used by dispatch. Panel reads use the broader is_readable_member_name predicate. The exact panel name is used only for byte-exact ownership-digest comparison, and every returned panel field is already scrubbed, so a credential-shaped legacy owner can recover its panel without exposing the raw name.

Chat, OpenAI-compatible requests, slot-agent updates, boot restore, explicit resume, and _run_chat enforce dispatch eligibility before model execution. The post-resolution _run_chat guard also covers a non-dispatchable default member selected for an ordinary slot. It returns before execution-context publication, provider acquisition, or prompt construction. Both refusal warnings redact slot keys through the companion-aware log chain.

Security and ownership guards now fail closed. Startup event-log reconciliation counts every slug claimant before filtering unsafe names. It mutates only a uniquely owned member log and emits bounded diagnostics without display names, foreign headers, or exception text. SEL assignment events and startup restore warnings redact stored identities before logging. Dotted template identifiers resolve through every read-side policy consumer while writes keep the bounded template grammar. The agent fields of spawn_run, spawn_continue, cron_add and cron_update, and the spawn roster (subagent.visible_agent_names), admit the same registered-agent grammar (validation.REGISTERED_AGENT_NAME_RE), so a published dotted template can be spawned and scheduled; Crew Members are still named through crew / member_id, never through agent. _AGENT_NAME_RE and the consolidated TEMPLATE_NAME_RE anchor with \Z (a trailing newline no longer matches), and a template identifier may not end in ., -, or _; this tightens identifier validation for every consumer of those regexes, not only members.

A stored name can become non-dispatchable after the redaction policy changes. kirocrew doctor now reports the affected count without printing names or slugs. On a host whose platform failed to compose, where doctor is the one command still allowed to run, both member sections print not checked and defer to the Platform section instead of aborting the report. It directs the operator to create a safe replacement in Crew Manager, change the default if needed, and delete the old record. The replacement gets a new member identity and does not inherit the old member key's DM history.

Tests

  • The first commit passed 1,449 affected tests and a separate 1,401-test latest-base dependency overlap gate.
  • The current remediation passed a 575-test corrected adjacent run and a non-overlapping 2,132-test broader PR-affected run.
  • A final 29-test focused run passed after composing dispatch eligibility on safe local references.
  • A two-test red-first log closure failed on raw credential-shaped slot keys before the fix and passed after both refusal warnings used companion-aware log redaction.
  • Black, isort, Flake8, mypy, subprocess-encoding, comment-history, git diff --check, and documentation checks pass. Documentation lint also passed its self-test and scanned 364 Markdown files.
  • Tests cover a free-form member on a team and on an ordinary chat slot, doctor on a host whose platform did not compose, safe free-form names, credential-shaped stored names, explicit and omitted-agent dispatch, OpenAI-compatible requests, direct runner refusal, AutoNudge finalization, boot restore, resume races, slug collisions, diagnostic secrecy, template policy, and doctor recovery output.

Manual verification

The original failure reproduced as an empty Members roster and HTTP 400 responses for a configured dr. eggbot. The corrected API tests round-trip that exact name through roster, thread, activity, rules, chat, reset, panel, and OpenAI-compatible requests. Legacy NFD tests also exercise activity, rules, and panel access. A credential-shaped legacy owner can read only its scrubbed panel, while ordinary-slot default-member dispatch fails before model access.

Review findings were reproduced before each fix. The tests observed lost dotted-template MCP grants, skipped startup reconciliation, credential-shaped prompt egress, unsafe SEL values, pre-refusal resume mutations, a live resume bypass, and doctor output with no recovery path. The current tests prove that each path fails closed without model execution, disclosure, or hidden resume writes.

Known baseline

Both Linux and Windows backend shard 7 currently fail test/test_crew_log_exc_info_sites.py::test_no_exc_info_site_anywhere_in_kiro_crew_holds_a_crew_log_handle because src/kiro_crew/apps/builtins/issue_radar/backend/crew_store.py has two existing exc_info=True sites. This PR does not touch Issue Radar, and the same test fails on main.

Related Issues

N/A. No issue is linked.

Pattern harvest

Rule candidate: keep user-facing display text separate from path, route, slot, and template identifiers. Derive each identifier at the boundary that requires it.

Place safety guards at the shared egress boundary. Keep earlier protocol checks only when they preserve stable errors or prevent side effects.

Checklist

  • At most two commits. This PR has two.
  • Existing tests pass and new tests cover the changed behavior.
  • Self-review completed and code follows project style.
  • Documentation updated.
  • No secrets, credentials, or internal references in the diff.

Contribution License Agreement

@vinayshah1998
vinayshah1998 requested review from a team and CrysisDeu September 15, 2026 21:54
@github-actions github-actions Bot added the fork Pull request from a fork (external contributor) label Sep 15, 2026
@dwu96

dwu96 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

👋 Hi! This PR's description is missing some required sections from our PR template. Workflow runs won't be auto-approved until the description is updated.

Missing sections:

  • ## Problem / Motivation
  • ## Why it matters
  • ## What changed
  • ## Tests

Please update your PR description to include these sections, then push or re-save the description. The workflows will be approved on the next cycle.

@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Sep 15, 2026
@vinayshah1998
vinayshah1998 force-pushed the fix/member-display-names branch from 8733dfa to b2092de Compare September 15, 2026 22:48
@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — 🟡 CONCERNS

Design-level review of a1db504485d8c55ec2ecdf56be6fce40941bd8fe via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

A stored member name that turns non-dispatchable strands its DM thread permanently — no rename exists, and the only remedy discards the thread's history.

Watch

  • Dispatch eligibility is now a function of the mutable redaction policy ("A stored name can become non-dispatchable after the redaction policy changes"), and the docs state "Crew Manager has no rename operation... does not inherit the old member key's DM history." A future redaction-pattern update that false-positives on a legitimate display name silently drops the member from the roster and 409s its thread, with kirocrew doctor as the only explanation and recreate-with-history-loss as the only remedy. The history stays on disk under the old key, so this is recoverable later, but humans should own that trade now.
    Clears when: a maintainer explicitly accepts recreate-without-history as the remediation, or a rename/history-transfer follow-up is filed.

Suggestions

  • When a member is hidden for non-dispatchability, consider surfacing a redacted "1 member needs attention" row in the roster itself rather than only in doctor — the vanishing-member symptom is exactly what this PR set out to fix.

[DESIGN-REVIEWED] a1db504

@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — ✅ no blocking findings

Reviewed a1db504485d8c55ec2ecdf56be6fce40941bd8fe via the fork AI-review pipeline; updated in place on each push.

Review details

FINDING -- docs/system-specs/modules/learn-cron-dashboard.md:1221 -- "It is a pure read" contradicts the owned-log reconciliation writes -> Fix: document the ownership-gated writes.
FINDING -- src/kiro_crew/members.py:441 -- "validation._AGENT_NAME_RE" misdocuments guards using the combined is_registered_agent_name grammar -> Fix: name the combined grammar in both changed texts.
[GPT-REVIEWED] a1db504

@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5, fork) — 🟡 CONCERNS

Premise-level review of a1db504485d8c55ec2ecdf56be6fce40941bd8fe via the fork AI-review pipeline — 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 period-only name refusal patches one spelling of "display name is a URL path segment" while the tests deliberately bless /-containing names on that same segment.

Not justified as shipped

  • Item 2 — symptom-level: validate_member_name refuses ./.. because such a crew "could be created but never addressed at /api/agents/{name} for edit or delete", yet the rewritten roster-contract test blesses names containing / ("/ inside a name are display text and pass") — and both PUT and DELETE /api/agents/{name} (routes/agents.py:52-53) read the exact name from request.match_info["name"], a single path segment a / splits or a %2F round-trip must survive. The cause the guard's own comment names covers the / sibling it admits, and "delete the old record" is this PR's prescribed recovery for a bad name.
    Clears when: a test round-trips a /-containing name through PUT and DELETE /api/agents/{name}, or / is refused with the period-only forms.

What this change ships

Inventory (10 items) — 9 justified

Intent: FIX — a configured free-form crew name (dr. eggbot) vanished from the Members roster and was refused by its own thread, activity, rules, panel and chat routes; separate display text from identifier grammars.

  1. Free-form member names (spaces, periods, non-ASCII, emoji) now create, list and round-trip everywhere — justified
  2. Names that are only periods are refused while /-containing names pass — symptom-level: the path-segment cause it cites also covers /
  3. Free-form members are teamable; team name cap 64→500 chars, teams file cap 40→320 MB (pinned inequality) — justified
  4. Credential-shaped stored names are refused at every dispatch seam (409 member_pin_mismatch) and omitted from the roster — justified
  5. kirocrew doctor counts non-dispatchable names, name-free, and prints not checked when the platform did not compose — justified
  6. Dotted template ids (reviewer.v2) now resolve read-side, restoring their MCP grants — justified
  7. Template ids may no longer end in ./-/_; name regexes anchor with \Z — justified
  8. One shared external-text redactor replaces discover.py's private copy, routed through the canonical context shim — justified
  9. Startup event-log reconcile skips ambiguous slugs and placeholder/foreign headers; diagnostics carry counts and slugs only — justified
  10. Member name is scrubbed in prompt assembly; SEL assignment events and restore warnings redact stored identities — justified

More restructures ride along (openai-compat guard ordering, idempotent template rebind); none ships new surface.

[FIRST-PRINCIPLES-REVIEWED] a1db504

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

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review (fork) — 🔴 changes requested (blocking)

Reviewed a1db504485d8c55ec2ecdf56be6fce40941bd8fe via the fork AI-review pipeline; updated in place on each push.

Blocks: the create-route name-refusal ratchet in test/test_config_api.py is narrowed with a .filter and its assertions deleted, although the wide domain still holds exactly under the new validator.

BLOCKING — test/test_config_api.py:268

-        ),
+        ).filter(is_valid_member_name),
-                    if not _AGENT_NAME_RE.match(name):
-                        assert resp.status == 400
-                        assert create_data["code"] == "invalid_agent_name"
-                        assert json.loads(tmp.read_text()) == _seed_config()
-                        return

A draw the new route still refuses (e.g. "\u212a" — sanitize_string NFC-folds it, so validate_member_name raises and POST /api/agents returns 400 invalid_member_name before any write) is now discarded by the filter instead of asserted on, so the universal property "a name-refused create returns the refusal code and leaves config.json byte-identical" no longer executes for any input, and the remaining parametrized refusal tests assert neither byte-identity nor the non-canonical/hidden-character class the filter removes.
Fix: drop .filter(is_valid_member_name) and re-point the deleted arm at the new predicate in place — if not is_valid_member_name(name): assert resp.status == 400; assert create_data["code"] == "invalid_member_name"; assert json.loads(tmp.read_text()) == _seed_config(); return (the import is already added by this diff, and the domain is unchanged because the filter's reject set is exactly the route's reject set).

FINDING — src/kiro_crew/dashboard/handlers/agents.py:4924 — validate_member_name(name) admits dr. eggbot at create while SPAWN_RUN_SCHEMA/SPAWN_CONTINUE_SCHEMA/CRON_ADD_SCHEMA/cron_update still carry FieldSpec("agent", str, …, pattern=_AGENT_NAME_RE) and subagent.visible_agent_names filters on the same grammar, so a member the dashboard and CLI just created cannot be spawned or scheduled and is not even listed to the model, failing with a generic schema error → Fix: gate those agent fields on grammar-or-configured-dispatchable-member as the chat guards were; this needs edits in untouched validation.py/subagent.py, so it cannot land inside this diff.

[BLOCK-MERGE] a1db504
[OPUS-REVIEWED] a1db504

@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 15, 2026
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Sep 19, 2026
@vinayshah1998
vinayshah1998 force-pushed the fix/member-display-names branch from b2092de to dd3c9ba Compare September 21, 2026 23:55
@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 Sep 22, 2026
@vinayshah1998
vinayshah1998 force-pushed the fix/member-display-names branch from dd3c9ba to fa5882c Compare September 22, 2026 00:04
@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 22, 2026
@vinayshah1998
vinayshah1998 force-pushed the fix/member-display-names branch from fa5882c to 90f89aa Compare September 22, 2026 00:18
@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 22, 2026
@vinayshah1998
vinayshah1998 force-pushed the fix/member-display-names branch from 90f89aa to 1756959 Compare September 22, 2026 00:43
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Sep 22, 2026
@vinayshah1998
vinayshah1998 force-pushed the fix/member-display-names branch from 1756959 to 5891d17 Compare September 22, 2026 03:13
@CrysisDeu

CrysisDeu commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor
  • rebutted — Item 1: display-text member names reverse the pinned identifier posture and the crewmates RFC wizard-grammar note (span=fac78b9397c8)

Maintainer decision recorded: display-text Crew Member names are the intended end state, superseding the rfc-crewmates-launch §08 wizard-grammar note. The identifier grammar stays for slot keys, templates and spec-file names.
Storage follows in #13688 (config.agents keyed by member_id, display_name as a field); the Meet CrewMates wizard hint is aligned there too. The lane reads PASS on 2f6a888.

@CrysisDeu

Copy link
Copy Markdown
Contributor
  • rebutted — Item 3 rides along: fail-closed refusals for non-dispatchable stored names (span=f4c018a329d4)

Not separable: once a stored name can require redaction, every dispatch path must refuse it or the raw name reaches a model; the refusals are the safety half of the same change.

@CrysisDeu

Copy link
Copy Markdown
Contributor
  • rebutted — Item 4 rides along: dotted-template resolution (span=49b83e603120)

Splitting display names from template identifiers is what exposed that read-side policy consumers dropped published dotted templates; the fix is the identifier half of the same separation and has its own red-first test.

@CrysisDeu

Copy link
Copy Markdown
Contributor
  • rebutted — Item 5 rides along: identifier grammar tightening (span=7181ac608cdb)

Declared in the description; \Z anchoring and no trailing template punctuation are required for the identifier side to stay a safe filename grammar once names no longer share it.

@CrysisDeu

Copy link
Copy Markdown
Contributor
  • rebutted — Item 6 rides along: doctor count of non-dispatchable names (span=d2347a43eed5)

It is the only discovery path once the roster hides a name; shipping the hiding without it would leave an operator with a silently missing member.

@CrysisDeu

Copy link
Copy Markdown
Contributor
  • rebutted — Item 7 rides along: redaction shim consolidation (span=f0b4bf0462df)

is_dispatchable_member_name needs one canonical redaction predicate; the consolidation replaces a duplicated copy that every consumer of the new predicate would otherwise have to pick between.

@CrysisDeu

Copy link
Copy Markdown
Contributor
  • rebutted — Item 8 rides along: startup reconcile guards for slug collisions (span=580a7a19a9c0)

Free-form names make lossy slugs collide more often; counting claimants before mutating a member log is the guard that keeps the widened domain from writing one member's state into another's log.

@CrysisDeu

Copy link
Copy Markdown
Contributor
  • fixed — dotted templates fail _AGENT_NAME_RE.fullmatch at the send, slot-switch and OpenAI-compat template-selection guards (span=27afc892be32)

Legitimate: this PR's own agent.py / agent_capabilities.py admit published dotted templates through validation.is_registered_agent_name, so the three dispatch guards refusing reviewer.v2 were inconsistent with the identifier grammar the PR introduced.
Fixed in e29466b: all three guards use is_registered_agent_name (the _AGENT_NAME_RE OR TEMPLATE_NAME_RE union); a trailing . is still refused. Test: test_agent_switch_admits_a_published_dotted_template.

@CrysisDeu

CrysisDeu commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor
  • fixed — slug-valued ownership header treated as the member's own log during startup reconciliation (eventlog_hooks.py) (span=7b8f6e4730d8)

The adjudicator's sequence reproduces: a no-member_id template whose hyphenated name folds onto itself, pruned, then a display-name member allocated the identical slug — the sweep accepted the slug-valued header and wrote the new member's config into the retired log. Red-first test test_a_recreated_member_handed_a_retired_slug_never_inherits_the_old_log fails on e29466b and passes after the fix (fix on 2f6a888).
Fixed: ownership requires logged_name == name exactly; a header equal to the slug is reported as an ambiguous placeholder header and the log is skipped with the same bounded, slug-only diagnostic as a foreign header. The roster read (handlers/members.py) still serves a placeholder log's projection but no longer reconciles config or preview into it, so the read and write paths agree. Earlier rebutted record on this span (comment 5825155496) is withdrawn by this one.

@CrysisDeu

CrysisDeu commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Backend Lint & Type Check red on 2f6a8886d0 is fork-runner infra, not a defect in this PR.

The Check formatting (black, baselined) step dies with exit 143 (runner shutdown) on every fork PR routed to ubuntu-latest; the same gate passes locally on this head in CI shape (285 s, <1 GB peak, identical profile to origin/main). Tracked in #13689 (ci.yml runner routing fix opened separately).

@CrysisDeu

Copy link
Copy Markdown
Contributor
  • fixed — test_config_api.py create-refusal property narrowed by .filter(is_valid_member_name) (span=83735c8e559e)

Confirmed: the filter removed every refused input from the domain, so the "refused create returns the code and leaves config.json byte-identical" arm never executed. Fixed in f9c0bed exactly as suggested: filter dropped, the arm restored on is_valid_member_name asserting 400 / invalid_member_name / seed config unchanged. Probed 2000 draws of the wide strategy: 11 reach the refusal arm (non-NFC letters), so the property now exercises both sides; test_config_api.py 47 passed.

@CrysisDeu

CrysisDeu commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor
  • fixed — spawn_run/spawn_continue/cron_add/cron_update agent fields and visible_agent_names still gate on _AGENT_NAME_RE (span=c3f437d06514
    2c9d7cea33ef
    c3f437d06514)

Half rebutted, half fixed. The member half is a misread: those agent fields name a kiro-cli TEMPLATE, not a crew member -- members are dispatched through spawn_run(crew=...) and cron_add(member_id=...), which the schema deliberately leaves unpatterned (see the comment on SPAWN_RUN_SCHEMA's crew field), so dr. eggbot was spawnable and schedulable before this round.
The template half is real and contained: this PR admits published dotted templates (reviewer.v2) on every read-side resolver, but those four agent fields, the agents list item pattern, visible_agent_names and run.py's named_agent still used the slot grammar. Fixed in f9c0bed with one shared validation.REGISTERED_AGENT_NAME_RE (union of the two grammars, \Z-anchored, so a newline still fails) and is_registered_agent_name at the roster filter; test test_a_published_dotted_template_is_rendered_and_dispatchable covers admit + refuse on all surfaces.

Crew Member display names get their own bounded validator instead of
the agent-template identifier regex. Roster, thread, activity, rules,
CLI and dashboard creation, pinned-slot chat, same-name reset, and the
OpenAI-compatible paths accept the exact display name; path and route
identity still use the derived slug. kiro_agent, new slots, and
subagent addressing keep the strict grammar. Display names are scrubbed
before prompt interpolation.
@CrysisDeu

CrysisDeu commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor
  • fixed — module spec says the roster read "is a pure read" while it performs ownership-gated reconcile writes (span=be0ca0596a20)

Legitimate: the sentence arrived with main's projections-route change and did not account for the owned write-through this PR keeps. Fixed in ac6ad62: the bullet now states the one append the roster read performs (config/preview reconcile into a log whose header holds the exact member name or no header yet) and that placeholder/foreign headers are served but never written to.

@CrysisDeu

Copy link
Copy Markdown
Contributor
  • fixed — is_configured_dispatchable_member docstring names _AGENT_NAME_RE while the guards use is_registered_agent_name (span=2c9d7cea33ef)

Legitimate after this round's guard change. Fixed in ac6ad62: the docstring names the registered-agent grammar (validation.is_registered_agent_name: slot grammar or published dotted template).

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

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants