Repository navigation
fix: show a signed-out prompt on crew's own engine as a sign-in error - #36464
bolichen97 wants to merge 1 commit into
Conversation
Code change approver recommendation: ApproveWhy: the decider estimates a 10% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes. This PR makes the bundled engine's structured SignInRequiredError show as a sign-in error. The new check exact-matches data.errorType and never reads the message text. It is wired into both the wording branch and the sign_in_needed tag in transport_errors.py. The usage-limit, throttle, credential-propagation and Bedrock (_RE_AUTH) checks still run first, and auth_required stays limited to ACP_BACKENDS_HOST_AUTH_CALLBACK (harness parity H6). The tests use the live captured frame and would fail without the change. They cover the bundled engine (auth_required, signed-out text, non-retryable), kiro-cli (sign_in_needed without the card), three look-alike frames that must not match, and the Bedrock-first ordering. The new fixture has the required header fields, a snapshot matching the replay harness output, no host-data markers, and an engine version at the bundle pin (0.66.104). The widening is additive, and no other code or test depends on the old raw-text behaviour. Backend test shards were still pending at review time, so a green run is not confirmed. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
The bundled KAS engine (0.66.104) answers a signed-out session/prompt with -32000 "Sign in to Kiro to send a prompt." and data.errorType "SignInRequiredError". The frame has no 401/403 and none of the expiry or "not signed in" wording the older engine sent, so _raise_acp_error neither worded it as a sign-in error nor set sign_in_needed / auth_required. The chat showed the engine's raw text, the row had no kind, and the composer kept the plain Resume hint. Add sign_in_required_errors.is_sign_in_required, an exact compare on the structured data.errorType (dict or JSON text, message never read), and use it in both the formatter's sign-in arm and the sign_in_needed tag, behind the Bedrock-credential and usage-limit branches as before. auth_required still follows ACP_BACKENDS_HOST_AUTH_CALLBACK, and the verdict stays terminal. The captured frame is a KAS replay fixture. Correct the spec and docstring claims that the bundle's signed-out answer already mapped to a sign-in prompt. Closes #36443 Part of #32065
a80d5b4 to
1410537
Compare
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the fix reads the engine's structured [DESIGN-REVIEWED] 1410537 Description read[DESCRIPTION-READ] 7eb339739bbe8087ed524198ace2e19e70a31ef1ed2fc019e49a4cd60b96e530 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) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing to check. What this change shipsInventory (5 items) — 5 justifiedIntent: when a new user with no kiro-cli and no Kiro sign-in sends a chat on crew's bundled engine, they are told to sign in and offered the sign-in action, not a Resume that hits the same refusal. FIX.
[FIRST-PRINCIPLES-REVIEWED] 1410537 Description read[DESCRIPTION-READ] 1c3d1731017cc4b6ea24fc7cd23b945fbf4d51fd69c85f2bf2c847a829ce254c That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
|
Review passed on this head. Please rebase onto the latest main so CI can run fresh; this head is 574 commits behind main, and its red checks (Coverage Gate and Dependency License Gate) come from the 11-13 run. The approval will follow once the rebased head is green. |
|
[operator: bolichen97] Closing this as superseded by #38803, which merged into main as a228ee3 and maps the engine's Thanks for the review and the rebase request. Rebasing this branch conflicts with main in The fix is on main only for now: the 0.13.0 release branch does not include a228ee3 yet. |
Pull request was closed
Problem / Motivation
Goal: A chat turn refused because nobody is signed in to Kiro, on Kiro Crew's own bundled engine, shows as a sign-in error with the Kiro sign-in action, not as the engine's raw text.
With kiro-cli not installed and no Kiro sign-in, a chat message fails with "❌ Sign in to Kiro to send a prompt." The saved error row has no
kind, the card offers only Resume, and the message box keeps "Last turn was interrupted — press Resume, or just type". The sign-in hint from #35036 never shows, and the sidebar row cannot name the sign-in (#32065).Why it matters
This is the first thing a new user without kiro-cli sees: the bundled engine is the default route when kiro-cli is absent, and the chat offers a Resume that hits the same wall instead of the sign-in that fixes it. It came with the engine pin bump: 0.12.2 pinned engine 0.66.33, and on that release users on this route saw the sign-in message and its sign-in tag (#36381); no frame from 0.66.33 was captured.
Not a goal
data.errorTypeis read.What changed (motivation → approach → change)
session/promptwith{"code": -32000, "message": "Sign in to Kiro to send a prompt.", "data": {"errorType": "SignInRequiredError", "retryErrorType": "CLIENT_ERROR"}}._raise_acp_error(acp/transport_errors.py) recognises a sign-in failure only from a 401/403 or expiry / "not signed in" wording (_is_session_expired). This frame has neither, so the formatter fell through to the raw message andsign_in_needed/auth_requiredstayed False.acp/sign_in_required_errors.is_sign_in_required(data). It acceptsdataas a dict or as JSON text and never reads the message. It follows the shape ofmodel_registry_errors.is_model_registry_unavailable, and it lives in a sibling module becausetransport_errors.pyis near the file-line cap._raise_acp_erroruses the predicate at both sites. (1) In the formatter's sign-in arm (_is_session_expired(haystack) or is_sign_in_required(...)) it buildshost_auth.signed_out_message(backend)+ "Switching models will not help …". (2) In thesign_in_neededtag,auth_requiredthen follows fromACP_BACKENDS_HOST_AUTH_CALLBACKas before (positive harness identity, parity H6). The Bedrock-credential (_RE_AUTH) and usage-limit branches stay ahead of it at both sites. The retry verdict needed no change: the frame already reaches_is_transient_raw_error's terminal fall-through, and the test pinstransient is False.docs/system-specs/modules/kas-auth.md,docs/system-specs/modules/acp-client.md(bundle route paragraph + module table) and thebuild_kas_bundle_argv/KAS_AUTH_CALLBACK_ERROR_CODEdocstrings inacp/kas_transport.py. Added the refusal todocs/system-specs/common/error-handling.mdbeside the model-list refusal.Backwards compatibility
Compatible: a frame is only ever ADDED to the sign-in arm when its
data.errorTypeis exactlySignInRequiredError; every frame the arm matched before still matches, and no field, key or verdict is renamed or removed.Removes nothing: the change widens which frames get the existing sign-in wording and tags; it hides, deletes, tightens or migrates nothing.
Tests
test/test_acp_sign_in_required_error.py, driven by the live capturetest/fixtures/acp_frames/kas/sign-in-required-live.jsonl(+ its replay snapshot):sign_in_neededandauth_requiredTrue,transientFalse,user_wordedTrue, text is the KAS signed-out message + "Switching models will not help …", fordataas a dict and as JSON text."", no host-auth callback):sign_in_neededTrue,auth_requiredFalse, terminal, kiro-cli's own signed-out message (parity H6).message, the same message with nodata, and the name in prosedatamatch nothing._RE_AUTHstays first).Determinism: 3 runs of
pytest -n 4 --dist loadgroup --max-worker-restart=2 -p no:cacheprovider -q test/test_acp_sign_in_required_error.pypassed 8/8 each time, and one shuffled-n0run (seed 4999) passed all 8.Proof: PROVEN test/test_acp_sign_in_required_error.py::test_kas_tags_it_auth_required_with_the_signed_out_message[data-dict], test/test_acp_sign_in_required_error.py::test_kas_tags_it_auth_required_with_the_signed_out_message[data-json-text], test/test_acp_sign_in_required_error.py::test_a_harness_without_the_host_sign_in_gets_no_kiro_card[data-dict], test/test_acp_sign_in_required_error.py::test_a_harness_without_the_host_sign_in_gets_no_kiro_card[data-json-text] (head 61cac53dc41f)
Manual verification
How it was verified, on Ubuntu 24.04 (Linux x86_64): a real isolated gateway, a fresh
KIROCREW_HOME=$(mktemp -d), kiro-cli not onPATH, an empty vault, and bundled KAS 0.66.104. The gateway ran on a free 127.0.0.1 port and was stopped by its own PID. Onehellowas sent from the dashboard in headless Chromium (Playwright). The frame was captured withKIROCREW_ACP_RECORD_FRAMES.Before (main
ff344c78e), saved row and dashboard:After (this branch), same path:
Nearby happy path: every other error frame in the KAS replay corpus, plus a model-list refusal and a 5xx, run through
_raise_acp_error(..., backend="kas"). All of them staysign_in_needed=False auth_required=Falsewith unchanged wording and verdicts. A non-sign-in error could not be produced on the live path on this host, which has no Kiro account to sign in with.Screenshots / video
Before, the raw engine text and the plain Resume hint:
After, light and dark: the signed-out message with the "Sign in to Kiro" action, and the sign-in hint in the message box:
Related Issues
Closes #36443
Part of #32065
Related: #36381 (the "A chat stopped" notice wording for a missing sign-in; not changed here).
Sibling sweep
Swept: git grep -n "_is_session_expired(" -- src
Sibling: src/kiro_crew/acp/transport_errors.py:1615 -- changed here
Both sites are in that file: the formatter's sign-in arm (:1615) and the
sign_in_neededtag (:1959).The other readers of the same vocabulary, all in that file, are not affected:
_is_transient_raw_error(:1256) already answers terminal for this frame through its unknown fall-through; the new test pinstransient is False.classify_provider_error(:1338) reads text only and already answers terminal (unknown). The sign-in tags its readers use come from_raise_acp_error.is_auth_failure_output(:760) reads process output that is not a JSON-RPC frame, so there is nodata.errorTypeto read.Pattern harvest
Rule candidate: review-prompt
Pattern: an engine refusal that carries a structured
data.errorTypeis classified from that field with an exact compare, not by adding its message wording to a prose regex. An engine bump that rewords the message then cannot silently drop the classification.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)