Repository navigation
Conversation
The dashboard half of Kiro Workflows on Kiro Agent: the /api/workflows/kas/* routes (recipes, runs, run controls, step transcripts, approvals, questions, reconnect), the chat-turn wiring that starts a launch or observe turn on the chat's own KAS session, keeps a KAS plan or question on the person's card under every approval mode, refuses a rewind / edit-resend / regenerate past a live run (409 kas_rewind_refused), and boot recovery of interrupted runs. A request's project directory is confined to server-held roots before any filesystem use. Every route refuses unless agent.kas_workflows is on and the backend is Kiro Agent; responses are redacted and the handler is registered as a redaction sink. Cherry-picked from c35ccf3 onto feat/kas-wf-2b-engine at 31930a7. Ten files conflicted with what main changed since 2026-11-12: - Both sides kept: docs/feature-map/README.md (main's Workflows row, then the new Kiro Workflows row), change_card_catalog_kinds.py, handlers/core_config_schema.py, slot_projection.py, test/test_security_posture.py, and chat_turn/turn_dispatch_gates.py (main's comment with the _kas_observe condition added). - chat_regenerate.py: the rewind guard runs before main's restored-hold flush, so a refused edit-resend still changes nothing. - chat_turn/permission_prompt.py: main's approval trace span and the person-wait window both stay. - test_dashboard_server_composition_contract.py: main's version, which computes the lazy-import check, so the hand-kept _LAZY_IMPORTS rows and the count are dropped. - test_dashboard_server_composition_contract_reach.py: main's version; the 29 new routes become rows in test/fixtures/dashboard_mcp_route_table.txt in place of the stored count and digest. Moved with git rebase --onto from 31930a7 to our copy of #25449 (feat/kas-workflows-engine at 11472b6537: Kyle's head with origin/main 378ec94 merged, our live-walk fixes, the frame-fed step transcript and the ledger drop). Four files conflicted with main's changes since 2026-11-12: - docs/feature-map/README.md: the Kiro Workflows row, then main's current Bot abilities row. - change_card_catalog_kinds.py: main's agent.kas_persist_mcp_sign_in and this agent.kas_workflows, both kept. - chat_delivery.py: the observe-turn refusal first, then main's loss_prone and held_peer condition. - chat_turn/permission_prompt.py: the person-wait window and main's YOLO timeout advice both kept; the advice leaves out a KAS plan handoff too, since no auto-approve answers one. The calls into the router the base removed or re-signed are fitted in our own commit "fit the dashboard routes to the ledger-free router", three commits up.
- The KAS session fake takes main's new session_cwd keyword. - chat_runner no longer imports kas_workflows.chat: nothing reads it there, and main's compose-binding test now refuses an unread runner import. - The parity-route waits use FALLBACK_TIMEOUT_SECS (K19); the turn-ceiling stub carries flake-ok, since nothing waits on it. Cherry-picked from 552b9b6 onto the commit above; it applied with no conflict.
The two cherry-picked commits were written against the engine and main of 2026-11-12. On today's engine head and its main, these tests broke at run time; the product code needed no change. - test_kas_workflows_chat_session.py and test_kas_workflows_optin_gate.py build the settings with workflow_settings() merged through with_client_meta_settings(), which replaced attach_workflow_settings. - test_kas_workflows_chat_session.py resets the engine's record of sessions last driven with workflows on, and the switch-off test records its session first: the engine now sends enabled: false only for such a session. The old test passed in file order only. - test_chat_surface_follows_the_gate installs the turn starter, since chat_workflows_enabled() now also requires the dashboard wiring. - test_kas_workflows_round5.py plants a synthetic GitHub token: main's redactor keeps an AWS key ID visible. - test_held_note_turn_starts.py lists the launch, reconnect and observe turn starts in handlers/kas_workflows.py: turn admission answers each without sending the model a prompt, so a held note waits for the turn's cycle end, as the PR had it. Verified on this tree: - pytest -n0 on the 15 test files the two commits add or change, plus both composition-contract tests: all pass. - black, isort, flake8, subprocess encoding, comment history, brand, file line cap, harness parity, docs-lint: pass; mypy src/kiro_crew: no issues in 4917 files. - scripts/local-gate.py --base origin/feat/kas-wf-2b-engine: backend 6/6 batches pass (148,622 tests), with one case deselected that fails the same way on the engine head: test_find_ui_auto.py::test_the_generated_auto_tier_answers_labels_ only_it_carries[continue with github-...]. Frontend: batches 1-3 and 5 pass; batch 4 has one failure, UsageTab.spendChartHarness.test.tsx, which fails alone too and reads no file this branch changes (website/ is untouched). Co-authored-by: kyleseaman <2904635+kyleseaman@users.noreply.github.com>
Our copy of #25449 keeps no run ledger: a run's chat is the chat whose Kiro Agent session is, or was, the run's parent, and boot recovery asks Kiro Agent's own run lists. Kyle's two commits above called the ledger's names, so this fits them: - recover_runs_on_boot passes recover_on_boot an open chat as chat_exists and the open chats' project folders as folders, in place of each chat's named workspace (a chat that switched workspace now gets its runs back). - The state poll's reconnect and the reconnect route no longer await ensure_ledger, which is gone. - Turn admission names the chat's session without workspace=. - The transcript route's docstring says it serves the router's kept copy of the step's conversation; it reads no session file. - test_kas_workflows_boot_recovery.py gives each run a parent named for its chat and answers boot recovery's list in place of the ledger and load; the named-workspace and ledger-stamp tests are gone with the rule. Two tests patch project_root.recent_project_dirs, the name the base made public. Spec: kas-workflows.md gets the dashboard's own section ("The dashboard": the routes, turn admission, the transcript route, boot recovery's caller, the rewind and authoring refusals), and its gate paragraph no longer says nothing calls the entry points. The spec index row and the AGENTS.md routing row name the routes. Verified on this tree: - pytest -n 8: the test files this branch adds or changes against the base, every test_kas_workflows_*.py and both composition-contract tests, 1,318 passed before the spec edit; test_kas_workflows_*.py, test_chat_runner_kas_observe.py, test_kas_slot_needs_person.py, test_held_note_turn_starts.py and test_security_posture.py, 798 passed after it. - black --check, flake8, isort on the changed files; docs-lint.sh; docs_lint.py --strict-identifiers has no finding in the edited specs.
A Kiro Workflows step reads its parent chat's approval mode when it asks. The reader took the process-wide override alone, so the grant `gateway --approval yolo` arms auto-approved a step of a channel-linked chat, or of a chat whose turn a channel started, while that chat's own tool calls kept asking. The reader now ANDs the override with yolo_reaches, as every other dashboard approval path does, so a step follows the same channel scoping as its chat. Spec: docs/system-specs/modules/cli.md names the step reader among what the CLI launch grant does not reach. Verified on this tree: - pytest -n0 test/test_kas_workflows_chat_session.py test/test_chat_runner_coverage_approval.py: 70 passed, the new channel-linked case included. - black --check and flake8 on the two changed Python files: clean. - scripts/docs-lint.sh: all documentation checks passed. Co-authored-by: kyleseaman <2904635+kyleseaman@users.noreply.github.com>
Rewind and edit-resend refuse with 409 rewind_workflow_running while a Kiro Workflows run launched since the edited message is live, and the body names those runs so the person knows what to stop. The names came straight from the router's rows, which are not redacted, so a run name carrying a credential reached the browser as written. The refusal now passes each name through redact_via_context, capped at the router's display length, where it is built, so both doors answer it masked. kas_workflows/chat.py joins the security posture's redaction sinks as "Kiro Workflows rewind refusal". Verified on this tree: - pytest -n0 test/test_kas_workflows_round4_l2.py test/test_kas_workflows_chat.py test/test_security_posture.py: 118 passed, including the new rewind and edit-resend cases that plant a synthetic GitHub token in the run name. - black --check and flake8 on the changed Python files: clean. Co-authored-by: kyleseaman <2904635+kyleseaman@users.noreply.github.com>
The Kiro Workflows views learn about run changes by polling
GET /api/workflows/kas/state every 2 seconds. The dashboard already
holds one WebSocket per page, /api/ws, so the server now pushes the
change there and a client can re-read the state route when it arrives.
The router's revision becomes a property whose setter calls a new
DashboardHooks.changed hook. Every existing `revision += 1`, in any of
the router's modules, reaches it with no other edit, including one a
later engine change adds. The new module dashboard/kas_workflow_triggers
supplies that hook: revision_publisher sends kas_workflow_revision
{"revision": n} to owner sockets only (broadcast_ws_owners), coalesced
on a leading and a trailing edge over 250 ms, and the workflow startup
installs it beside the bell-note and marker-row hooks. The frame is
listed in ws_event_scope._OWNER_ONLY_EVENTS, so an app token's denial
is audited as owner_only. The routes are unchanged and the frame
carries no run data.
Specs: docs/system-specs/modules/learn-cron-dashboard.md gains the
kas_workflow_triggers.py entry; docs/feature-map/README.md's Kiro
Workflows row names the frame.
Moved onto our copy of #25449 with git rebase --onto. Conflicts:
router_base.DashboardHooks keeps the base's transcript_changed beside
changed, both docstring bullets; learn-cron-dashboard.md keeps main's
current text around the new entry, and the feature-map row sits above
main's current Bot abilities row. kas-workflows.md says a revision
move calls the changed hook and, in "The dashboard", that the frame
is pushed.
Verified after the move:
- pytest -n 8 on the seven files below and
test/test_kas_workflows_step_transcripts.py: 303 passed.
- black --check and flake8 on the changed modules;
check_file_line_cap.py: 0 failures, router.py at 1,929 lines;
docs-lint.sh: pass.
Verified on the first base (31930a7):
- pytest -n0 test/test_kas_workflow_triggers.py
test/test_kas_workflows_round4.py test/test_ws_event_scoping_frames.py
test/test_workflow_startup_lifecycle.py
test/test_dashboard_server_composition_contract.py
test/test_kas_workflows_router.py test/test_kas_workflows_router_bounds.py:
266 passed.
- mypy src/kiro_crew: no issues in 4918 files; check_black_formatting.py,
flake8 and isort on the changed files: pass (ws_event_scope.py is on
the black baseline); check_file_line_cap.py: 0 failures, router.py at
1,977 lines; scripts/docs-lint.sh: pass.
Co-authored-by: kyleseaman <2904635+kyleseaman@users.noreply.github.com>
A Kiro Workflows step that asks while its chat is in Normal waits for a person. When the person then switches the chat to Trust, the held step should follow the switch as the next step would. That re-decision ran inside GET /api/workflows/kas/state, so it happened only while a tab polled, and it ran even with agent.kas_workflows turned off, because that route stays readable for a run the switch was turned off under. kas_workflow_triggers.recheck_step_approvals now runs where the mode changes: after a successful apply_approval_mode (the mode route, and every other caller of it), after the approval card's Trust or YOLO press, and in the waiting turn after a Trust-reads press. It decides nothing while the switch is off, reads no config when nothing is held, and never fails the mode change. The state route decides nothing. Specs: docs/system-specs/modules/security.md (the POST /api/chat/mode paragraph) and learn-cron-dashboard.md (slot_approval and the kas_workflow_triggers.py entry). Moved onto our copy of #25449 with git rebase --onto. Conflict: learn-cron-dashboard.md keeps main's current text around the kas_workflow_triggers.py entry. The new test fixture patches project_root.recent_project_dirs, the name the base made public. kas-workflows.md, "The dashboard": the state route no longer re-decides held approvals; a chat's mode change does. Verified after the move: - pytest -n 8 on the nine files below and test/test_kas_workflows_step_gate.py: 511 passed. - docs-lint.sh: pass. Verified on the first base (31930a7): - pytest -n0 test/test_kas_workflow_triggers.py test/test_kas_workflow_mode_recheck.py test/test_chat_mode_security.py test/test_chat_runner_coverage_approval.py test/test_kas_workflows_parity_routes.py test/test_kas_workflows_l4_recipes.py test/test_kas_workflows_optin_gate.py test/test_kas_workflows_round4.py test/test_approval_modes_trust_policy.py: all pass (391 after one test fix in the new file). - mypy src/kiro_crew: no issues in 4918 files; check_black_formatting.py, black --check, flake8 and isort on the changed files: pass; scripts/docs-lint.sh: pass. Co-authored-by: kyleseaman <2904635+kyleseaman@users.noreply.github.com>
A Kiro Workflows run lives in its chat's Kiro Agent process. When that process dies mid-run, the chat needs a reconnect turn. That turn went out from GET /api/workflows/kas/state and GET /api/workflows/kas/runs, so a run reconnected only while a tab polled, and even with agent.kas_workflows turned off, since both routes stay readable for a run the switch was turned off under. runtime_death gains subscribe(listener): every announced death calls the listeners after the record is stored, and a failing listener breaks nothing. The dashboard's Kiro Workflows triggers subscribe; each death schedules one reconnect_after_process_exit pass, which sends nothing while the gateway stops or the switch is off, and otherwise sends the reconnect turn to each chat the router's due_reconnects names, keeping its interval and try bounds. A chat whose turn is running is waited for (up to BOOT_RECOVERY_TURN_SECS), because that turn most likely ran on the process that died; one still busy afterwards is left to its next ordinary turn. Turn admission now reattaches on an ordinary turn only while the switch is on. The read routes send no turn. With the boot pass, these are the only ways a run reconnects; none is a timer. The visible reconnect turn is unchanged. Specs: docs/system-specs/modules/runtime-ownership.md (the subscriber, its one consumer, and the tests that pin it), learn-cron-dashboard.md (the kas_workflow_triggers.py entry) and docs/feature-map/README.md. Moved onto our copy of #25449 with git rebase --onto. That base has no run ledger, so the exit pass no longer awaits ensure_ledger: the runs it reconnects are in the mirror. Its tests mirror an undriven run of chat-1 (name_chat_session, listed_run) in place of writing a ledger file, and the switch-off case checks that no chat was tried. The router_recovery.py comments already name the crash pass in the base, so this commit no longer edits them. Conflicts: the poll's _auto_reconnect is deleted; learn-cron-dashboard.md and the feature map keep main's current text around this commit's lines. The parity route test patches project_root.recent_project_dirs. kas-workflows.md, "The dashboard": no read sends a turn; a process exit does. Verified after the move: - pytest -n 8 on the twelve files below: 227 passed; test/test_flake_pattern_ratchet.py: 75 passed. - black, isort and flake8 on the changed test file; docs-lint.sh: pass. Verified on the first base (31930a7): - pytest -n0 test/test_runtime_death_is_a_process_event.py test/test_runtime_death_subscribe.py test/test_acp_runtime_death.py test/test_kas_workflow_triggers.py test/test_kas_workflows_parity_routes.py test/test_kas_workflows_boot_recovery.py test/test_kas_workflows_recovery.py test/test_kas_workflows_optin_gate.py test/test_chat_runner_kas_observe.py test/test_held_note_turn_starts.py test/test_workflow_startup_lifecycle.py test/test_kas_workflow_mode_recheck.py: 227 passed. - test/test_flake_pattern_ratchet.py: 75 passed. - mypy src/kiro_crew: no issues in 4918 files; check_black_formatting.py, flake8 and isort on the changed files: pass; comment history and brand checks against origin/feat/kas-wf-2b-engine: pass; check_file_line_cap.py: 0 failures; scripts/docs-lint.sh: pass. Co-authored-by: kyleseaman <2904635+kyleseaman@users.noreply.github.com>
Turn admission's code runs on chat_runner's globals (chat_turn.compose), and test_chat_runner_composition_contract.py refuses an owner that imports, at load, a name the runner's tests rebind: such an owner keeps its own object and a patch of the runner stops applying there. The reattach gate added in the previous commit imported kas_workflows_enabled in turn_admission.py, and the new test_chat_runner_kas_observe.py case patches it on the runner. The runner now imports it and turn admission names it under TYPE_CHECKING, as it does for every other runner seam. Behaviour is unchanged. Found by scripts/local-gate.py --base origin/feat/kas-wf-2b-engine at 4d3c5e3456: backend batch 1/7 passed (23,842 tests), batch 2/7 failed one test, test_chat_runner_composition_contract.py::test_no_owner_captures_a_name_tests_rebind_on_the_runner (26,146 passed). Verified on this tree (the gates for the whole branch, item (d)): - pytest -n0 test/test_chat_runner_composition_contract.py test/test_chat_runner_kas_observe.py test/test_kas_workflows_optin_gate.py test/test_held_note_turn_starts.py: 196 passed. The 285 contract, facade, boundary, composition, posture and Kiro Workflows test files: 13,200 passed. - scripts/local-gate.py --base origin/feat/kas-wf-2b-engine (the port's own diff; main's merge-base would also rerun #25449's tests), with test_find_ui_auto.py's "continue with github" case deselected (it fails the same way on the engine head): backend 7/7 batches pass, 168,161 tests. Frontend batches 1-3 pass (28,606 tests); batch 4 has the one known failure, UsageTab.spendChartHarness.test.tsx, which fails on the engine head too (website/ is untouched), 12,056 passed; batch 5, run by hand from the gate's own plan: 8,658 passed. Gate exit 1 for that one test only. - HARNESS_BASE_REF=origin/feat/kas-wf-2b-engine scripts/check_harness_parity.py: pass. HARNESS_BASE_REF=origin/main: pass. - check_black_formatting.py, check_subprocess_encoding.py, isort --check-only and flake8 over src/kiro_crew test conftest.py xdist_budget.py, mypy src/kiro_crew (no issues in 4918 files): pass. check_comment_history.py and check_brand_name.py against the engine head and against the merge-base with origin/main: pass. check_file_line_cap.py: 0 failures. test_flake_pattern_ratchet.py: 75 passed. scripts/docs-lint.sh: pass. Co-authored-by: kyleseaman <2904635+kyleseaman@users.noreply.github.com>
A Kiro Workflows run lives in its chat's Kiro Agent process, and the idle sweep measures only the chat's own turns. So a step still working session.timeout_secs after the chat's last turn was killed with the process, and a chat holding a run parked on a question lost its process at every idle expiry. The session manager's idle hold (set_idle_hold, the sweep's union with session.idle_exempt_keys and its re-check just before each idle reset) moved down into our copy of #25449 with its tests and its session.md paragraph (e49bb656f0 there). This commit keeps the dashboard half: the workflow triggers install idle_held_sessions as that hold, naming the chat of every run a live process here drives that is running, or paused on an ask waiting for a person. Other paused runs, finished runs and runs with no live process hold nothing. Specs: session.md names the installer in place of "no code installs one yet"; kas-workflows.md, "Reconnect and boot recovery", says the triggers install it; learn-cron-dashboard.md (kas_workflow_triggers.py). Moved onto our copy of #25449 with git rebase --onto. session.py, session_cleanup.py, session_parts/sweeps.py and test/test_session_idle_hold.py are the base's (its shorter mid-sweep comment keeps session_cleanup.py at the 2,000-line cap). The hold tests name the run's parent session for chat-1 in place of a ledger entry; learn-cron-dashboard.md keeps main's current text around the entry. Verified after the move: pytest -n 8 on test_kas_workflow_triggers, test_session_idle_hold, test_session_bindings, test_facade_bindings and metrics/test_session_duration: 557 passed. black --check and flake8 on the changed files, check_file_line_cap.py (0 failures) and docs-lint.sh pass. Ran on the first base (31930a7): pytest -n 4 on test_session_idle_hold, test_kas_workflow_triggers, test_session_idle_exempt_keys, test_session_cleanup, test_idle_sweep_backend_activity and test_idle_compaction: 243 passed; the mid-sweep hold test fails with the pre-reset re-check removed.
The process-exit reconnect fired on every Kiro Agent process death and
sent its reconnect turn at once. An idle expiry is a death too, so a
chat holding a paused run got a reconnect turn and a new process at
every expiry, and a reconnect sent inside KAS's claim window was
refused ("just claimed by another process") with nothing retrying.
The runtime_death listener now acts only on a crash (expected False)
of a process that drove a run. It arms one pass
EXIT_RECONNECT_WAIT_SECS (45 s: KAS's 30 s run.claim TTL plus the boot
pass's 15 s slack) after the crash; a crash inside the wait moves the
pass after it, with both crashes' chats. The pass reconnects only the
chats whose runs the crashed process drove (slots_driven_by, read at
the death; due_reconnects(only=...) marks no other chat tried). The
live walk showed why: reconnecting every due chat started another
chat's process in the same project, its KAS stale-run sweep claimed
the crashed chat's run, and KAS refused that chat's reconnect.
The router half (slots_driven_by, due_reconnects(only=...) and the
router tests for both) moved down into our copy of #25449 (4bcb9aa52f
there); this commit keeps the dashboard half: the crash-only listener,
EXIT_RECONNECT_WAIT_SECS, its tests and the handler docstrings.
Specs: learn-cron-dashboard.md (kas_workflow_triggers.py),
runtime-ownership.md (the death subscriber), feature-map README, and
kas-workflows.md ("The dashboard" says the reconnect follows a crash
only; "Reconnect and boot recovery" names the crash listener as the
caller of due_reconnects and slots_driven_by).
Moved onto our copy of #25449 with git rebase --onto. router.py and
router_recovery.py are the base's, which already carry the router
half and read the run's chat from its parent session, not a ledger.
The tests name each run's parent session for its chat in place of a
ledger entry, and learn-cron-dashboard.md no longer says the pass
reads the run ledger. Conflicts in learn-cron-dashboard.md and the
feature map keep main's current text around this commit's lines.
Verified after the move: pytest -n 8 on test_kas_workflow_triggers,
test_kas_workflows_recovery, test_runtime_death_subscribe and
test_kas_workflows_parity_routes: 61 passed; black --check, flake8 and
docs-lint.sh pass.
The gate set on the branch head (this tree):
- AGENTS.md pre-commit gate: black gate, subprocess encoding,
isort --check-only, flake8, mypy --platform linux src/kiro_crew (no
issues in 5,016 files), check_comment_history.py and
check_brand_name.py (each after its --test) against the merge-base
with origin/main (378ec94) and against the branch below,
check_file_line_cap.py (0 failures; no file this branch changes
crosses 1,600 lines that main had under it): pass.
- docs_lint.py --test and docs-lint.sh pass; --strict-identifiers has
the base's 99 findings and none in a spec this branch edits.
- check_harness_parity.py --test, then HARNESS_BASE_REF at origin/main
and at the branch below: pass. scripts/scrub-lint.sh is not in the
tree.
- Fast-gate source gates (--test, then the check, bases at
378ec94): all pass; verify_vendor_manifest passed once the
worktree's generated _vendor/__pycache__ folders (ignored, never
committed) were removed.
- KAS pin diff against origin/main, Kyle's engine head and the branch
below: empty.
- pytest: test_security_posture.py with test_kas_pin.py 85 passed;
the flake-pattern ratchet 75 passed; every kas workflow test file
with test_chat_runner_kas_observe, test_kas_slot_needs_person,
test_runtime_death_subscribe and test_held_note_turn_starts 800
passed; the session map, idle hold, facade bindings and session
duration tests 596 passed.
- scripts/local-gate.py --base feat/kas-workflows-engine (this
branch's diff; the known test_find_ui_auto "continue with github"
case deselected), every batch of its plan run by label: backend 1/7
to 7/7 23,824, 26,881, 24,442, 27,801, 26,307, 27,300 and 20,315
passed, none failed; frontend 1/5 to 5/5 9,156, 9,091, 10,207,
11,865 and 10,022 passed, with two known failures and website/
identical to the base: ChatPageDrafts "leaves the draft alone when
a staged prefill belongs to another slot" (passes alone) and
UsageTab.spendChartHarness.
Ran on the first base (31930a7):
- pytest -n 4 on test_kas_workflow_triggers, test_runtime_death_subscribe,
test_kas_workflows_boot_recovery, _recovery, _router, _router_bounds
and _parity_routes: 180 passed.
- AGENTS.md static gate: black, subprocess encoding, isort, flake8 and
mypy src/kiro_crew clean; check_comment_history and check_brand_name
pass against the merge-base with origin/main and against
origin/feat/kas-wf-2b-engine; check_file_line_cap, the flake-pattern
ratchet (75 passed) and docs-lint pass; the KAS pin diff is empty.
- check_harness_parity.py passes with HARNESS_BASE_REF at
origin/feat/kas-wf-2b-engine and at origin/main.
- scripts/local-gate.py (base origin/main, the known test_find_ui_auto
"continue with github" case deselected): the first run stopped at
backend 4/10 on the defect fixed in 8137814ab2. The plan's batches
were then run one at a time: backend 1/10 to 10/10 pass (15,903,
27,144, 25,912, 25,164, 27,977, 28,611, 25,964, 29,308, 22,735 and
10,787 tests) except one test in 7/10,
test_push_guard_diagnostics.py::TestPushGuardChildren::
test_a_signal_inside_popen_wait_still_reaps_the_child, which fails
only inside that batch and passes alone (41 passed, serial and -n 4);
the branch changes no file it reads. Frontend 1/6 to 6/6 pass except
the known UsageTab.spendChartHarness case (website/ is untouched).
Backend 4 to 6, 9, 10 and the frontend batches ran before 5ba26a6fa9,
which adds an inventory test entry and a type-only import.
- Live walk on the pinned KAS 0.66.117: two engine crashes, each
reconnected 45.0 s later and resumed; no other chat was reconnected.
Each boot pass logged main's guard for every chat it reconnected: "Loading the transcript window of <chat> on the event loop; the reader did not await load_window_off_loop first". A chat restored at gateway start has not read its transcript window, and queuing the reconnect turn read it on the event loop, stalling the gateway on a large transcript. _send_reconnect, the one sender the boot pass, the crash pass and the reconnect route share, is now async and awaits load_window_off_loop before it queues the turn, then reads the chat again in case it went away meanwhile. Spec: kas-workflows.md "The dashboard". Ran: pytest -n 4 on the kas workflow tests with the dashboard's (test_kas_workflows_*, test_kas_workflow_*, test_chat_runner_kas_observe, test_kas_slot_needs_person, test_runtime_death_subscribe, test_held_note_turn_starts): 804 passed. The new triggers test fails with the load taken out. black, isort, flake8 and mypy --platform linux on the changed files: clean.
kas-workflows.md "The dashboard" grouped GET .../slots/{slot}/runs with
GET .../state as starting no process. The runs route serves chat_runs,
which lists through a live Kiro Agent process and spawns the query
process when none is up. The bullet now says so; the state route still
starts none.
Ran: scripts/docs-lint.sh: pass.
Gates, walk fix pass. The full set on tree 47ea77b8aa (c2bcfb3bcd,
before the two doc commits): the AGENTS.md pre-commit gate (mypy
--platform linux with no issues in 5,016 files; comment history and
brand name against 378ec94 and the branch below), docs-lint.sh,
harness parity, the fast-gate source gates and the KAS pin diffs: pass;
docs_lint.py --strict-identifiers: the same 99 findings, none in
kas-workflows.md. pytest: security posture 85, flake ratchet 75, kas
workflow tests with the dashboard's 846, session tests 596 passed.
local-gate.py --base f5a7d972bb (everything that changed in the tree
since its last gated head): backend 196,535 passed in 8 batches and one
failure, test_pending_steer_queue.py's held-steer case, which passes
alone (20 passed); frontend 52,095 passed in 6 batches and the two known
failures, ChatPageDrafts.test.tsx and
UsageTab.spendChartHarness.test.tsx, on a website/ identical to
378ec94.
On this commit's tree, which differs by the base's and this commit's
spec wording only: the same static gates pass, test_docs_*.py 608 passed
and 50 skipped, the kas workflow tests 846 passed.
The crash pass and boot recovery check that a chat is idle (and, for the crash pass, that the gateway is not stopping) before they send it a reconnect turn. The sender then reads a cold chat's transcript window on a worker thread before it queues the turn, so a turn the person started during that read was not seen, and a reconnect turn was queued behind it. Both callers now load the window before their check. The sender's own load then returns without suspending, so nothing runs between the check and the queued turn. The reconnect route, which queues behind a running turn on purpose, is unchanged. Spec: kas-workflows.md "The dashboard". Ran: the two new tests (a turn starts during the window read, crash pass and boot pass) with the change undone: both failed; pytest -n 4 on the kas workflow tests: 852 passed. black, isort, flake8 and mypy --platform linux on the changed files: clean; docs-lint.sh, comment history against 378ec94 and the file line cap: pass. Gates: the full set on this commit's tree 802e8f601d: the AGENTS.md pre-commit gate (mypy --platform linux with no issues in 5,016 files, comment history and brand name against 378ec94 and the branch below, file line cap with 0 failures), docs-lint.sh, harness parity, the fast-gate source gates and the KAS pin diffs: pass; docs_lint.py --strict-identifiers: the same 99 findings, none in kas-workflows.md. pytest: security posture 85, flake ratchet 75, kas workflow tests with the dashboard's 852, session tests 596 passed. local-gate.py --base e6c50751ef: backend 22,503, 26,309, 23,843, 29,608, 28,717, 29,818, 24,117 and 11,627 passed, none failed; frontend 52,095 passed and the two known failures (ChatPageDrafts.test.tsx "leaves the draft alone when a staged prefill belongs to another slot", UsageTab.spendChartHarness.test.tsx). Gates on tree da9b5eddd9 (this branch restacked onto the base's four new commits, its own changes unchanged): the AGENTS.md pre-commit gate (mypy --platform linux with no issues in 5,016 files; comment history and brand name against 378ec94 and the base), docs-lint.sh, harness parity against main and the base, the fast-gate source gates and the KAS pin diffs: pass; docs_lint.py --strict-identifiers: the same 99 findings, none in kas-workflows.md. pytest: doc tests 608, kas workflow tests 862, security posture with test_kas_pin.py 85, flake ratchet 75, every test file naming kas_workflows 868 passed; none failed. Focused on the changed code, as the 2026-11-24 rule for small fixes says; no full local gate. Gates on tree cbb12089af (this branch restacked onto the base's three new commits, its own changes unchanged): the AGENTS.md pre-commit gate (mypy --platform linux with no issues in 5016 files; comment history and brand name against 378ec94 and the base), docs-lint.sh, harness parity, the fast-gate source gates and the KAS pin diffs against the merge base 378ec94, Kyle's engine head and the base: pass; docs_lint.py --strict-identifiers: the same 99 findings, none in kas-workflows.md. pytest: doc tests 608, kas workflow tests 864, security posture with test_kas_pin.py 85, flake ratchet 75, every test file naming kas_workflows 870 passed. None failed. Focused on the changed code, as the 2026-11-24 rule for small fixes says; no full local gate.
The step composer's model picker needs a route. POST
/api/workflows/kas/runs/{workflow_id}/steps/{node_id}/model takes
{model?, effort?, path?} and serves set_step_model: at least one field,
each a string of at most 200 characters, else 400 invalid_model; a step
that has not started answers 404 step_unknown, a refusal 409. It
answers the model and effort now in force. It is a control, so with the
switch off it is refused while a run is held, like a reply.
The transcript route's answer carries the step's model reading
(model, effort, defaultEffort, modelOptions, effortOptions), which the
picker shows and offers.
Spec: kas-workflows.md, "The dashboard".
Gates on this tree (run as e86039a41c, tree 1b87eb7): the
AGENTS.md pre-commit gate (black gate, subprocess encoding, isort
--check-only, flake8, mypy, comment history and brand against
378ec94 and against 6555385a57), file line cap, docs-lint and
HARNESS_BASE_REF=origin/main check_harness_parity.py pass; the KAS pin
files equal origin/feat/kas-wf-2b-engine; pytest -n0
test/test_kas_workflows_*.py 791 passed; the flake ratchet passes.
scripts/local-gate.py --base 6555385a57 (this branch before the step,
so the base commits under it count too), every batch by
label, the known find_ui "continue with github" case deselected:
backend 8 batches, 196,595 passed; frontend 6 batches, 52,095 passed
and 2 failed, both known on main: ChatPageDrafts "leaves the draft
alone when a staged prefill belongs to another slot" and
UsageTab.spendChartHarness "mounts a dollar chart, and no credits
chart, for a harness that bills in dollars".
Brings the engine branch, now on origin/main 704bfc3, under the dashboard routes. Nine files conflicted; each keeps main's change and the routes': - dashboard/ws_event_scope.py: main's layout of _OWNER_ONLY_EVENTS with kas_workflow_revision as its last member. - dashboard/chat_turn/turn_dispatch_gates.py: main's replay flag and _prompt_hooks_fired mark, inside the branch that skips the prompt hooks on an observe turn. - dashboard/chat_api/slot_approval.py: after a mode change, main's kept-grants notice, then the step approvals rechecked. - dashboard/slot_projection.py: a workflow parked on a person still counts as needs-input, with main's in_flight name. - dashboard/chat_regenerate.py, test/test_security_posture.py: both sides' imports and entries. - feature-map/README.md: main's Workflows row, then the Kiro Workflows row. - runtime-ownership.md: main's sub-agent sentence, without its "no observer registry" sentence, since this branch adds the one subscriber, described in the next paragraph. - learn-cron-dashboard.md: main's ws.py entry, then the kas_workflow_triggers.py entry. Ran on this tree: black, isort and flake8 on the six changed Python files: clean. pytest on the branch's own 21 test files and every test file that imports a conflicted module or chat_turn/tool_approval.py (105 files): 4,225 passed, 2 expected failures.
With main's 1,988 lines under it, dashboard/chat_turn/tool_approval.py came to 2,025 lines, over the 2,000-line cap. _kas_step_mode_reader, how a workflow step reads its parent chat's approval mode, moves whole into its own owner, chat_turn/kas_step_mode.py, which the chat runner composes like the others, so chat_runner._kas_step_mode_reader still resolves and still runs on the runner's names. The plan handoff comment beside the person-only check is rewrapped and says permission request. The file is at 2,000 lines. learn-cron-dashboard.md lists the new owner, and cli.md names its path. test_kas_workflows_optin_gate.py's "fixture sanity" comment, which the Inclusive Language check rejects, says what the line checks. Ran on this tree: black, isort and flake8 on the five changed Python files: clean. check_file_line_cap: 0 failures. pytest on the composition, facade and line-cap tests, the workflow chat session and opt-in gate tests and every test file that imports tool_approval, turn_admission or the new owner (24 files): 1,563 passed.
Bring in the engine branch's commit that adds Kiro Agent's own send_message to the chat's workflow tools. The merge met no conflict; this branch's exact-list test of those tools follows in the next commit.
The exact-list test of the tools a chat's active agent gains now lists Kiro Agent's own send_message after validate_workflow, as the engine branch adds it to WORKFLOW_CHAT_TOOLS, and drops the assertion that the tuple leaves it out. Checks run on this commit: black --check, isort --check-only and flake8 on the test file; check_black_formatting.py, and check_comment_history.py and check_brand_name.py on the change, all passed; pytest test/test_kas_workflows_chat_session.py test/test_kas_workflows_chat.py, 44 passed.
Brings the engine branch, now on origin/main 190fef0, under the dashboard routes. One file conflicted, and kept both sides: - security.md: main's paragraph on an app's unattended pooled task, then the paragraph on per-slot approval modes in main's wording with this branch's sentence on rechecking the held step approvals. dashboard/chat_turn/tool_approval.py merged cleanly but came to 2,011 lines, over the 2,000-line cap: main brought it to 1,999 and this branch adds the plan hold's 12. The credential hint, which only the deny steer and the spec hooks' recovery read (_CREDENTIAL_HINT_CLASSES and _credential_tool_hint_for), moves whole into chat_turn/deny_chokepoints.py with its deny_guidance imports, so tool_approval.py is at 1,982 lines. The chat runner composes both owners, so chat_runner._credential_tool_hint_for still resolves and runs on the runner's names. turn_spec_hooks.py names the new owner in its type-checking imports, the base-surface test lists the two names under deny_chokepoints, and learn-cron-dashboard.md's owner table says where the hint now lives. Ran on this tree: black --check, isort and flake8 on the four changed Python files: clean. check_black_formatting.py, check_file_line_cap (0 failures), docs-lint, comment-history and brand checks: passed. mypy --platform linux src/kiro_crew: no issues in 5,309 files. pytest on the branch's own 21 test files and every test file that names the chat runner's composition, the moved owners, the deny guidance, the plan hold or the two specs (110 files): 6,483 passed, 2 skipped, 2 failed, the base-surface rows fixed above; after the fix the base surface and composition contract tests: 457 passed.
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the backend wiring sits behind Notes
[DESIGN-REVIEWED] 3c5da62 Description read[DESCRIPTION-READ] fa6b04b91f1e3044e0faa699352a2cf2169f24dd579bb5fe2dc5b1acc8419aa8 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 (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Every item is behind the Notes
What this change shipsInventory (10 items) — 8 justifiedIntent: let a dashboard chat on Kiro Agent start, follow and answer Kiro Workflows runs that survive idle timeouts, crashes and restarts. This is an ADDITION, off by default.
[FIRST-PRINCIPLES-REVIEWED] 3c5da62 Description read[DESCRIPTION-READ] 72e934c89c9b00ed6aab96b93217a0c511e1b4c76131c7817df5c164d25d93cf That sha256 names the PR description this verdict read. Recompute it with |
Sensitive change review
|
GPT 6.1 Review — 🔴 changes requested (blocking)GPT 6.1 found at least one blocking issue that must be resolved before merging This comment is updated in place on each push. BLOCKING -- src/kiro_crew/dashboard/chat_turn/turn_admission.py:1572 -- Recheck the workflow switch before dispatching queued actions
BLOCKING -- src/kiro_crew/dashboard/handlers/kas_workflows.py:755 -- Keep accepted launch payloads recoverable until dispatch
[BLOCK-MERGE] 3c5da62 Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1 ( F2 (fenced, False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
The workflow routes checked a launch's model and effort and a new recipe's name against patterns that end in "$", with match. The anchored-pattern ratchet counts that shape, because "$" also matches before a final newline: dashboard/handlers/kas_workflows.py went from 0 to 2 sites. Both checks now use fullmatch. A model or effort that ends in a newline, such as "high\n", passed the check before and now answers 400 invalid_model or invalid_effort; the new test pins that. The recipe name is stripped before its check, so it cannot end in a newline and what it accepts does not change. Checks run on this commit's tree: - pytest -n 4 on the 8 test files that import the handler module: 121 passed - pytest -n0 test/test_wait_discipline_ratchet.py test/test_anchored_pattern_match_ratchet.py: this layer's file is no longer reported; 3 failed, 61 passed, the failures naming only layer 1's sites (test_kas_workflows_step_transcripts.py, router.py, workflow_markers.py), which this branch gets when layer 1's fix 1134b7a is merged up - the same two files on a trial merge of 1134b7a into this commit (not committed, aborted after): 64 passed in committed-baseline mode and 64 passed with GITHUB_BASE_REF=main and FLAKE_RATCHET_BASE set to d646881 - pytest -n0 test/test_flake_pattern_ratchet.py against 2359152: 81 passed - black, isort, flake8 on the two files, mypy --platform linux on the handler, the comment-history, brand and line-cap gates: clean
The dashboard routes keep three module-level lists that no per-test floor reset: the one boot-recovery task a process starts (dashboard/handlers/kas_workflows.py _BOOT_RECOVERY), what a trigger install undoes (dashboard/kas_workflow_triggers.py _UNSUBSCRIBE), and the crash listeners that install subscribes (runtime_death.py _listeners). A task one test started kept every later boot recovery on the worker from starting, and a listener one test left would schedule a reconnect for that test's chats when a later test announced a death. A new guard in test/conftest_resets_dashboard.py, _fresh_kas_workflow_dashboard_state, gives every test an empty list for each, through _floor_monkeypatch and only for a module already loaded. It is bound in that file's block in test/conftest.py (1,998 lines here). Checks run on this tree: - pytest (-n auto) on test/test_process_cache_floor_ratchet.py, test_conftest_guards.py, test_conftest_teardown_imports.py, test_conftest_import_budget.py, test_conftest_parts_reach.py, test_platform_collect_ignore.py, test_host_isolation_floor_worker_budget.py, every test/test_kas_workflow*.py and test/test_runtime_death*.py, test_chat_runner_kas_observe.py and test_kas_slot_needs_person.py: 1,014 passed, 1 failed. The failure is test_every_new_module_level_cache_has_a_per_test_reset naming the five router and chat names of layer 1, which the layer 1 reset (test/conftest_resets_kas_workflows.py) covers once it is merged up; none of this layer's state is named - a two-test leak check, not committed: without the guard the second test reads the three entries the first one left, with it none - black --check, isort --check-only, flake8 on the two files: clean - check_black_formatting.py, check_subprocess_encoding.py, check_comment_history.py and check_brand_name.py against 2359152, check_file_line_cap.py: passed
Six /api/workflows/kas routes confined their project directory inline (_project_dir reads the recent-projects file and resolves every root), and recipe create and delete resolved the home directory inline in _recipe_dir_allowed. Both now run with asyncio.to_thread. A launch (POST /api/workflows/kas/runs) and the observe turn starter queued a turn on a chat restored at gateway start without loading its transcript window first, so the queue read the window from disk on the loop. The launch now awaits load_window_off_loop and answers 400 invalid_slot if the chat closed meanwhile. The observe starter, which the router calls synchronously, queues such a chat's turn from a task once the window is loaded, after the same closed and busy checks, and drops the router's observe token when the turn does not start, as a start refused at once does. The kas-workflows spec says so. Checks: pytest test/test_kas_workflow*.py, test_chat_runner_kas_observe.py and test_held_note_turn_starts.py, 858 passed and 1 new test failed on a client read after close, fixed and its file rerun, 21 passed; the five new tests fail on the unfixed code. black, isort, flake8, mypy --platform linux on the handler, the comment-history, brand, line-cap and agent-SDK boundary gates and docs-lint pass.
…rd routes Brings in the engine layer's ratchet fixes, per-test resets and model review fixes, so this layer is tested with them.
Brings in fullmatch for the model, effort and recipe name checks, so the anchored-pattern ratchet passes on this layer.
Brings in the RouteAccess labels of the 22 workflow routes this layer adds, so the route label test passes.
Brings in the per-test resets of the boot recovery list, the trigger unsubscribe list and the runtime death listeners.
Brings in the project and recipe directory checks off the event loop, and a launch and an observe turn that read a restored chat's window off the loop first, each with its tests.
Sensitive change review
|
The workflow engine change no longer carries scripts/capture_kas_workflow.py, to stay under the Design Review lane's diff cap. The script, unchanged, and the three lines of kas-workflows.md that name it come back here. Checks: scripts/docs-lint.sh passed; check_file_line_cap.py 0 failures.
test_reconnects_run_at_most_concurrency_at_a_time held each reconnect on an event that only a second reconnect in flight could set. A recovery that ran reconnects one at a time, the regression the test is there to catch, never set it, so the test hung until pytest-timeout killed the worker instead of failing at that line. The reconnects now wait on a release the test owns, and the test waits for two in flight with kiro_crew.testing.wait.await_until under the lost-run bound, so a serial recovery fails naming the bound. The reconnect counts in_flight down in a finally, and the peak is read before the release, after every reconnect task has run up to its first wait. A second test runs the same check with concurrency 1 under pytest.raises(AssertionError) and a short bound marked flake-ok: there the expiry is the result under test. Ran (Python 3.12, PYTHONPATH=src): - before, the old test with concurrency=1 and --timeout=20: hangs, "Failed: Timeout >20.0s" at the gather - after, the new test with concurrency=1 and --timeout=60: "AssertionError: 2 reconnects in flight at once with concurrency=1 had not happened after 30.03s (lost-run bound 30.00s)" - pytest test/test_kas_workflows_boot_recovery.py: 15 passed - pytest test/test_flake_pattern_ratchet.py test/test_wait_discipline_ratchet.py: 135 passed - black --check, isort --check-only, flake8 on the file; comment history, brand and line cap scripts: clean
The setting's description said no surface read the switch yet, so setting it changed nothing. This layer wires it: with it on, a dashboard chat's session on Kiro Agent gets the workflow tools, the /api/workflows/kas/* routes answer, and the gateway reconnects a chat's interrupted runs at start, and Settings can write it. The description now says so, in the config field, config-baseline.json and the configuration doc together. No translation catalog carries the sentence. Ran (Python 3.12, PYTHONPATH=src): - pytest test/test_config_baseline.py test/test_configuration_doc_facts.py test/test_configuration_doc_defaults.py: 29 passed - check_black_formatting, black --check, isort --check-only, flake8 on sections_agent.py; line cap (the file at 2,000 lines), comment history, brand, scripts/docs-lint.sh: clean
Sensitive change review
|
A launch, reconnect or observe marker queued behind a busy turn carried no mark the queue merge stops at. With dashboard.merge_queued_messages on, it merged with the next queued message, and turn admission, which knows a marker only as the whole prompt, sent the merged text to the model: no run started although the launch route had answered 202. The three marker sites in the workflow routes now queue the marker with a drains_alone meta key, and _dequeue_next_message stops at it as it does at an automation steer, whatever the merge setting says. The kas-workflows spec states the rule beside the launch route. Ran (Python 3.12, PYTHONPATH=src): - pytest test_kas_workflows_parity_routes.py -k never_merge: 1 failed without the fix (the four entries drained as one turn), 1 passed with it - pytest test_kas_workflows_parity_routes.py test_kas_workflow_triggers .py test_kas_workflows_boot_recovery.py test_chat_runner_kas_observe .py test_merge_queued_messages.py test_held_note_turn_starts.py test_automation_steer_row_role.py: 129 passed - check_black_formatting, check_subprocess_encoding, isort and flake8 on the changed files, mypy src/kiro_crew, comment history, brand, line cap, scripts/docs-lint.sh: clean
The Coverage Gate measured dashboard/handlers/kas_workflows.py at 74.0% of its lines, under the 80% every new source file must reach. The routes it had no test for were the run control (pause, resume, stop, delete), a step reply, an approval answer, a chat's run list and its reconnect, and the start and stop of boot recovery. New tests drive each through the real route table and the router: a pause reaches Kiro Agent on the process that drives the run, an unknown action and an undriven run are refused; a reply becomes a prompt on the parked step's session, and a missing text, an unknown step and a busy step are refused; an Allow answers the held permission request and a stale key answers 409; a chat's runs come with the held requests and the revision, and a failed listing is a 409; a reconnect reaches an open chat once and resets its tries, a closed chat is a 400; boot recovery starts once per process, stops at shutdown and ends quietly when it fails. Ran (Python 3.12, PYTHONPATH=src): - the gate's per-file check (scripts/check_per_file_coverage.py, floor 80, backend baseline) on coverage of the 46 test files naming these modules, sysmon core, lines only: kas_workflows.py 72.1% (459/637) before, 86.0% (548/637) after - pytest test_kas_workflows_parity_routes.py test_kas_workflows_boot_recovery.py: 50 passed - the four ratchets against the layer below: 150 passed; black, isort, flake8, comment history and brand on the two files: clean
Sensitive change review
|
Three tests made a directory link with Path.symlink_to, which fails on Windows without the symlink privilege (WinError 1314): the create and delete refusals behind a linked .kiro in test_kas_workflows_l4_recipes.py and the handler's refusal of a link in home in test_kas_workflows_project_root.py. They now use the repository's kiro_crew.testing.links.make_dir_link, which makes a junction on Windows and the same directory symlink everywhere else. The routes confine a path with os.path.realpath, which follows a junction as it follows a symlink, so each test checks the same refusal on Windows. Ran (Python 3.12, PYTHONPATH=src): - pytest test_kas_workflows_l4_recipes.py test_kas_workflows_project_root.py: 37 passed - the four ratchets against the layer below: 150 passed - black, isort, flake8, comment history and brand on the two files: clean
Sensitive change review
|
Problem / Motivation
Goal: With
agent.kas_workflowson and Kiro Agent as the backend, a dashboard chat can start Kiro Workflows runs and answer its own run's steps, the dashboard gets routes to watch, answer and control them, and a run survives idle timeouts, crashes and gateway restarts.Kiro Agent has its own workflow engine: saved recipes, multi-step runs, and steps that stop to ask a person a question or for an approval. The PR this one sits on gives Kiro Crew the engine's run mirror and router, but nothing in the gateway calls them. With the switch on, a chat still gets no workflow tools, no route lists a run or answers a step, and a running step dies with its chat's Kiro Agent process at the next idle timeout.
Why it matters
Kiro Agent is Kiro Crew's default backend. Without this PR the switch turns nothing on: the dashboard pages in the frontend PRs above this one have no routes to call, and a step that asks a question waits with no way for the person, or the chat on the person's behalf, to answer it.
Not a goal
agent.kas_workflowsoff, chats behave as on main.website/changes here.What changed (motivation → approach → change)
The gateway now calls the engine from the PR below, only with
agent.kas_workflowson and Kiro Agent as the backend. A run belongs to the chat whose Kiro Agent session started it, and the dashboard reaches the run through that chat's turns or through a route./api/workflows/kas/send_message, so its model can start a run and answer a step of it; a dashboard launch becomes the chat's next turn and starts the run on the chat's own session; a message sent while the chat follows a run waits as its next turngateway --approval yoloreaches that chatkas_workflow_revisionframe on/api/wsto the owner's pages, coalesced over 250 ms, so a page reads again only when something changedsession.timeout_secs; 45 s after a process crashes, the chats whose runs it drove get a reconnect turn; at gateway start, boot recovery reconnects interrupted runsrewind_workflow_running, with the run names maskedagent.kas_workflows, a config change the agent proposes that turns it on counts as widening access, andGET /api/workflows/enginenames the engine in useEvery route is the dashboard owner's, and an app token gets 403. Each of the 22 routes this PR registers has a
RouteAccesslabel in the route table. With the switch off, or on another backend, every/api/workflows/kas/route answers 409engine_not_kas, except that the reads and Stop stay open while the router still holds a run;GET /api/workflows/engineanswers in both cases, naming Kiro Crew's own engine when the switch is off. A project folder a request names must sit under the home folder, a recent project or an open chat's project, and every answer is redacted.When Kiro Agent starts a turn on the chat's session by itself, the chat follows that turn without prompting the model. In a chat that has Kiro Agent's
run_workflow, Kiro Crew's own routes for writing a new workflow answer 409kas_workflows_in_chat, so the model is offered one engine.A launch, reconnect or observe message queued behind a busy turn runs as a turn of its own, also with
dashboard.merge_queued_messageson, so it starts its run instead of reaching the model merged with the next queued message.Only a crash sends a reconnect turn: an idle expiry also ends a process, and reconnecting after one would start a new process at every expiry. The 45 s wait covers Kiro Agent's 30 s claim on the dead process's runs, during which it refuses a reconnect. Only that process's chats are reconnected, because a new process for another chat in the same project would sweep the crashed chat's run as stale and take it first. A crash or boot reconnect reads a cold chat's transcript off the event loop before it checks that the chat is idle, so a turn the person starts during that read gets no reconnect turn queued behind it. A launch reads a cold chat's transcript off the event loop too before it queues its turn, and answers 400
invalid_slotwhen the chat closed during that read; a restored chat's observe turn starts once its transcript is read. The routes check a project folder and a recipe folder off the event loop. A launch's model and effort are checked withfullmatch, so a value that ends in a newline answers 400invalid_modelorinvalid_effort.One limit stays: Kiro Agent asks the chat's session for permission before each poll of a command watch, and nothing reads a request that arrives between the chat's turns. Kiro Crew denies it at the chat's next prompt, which fails the watch and its run.
How a workflow step reads its chat's approval mode is its own module,
dashboard/chat_turn/kas_step_mode.py, which keepsdashboard/chat_turn/tool_approval.pywithin the 2,000-line cap. The specs, the feature map and the AGENTS.md routing row follow the code.Backwards compatibility
Compatible: with
agent.kas_workflowsoff, the default, every/api/workflows/kas/route refuses, no chat gets the workflow tools, and each chat-turn and approval change acts only on a workflow launch, observe or reconnect turn or on a run's plan approval, none of which occurs.Removes nothing: the diff adds routes, a listener on process deaths (
runtime_death.subscribe) and code paths taken only for a Kiro Workflows run; its two new refusals (a rewind past a live run, Kiro Crew workflow authoring in a chat that hasrun_workflow) need the switch on.Tests
/api/workflows/kas/route through aiohttp: the switch and backend check, project folders outside the allowed roots, redacted answers, and the step model route's 400, 404 and 409.send_message.python -m pytest -q -p no:cacheprovider -n 8 --dist loadgroup <files>: the five test files that read the sink list (test_security_posture.py,test_security_posture_facade.pyand three core decoupling tests) and six test files of the modules behind this PR's two new sinks, the routes' answers and the rewind refusal's run names (test_kas_workflows_plan_redaction.py,test_kas_workflows_step_transcripts.py,test_kas_workflows_round4_l2.py,test_kas_workflows_round5.py,test_kas_workflows_chat.py,test_kas_workflows_chat_session.py): 11 files, 264 passed, 0 failed, 0 skipped.test/test_kas_workflow*.pywith the conftest, observe-turn, idle-hold and process-death tests and the test files the diff changes, 54 files: 1,939 passed, 0 failed; the agent-SDK import boundary and focus-cue gates and the file line cap pass.test_workflow_turns_queued_behind_a_busy_turn_never_mergeposts two launches to a busy chat with merging on, then a plain message and a reconnect, and fails without the fix (the four drain as one turn that is not a launch). New route tests (run control, step reply, approval answer, a chat's runs and its reconnect, boot recovery's start and stop) bringdashboard/handlers/kas_workflows.pyfrom 72.1% to 86.0% of its lines by the Coverage Gate's per-file check over the 46 test files that name these modules, over its 80% floor. On 37be11a, the fix commit below this head,scripts/local-gate.py --base 9b94d7af493d, the related set of the fix, 145 backend test files: 5,751 passed, 0 failed; mypy, black, isort, flake8, the comment history and brand checks and docs lint pass.test/conftest_resets_dashboard.pyresets the boot recovery task, what a trigger install undoes and the process-death listeners before every test. New tests pin the route labels, the routes' path checks off the event loop, a launch into a cold chat and into one closed during the read, a restored chat's observe turn, and a launch option that ends in a newline.scripts/local-gate.py --base 989b629c2b --dry-runrelates 5,034 backend test files to this diff (22 in the diff, 905 by name, 4,060 that reference a changed file, 47 through a facade) and leaves its frontend set to CI, since no file underwebsite/changes. They ran with the gate's pytest command at 4 workers,python -m pytest -q -n 4 --dist loadgroup --max-worker-restart=2 --no-cov -p scripts.explicit_file_targets -p no:cacheprovider -- <files>, in this order until a 25-minute cap:test/test_git_repo_touches.py::TestStatusAdmitsTouchedRoots::test_user_file_changes_cannot_list_or_admit_an_untouched_repo, is in a file this PR does not change, and it fails the same way on main 190fef0 on this host (the file alone: 1 failed, 171 passed on both);chat,routerorworkflows.Manual verification
With the four PRs above stacked on this one, on the pinned Kiro Agent 0.66.117, in headless Chromium against a local gateway on loopback: five runs launched from the Workflows tab's form (one waiting on its question, one answered through the step reply route and completed, one with its step marked failed, one paused, one stopped from its menu), and three runs started by a chat's model, in which the chat answered the step's question with Kiro Agent's
send_messageand the run completed (in the first of the three only after the person told it to answer; the engine PR below describes the three).Not repeated since the stack moved onto main 704bfc3:
/workflow-run, a plan approval held under Trust until allowed, a parked step moved to another model, about 50 minutes of use in which the page never read these routes on a timer, and the command watch failing at the chat's next prompt. A live Kiro Agent crash during a run was not repeated either; the 45 s crash reconnect has unit tests here, and its last live run was on an earlier version of this branch.Real-machine verification
Machine: the author's own Linux development host, Amazon Linux 2023, x86_64, 16 vCPU / 30 GiB.
Before (main 190fef0):
pytest -n 4 test/test_kas_workflows_optin_gate.pywith this PR's test file ->34 failed | 6 passed.After (head 3c5da62): the same command ->
40 passed.Route check: in the browser check of the two UI PRs above, on this machine,
GET /api/workflows/engine, the route this PR adds, answered 404 on main 190fef0 and 200 on heads dea05b0 and 53225fe.Cleanup: own host, no machine to delete; the check worktree on main was removed.
Screenshots / video
N/A -- this PR changes no file under
website/, so it has no rendered surface.Related Issues
No issue tracks this work.
Continues draft #25450.
It lands after the PR that adds the Kiro Agent workflow engine and before the PR that holds plan approvals for a person on every channel.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commitsContribution License Agreement
Contributed under the project's Apache-2.0 license, as the Licensing section of CONTRIBUTING.md sets out.