Skip to content

fix(test): enumerate _switch_target_busy as the slot busy reader - #12716

Closed
dimwael wants to merge 1 commit into
kirodotdev:mainfrom
dimwael:fix/slot-reader-enumeration-switch-target-busy
Closed

dimwael wants to merge 1 commit into
kirodotdev:mainfrom
dimwael:fix/slot-reader-enumeration-switch-target-busy

Conversation

@dimwael

@dimwael dimwael commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Problem / Motivation

test/test_pending_boundary_consumer_semantics.py::test_running_and_turn_running_slot_readers_are_enumerated fails on pristine current main, reddening Backend Tests shard 4 (3.12 and Windows) and the downstream Coverage Gate on every PR whose merge ref includes the current main tip.

Why it matters

Every open PR against main is blocked: shard 4 + Coverage Gate are red repo-wide until the census is updated (e.g. #12708 is currently wearing exactly this red).

What changed (motivation → approach → change)

Symptom: the enumeration census (an AST scan of src/kiro_crew/dashboard for direct slot.running / turn_running reads) disagrees with its expected table. Root cause: commit af0f186 (#11425) hoisted the switch handlers' busy refusal into a new _switch_target_busy helper, so the slot.running read the census used to attribute to the four switch handlers — api_chat_slot_agent, api_chat_slot_model, api_chat_slot_reasoning_effort, api_chat_slot_workspace — is now attributed to the helper. The census test itself landed via #11454 from a base cut before #11425 merged, so its last CI verdict never saw the refactor (per @pepmach's attribution on the issue: a stale merge ref, not a refactor that skipped a test). Change: in the expected reservation set, drop those four switch-handler entries and add ("chat_handlers.py", "_switch_target_busy").

Verified against the code, not just the assertion diff (an AST probe over chat_handlers.py): the four dropped handlers call _switch_target_busy and retain no direct slot.running read; api_chat_slots_model (bulk model) keeps its entry because it still reads slot.running directly alongside its helper call; api_chat_slot_detail / continue / interrupt never routed through the helper and keep their entries. Note the issue body names detail/continue/interrupt among the four to remove — that reading came from pytest's unordered set-diff display; the shard-4 log delta and the code agree on agent/model/reasoning_effort/workspace.

Backwards compatibility

Compatible: test-only change to an expected table; no runtime code touched.

Tests

The fixed test is the test: test_running_and_turn_running_slot_readers_are_enumerated now locks in _switch_target_busy as the single census-visible busy reader for the four switch handlers. Full file (9 tests) run locally on a 3.12 venv: failed before the change with exactly the reported delta, all green after.

Manual verification

N/A — unit coverage sufficient: the failing census test is deterministic (pure AST scan of the source tree).

Related Issues

Fixes #12713

Pattern harvest

Rule candidate: review-prompt
Pattern: a refactor that moves a state read into a helper must update the reader-enumeration census in the same commit — and a PR whose merge-ref CI predates a just-merged census/refactor pair can land already-broken; anyone touching slot.running/turn_running reads should re-run the census test on fresh main before merge.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable) — N/A, test-only
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

@dimwael
dimwael requested review from a team and bolichen97 September 22, 2026 05:25
@github-actions github-actions Bot added the fork Pull request from a fork (external contributor) label Sep 22, 2026
@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Sep 22, 2026
Commit af0f186 (kirodotdev#11425) hoisted the switch handlers' busy refusal
into _switch_target_busy, so the enumeration census now attributes the
slot.running read to the helper instead of the four switch handlers
that call it (agent, model, reasoning effort, workspace). Update the
expected reservation set to match: drop those four entries and add the
helper. api_chat_slots_model keeps its entry -- it still reads
slot.running directly alongside the helper call -- and detail,
continue, and interrupt never routed through the helper.

Fixes kirodotdev#12713
@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — ✅ no blocking findings

Reviewed 7de2b9d01e71f86c529c0f045a975fe3cba6a1bb via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 7de2b9d

@bolichen97

Copy link
Copy Markdown
Contributor

Thanks for the quick fix. #12713 is now closed by #12718 (merged as 194f6d5), which keeps the four switch handlers enumerated by crediting callers of _switch_target_busy the same way the test already credits _destructive_history_busy. This PR removed those handlers from the table, which would let a new handler wired through the helper go unenumerated. Closing as superseded.

@bolichen97 bolichen97 closed this Sep 22, 2026
@github-actions github-actions Bot removed the readiness: checking Automated validation is still running label Sep 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Opus 4.8 Review (fork) — ✅ no blocking findings

Reviewed 7de2b9d01e71f86c529c0f045a975fe3cba6a1bb via the fork AI-review pipeline; updated in place on each push.

Review details

The source is already refactored: the four switch handlers (api_chat_slot_agent, api_chat_slot_model, api_chat_slot_reasoning_effort, api_chat_slot_workspace) no longer read slot.running directly — they delegate to _switch_target_busy (line 7128, 8249, 9249, 9670), which reads slot.running at 6952. The test's expected census must track that: dropping the four handlers and adding _switch_target_busy as a reservation reader exactly matches what the AST walk now derives. _switch_target_busy reads only slot.running (other.running at 6964 uses alias other, outside the counted {"slot","removed"} set), so reservation is the correct classification. The busy guard is preserved, only re-attributed. This is a correct test-only expectation fix; no shipped behavior changes.

No findings.

[OPUS-REVIEWED] 7de2b9d

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — ✅ PASS

Design-level review of 7de2b9d01e71f86c529c0f045a975fe3cba6a1bb via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Verify shard 4 goes green on a fresh-main merge ref; the author's validation was a local 3.12 run, not the red CI lane itself.

[DESIGN-REVIEWED] 7de2b9d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

main: slot-reader enumeration test not updated by the _switch_target_busy refactor (af0f18678) — Backend shard 4 red on every merge ref

2 participants