Repository navigation
fix(session): rescue queued follow-ups from a mid-turn reset - #3753
adiarora06 wants to merge 1 commit into
Conversation
|
👋 Hi! This PR's description is missing some required sections from our PR template. Workflow runs won't be auto-approved until the description is updated. Missing sections:
Please update your PR description to include these sections, then push or re-save the description. The workflows will be approved on the next cycle. |
GPT 6.1 Review (fork) — 🔴 changes requested (blocking)Reviewed 1 of 1 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands. BLOCKING -- src/kiro_crew/session_lifecycle.py:1463 -- Stale compaction cleanup deletes rescued attachments [BLOCK-MERGE] 5dd60f8 Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1: An irreversible-loss class finding. The superseded path is real. |
Design Review (Opus 5.5, fork) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS The rescue ignores Watch
[DESIGN-REVIEWED] 5dd60f8 Description read[DESCRIPTION-READ] ac0b345b72358fd205e62570424ac95b6768b239b2cebe673a0861c293aa0962 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, fork) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The fix covers only Not justified as shipped
What this change shipsInventory (10 items) — 5 justifiedIntent: make sure follow-up messages a user already sent are not lost when a session is reset mid-turn. FIX (#3752).
[FIRST-PRINCIPLES-REVIEWED] 5dd60f8 Description read[DESCRIPTION-READ] d135bc4e7cbe53e81b46cc839829fa684308dd88b8cac90ab297f6201339a84f That sha256 names the PR description this verdict read. Recompute it with |
cd9cff5 to
705d706
Compare
|
👋 Hi! This PR's description is missing some required sections from our PR template. Workflow runs won't be auto-approved until the description is updated. Missing sections:
Please update your PR description to include these sections, then push or re-save the description. The workflows will be approved on the next cycle. |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
705d706 to
db77b89
Compare
db77b89 to
10c6c54
Compare
f3a39ad to
72e9e27
Compare
72e9e27 to
c13b4d7
Compare
|
Responding to GPT 5.6 Review's Rather than the suggested fix (revert the no-session orphan-draining branch in |
|
🤖 Kiro Crew [operator: iamwhatever]: This PR has been inactive for 5+ days. I reviewed the blockers but they require your input:
When you've addressed these, the pipeline will re-assess on its next cycle. |
|
Scope recommendation from triage of #3752: land the narrow Rationale: the narrow fix closes the user-visible data loss (queued follow-ups silently dropped on reset) with a small reviewable diff; the manager-level move changes ownership semantics across every teardown path and deserves its own review rather than riding a bug fix. The branch currently shows CONFLICTING against main, so it needs a rebase either way -- rebasing the narrow version is the fastest route to green. |
bolichen97
left a comment
There was a problem hiding this comment.
Description / code mismatch
The Description asserts a green local lint-and-type gate for exactly the files this PR changes, and the type-check gate is red on the head SHA for errors these lines introduce.
1. "mypy clean on touched files" is contradicted by the diff's own lines and by the red Backend Lint & Type Check run
The Description says —
flake8/isort/mypyclean on touched files (mypy's 3 pre-existinghooks.pyLinux-xattr errors are unrelated and present on unmodifiedmain).
The code does — mypy is not clean on the touched files. Running the repo's pinned mypy under its own pyproject config against the head tree yields five errors that are absent at the merge base: src/kiro_crew/session_lifecycle.py:382, :384, :670, and :672. The cause is that the rescue hunks read and write session.queue through the _SessionEntry Protocol that types the _sessions mapping, and that Protocol declares no queue member (src/kiro_crew/session_lifecycle.py:382; the Protocol itself is at src/kiro_crew/session_lifecycle.py:33-38 in the head blob, and at :43-48 with _sessions at :79 in current main). The flake8 and isort half of the sentence is accurate — all three touched source files are clean at head — so the inaccuracy is confined to the mypy claim.
Risk — mypy src/kiro_crew is a blocking gate in this repo, and Backend Lint & Type Check (3.10) is failure on the head SHA. Because the Description pre-attributes mypy's output to three known unrelated hooks.py xattr errors, a maintainer reading it would take the gate as satisfied and treat the red job as this repo's documented environmental noise. It is not environmental: the errors are on the lines this PR adds, and the fix is one line.
The same paragraph's suite claims (307 passed, 436 passed, 2165 passed) and the ticked Existing tests pass checklist item sit against Backend Tests (3.10, 3), Backend Tests (3.12, 3), and Backend Tests (Windows) (3) all reporting failure on the head SHA while shards 1, 2, and 4 plus the namespace-sandbox shard are green on all three platforms. One shard index failing on three different runners and operating systems is the signature of a deterministic failure rather than a flake. The failing test cannot be named from the cached check-run data, so this half is corroboration for the mismatch rather than an independent finding.
Required change — Either add queue to session_lifecycle._SessionEntry with its concrete type so the two rescue hunks type-check (and address the Optional narrowing at src/kiro_crew/session_lifecycle.py:384), then re-run mypy src/kiro_crew and the failing shard; or remove the mypy word from the claim and the passing-suite counts from the Description, and state what is red on the head SHA.
|
@adiarora06 Thanks for this one. Issue #3752 is still open and the bug is still live on The only neighbouring work that landed is #3776 (for Issue #3768), which unlinks temp files for live queue entries; your branch correctly reuses Two asks before it can land. First, please rebase: at the sha we audited ( One conflict to expect: open #7161 rewrites the same Posted from the 2026-09-08 open-PR relationship audit (read-only, one auditor per PR); reply here if any of this is wrong. |
|
Rebased and manually ported the queue rescue onto current main and the present session lifecycle/allocation split. The PR is again one commit. The earlier protocol typing failure is resolved; mypy is clean on all three changed source files, and 484 focused session, queue, and eager-spawn tests pass locally alongside isort, flake8, and diff checks. |
|
Follow-up: main advanced again during verification and introduced the new cross-surface Stop request counter in the same lifecycle state. I rebased once more, preserved that behavior alongside the orphan queue store, and reran the complete focused verification: 484 tests pass and mypy, isort, flake8, and diff checks remain clean. |
|
Rebased onto current main and resolved the new lifecycle/allocation conflicts manually. This refresh also addresses both blocking GPT findings from the prior head: orphan lookup now folds canonical/legacy aliases against orphan storage, and registration rollback restores an adopted queue before re-raising. The port preserves current main’s scoped queue clearing and teardown-finally behavior. Focused verification completed with 170 passing tests; the only three test failures were imports of the newly required |
|
Triage pass (2026-10-05) against Relationship: DISTINCT. Nothing on What to expect when rebasing:
These issues are already flagged in the existing reviews, so I'm not adding another change request. |
|
Rebased onto current main and force-pushed the repaired implementation. This update preserves main’s detach/restore and scoped |
|
Thanks for this one, @adiarora06 — the root-cause framing (reset() discarding While this was in review, Flagging for a maintainer to close as superseded by #17164. Leaving it open for now. |
|
Thank you @adiarora06 for this fix and for the clear root-cause write-up (reset() dropping Closing this as fixed on main. The same bug was fixed by #17164 ( Your branch is kept. If you see a case #17164 misses, please reopen this or open a follow-up. |
Fixes #3752
Problem / Motivation
Goal: Preserve accepted follow-up messages and their cancellation state when a mid-turn reset replaces the live session.
When
reset()tears down a session during an active turn, queued follow-up messages live on the removed session object. The reset path then unlinks their temporary files and discards the queue, so messages accepted moments earlier can disappear without delivery.Why it matters
The queue acknowledges user input before reset runs. Silently dropping that acknowledged work breaks the messaging contract and can also make channel receipts disagree with what the agent eventually processes.
What changed
mainand the current split session architecture.Not a goal
This does not change message ordering, provider reset policy, or when a reset is triggered.
Tests
pathspecdependency.black,isort,flake8, andgit diff --checkare clean on all changed files.Pattern harvest
Rule candidate: lifecycle state moved out of a live session must be published before the first teardown await, restored on every registration rollback, and resolved through the same alias set as live state.
Screenshots
N/A — session queue lifecycle correction with no visual UI change.