Repository navigation
fix(kas): name the failing runtime's route in its sign-in prompt - #39128
bolichen97 merged 1 commit into
Conversation
|
@bolichen97 could you review this PR when you have a moment? It fixes #39077: the KAS sign-in prompt and its row now follow the failing runtime's own route instead of the last spawn in the process. Maintainer approval is also needed to run the fork workflows. Thanks! |
|
@JalaluddinYazdani I approved the held CI runs on ca8d677 and read the change. Carrying the route on the runtime ( Fast Gate fails on the comment-history check, which flags issue numbers in added comments:
Dropping the number and keeping the sentence passes. The AI review lanes start once Fast Gate is green, and I'll approve after they report. Optional: AI-assisted, sent by Bolin Review bot |
ca8d677 to
c73dc83
Compare
|
@bolichen97 thanks for approving the runs and reading the change.
Still one commit. Since the last head: black, flake8 and the flake-pattern ratchet are clean, and the 5 touched test files pass (385). |
|
@JalaluddinYazdani thanks for c73dc83; the comment and REASON_* test changes look good. Fast Gate now fails on the harness gate: AI-assisted, sent by Bolin Review bot |
c73dc83 to
e9f537f
Compare
|
@bolichen97 thanks. Fixed in e9f537f:
Still one commit. Comment-history, harness parity, black and flake8 are clean. 567 tests across the 8 touched or related test files pass, and the 30 new or extended cases fail with |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
|
@JalaluddinYazdani e9f537f has one real red, Backend Tests (3.12, 1): AI-assisted, sent by Bolin Review bot |
A KAS sign-in prompt was led by the route of the last KAS spawn in the whole process (kas_route._LAST_SPAWN_ROUTE), and the translated row's route token re-read that slot at render time. When a second chat spawned on another route between one chat's spawn and its error, the refused chat named the other chat's engine (the Kiro sign-in card instead of kiro-cli login, or the reverse), or lost its token. KasHarness now records the route its own spawn took (spawn_route), the runtime exposes it (AcpRuntime.kas_spawn_route), and the five failure sites that hold the runtime pass it to host_auth.signed_out_message. kas_signed_out_route reads the route from the sentence itself. Callers with no runtime in hand keep the process-wide reading, as do the warm-pool extract check and the engine card, which describe the next or latest spawn on purpose. Closes kirodotdev#39077
e9f537f to
c816792
Compare
|
@bolichen97 thanks. New head c816792, still one commit, rebased onto main
Comment-history (against main), harness parity, black, flake8 and isort are clean. The fork runs for the new head need your approval. |
UX Review (Opus 5.5, fork) — ⏭️ skippedRevision |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS The fix reads the failing runtime's own route, so another chat's spawn can no longer pick the wrong sign-in prompt. Nothing blocks. Notes
[DESIGN-REVIEWED] c816792 Description read[DESCRIPTION-READ] a3dc8590a82e1b46c88e166ca39db680e899988f12930c6b7f06ac1218e58e45 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) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The fix targets the cause: each runtime's own route goes into the sentence and is read back from it. One unfixed sibling remains, listed in the note. Notes
What this change shipsInventory (6 items) — 5 justifiedIntent: a signed-out chat on KAS is shown the sign-in prompt for its own engine's route, not the route of whichever chat spawned last. FIX (#39077).
[FIRST-PRINCIPLES-REVIEWED] c816792 Description read[DESCRIPTION-READ] c95e4a15b7165b49c637cf56122b16761b3403375cf156c9bcf54381032b5ea0 That sha256 names the PR description this verdict read. Recompute it with |
|
@JalaluddinYazdani sorry for the slow reply. The binding-test fix on AI-assisted, sent by Bolin Review bot |
bolichen97
left a comment
There was a problem hiding this comment.
Approving c816792f5c. The binding-test fix lists kas_spawn_route under the instance fields runtime_session_load reads, which is what test_runtime_bindings.py asked for, and the sign-in prompt now names the failing runtime's route. Every CI job is green and both AI lanes passed on this head; the two red "Publish readiness signal" runs predate the lanes and the readiness check is being refreshed.
AI-assisted, sent by Bolin Review bot
Problem / Motivation
Goal: A chat whose KAS engine is refused for sign-in gets the sign-in prompt for its own engine's route, not the route of whichever chat spawned last.
The KAS signed-out prompt was built from
kas_route._LAST_SPAWN_ROUTE, the route of the last KAS spawn in the whole process. That covers the message text (host_auth._with_kas_route), the row's translated token (host_auth.kas_signed_out_route) and, since #36888, the row kind (recovery._relay_takes_crew_sign_in→kas_bundle.last_relay_takes_crew_sign_in). When a second chat spawns its engine on another route between the failing chat's spawn and its error, the refused chat shows the other chat's sign-in row: kiro-cli's commands instead of Kiro Crew's Sign in, or the reverse (#39077).Why it matters
The sign-in row is the only thing that tells a signed-out user what to do. A wrong row sends them to a sign-in that does not start their engine:
kiro-cli loginfor a chat on Crew's own engine, or Crew's Sign in for a relay pinned to kiro-cli's launcher. It hits gateways with chats on more than one route, which the relay-to-bundle fallback and the runtime sharing preview make common. It is timing-dependent, so it shows up as "sometimes the wrong prompt".Not a goal
kas_extract_repair._spawns_kas_relay) and the engine card (kas_bundle.last_kas_route,GET /api/kas-bundle).transport_errors's frame formatter, doctor, the CLI). They keep the last-spawn reading.What changed (motivation → approach → change)
Symptom: wrong sign-in row under concurrent spawns. Cause: the route is read from one process-wide slot at message time and at render time, instead of from the runtime that failed. Change: carry the failing runtime's route into the sentence, and read it back from the sentence.
acp/harness/kas.py:KasHarness.spawn_routeis set next to eachnote_spawn_routecall, on both the relay and the bundle arm. The harness is per runtime (harness_forbuilds a fresh instance).acp/runtime_class.py:AcpRuntime.kas_spawn_routereads the cached harness'sspawn_route. It isNonebefore a spawn and on other harnesses, and it never resolves a harness.agent_sdk/host_auth.py:signed_out_message(..., *, route=<unset>). A passed route (includingNone) is used as-is; unset keeps the process-wide reading. The newkas_sentence_route(text)returns the route whose sentence leadstext(every route a spawn records, launcher forms included),Nonefor the bare sentence, orNOT_A_KAS_SENTENCE.kas_signed_out_routeis built on it.acp/session_provider.py(stream connection failure,_translate_dead)providers/acp_runtime_start.py(three start and create-session arms) andacp/runtime_session_load.py(a governance read refused because Crew's sign-in is dead) pass the runtime'skas_spawn_route.agent_sdk/kas_bundle.py:relay_takes_crew_sign_in(route)is split out oflast_relay_takes_crew_sign_in, which now calls it.dashboard/chat_turn/recovery.py:_relay_takes_crew_sign_in(text)uses the sentence's route. Text that is not a KAS signed-out sentence keeps the last-spawn reading, so other backends' rows are unchanged.docs/system-specs/modules/kas-auth.mdandacp-client.mdsay which reading applies where.Analysis on the issue: #39077 (comment)
Backwards compatibility
Compatible:
signed_out_message's new parameter is keyword-only with a default that keeps today's behavior.last_relay_takes_crew_sign_inandkas_signed_out_routekeep their signatures and their answers for every input they could see before, except a route-led sentence read while the slot points elsewhere, which is the bug.Removes nothing: no key, function, row kind or record is removed or renamed; one public helper (
kas_bundle.relay_takes_crew_sign_in) is added.Tests
Proof: not provable -- prove.py timed out
Manual revert check instead: with
src/checked out at main (60a1064) and the tests at head (c816792), the 30 new or extended test cases listed below fail (30 failed); on head they pass (30 passed). Most of the main-side failures are the missingroute=keyword. The two harness tests fail on behavior:KasHarnessrecords nospawn_routeandAcpRuntimehas nokas_spawn_route.test/test_kas_route.py::TestHarnessRoute::test_a_runtime_keeps_its_own_route_after_another_chat_spawns: the harness andAcpRuntime.kas_spawn_routekeep the bundle route after another spawn moves the slot to the relay;Nonebefore a spawn.test/test_kas_route.py::TestHarnessRoute::test_an_operator_launcher_names_kiro_cli_login(extended): the relay arm records its route.test/test_agent_sdk_host_auth.py::test_a_kas_message_for_a_runtime_names_that_runtimes_route: a passed route wins over the slot in both directions (bundle vs launcher);Nonegives the bare sentence; unset keeps the slot; another harness ignores the route.test/test_agent_sdk_host_auth.py::test_every_route_reason_reads_back_from_its_own_sentence: everyREASON_*constant inkas_routereads back throughkas_sentence_routeas the route that wrote it, so a reason added later and missed in its list fails here instead of quietly keeping the English.test/test_transient_notice_parity.py::test_the_row_follows_the_route_its_sentence_was_written_for: row kind and token follow the sentence for 6 written routes × 4 moved slots (24 cases).test/test_acp_session_provider.py::TestAcpSessionProviderRuntimeDeadTranslation::test_a_kas_sign_in_prompt_names_this_runtimes_route: a dead KAS runtime'sAcpAuthRequirednames its own route while the slot says launcher.test/test_kas_token_refresh_recovery.py::TestAFailClosedStart::test_a_refused_sign_in_names_this_runtimes_route: a start whose governance read Kiro refused for a dead Crew sign-in names the runtime's own route.All 85 test files that reference the touched names: 4881 passed, 7 skipped (
pytest -n0, macOS). black and flake8 are clean on every changed file.scripts/local-gate.pywas not run to completion: its related set forhost_authis most of the backend suite, and on this host it would take hours with one worker.Manual verification
N/A — unit coverage sufficient: the race is between two spawns and one error render in one process. The tests reproduce it deterministically by moving the process-wide slot between writing the sentence and building the row.
Real-machine verification
N/A -- the defect is in-process message and row selection, reproduced deterministically by the unit tests above; no host-specific path is involved.
Related Issues
Closes #39077
Sibling sweep
Swept:
git grep -n "last_spawn_route\|_LAST_SPAWN_ROUTE\|last_relay_takes_crew_sign_in" -- src/Sibling: src/kiro_crew/agent_sdk/host_auth.py -- changed here
Sibling: src/kiro_crew/dashboard/chat_turn/recovery.py -- changed here
Sibling: src/kiro_crew/acp/kas_extract_repair.py -- not affected -- predicts the next spawn of a pool, which the last spawn describes
Sibling: src/kiro_crew/agent_sdk/kas_bundle.py -- not affected -- last_kas_route feeds the engine card, a process-wide diagnostic
Pattern harvest
Rule candidate: review-prompt
Pattern: a per-session message built from a process-global "last X" slot set by every session
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.