Repository navigation
feat(workflows): Kiro Workflows dashboard routes and chat-turn wiring - #25450
kyleseaman wants to merge 4 commits into
Conversation
Sensitive Change ReviewSensitive files changed:
How to clear this check:
Only the author's comment counts this way. A reviewer can instead |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the feature is off by default and needs the backend to be Kiro Agent; a launch or observe turn needs a token that only the gated routes issue; it takes nothing away. Notes
[DESIGN-REVIEWED] 67be079 Description read[DESCRIPTION-READ] 0063e914f04c6aff7de6bad9e615689d6c058ca6334c345431d4609f4005aafc 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 Nothing blocks: every chat-turn change only acts when the Notes
What this change shipsInventory (10 items) — 8 justifiedIntent: a developer who has opted in can launch, watch, answer and control KAS workflow runs from the dashboard, and every question a run raises waits for a person. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 67be079 Description read[DESCRIPTION-READ] 4b0a6bb5e718b4c5b00d44f4cee3a5758f3ce8a33a6407986eccc54d75b92fd1 That sha256 names the PR description this verdict read. Recompute it with |
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/handlers/kas_workflows.py:627 -- Polling still approves and resumes runs after opt-out
BLOCKING -- src/kiro_crew/dashboard/chat_rewind.py:315 -- Rewind refusals expose unredacted workflow names
BLOCKING -- test/test_kas_workflows_boot_recovery.py:176 -- Concurrency verification has an unbounded self-unblocked wait
[BLOCK-MERGE] 67be079 Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1. Harm rung: MEDIUM. When the operator switches the feature off, the polls are meant to be read-only, but they still resume runs and approve held steps. Confirmed conditions:
The effect is visible and has an exit: Trust mode and the name-grant check still apply ( F2 (fenced). Confirmed. F3 (fenced). Confirmed. False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — 🔴 changes requested (blocking)Reviewed KAS workflow step approvals ignore the YOLO scoping that the chat's own tool calls obey, so a channel-linked chat auto-approves every workflow step under BLOCKING — src/kiro_crew/dashboard/chat_turn/tool_approval.py:290 BLOCKING — src/kiro_crew/dashboard/handlers/kas_workflows.py:624 BLOCKING — src/kiro_crew/dashboard/handlers/kas_workflows.py:693 [BLOCK-MERGE] 67be079 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
102dbec to
87d2e9d
Compare
d4da76b to
bd01ffa
Compare
87d2e9d to
2e1f8d3
Compare
bd01ffa to
3a99302
Compare
2e1f8d3 to
4c1d139
Compare
6e81460 to
49e0654
Compare
2f734ed to
781f017
Compare
49e0654 to
d171853
Compare
ce49ae4 to
93ddbaf
Compare
781f017 to
67be079
Compare
The engine half of Kiro Workflows on Kiro Agent: the router that launches runs on the parent chat's own KAS process, routes each runtime's workflow frames into the one run mirror, holds step approvals and questions (kas_workflows/router.py, asks.py, policy.py), reads a step's transcript (transcript.py), and recovers interrupted runs; the ACP runtime and session-handle hooks that carry those frames and the observed engine turns (acp/workflow_sink.py, session_handle_kas.py, runtime_*); and the live-capture recorder (scripts/capture_kas_workflow.py). A project directory a caller names is resolved and confined to server-held roots (home, KIROCREW_PROJECT_DIR, recent projects) before any filesystem use (kas_workflows/project_root.py). Router, asks and transcript redact the text they hand to any surface, and are registered as redaction sinks. All of it is inert unless agent.kas_workflows is on and the backend is Kiro Agent.
…line cap kas_workflows/router.py was 2,829 lines, over the repository's file line cap. Its types, limits and pure helpers move to router_base.py, and three groups of KasWorkflowRouter methods move to owner modules the class binds back by name (own_methods), the pattern AcpRuntime and AcpSessionHandle use: router_reads.py (requests, rows, recipes, run lists, step transcripts), router_controls.py (run, step and recovery controls) and router_recovery.py (ledger, reconnects, boot recovery). router.py keeps the class, every method that redacts, the module entry points and the singleton, and imports every moved name, so router.<name> still resolves for callers and tests. Every redactor call stays in router.py, the module the security posture registry names; the new modules call none. The moved code is AST-identical except one line in schedule_reattach that unpacks the binding before the closure, so mypy can type it. scripts/capture_kas_workflow.py reads the kiro-cli and Kiro Agent versions after the drive instead of before it: kiro-cli extracts its engine on the first acp spawn, so a fresh HOME has no @kiro/agent package.json until then. The new waits in test_acp_observe_turn.py, test_kas_workflows_parity.py and test_kas_workflows_step_user_input.py take their bound from kiro_crew.testing.wait (default_timeout, or async_wait_until's own default) instead of a short literal, as the flake ratchet's K19 rule asks. A KAS question the chat itself asks (_kiro/userInput) is left to main's elicitation path, which holds it for a person under every approval mode. The workflow surface answers only a step's question, one on a session nobody reads, and one its sink fails on, each "answered" with text built by acp.elicitation's user_input_response, so a dismiss, deny, blank answer or failure never sends a reply KAS reads as yes. With the switch off, only a KAS chat's session/new says workflows.enabled:false. The kas_client_capabilities toggle is gone: main declares userInput on every KAS handshake. A step's command is resolved once, from KAS's _meta.kiro.command and the call's rawInput, for the deny screen, the grant key and every approval mode; a command named in a shape it cannot read, or two that disagree, is held for a person and never matched by a grant. Run and step routes are kept only for runs the mirror holds and go when it evicts them, and a step ask's answer task counts against the runtime's shared answer cap. agent.kas_creator_effort, AcpEvent.answers_only and the chat question-card helpers are gone: nothing in the stack reads them. Every value the router keeps from a KAS frame or a launch is bounded where it is stored: titles, options, plan views, question ids, launch fields and reconnect tokens are capped, and an id or grant input over its cap is refused or gets no grant, never cut. Inspections run only for runs the mirror holds, and the mirror refuses a run id over its cap instead of cutting it. A step's permission request or question is claimed by the router only while the run's chat has an approval-mode reader registered (note_chat_session), read at request time. With none, nothing would ever answer a held request, so the runtime's own fail-closed reply answers it: the permission is rejected and a question gets the no-answer reply. A person's "Always" on a step's tool is sent to KAS as allow-once on every path, so Crew's own step grant is the only "always"; the grant is recorded only when the call has a grant key, and the card says "once" when it has none. A step that offers only an always-allow is refused and stays held, so it can still be rejected. A request that names a command is never taken for a plan handoff.
93ddbaf to
d6acbd5
Compare
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.
- 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.
67be079 to
552b9b6
Compare
d6acbd5 to
91df23c
Compare
Off by default behind
agent.kas_workflows(Developer › Feature Previews); with it off, behaviour is main's.Problem / Motivation
Goal: When Crew's agent backend is Kiro Agent (KAS), a developer can turn on Kiro Workflows and launch, watch, answer and control KAS workflow runs from the dashboard, with every question or approval a run raises held for a person.
Why it matters
Kiro Agent is the default harness and ships its own workflow engine (recipes, multi-step runs, steps that park for input), but Crew drops the whole
_kiro/workflow/*surface: a KAS chat cannot start a workflow, nobody sees a run's steps, and a step that asks a question stalls with no sign anywhere. A run left to channel auto-answer paths could have a person's answer given on their behalf.Not a goal
agent.kas_workflows); with it off, Crew behaves exactly as main.workflow_run, saved Crew workflows). They keep running.What changed (motivation → approach → change)
The dashboard wiring around the engine.
/api/workflows/kas/*: recipes, runs, run and step controls, step transcripts, approvals, questions, reconnecthandlers/kas_workflows.py,server_runtime/mcp_routes.py_kiro/userInput, answered on main's elicitation card)chat_runner.py,chat_turn/*,chat_api/slot_approval.py,kas_workflows/chat.py(needs_a_person),providers/acp.py,providers/acp_turns.pyrewind_workflow_running)chat_rewind.py,chat_regenerate.pyserver_runtime/workflow_startup.py,chat_delivery.py,state_parts/*slot_projection.pyagent.kas_workflowsbecomes dashboard-editable for the Settings switch the UI PR draws; a change card reads turning it on as a widenhandlers/core_config_schema.py,change_card_catalog_kinds.pyA request's project directory is confined to server-held roots before any filesystem use (CodeQL
py/path-injectionon_project_dir). Every route refuses unless the switch is on and the backend is Kiro Agent. Responses go through_redact_obj, and the handler is a registered sink. The feature map gains the API-only row.Stack
Split out of #25395, which was over the 1 MB review cap. Merge bottom-up. Only a PR based on
maingets CI (ci.ymlandfast-gate.ymlrun onpull_request: branches: [main]), so each stacked PR is rebased ontomainonce the one below it merges. A and the B1a protocol PR do not depend on each other. C2's UI uses A's card, which is on main.feat/kas-wf-1-session-cardsmainfeat/kas-wf-2-backendmainfeat/kas-wf-2b-enginemainfeat/kas-wf-2c-dashboardfeat/kas-wf-2b-enginefeat/kas-wf-3-person-holdsfeat/kas-wf-2c-dashboardfeat/kas-wf-4-frontendfeat/kas-wf-3-person-holdsfeat/kas-wf-4b-frontend-uifeat/kas-wf-4-frontendBackwards compatibility
Compatible: every route refuses while the switch is off; the chat-turn changes only act on KAS launch / observe messages and KAS plan handoffs, which do not exist with it off.
Removes nothing: only additions.
Tests
test_kas_workflows_parity_routes.py,_l4_recipes.py,_round5.py,_optin_gate.py,_boot_recovery.py,_chat_session.py,_round4_l2.py,_project_root.py,test_chat_runner_kas_observe.py,test_chat_mode_security.py,test_chat_runner_coverage_approval.py,test_kas_slot_needs_person.py, composition contracts (+28 lazy imports, +29 MCP routes).session_cwdkeyword,chat_runnerdrops an unreadkas_workflows.chatimport that main's compose-binding test now refuses, and the parity-route waits useFALLBACK_TIMEOUT_SECS(flake ratchet K19).Proof: not provable -- other: feature PR, not a fix; each behaviour has its own test named above.
Manual verification
N/A — the UI that calls these routes arrives in C1 / C2; route tests drive them through aiohttp here.
Screenshots / video
N/A — this PR changes no website file, so it has no rendered surface.
Sensitive change
This PR adds rows to
src/kiro_crew/security_posture_sinks_gateway.py(SCR-watched): one row, fordashboard/handlers/kas_workflows.py. Nothing elseunder the Sensitive Change Review globs changes. Draft for the owner to post as the review comment:
Sensitive change review
Head: 552b9b6
dashboard/handlers/kas_workflows.py; no redactor, scanner or allowlist changes._redact_objbut sits in no registry; after, it is a named sink and the panel counts it.test_security_posture.pylearns that_redact_obj(runs both scanners (exfil then credential, keys included)._redact_objslips the disclosure check; every_redact_objtoday runs both._redact_objdefinition in the tree runsredact_exfiltration_urlsthenredact_credentials; every route body and error passes it.Related Issues
N/A — no tracking issue, by the owner's choice.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)