Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/request-for-change/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ was added 2026-08-27. The `rfc-crew-agent-sdk-boundary` row was added 2026-08-28
| [rfc-chat-backend-selection.md](rfc-chat-backend-selection.md) | `draft` | Nothing yet. Acceptance requested from a maintainer; the status flips to `accepted` when one records it here. Verified at `c4c51aac52`: a dashboard chat slot stores a `model` but no backend, `/api/chat/slots/{slot}/model` in `src/kiro_crew/dashboard/routes/chat.py` has no backend sibling, `mcp_dashboard_session_tools.py` has `session_set_model` but no `session_set_backend`, and `backend_override` reaches `select_provider_backend` only from `spawn_run`. Tracks [#13892](https://github.com/kirodotdev/KiroCrew/issues/13892). |
| [rfc-subagent-backend-selection.md](rfc-subagent-backend-selection.md) | `draft` | Phase 1 only. Acceptance requested from a maintainer; the status flips to `accepted` when one records it here. [#18150](https://github.com/kirodotdev/KiroCrew/pull/18150) merged 2026-10-11: `spawn_run` and its task items take an optional `backend`, limited to governance-selectable backends and refused at spawn time, and the child keeps it across continuations. Phase 2 (refusing a continuation or retry whose backend can no longer start, and recording the backend that actually ran) is not on main. Tracks [#13892](https://github.com/kirodotdev/KiroCrew/issues/13892). |
| [rfc-chat-document-attachments.md](rfc-chat-document-attachments.md) | `draft` | Nothing. Acceptance requested from a maintainer; the status flips to `accepted` when one records it in that document's §11. This document lands first because it changes what every dashboard prompt carrying a `.pdf`/`.docx`/`.pptx` attachment says to the agent, and the First Principles lane reads that decision from the base branch. Verified at `8c6e7eba90` and re-read at `2e8831ea52` on 2026-10-12: `api_upload_file` in `src/kiro_crew/dashboard/file_api/uploads.py` writes the upload and returns its path with no text extraction; `build_prompt_blocks` in `src/kiro_crew/acp/prompt_blocks.py` rewrites image paths into `[image: <name>]` and passes a document path through bare; `ingest_attachments` in `src/kiro_crew/messaging/attachments.py` already extracts, redacts and inlines document text for the eight messaging channels, so the dashboard is the parity gap. Tracks [#14570](https://github.com/kirodotdev/KiroCrew/issues/14570). |
| [rfc-agent-started-turns.md](rfc-agent-started-turns.md) | `partial` | Phases 1 and 2 shipped ([#18285](https://github.com/kirodotdev/KiroCrew/pull/18285), [#25132](https://github.com/kirodotdev/KiroCrew/pull/25132), [#25133](https://github.com/kirodotdev/KiroCrew/pull/25133), [#29269](https://github.com/kirodotdev/KiroCrew/pull/29269)): `on_agent_turn` in `acp/client_transport.py` and `dashboard/chat_turn/agent_started.py`. Phase 3 is blocked and the "started by the agent" label is not built. Re-audited 2026-11-14 against `1d08e941b3`. |
| [rfc-agent-started-turns.md](rfc-agent-started-turns.md) | `partial` | Phases 1 and 2 shipped ([#18285](https://github.com/kirodotdev/KiroCrew/pull/18285), [#25132](https://github.com/kirodotdev/KiroCrew/pull/25132), [#25133](https://github.com/kirodotdev/KiroCrew/pull/25133), [#29269](https://github.com/kirodotdev/KiroCrew/pull/29269)): `on_agent_turn` in `acp/client_transport.py` and `dashboard/chat_turn/agent_started.py`. Phase 3 is blocked. The "Started by the agent" label heads the turn's own group in the transcript. Re-audited 2026-11-14 against `1d08e941b3`. |
| [rfc-conductor-default-patrol.md](rfc-conductor-default-patrol.md) | `implemented` | Phase 1 ([#17069](https://github.com/kirodotdev/KiroCrew/pull/17069)), phase 2 ([#19742](https://github.com/kirodotdev/KiroCrew/pull/19742): `patrol_reason` in `dashboard/handlers/session_control.py` and `work_ledger_conductor.py`) and the §10 member-thread arm ([#27948](https://github.com/kirodotdev/KiroCrew/pull/27948): `autonudge_authz.admits_member_default_patrol`) are on main. The bind route's `ensure_patrol` call is in `dashboard/handlers/work_ledger_conductor.py`. Re-audited 2026-11-14 against `1d08e941b3`. |
| [rfc-conductor-round-reset.md](rfc-conductor-round-reset.md) | `implemented` | Shipped in [#18113](https://github.com/kirodotdev/KiroCrew/pull/18113) (`5665e9310217`); verified at `a84f616557`. `_CONDUCTOR_CORE_GRANTS` in `src/kiro_crew/agent_parts/spec_grants.py` grants `reset_conversation`; `apply_session_directive` in `src/kiro_crew/dashboard/session_directive_apply.py` admits it from a person's turn and, through `_refuse_unvouched_wake_reset`, from a conductor's own self-armed patrol wake when nothing waits on a person; `autonudge_authz.py` records the self-arm for a conductor slot (`WAKE_RESET_AGENTS` in `autonudge_selfarm.py`); the goal-conductor skill and `_CONDUCTOR_SYSTEM_PROMPT` carry the drop-your-chat step. |
| [rfc-conductor-chat-board-on-tab.md](rfc-conductor-chat-board-on-tab.md) | `implemented` | Shipped in [#18608](https://github.com/kirodotdev/KiroCrew/pull/18608): the "When your Dashboard tab already shows the board" rule is in the conductor prompt, now in `src/kiro_crew/agent_parts/spec_prompts.py`. Re-audited 2026-11-14 against `1d08e941b3`. |
Expand Down
2 changes: 1 addition & 1 deletion docs/request-for-change/rfc-agent-started-turns.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ superseded-by: []

# RFC: Agent-started turns — show a turn the agent starts between user turns as its own reply

- Status: partial (Phases 1 and 2 on main; Phase 3 blocked). Accepted: the product owner chose option A on all four [decisions](#decisions-needed) on 2026-10-08: an agent-started turn is its own assistant message with a notification, claude only, a user message queues behind it, and every other backend keeps today's behaviour. Phases 0 to 2 are unlocked; Phase 3 stays blocked. Phase 0's verdicts are recorded under [Phase 0](#phase-0--probe-no-product-code). Phase 1 (the transport) is implemented, and so is Phase 2 (the dashboard wiring): the dashboard chat registers `on_agent_turn`, and how it is built is recorded in `docs/system-specs/modules/claude-code-provider.md` ("A turn Claude Code starts on its own"). Two Phase 2 points differ from the design below: the assistant row's `meta.origin` carries `kind` only, because the closing origin's kind is read by the transport and not handed to the dashboard, so no `reason` is stored; and the "started by the agent" label and its browser-harness frame are not built yet, so the reply renders as an ordinary assistant row.
- Status: partial (Phases 1 and 2 on main; Phase 3 blocked). Accepted: the product owner chose option A on all four [decisions](#decisions-needed) on 2026-10-08: an agent-started turn is its own assistant message with a notification, claude only, a user message queues behind it, and every other backend keeps today's behaviour. Phases 0 to 2 are unlocked; Phase 3 stays blocked. Phase 0's verdicts are recorded under [Phase 0](#phase-0--probe-no-product-code). Phase 1 (the transport) is implemented, and so is Phase 2 (the dashboard wiring): the dashboard chat registers `on_agent_turn`, and how it is built is recorded in `docs/system-specs/modules/claude-code-provider.md` ("A turn Claude Code starts on its own"). Two Phase 2 points differ from the design below: the assistant row's `meta.origin` carries `kind` only, because the closing origin's kind is read by the transport and not handed to the dashboard, so no `reason` is stored; and the turn's first row, whatever its role, also carries `turn_start: true` in its `meta.origin`, so a turn that wrote only tool rows is marked too. The transcript starts the turn's own group at that row and heads it with the "Started by the agent" label; its browser-harness frame is `website/scripts/capture-17566-agent-started-reply.mjs`.
- Author: iamwhatever
- Design credit: the reader hand-off, the prompt-less turn through `_run_chat` and the end-of-turn signal are rinbn's [design note on #17566](https://github.com/kirodotdev/KiroCrew/issues/17566). This document writes that note up and adds what review of [#17884](https://github.com/kirodotdev/KiroCrew/pull/17884) found a new path must keep.
- Related: `docs/system-specs/modules/acp-client.md` (stdout, the replay buffer, cancellation), `docs/system-specs/modules/app-notifications.md` (unread badge, turn sound)
Expand Down
15 changes: 12 additions & 3 deletions docs/system-specs/modules/claude-code-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,12 @@ of its own on that chat (`_run_chat(_agent_started=True)`). The turn sends nothi
and reads the pending turn with `AcpProvider.stream_unsolicited`, through the same
event loop a user turn uses: its tool rows, permission cards, PreToolUse /
PostToolUse hooks, SEL records, redaction and persistence are a user turn's own. It
writes no user row, its assistant rows carry `meta.origin = {"kind": "agent"}`, it
writes no user row, its assistant rows carry `meta.origin = {"kind": "agent"}`, and
its first saved row, whatever its role, carries `{"kind": "agent", "turn_start": true}`
(`agent_started.agent_turn_opener_meta`, owed to the slot when the turn opens its
stream and paid by the next row `append` writes outside `_TRANSIENT_ROLES`, so a
permission or elicitation card, which is never saved and whose meta a refresh
rebuilds, leaves it for the row after; a turn that wrote no such row drops it). It
records crew-log actor `agent`, and it ends through the normal end-of-turn path,
so the unread badge and turn sound fire. A message sent while it runs queues
behind it: the turn is responsive-protected, so a send never cancels it. It is
Expand All @@ -1212,8 +1217,12 @@ without spending that arm's retry budget. A caller that still asks
`_queue_recovery` (a Stop hook's block) is declined and posts nothing. Its
reply and tool stream reach a linked Slack thread like any reply; no prompt echo is
posted, because none was typed. It does not count as an
AutoNudge or monitor cycle. Regenerate refuses (`agent_started_reply`) while a
reply it wrote sits after the newest user row: re-running that prompt would retire
AutoNudge or monitor cycle. The transcript starts the turn's own group at that
first row, in the chat page (`groupDisplayItems`) and the pane (`ChatMessageList`),
and TurnBlock heads the group with a "Started by the agent" label above its tool
rows and its reply; the chat page, which shows permission requests in the approval
bar rather than as rows, opens the group at the next row it shows. Regenerate refuses
(`agent_started_reply`) while a row it marked sits after the newest user row: re-running that prompt would retire
the agent's reply, and any reply beside it, for a variant of only the newest one. A
session no dashboard chat turn runs (a channel
conversation on the messaging driver, a cron job's own session, a sub-agent)
Expand Down
2 changes: 1 addition & 1 deletion docs/system-specs/modules/learn-cron-dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -2951,7 +2951,7 @@ surface. The modules of
| `recovery` | empty-turn config, terminal error metadata, retry delays and stop gates, the drain and consume seams of the recovery-replay ledger, auth and busy requeues, the refusal card text and the compact-after-turn notice. The ledger itself is the plain module `dashboard/recovery_replays.py` (`slot.replays`: the records, the drained-alone claim, the sweep, the revocation rule and each family's policy). A new replay family is a `ReplayFamily` member and a `POLICIES` row there (the row's position is the drain's re-check order; its `consume_phase` puts the consume-seam check before or after the turn-start allowance refresh), plus the arm site that queues it |
| `acp_recovery` | the post-token transient re-prompt and the thinking-binding discard-and-replay gate (`_binding_rebuild_allowed`); the except arms that recover the turn: a dead process (`_on_process_died`) and the `except AcpError` ladder's arms for a retryable ACP error on a fresh session, a lost or rebound session, an unsupported image, and a transient error before the first token (retried or spent) and after it (the `_on_acp_*` arms); a new arm that retries, resets or replays the turn goes here (a model fallback hop in `model_fallback`), one that ends it in `turn_failures` |
| `turn_marker` | the in-flight turn marker's write, retire and clear |
| `agent_started` | a turn the agent starts on its own between a chat's prompts (`docs/request-for-change/rfc-agent-started-turns.md`): the watch each turn registers on its session (`_watch_agent_turns`, gated by `agent.agent_started_turns`), the slot claim when it fires (`_on_agent_turn`: skipped for a closed or replaced slot or session, retried when the task holding the slot ends), the turn's `meta.origin` value and the predicate that reads it (`is_agent_started_row`, which `chat_regenerate` refuses on) and the close of its event stream |
| `agent_started` | a turn the agent starts on its own between a chat's prompts (`docs/request-for-change/rfc-agent-started-turns.md`): the watch each turn registers on its session (`_watch_agent_turns`, gated by `agent.agent_started_turns`), the slot claim when it fires (`_on_agent_turn`: skipped for a closed or replaced slot or session, retried when the task holding the slot ends), the turn's `meta.origin` value, the opener meta its first row carries (`agent_turn_opener_meta`) and the predicate that reads them (`is_agent_started_row`, which `chat_regenerate` refuses on) and the close of its event stream, which also drops an opener no row took |
| `directives` | not-applied directive wording and the unclaimed-directive backstop |
| `stream_chunks` | the stream's text and thinking arms, which hold the live-stream and thinking-stream sinks `security_posture` names: a chunk of the reply's text (`_on_text_chunk`): the segment cut after a tool group, with the tool rows it marks done and the crew log's next model-call step, the drop of text after an applied terminal directive, the per-delta redaction and the segment's raw copy, the turn-emit flag and the consumption report, and the `chat_chunk` frame the live-stream redactor releases, a plain sentence end included (`release_sentence_end`); and a chunk of thinking (`_on_thinking_chunk`) and the `chat_thinking` frame the thinking-stream redactor releases |
| `tool_rows` | what a turn's tool rows persist and broadcast: row meta, the WS payload, the refinement rewrite, the tool-call identity key and the rows-only save, and the stream's tool-call and tool-update arms (`_on_tool_call`, `_on_tool_call_update`) |
Expand Down
2 changes: 2 additions & 0 deletions src/kiro_crew/dashboard/chat_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
_ask_the_owed_cancel_answered,
_close_agent_turn_stream,
_send_owed_agent_cancel,
agent_turn_opener_meta,
is_agent_started_row,
)
from kiro_crew.dashboard.chat_turn.app_agent_binding import (
Expand Down Expand Up @@ -1148,6 +1149,7 @@ async def _run_chat(
# re-apply build_message's provenance so only the user's text is upgraded.
if _agent_started:
event_stream = turn._agent_turn_stream = client.stream_unsolicited()
slot._owed_turn_opener = agent_turn_opener_meta
elif is_slash:
if turn.first_word == "/compact":
_begin_compact_command(turn)
Expand Down
19 changes: 17 additions & 2 deletions src/kiro_crew/dashboard/chat_turn/agent_started.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
AGENT_STARTED_ACTOR = "agent"
#: The assistant row meta key that says who started the turn the row answers.
AGENT_ORIGIN_META_KEY = "origin"
#: Set in ``meta.origin`` on the first row a turn the agent started writes.
AGENT_TURN_START_KEY = "turn_start"


def agent_origin_meta() -> dict[str, str]:
Expand All @@ -48,8 +50,19 @@ def agent_origin_meta() -> dict[str, str]:
return {"kind": AGENT_STARTED_ACTOR}


def agent_turn_opener_meta(meta: dict | None) -> dict:
"""*meta* for the first row a turn the agent started writes, whatever its role.

That turn has no prompt row, so this row is where the transcript starts the
turn's own group, and it exists for a turn that wrote only tool rows too.
"""
out = dict(meta) if meta else {}
out[AGENT_ORIGIN_META_KEY] = {**agent_origin_meta(), AGENT_TURN_START_KEY: True}
return out


def is_agent_started_row(row: object) -> bool:
"""Whether *row* is a reply a turn the agent started wrote (:func:`agent_origin_meta`)."""
"""Whether a turn the agent started wrote *row* and marked it (:func:`agent_origin_meta`)."""
meta = row.get("meta") if isinstance(row, dict) else None
origin = meta.get(AGENT_ORIGIN_META_KEY) if isinstance(meta, dict) else None
return isinstance(origin, dict) and origin.get("kind") == AGENT_STARTED_ACTOR
Expand All @@ -72,12 +85,14 @@ async def _close_agent_turn_stream(turn: _ChatTurn) -> None:

The client holds the next prompt back while that stream is open, so a turn
that leaves its loop early (a Stop, a raise, a ``break``) must not leave it
for the garbage collector to close.
for the garbage collector to close. A turn that wrote no row leaves its
opener unclaimed, and the next row on the slot is not this turn's.
"""
stream = turn._agent_turn_stream
if stream is None:
return
turn._agent_turn_stream = None
turn.slot._owed_turn_opener = None
try:
await stream.aclose()
except Exception:
Expand Down
2 changes: 2 additions & 0 deletions src/kiro_crew/dashboard/state_parts/chat_slot.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ class _ChatSlot:
"_steer_segment_cut",
"_compact_command_turn",
"_owed_segment_cut",
"_owed_turn_opener",
"_native_subagent_tracker",
"_native_subagent_output",
"_steer_confirmed",
Expand Down Expand Up @@ -729,6 +730,7 @@ class _ChatSlot:
_steer_segment_cut: Callable[[], None] | None
_compact_command_turn: bool
_owed_segment_cut: Callable[[], None] | None
_owed_turn_opener: Callable[[dict | None], dict] | None
_native_subagent_tracker: dict[str, dict[str, Any]]
_native_subagent_output: dict[str, list[str]]
_steer_confirmed: set[str]
Expand Down
3 changes: 3 additions & 0 deletions src/kiro_crew/dashboard/state_parts/slot_ladder.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,9 @@ def init_ladder_fields(self: _ChatSlot) -> None:
# A segment cut a permission request owes: paid by ``append`` before the
# next durable row, dropped when the request lands none. None when idle.
self._owed_segment_cut = None
# The meta a turn with no prompt row puts on its first durable row, set when
# that turn opens its stream and consumed by ``append``. None when idle.
self._owed_turn_opener = None
# Native kiro-cli subagents run inside the parent ACP turn. Keep their
# live and terminal state on the slot so reconnects can hydrate cards.
self._native_subagent_tracker = {}
Expand Down
8 changes: 8 additions & 0 deletions src/kiro_crew/dashboard/state_parts/slot_transcript.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,14 @@ def append(
owed_cut()
except Exception:
logger.warning("owed segment cut failed for slot %s", self.key, exc_info=True)
# A turn with no prompt row has its first durable row open it, after any
# row the cut above wrote first. A transient row (a permission or
# elicitation card) is never saved and a refresh rebuilds its meta, so it
# would carry the mark away: the first saved row takes it instead.
owed_opener = getattr(self, "_owed_turn_opener", None)
if owed_opener is not None and role not in _TRANSIENT_ROLES and role != "user":
self._owed_turn_opener = None
meta = owed_opener(meta)
# A live row the person typed makes any in-flight return summary stale.
# The local import avoids a state -> warm_task_brief -> state cycle, and
# replay appends (broadcast=False) deliberately do not cancel current work.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading