Repository navigation
fix(meetings): release a meeting whose agents were retired out from under it - #7899
Conversation
Design Review (Fable 5, fork) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS Description promises Watch
[DESIGN-REVIEWED] 1ff21b0 |
First Principles Review (Fable 5, fork) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS Description claims " Not justified as shipped
What this change shipsInventory (6 items) — 5 justifiedIntent: FIX — a meeting whose agent sessions were retired mid-init must stop wedging the single-active latch and blocking every new
[FIRST-PRINCIPLES-REVIEWED] 1ff21b0 |
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsFINDING -- src/kiro_crew/apps/builtins/meetings/backend/routes/_common.py:148 -- an identity sweep after agent init removes every slot, but |
Opus 4.8 Review (fork) — ✅ no blocking findingsReviewed Review detailsI've independently verified the core safety argument:
The residual edges (partial init-failure leaving live slots; no self-heal on disk absent a new start) are pre-existing behaviors, not regressions on the changed lines. Nothing survives falsification, and I found no grounded new defect. No findings. [OPUS-REVIEWED] 1ff21b0 |
f8c4f84 to
e47f63b
Compare
|
Confirmed legitimate against source ( |
|
Legitimate and the same root issue GPT caught. Resolved exactly as suggested (gate abandoned so an idle-reaped resumable meeting is not treated as terminal): |
Open PR relationship auditThis is a consolidated, point-in-time code-level audit note. It compares complete merge-base diffs and current/merged code; it does not treat a shared topic as duplication or partial coverage as completion. Relationship findings
No PR, Issue, label, branch, or review state was changed by the relationship-note portion of this audit. |
e47f63b to
2726986
Compare
|
Rebased onto main One conflict, in Gates run locally on the changed files: black, isort, flake8 (the two black hits are pre-existing baselined files, also failing on main), and Please review the comment relocation. A maintainer push makes the maintainer the last pusher, so a second approver is needed under the repo's last-push rule. Reply if anything looks wrong. |
2726986 to
2d6d2b9
Compare
|
Pushed
The gate's doctrine is that change history lives in git and the PR, not in code comments, so I removed only the issue-number narration and kept the behavioral descriptions verbatim (e.g. "The case this guards: a gateway-wide session sweep ..."). The diff vs the prior head is exactly three lines, one per file. This was amended onto your rebased head The other two reds on the prior head were unrelated to this diff: Build Desktop (arm) built its installers and failed only on |
|
PR description — "
Correct: the surfacing line was deleted from Historical (head |
8b98f84 to
8562f20
Compare
…mid-init A gateway-wide session sweep (the dashboard's 'Kiro identity changed' reconcile) can retire a meeting's agent sessions while it is still initializing. The MeetingSession survives, never became dispatch-ready, and is young enough that .expired stays False, so it holds the single-active-meeting latch with no live slot: the meeting wedges status active and every new /start answers 409 (issue kirodotdev#5904). Add MeetingSession.abandoned, true only when BOTH: - the meeting never became dispatch-ready (new monotonic became_ready flag, set only by the post-init start path via an explicit mark_ready flag on resume_dispatches, i.e. agent init completed), AND - every installed agent slot is gone from the session registry. The /start single-active guard releases the latch for such a meeting (and the outgoing meeting gets the same terminal end_meeting_meta teardown expiry already uses). The dispatch path deliberately does NOT tear down on abandoned (only on expired): the became_ready condition excludes an established meeting whose idle agent slots were reaped by the ordinary idle sweep (session_cleanup._expire_idle, meeting slots are not persistent/channel-exempt) - that meeting resumes its slots via get_or_create on its next line and must stay recoverable. Gating on became_ready is what tells that recoverable idle-reaped case apart from a genuinely-wedged mid-init retirement. Review amendments (original fix by Robert Fisher): - became_ready is set only behind resume_dispatches(mark_ready=True), passed solely by the start path after init_agents completes; a routine /status active unpause can no longer falsely mark a retired-mid-init meeting ready (regression test proven red-before-green). - abandoned is not surfaced in the status-poll payload (zero consumers; the latch guard reads the property directly). The identity-sweep root cause is a maintainer design decision, left untouched. Fixes kirodotdev#5904 Co-authored-by: Kiro Crew <noreply@kirodotdev.github.io>
8562f20 to
1ff21b0
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Reviewed the full production diff on 1ff21b0. 释放初始化期间全部代理已被回收、从未就绪的会议占用。
已完整审查会议初始化、abandoned状态及START_LOCK替换路径。写前main与已审查main一致,完整diff SHA256未变;已就绪会议仍可空闲恢复。
Fresh REST checks: current-head PR Readiness success; no effective change request or unresolved review hold; CODEOWNERS/UX eligibility and the distinct last pusher verified. Optional baseline failures, if present, remain recorded and are not claimed green. This approval does not bypass branch protection.
…mid-init (kirodotdev#7899) A gateway-wide session sweep (the dashboard's 'Kiro identity changed' reconcile) can retire a meeting's agent sessions while it is still initializing. The MeetingSession survives, never became dispatch-ready, and is young enough that .expired stays False, so it holds the single-active-meeting latch with no live slot: the meeting wedges status active and every new /start answers 409 (issue kirodotdev#5904). Add MeetingSession.abandoned, true only when BOTH: - the meeting never became dispatch-ready (new monotonic became_ready flag, set only by the post-init start path via an explicit mark_ready flag on resume_dispatches, i.e. agent init completed), AND - every installed agent slot is gone from the session registry. The /start single-active guard releases the latch for such a meeting (and the outgoing meeting gets the same terminal end_meeting_meta teardown expiry already uses). The dispatch path deliberately does NOT tear down on abandoned (only on expired): the became_ready condition excludes an established meeting whose idle agent slots were reaped by the ordinary idle sweep (session_cleanup._expire_idle, meeting slots are not persistent/channel-exempt) - that meeting resumes its slots via get_or_create on its next line and must stay recoverable. Gating on became_ready is what tells that recoverable idle-reaped case apart from a genuinely-wedged mid-init retirement. Review amendments (original fix by Robert Fisher): - became_ready is set only behind resume_dispatches(mark_ready=True), passed solely by the start path after init_agents completes; a routine /status active unpause can no longer falsely mark a retired-mid-init meeting ready (regression test proven red-before-green). - abandoned is not surfaced in the status-poll payload (zero consumers; the latch guard reads the property directly). The identity-sweep root cause is a maintainer design decision, left untouched. Fixes kirodotdev#5904 Co-authored-by: Kiro Crew <noreply@kirodotdev.github.io>
Problem / Motivation
A Meetings meeting can be left permanently wedged.
POST /startinitializes thethree meeting agents serially (~38s with the default roster), and any dashboard
chat turn during that window triggers the gateway-wide "Kiro identity changed"
session reconcile, which retires the meeting's agent sessions out from under it
while it is still initializing. The
MeetingSessionobject survives, neverbecame dispatch-ready, and because it is young its
.expiredflag is stillFalse, so it keeps holding the single-active-meeting latch with no live agentslot behind it. The meeting is left
status: activewith no live session:starting any new meeting answers
409 meeting_already_active(issue #5904).Why it matters
The user cannot start a new meeting, and the wedged one shows as active while
doing nothing. There is no self-recovery for the latch: it only releases if the
user happens to start a different meeting.
What changed (motivation to approach to change)
Root cause: the single-active latch keys on
MeetingSession.expired, a pure TTLthat has no idea whether the session's agent slots still exist. A swept-mid-init
meeting is un-live but not expired, so it slips through the guard.
The naive signal "all agent slots gone from the registry" is ambiguous: the
ordinary idle sweep (
session_cleanup._expire_idle, 3600s) also reaps amerely-quiet established meeting's slots (they are not persistent/channel-exempt),
and that meeting is fully recoverable — its next line resumes the slots via
dispatch_to_agent -> get_or_create. Treating that as terminal would drop arecoverable meeting.
So
abandonedis defined to fire ONLY for the genuine #5904 state, requiringBOTH:
not became_ready— a new monotonic flag set the first time_ActiveMeeting.resume_dispatchesopens the session's ingress (i.e. agent initcompleted and it became usable). This excludes every established meeting, which
by definition already became ready.
The
/startsingle-active guard releases the latch for such a meeting, and theoutgoing meeting gets the same terminal
end_meeting_metateardown expiryalready uses. (
abandonedis deliberately NOT surfaced in the status-pollpayload — it has no consumer there; the latch guard reads the property
directly.)
The dispatch path deliberately does NOT tear down on
abandoned(only onexpired): an idle-reaped established meeting must keep resuming on its nextline. The identity-sweep root cause is a maintainer design decision, left
untouched.
Tests
test_meetings_session.py::TestAbandonedpins the discriminator: all slotslive -> False; never-ready + no slot live -> True; established
(
became_ready=True) + all slots reaped -> False (the load-bearing guard forthe idle-reap case); one surviving slot -> False; no manager / no slots ->
False.
test_meetings_routes.py::test_start_releases_an_abandoned_meeting_holding_the_latchmodels mid-init retirement (slots gone AND
became_readyFalse) and asserts afresh
/startreturns 200, the wedged meeting is written non-active, and thenew meeting takes over.
FakeSessionManager.has_session/live_keys(defaults all-live,so existing meetings tests are unaffected).
Manual verification
N/A, unit coverage sufficient. Backend session-lifecycle logic exercised end to
end over the real aiohttp router with the fake session manager; no UI, socket, or
external service involved.
Related Issues
Fixes #5904
Pattern harvest
Rule candidate: review-prompt
Pattern: a liveness signal ("resource gone from the registry") used as a
single-owner-latch release condition, when the same observable state also arises
from a fully-recoverable cause (idle reclamation resumes on next use). Gate the
terminal action on a positive "reached the ready/committed state" marker so a
recoverable transient is never treated as terminal.
Checklist
Why no screenshot: backend session-lifecycle change only; no rendered UI delta.