Repository navigation
Conversation
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
bf30fa6 to
3dfed2d
Compare
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
6 similar comments
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
1 similar comment
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
bolichen97
left a comment
There was a problem hiding this comment.
Request changes: resolved_cwd imports a function that does not exist, so every dashboard agent switch returns 503
src/kiro_crew/config/paths.py:385-387 (audited head 3dfed2d):
from kiro_crew.config.loader import session_default_cwd
return str(session_default_cwd(session_key))This PR does not touch config/loader.py. At this head that file defines only _session_work_dir (src/kiro_crew/config/loader.py:536), and neither origin/main nor the merge base has session_default_cwd. The rename that adds it exists only in the open PRs #11722, #11813 and #11831. The description says the shared infrastructure is carried here "so this change compiles and tests on its own", but the loader rename was left out.
What breaks. api_chat_slot_agent (chat_handlers.py:6986, POST /api/chat/slots/{slot}/agent) gets past its early refusals on an ordinary local switch and always runs chat_handlers.py:7200:
cleared_arm_cwd = await state.sessions.resolve_arm_cwd(session_key, CWD_CLEARED)CWD_CLEARED is "" (paths.py:330), so resolve_arm_cwd (session.py:1745-1756) always goes to asyncio.to_thread(resolved_cwd, "", key). The deferred import then raises ImportError: cannot import name 'session_default_cwd' from 'kiro_crew.config.loader'. The except Exception at :7201 catches that and returns 503 workspace_unavailable. Every agent switch and every same-name reset fails this way, before anything is committed, so no user can switch a slot's agent. Reviewers reproduced it on the PR tree by calling resolved_cwd("", "dashboard:chat-1") directly and through a real SessionManager.resolve_arm_cwd.
Why the tests stay green. Every fixture that drives this handler replaces the resolver with an AsyncMock, so the real resolver never runs. The fixtures are test/chat_test_helpers.py:133, test/test_chat_slot_switch_atomicity.py:82, test/test_eager_spawn.py:754 and test/test_switch_handlers_sibling_alias_busy.py:85. mypy does catch it: paths.py:385: error: Module "kiro_crew.config.loader" has no attribute "session_default_cwd". No check has failed on this head yet, so nothing has surfaced this so far.
Also a mypy error. The diff re-adds set_lifecycle_turn_active and mark_lifecycle_lease at session.py:1758/:1772. Both already exist at :1714/:1728, so mypy reports no-redef.
Smallest fix.
- Either bring the
_session_work_dir->session_default_cwdrename intoconfig/loader.py, or import_session_work_dirhere. - Add one test that calls the real
SessionManager.resolve_arm_cwd(key, "")with no mock. - Remove the duplicate method definitions.
The branch also conflicts with main, so it needs a rebase anyway.
From a full open-PR audit against origin/main c66f95b (2026-09-25); findings were checked by independent reviewers reading the code. Reply here if this is wrong.
3dfed2d to
c898993
Compare
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
…shes The settle and its authorization gate now precede the binding commit, an unsettled key answers 409 and commits nothing, and the arm transfer follows with no await.
c898993 to
7be963c
Compare
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
1 similar comment
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
3 similar comments
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
Triage (open-PR audit against origin/main 5edf2fe, head 7be963c): OVERLAPPING. Needs a rebase and a merge discussion. Rebase. The branch point is cd783d2, 1254 commits behind main. Earlier review. The CHANGES_REQUESTED review on 3dfed2d raised two problems, and both look fixed at 7be963c:
The second point that review asked for, a test that calls the real Merge discussion. This PR's own change is the agent-switch reordering: settle and authorize before the commit triple, answer 409 on an unsettled arm, and make Minor. The comment block at No breaking change and no P0 found at this head, so this is a comment, not a change request. |
|
Thanks for this work, @rnoack1. Closing it because it no longer applies to current main (b42f19b).
If the arm design comes back on top of the current |
Problem / Motivation
The agent switch resolves which session key its change should land on behind an
await.A rebind arriving inside that window is parked rather than applied, so the key the resolve
observed never moves.
The handler published the binding triple before that was settled. The result is a slot
whose
slot.agentnames the newly selected agent while the arm still names the key the slothas already left.
mark_retire_on_next_claimdoes not retro-correct a turn already inflight, so a turn claiming the rebound key runs under an agent whose own switch can still
answer 409 and roll back underneath it.
Why it matters
The switch answers 200 and the UI shows the new agent, so nothing signals that the binding
was never armed on the key that will actually run. The failure surfaces a turn later, as an
agent running with the previous agent's arm, with nothing connecting it to the switch that
caused it.
Rolling back after the fact does not close the window: by then a concurrent send may already
have cold-started a replacement session on the new binding, and restoring the old agent would
advertise a binding nothing runs. Only ordering the settle and the authorization before the
commit removes the window.
What changed
The commit triple now follows the settle and the rebind authorization:
against the current binding.
_settle_arm_targetis the single place that resolves an arm target and reports whether itsettled, retracting the source arm when it does not. The workspace-root probe also moves
ahead of the commit, so an unavailable root answers 503 with nothing published to unwind —
unwinding there previously re-ran the same failed resolve and raised a 500.
Two consequences of that reordering are worth calling out for review:
_rollback_switchbecomesasync, and two call sites added since this branch point arenow awaited. A bare call there builds a coroutine nobody awaits, so the rollback would
silently never run.
committed_agentstarts at the module's uncommitted sentinel and those guards stand downinstead of unwinding a commit that has not happened.
The slot-allocation core, the arm verbs and the cleared-cwd marker are carried here
identically to their siblings (#11813, #11831, #11910, #11983, #12055) so this change
compiles and tests on its own.
Tests
Nine added cases across five new classes in
test/test_chat_slot_switch_atomicity.py:awaitbetween them;The no-await requirement is pinned twice over — once by inspecting the handler and once by a
structural scan of every commit site in the module. The scan is armed by its own synthesized
positive control, so it cannot pass vacuously on a module that happens to contain no commit
sites.
Break-armed, and the arms are each other's controls:
awaitbetween the commit and the arm fails both no-await cases, so theinspection check and the structural scan cross-validate rather than duplicate;
Four existing test fixtures gain the async stub the carried pre-commit probe requires.