Repository navigation
Conversation
d74f3bd to
b23ffee
Compare
|
Rebased: main moved in the docs system-spec module since this head's CI base (f0be829 -> 9eb318e). The same revision also replaces the Comment History Gate's flagged historical wording with a present-tense mechanism statement. The affected 899-test suite, comment-history gate, formatting, lint, mypy, docs, and whitespace checks pass locally; CI is re-running on b23ffee. |
b23ffee to
4f3f57a
Compare
|
Rebased: main moved in src/kiro_crew/slack/gateway.py and related cron-routing files since this head's CI base (9eb318e -> 8ef5ea4). The branch remains one commit and now removes test/test_chat_turn_timeout_consistency.py from the Black debt baseline because this change makes it Black-clean. The affected cancellation and cron-routing suite passes 926 tests; Black baseline, comment-history, isort, flake8, mypy, docs, and whitespace checks pass locally. CI is re-running on 4f3f57a. The prior readiness/desktop-matrix failures were GitHub installation rate limits, and the Windows installer exceeded its runner time ceiling. |
|
@bolichen97 The current head is locally clean, but two status-publishing jobs failed only because the repository's GitHub App installation hit its API rate limit. The description check itself concluded success. I cannot rerun them because GitHub requires repository admin rights. Could you please rerun the failed jobs for Fork PR Description (https://github.com/kirodotdev/KiroCrew/actions/runs/37082233809) and PR Readiness (https://github.com/kirodotdev/KiroCrew/actions/runs/37082233908)? |
Send an owner-fenced native cancellation before local timeout teardown so timed-out chat work cannot continue invisibly. Preserve partial output and fail closed when cancellation cannot be acknowledged. Refs kirodotdev#14058
4f3f57a to
8c789d0
Compare
|
Rebased onto latest
Pushed with |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Check that timed-out subagent and Spec Builder turns showing a new timeout card was intended. The description never says these surfaces gain a card. Not justified as shipped
What this change shipsInventory (8 items) — 5 justifiedIntent: a chat turn that times out must actually stop its native model work before the dashboard says it stopped — FIX.
[FIRST-PRINCIPLES-REVIEWED] 8c789d0 Description read[DESCRIPTION-READ] 86f26e810d144267fbfe8e5c58deb2209f4f0dcd58ea0a0071cca17853dcd1a1 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5, fork) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS The unacknowledged-cancel card tells users "do not resume until it becomes idle", but nothing shows idleness or stops the next prompt. Watch
[DESIGN-REVIEWED] 8c789d0 Description read[DESCRIPTION-READ] e40fbad7c121565a6925ebeb1764ac078fa8a5fb1e0b1339c7bedd5e412a85a7 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 |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed Review detailsOne advisory finding; nothing blocks the merge. FINDING — src/kiro_crew/slack/gateway.py:9749 — [OPUS-REVIEWED] 8c789d0 |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
When a guarded chat turn reaches its wall-clock ceiling, cancel the native ACP turn against the exact session lease owner and wait for the provider's bounded acknowledgement before unwinding the local Python stream. This stops native work (and its built-in subagents) from continuing to edit files or request tools after the dashboard has reported the timeout, and prevents a stale deadline from cancelling a successor turn. Guarded and off-loop timeout dispatches now share the owner-fenced cancellation sequence and one timeout-reporting path. A provider-confirmed completed turn skips redundant cancellation and replay; unacknowledged outcomes preserve partial output and warn that resume is unsafe. Replaces #16301 by @junjiequ. Co-authored-by: JJ_Q <5853857+junjiequ@users.noreply.github.com>
When a guarded chat turn reaches its wall-clock ceiling, cancel the
native ACP turn against the exact session lease owner and wait for the
provider's bounded acknowledgement before unwinding the local Python
stream. This stops native work (and its built-in subagents) from
continuing to edit files or request tools after the dashboard has
reported the timeout, and prevents a stale deadline from cancelling a
successor turn.
Guarded and off-loop timeout dispatches now share the owner-fenced
cancellation sequence and one timeout-reporting path. A
provider-confirmed completed turn skips redundant cancellation and
replay; unacknowledged outcomes preserve partial output and warn that
resume is unsafe.
The virtual-time turn harness is given the healthy-session answer for
the new SessionManager.cancel_owned_turn call ("acked"), and
turn_dispatch keeps off the agent-sdk boundary: CancelOutcome is spelled
as a local Literal rather than imported from kiro_crew.providers, so the
shrink-only boundary gate stays at its baseline.
Replaces #16301 by @junjiequ.
Co-authored-by: JJ_Q <5853857+junjiequ@users.noreply.github.com>
When a guarded chat turn reaches its wall-clock ceiling, cancel the
native ACP turn against the exact session lease owner and wait for the
provider's bounded acknowledgement before unwinding the local Python
stream. This stops native work (and its built-in subagents) from
continuing to edit files or request tools after the dashboard has
reported the timeout, and prevents a stale deadline from cancelling a
successor turn.
Guarded and off-loop timeout dispatches now share the owner-fenced
cancellation sequence and one timeout-reporting path. A
provider-confirmed completed turn skips redundant cancellation and
replay; unacknowledged outcomes preserve partial output and warn that
resume is unsafe.
The virtual-time turn harness is given the healthy-session answer for
the new SessionManager.cancel_owned_turn call ("acked"), and
turn_dispatch keeps off the agent-sdk boundary: CancelOutcome is spelled
as a local Literal rather than imported from kiro_crew.providers, so the
shrink-only boundary gate stays at its baseline.
Replaces #16301 by @junjiequ.
Co-authored-by: JJ_Q <5853857+junjiequ@users.noreply.github.com>
When a guarded chat turn reaches its wall-clock ceiling, cancel the
native ACP turn against the exact session lease owner and wait for the
provider's bounded acknowledgement before unwinding the local Python
stream. This stops native work (and its built-in subagents) from
continuing to edit files or request tools after the dashboard has
reported the timeout, and prevents a stale deadline from cancelling a
successor turn.
Guarded and off-loop timeout dispatches now share the owner-fenced
cancellation sequence and one timeout-reporting path. A
provider-confirmed completed turn skips redundant cancellation and
replay; unacknowledged outcomes preserve partial output and warn that
resume is unsafe.
The virtual-time turn harness is given the healthy-session answer for
the new SessionManager.cancel_owned_turn call ("acked"), and
turn_dispatch keeps off the agent-sdk boundary: CancelOutcome is spelled
as a local Literal rather than imported from kiro_crew.providers, so the
shrink-only boundary gate stays at its baseline.
Replaces #16301 by @junjiequ.
Co-authored-by: JJ_Q <5853857+junjiequ@users.noreply.github.com>
When a guarded chat turn reaches its wall-clock ceiling, cancel the
native ACP turn against the exact session lease owner and wait for the
provider's bounded acknowledgement before unwinding the local Python
stream. This stops native work (and its built-in subagents) from
continuing to edit files or request tools after the dashboard has
reported the timeout, and prevents a stale deadline from cancelling a
successor turn.
Guarded and off-loop timeout dispatches now share the owner-fenced
cancellation sequence and one timeout-reporting path. A
provider-confirmed completed turn skips redundant cancellation and
replay; unacknowledged outcomes preserve partial output and warn that
resume is unsafe.
The virtual-time turn harness is given the healthy-session answer for
the new SessionManager.cancel_owned_turn call ("acked"), and
turn_dispatch keeps off the agent-sdk boundary: CancelOutcome is spelled
as a local Literal rather than imported from kiro_crew.providers, so the
shrink-only boundary gate stays at its baseline.
Replaces #16301 by @junjiequ.
Co-authored-by: JJ_Q <5853857+junjiequ@users.noreply.github.com>
When a guarded chat turn reaches its wall-clock ceiling, cancel the
native ACP turn against the exact session lease owner and wait for the
provider's bounded acknowledgement before unwinding the local Python
stream. This stops native work (and its built-in subagents) from
continuing to edit files or request tools after the dashboard has
reported the timeout, and prevents a stale deadline from cancelling a
successor turn.
Guarded and off-loop timeout dispatches now share the owner-fenced
cancellation sequence and one timeout-reporting path. A
provider-confirmed completed turn skips redundant cancellation and
replay; unacknowledged outcomes preserve partial output and warn that
resume is unsafe.
The virtual-time turn harness is given the healthy-session answer for
the new SessionManager.cancel_owned_turn call ("acked"), and
turn_dispatch keeps off the agent-sdk boundary: CancelOutcome is spelled
as a local Literal rather than imported from kiro_crew.providers, so the
shrink-only boundary gate stays at its baseline.
Replaces #16301 by @junjiequ.
Co-authored-by: JJ_Q <5853857+junjiequ@users.noreply.github.com>
When a guarded chat turn reaches its wall-clock ceiling, cancel the
native ACP turn against the exact session lease owner and wait for the
provider's bounded acknowledgement before unwinding the local Python
stream. This stops native work (and its built-in subagents) from
continuing to edit files or request tools after the dashboard has
reported the timeout, and prevents a stale deadline from cancelling a
successor turn.
Guarded and off-loop timeout dispatches now share the owner-fenced
cancellation sequence and one timeout-reporting path. A
provider-confirmed completed turn skips redundant cancellation and
replay; unacknowledged outcomes preserve partial output and warn that
resume is unsafe.
The virtual-time turn harness is given the healthy-session answer for
the new SessionManager.cancel_owned_turn call ("acked"), and
turn_dispatch keeps off the agent-sdk boundary: CancelOutcome is spelled
as a local Literal rather than imported from kiro_crew.providers, so the
shrink-only boundary gate stays at its baseline.
Replaces #16301 by @junjiequ.
Co-authored-by: iamwhatever <26782336+cixuuz@users.noreply.github.com>
Co-authored-by: JJ_Q <5853857+junjiequ@users.noreply.github.com>
Problem / Motivation
Goal: Ensure a timed-out chat turn stops its native model work before the dashboard reports the timeout.
When a guarded chat turn reaches its wall-clock ceiling, Kiro Crew cancels the local Python stream task. That local unwind can mark the ACP turn inactive without sending
session/cancel, so the native turn and its built-in subagents can continue editing files or requesting tools after the dashboard has stopped listening.Why it matters
A timeout must stop the work it reports as stopped. Otherwise invisible native work can continue for minutes, mutate the workspace, strand queued results, and leave later Stop requests with no active turn to cancel.
Not a goal
What changed (motivation → approach → change)
Observed symptom: a timed-out dashboard stream stopped locally while its native ACP turn continued unattended.
Root cause: the timeout callback cancelled
_run_chatfirst. Stream teardown then cleared active-turn state before any native cancellation was sent, so later cancellation resolvedno_turneven though the underlying prompt was still running.Approach: use the session lease's existing owner task as the generation fence. At the deadline, request native cancellation only while that exact task still owns the session, wait for the provider's bounded acknowledgement, and only then unwind the local stream. This prevents a stale timeout from cancelling a successor turn.
Change: guarded and off-loop timeout dispatches now share the owner-fenced cancellation sequence and one timeout-reporting path. A provider-confirmed completed turn skips redundant cancellation and replay. Unfinished
no_turn, timeout, and error outcomes preserve partial output and show that resuming is unsafe because native cancellation was not acknowledged.Implementation map:
src/kiro_crew/dashboard/turn_dispatch.py: deadline ordering, acknowledgement handling, and shared timeout reporting.src/kiro_crew/session_lifecycle.pyandsrc/kiro_crew/session.py: exact-owner cancellation and provider-confirmed completion proof.src/kiro_crew/slack/gateway.pyandsrc/kiro_crew/apps/builtins/spec_builder/backend/runtime.py: pass session state and slot identity to the shared timeout wrapper and consume task exceptions.docs/system-specs/modules/learn-cron-dashboard.md: document the owner-fenced native cancellation contract..github/black-baseline.txt: remove the cancellation consistency test after this change makes it Black-clean.Backwards compatibility
Compatible: existing callers keep their timeout behavior and signatures remain compatible through optional cancellation context; production call sites now supply session state and slot identity for native cancellation.
Removes nothing: the change adds owner-fenced cancellation and more precise timeout reporting without deleting or rejecting an existing input, API, or recovery path.
Tests
test/test_turn_dispatch.py: deadline ordering, bounded acknowledgement, repeated cancellation, provider-confirmed completion, replay, and fail-closed timeout cards.test/test_session.py: exact-owner cancellation, wrong-owner refusal, completion proof, and pre-await replay marking.test/test_chat_turn_timeout_consistency.py: every timed dispatch uses a valid guarded form, supplies state and slot identity, and consumes task exceptions.test/test_spec_builder_routes_coverage.py: Spec Builder passes the exact state and slot into the shared timeout wrapper.git diff --checkpassed on the rebased head.Manual verification
N/A — the change is an async lifecycle and ownership repair with deterministic race coverage; it does not change a rendered UI surface.
Screenshots / video
N/A — no user-visible frontend files or layout behavior changed.
Related Issues
no linked issue: #14058 also tracks stage-boundary, queued-message, and Stop recovery outside this focused native-cancellation repair.
Related but non-overlapping: #15918 reports an honest response when Stop finds an already-idle wedged slot; this PR prevents the native turn from being abandoned at the timeout boundary.
Pattern harvest
Rule candidate: review-prompt
Pattern: a timeout around a remote stream must stop and acknowledge the remote operation before cancelling the local consumer, fenced by the exact operation owner so a stale timeout cannot cancel successor work.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement