Skip to content

fix(crew): the crewmate chat draws messages only, not runner notices - #19114

Merged
chenmingwei23 merged 2 commits into
kirodotdev:mainfrom
chenmingwei23:fix/18669-crewmate-chat-messages-only
Oct 12, 2026
Merged

chenmingwei23 merged 2 commits into
kirodotdev:mainfrom
chenmingwei23:fix/18669-crewmate-chat-messages-only

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: stop a crewmate's chat drawing runtime notice rows (the automation arm refusal), so it shows messages only.

A crewmate's chat is meant to show messages only — the person's rows and the
crewmate's speech. It still drew runner notice rows: isCrewmateChatRow
dropped a notice only when it carried meta.kind = "empty_turn", so any other
notice (the automation arm refusal written when a loop update is refused) still
rendered as a yellow bar inside the crewmate's DM.

Reproduction on main: a crewmate that calls monitor_update on a loop that has
already ended gets _surface_arm_refusal writing a notice row ("Automation
update refused: a stopped loop cannot be restarted by updating it…"), and
isCrewmateChatRow draws it because its tag is not empty_turn — confirmed by
the module's own comment ("A notice row with any other tag … still draws") and
the test that pinned isCrewmateChatRow({role:'notice'}) as true.

Why it matters

A notice is the runtime talking about its own machinery; a person reading a
crewmate's DM has nothing to do with it. The maintainer recorded on 2026-10-09
that this surface shows messages only; #18672 captures that decision in
docs/decisions/ and names this PR as the code change that applies it.

Who else is affected: only the member-mode crewmate DM changes — the notice no
longer draws there, and the same information now reaches the crewmate (its next
turn) instead. No other session's notices change and the Sessions page still
draws notices as today, so this is a narrow fix that keeps the surface's intended
design, not a default-behaviour change for users who were not asking.

Not a goal

What changed (motivation → approach → change)

The crewmate chat must stop drawing the runtime's own notices → but a notice
row is never replayed to the model, so simply dropping it would lose the arm
refusal for both the person and the crewmate, and dropping EVERY notice would
also hide ones the person must act on → so the chat hides notices by an
allowlist of machinery kinds, and the refusal is re-routed to the crewmate as a
system injection.

This deliberately narrows the issue's literal acceptance ("isCrewmateChatRow
returns false for every role === 'notice'") to the two machinery kinds
{empty_turn, arm_refusal}. A blanket role-drop also removes person-actionable
notices that have no second route — a dropped queued message, a model-fallback
hint ("pick another model"), a "request not applied" warning — which review
flagged as a regression. The allowlist matches the issue's actual intent (the
arm-refusal case) while keeping those notices visible.

  • website/src/components/chat/crewmateBubbles.ts: isCrewmateChatRow hides a
    notice only when its meta.kind is in CREWMATE_HIDDEN_NOTICE_KINDS
    (empty_turn, arm_refusal); every other notice draws.
  • src/kiro_crew/dashboard/session_directive_apply.py: the refusal notice is
    tagged meta.kind = "arm_refusal" so the allowlist can match it; and in a
    member session the refusal is queued with AUTOMATION_NOTICE_KIND so it
    drains as an inject row (not a user row shown as the person's own bubble,
    and never counted as a user follow-up), carried on the crewmate's next turn.
    When the refused directive was itself the loop's own wake, the originating
    self-wake flag and loop id are stamped on the (non-durable, never-persisted)
    entry meta so the successor turn inherits them — a crewmate that retries
    monitor_stop from that turn still hits the stale-wake guard instead of
    silently removing a paused loop record a person kept.
  • src/kiro_crew/dashboard/chat_utils.py, chat_turn/steer_queue.py,
    chat_runner.py: register AUTOMATION_NOTICE_KIND as a system-injection kind
    (_SYSTEM_INJECTION_KINDS, _QUEUE_KIND_ACTORS → autonudge), map it to an
    inject row with injectKind: "automation_notice" at drain, and rebuild the
    wake provenance (_directive_self_wake / _directive_loop_id) on the
    successor turn from the live entry meta only.
  • website/src/pages/chat/RecoveryCard.tsx, store/chat/selectors.ts,
    src/kiro_crew/dashboard/state.py: classify automation_notice as a turn
    OPENER (INJECT_KIND_OPENS_TURN, TURN_INJECT_DISPATCHED, _TURN_INJECT_KINDS)
    — the drain dispatches a real turn for it, so interrupt-recovery and
    session-start-failure counting must land on it, not an earlier reply.
  • website/src/pages/chat/transcriptRenderers.tsx,
    crew-window/crewWindowRenderers.tsx, test/chatRolesParity.contract.test.ts:
    suppress the automation_notice inject row on every surface that draws
    inject rows (the Sessions page, render:()=>null) — model-only machinery
    the refusal's own notice bar already shows; registered as a documented
    page-only / peer-safe entry. The crewmate DM already hides it via
    MACHINERY_ROLES.
  • docs/system-specs/modules/session.md: update the spec to describe the
    allowlist drop, the queued refusal, and the suppressed inject row.

Backwards compatibility

Compatible. Only the member-mode crewmate DM behaves differently (a notice no
longer draws there and is instead delivered to the crewmate). Every other
session, and the Sessions page, is unchanged. No schema or config change.

Tests

  • website/src/components/chat/crewmateBubbles.test.ts: pins that only the
    machinery kinds {empty_turn, arm_refusal} are hidden and that a
    person-actionable notice (model-fallback) and an untagged notice still draw —
    fails if the filter goes back to a blanket role drop or the old
    empty_turn-only tag.
  • test/test_monitor_directive_apply.py: a refused update in a member session
    writes the person-facing notice tagged arm_refusal AND queues the refusal
    stamped AUTOMATION_NOTICE_KIND, which classifies as a system injection
    (drains as an inject row, counts as orchestration not a user follow-up) with
    the autonudge actor; in a plain session nothing is queued (notice only).
  • website/src/test/RecoveryCard.test.tsx: pins automation_notice in the
    INJECT_KIND_OPENS_TURN table as not opening a turn.
  • The shared test/fixtures/crewmate_speech_rows.json twin (is_speech_row /
    isCrewmateSpeech) is unchanged: a notice is not a speech row on either side.

Local: crewmateBubbles.test.ts, RecoveryCard.test.tsx,
test_monitor_directive_apply.py, test_mcp_apps_message_endpoint.py,
test_chat_runner_composition_contract.py, test_start_priority.py and
test_members_preview_speech_only.py pass, plus tsc, eslint, mypy, black, isort,
comment-history and docs-lint. CI runs the full cross-surface set.

Manual verification

N/A beyond the automated tests — the change is a render-time filter plus a
best-effort queue append, both covered above.

Screenshots / video

Why no screenshot: the only visual effect is the REMOVAL of a runtime
notice bar (the arm refusal) from the crewmate DM — there is no new layout,
theme, or component to show, and the row the change deletes only appears in a
live member-mode session after a monitor arm is refused. The behaviour is pinned
instead by the crewmateBubbles.test.ts cases, which assert the notice row no
longer draws.

Related Issues

Pattern harvest

Rule candidate: review-prompt — flag a blanket role drop (role === 'notice')
added to a render/visibility filter when sibling rows of that role carry a
distinguishing meta.kind. Keying the filter on the ROLE hides a whole class,
including rows outside the fix's intent; an allowlist of the machinery KINDS
shows a new row kind until it is deliberately classified.
Pattern: per-surface visibility keyed on role, not on an allowlist of kinds.

Fixes #18669

isCrewmateChatRow now drops every notice row whatever its meta.kind, so a
crewmate's DM shows the person's rows and the crewmate's speech only. An arm
refusal in a member session is also queued for the crewmate's next turn as an
injected message, since a notice row is never replayed to the model; other
sessions keep the person-facing notice row.

Fixes kirodotdev#18669
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: checking Automated validation is still running labels Oct 11, 2026
@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — 🟡 CONCERNS

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

UX-Verdict: CONCERNS

A refused automation loop now goes silent in the crewmate DM: the person only learns about it if the crewmate chooses to mention it.

Watch

  • The person loses sight of the failure. CREWMATE_HIDDEN_NOTICE_KINDS = new Set(['empty_turn', 'arm_refusal']) hides the "⚠️ Automation loop NOT armed/updated/stopped: " bar. The refusal now goes only to the model, as an [Automation notice] inject row, and MACHINERY_ROLES hides inject rows too. So when a person asks their crewmate for a recurring check and the arm is refused, nothing in the DM shows it unless the crewmate's next reply says so. If the crewmate retries quietly or says nothing, the person believes a loop is running when it isn't. Some refusal reasons, like a governance denial, can only be fixed by the person, and they can't see them. This is rare, but when it happens the failure stays invisible until the person notices missing results. Smallest fix: when the successor turn ends with no crewmate speech that mentions the refusal, draw a muted one-line notice in the DM, such as "Couldn't start the automation loop. Ask why." Or keep arm_refusal visible for reasons the crewmate can't fix itself.

Suggestions

  • In _deliver_refusal_to_crewmate, tell the model what to do with the refusal: add a line to the injected text such as "Tell the person this loop is not running and why." Then the crewmate's reply, which is the only surface the person now has, reliably carries the news.

[UX-REVIEWED] 396b27d

Description read

[DESCRIPTION-READ] e52ed6f98aa970ccf524bb5a4c683b2ab8c785a52112d2262ee1f9aa1577d4b0

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — 🟡 CONCERNS

Premise-level review of 396b27deac77bdde60a9af94074957c9f492ca68 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 crewmate never saw the notice even on main, yet the fix also re-routes it into a new agent turn that carries wake authority. The Goal never asked for that.

Not justified as shipped

  • Item 3 — oversized, rides along: the Goal is "stop a crewmate's chat drawing runtime notice rows". By the description's own words, "a notice row is never replayed to the model", so hiding it costs the crewmate nothing it had before. Items 1–2 meet the Goal on their own.
    Subtraction: delete _deliver_refusal_to_crewmate, AUTOMATION_NOTICE_KIND and its registrations (_SYSTEM_INJECTION_KINDS, _QUEUE_KIND_ACTORS, _TURN_INJECT_KINDS, INJECT_KIND_OPENS_TURN, TURN_INJECT_DISPATCHED), the REFUSAL_*_META_KEY drain block in _start_next_queued_turn, and the automation_notice_inject renderer.
    Clears when: the mechanism is removed, or a human amends the Goal.
  • Item 6 — symptom-level: _surface_arm_success (session_directive_apply.py:208) still writes an untagged "✅ Automation loop armed" notice. That is the same runtime-machinery class, and it still draws in the crewmate DM. Grep append_and_surface(... "notice": 7 writers, and this PR tags 1.
    Clears when: the description says the success notice is deliberately left drawing.

What this change ships

Inventory (6 items) — 2 justified

Intent: keep runtime machinery notices out of a crewmate's DM. This is a FIX.

  1. The arm/revision/stop refusal bar no longer shows in a crewmate's DM — justified
  2. Refusal notices now carry meta.kind = "arm_refusal" — justified
  3. In a member session, a refused directive now starts a crewmate turn on its own — oversized; rides along
  4. That turn inherits the self-wake flag and loop id of the originating wake — oversized; rides along with 3
  5. The [Automation notice] inject row is hidden on the Sessions page — rides along with 3
  6. Other machinery notices, such as "loop armed", still draw in the crewmate DM — symptom-level

[FIRST-PRINCIPLES-REVIEWED] 396b27d

Description read

[DESCRIPTION-READ] 7d2cef0c958a09f617ca7cbee5a2aeb85e5b8233668516c0c8f25e5230ef2014

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 11, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — 🟡 CONCERNS

Design-level review of 396b27deac77bdde60a9af94074957c9f492ca68 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

The re-routed refusal opens a new crewmate turn that also inherits self-wake authority, and nothing limits how often that cycle repeats.

Watch

  • The successor turn gets more wake authority than it should. _start_next_queued_turn sets _run_kwargs["_directive_self_wake"] = True from the entry meta. In apply_session_directive_outcome, that flag does more than run the stale-wake guard:

    • It sets self_arm_ok = bool(producer_is_user_facing or producer_is_self_wake), so the crewmate can self-arm a loop.
    • It admits wake_reset, so the turn can reset the conversation.
    • It lets _quiet_end succeed.
    • It feeds _note_cycle_failure and _record_refused_cycle with _directive_loop_gen left at 0.

    So a turn the loop never delivered gets the full authority of a delivered wake. Its failures also count against the loop's stand-down budget at the wrong generation. The stated purpose only needs the stop guard: pass producer_wake_loop_id to stop directives only, and don't set the self-wake flag.
    Clears when: the successor turn carries only the stop-guard loop id, without self_arm_ok, wake_reset, quiet_end or cycle accounting, and a test pins that a monitor_start from that turn is not treated as self-armed.

  • A refusal can trigger an endless chain of turns. Each refusal in a member session queues an AUTOMATION_NOTICE_KIND entry. Draining that entry dispatches a real turn (INJECT_KIND_OPENS_TURN: automation_notice: true). If the crewmate retries the refused directive in that turn, it is refused again, which queues another turn, and so on. No dedupe or limit stops this. The result is unattended model spend in a DM where the person can't even see the notices.
    Clears when: re-routing is limited (for example, never queued when the refused directive came from an automation_notice turn) and a test pins that a refusal inside that turn queues nothing.

Suggestions

  • The stated goal is a render filter (CREWMATE_HIDDEN_NOTICE_KINDS). Ship that and the arm_refusal tag here, and move the injection kind and wake-provenance plumbing into a separate PR so it gets its own design review.

[DESIGN-REVIEWED] 396b27d

Description read

[DESCRIPTION-READ] 07d46f7d88a1ac332e6135f91da65b335f6896e9a0b91a04ce6c094ad19824e4

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 396b27d

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

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

Review details

No findings.
[GPT-REVIEWED] 396b27d

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Oct 11, 2026
@chenmingwei23
chenmingwei23 force-pushed the fix/18669-crewmate-chat-messages-only branch from f0a8335 to a1f943b Compare October 11, 2026 15:51
@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 11, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

On the first-principles note about the base spec pin: this diff updates that pin in the same commit — docs/system-specs/modules/session.md now describes the crewmate chat dropping a notice by an allowlist of machinery kinds (empty_turn, arm_refusal) and the refusal being re-routed to the crewmate's next turn, rather than the old "an untagged notice still draws". The decision this applies is recorded in #18672 (the decisions-ledger entry); this PR is the code change that #18672 names. No behaviour outside a member-mode crewmate session changes.

@chenmingwei23
chenmingwei23 force-pushed the fix/18669-crewmate-chat-messages-only branch from a1f943b to 8b4905f Compare October 11, 2026 16:39
@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 11, 2026
…ilter

Address review on the crewmate-notice change:
- hide crewmate-chat notices by an allowlist of machinery kinds
  {empty_turn, arm_refusal}, not by role, so a person-actionable notice
  (a dropped queued message, a model-fallback hint) keeps drawing.
- tag the refusal notice with meta.kind so the allowlist can match it, and
  queue the crewmate copy with a system-injection kind so it drains as an
  inject row, never a user row shown as the person's own bubble.
- update the session spec to describe the allowlist drop and the queued
  refusal.
@chenmingwei23
chenmingwei23 force-pushed the fix/18669-crewmate-chat-messages-only branch from 8b4905f to 396b27d Compare October 11, 2026 17:26
@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 11, 2026
@chenmingwei23
chenmingwei23 marked this pull request as ready for review October 12, 2026 00:16
@chenmingwei23
chenmingwei23 requested review from a team and KiroCrewCaptain as code owners October 12, 2026 00:16
@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 Oct 12, 2026
@chenmingwei23
chenmingwei23 merged commit cbf2b36 into kirodotdev:main Oct 12, 2026
107 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 12, 2026
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.

Crewmate chat draws runner notices (arm refusal); it should show messages only

2 participants