Skip to content

fix: show a signed-out prompt on crew's own engine as a sign-in error - #36464

Closed
bolichen97 wants to merge 1 commit into
mainfrom
fix/36443-sign-in-required-frame
Closed

bolichen97 wants to merge 1 commit into
mainfrom
fix/36443-sign-in-required-frame

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

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

What changed (motivation → approach → change)

  • Symptom → cause. Engine 0.66.104 answers a signed-out session/prompt with {"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 and sign_in_needed / auth_required stayed False.
  • Approach. One exact-compare predicate on the structured field, acp/sign_in_required_errors.is_sign_in_required(data). It accepts data as a dict or as JSON text and never reads the message. It follows the shape of model_registry_errors.is_model_registry_unavailable, and it lives in a sibling module because transport_errors.py is near the file-line cap.
  • Change. _raise_acp_error uses the predicate at both sites. (1) In the formatter's sign-in arm (_is_session_expired(haystack) or is_sign_in_required(...)) it builds host_auth.signed_out_message(backend) + "Switching models will not help …". (2) In the sign_in_needed tag, auth_required then follows from ACP_BACKENDS_HOST_AUTH_CALLBACK as 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 pins transient is False.
  • Docs. Corrected the claims that the bundle's signed-out answer already mapped to a sign-in prompt: docs/system-specs/modules/kas-auth.md, docs/system-specs/modules/acp-client.md (bundle route paragraph + module table) and the build_kas_bundle_argv / KAS_AUTH_CALLBACK_ERROR_CODE docstrings in acp/kas_transport.py. Added the refusal to docs/system-specs/common/error-handling.md beside the model-list refusal.

Backwards compatibility

Compatible: a frame is only ever ADDED to the sign-in arm when its data.errorType is exactly SignInRequiredError; 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 capture test/fixtures/acp_frames/kas/sign-in-required-live.jsonl (+ its replay snapshot):

  • KAS: sign_in_needed and auth_required True, transient False, user_worded True, text is the KAS signed-out message + "Switching models will not help …", for data as a dict and as JSON text.
  • kiro-cli ("", no host-auth callback): sign_in_needed True, auth_required False, terminal, kiro-cli's own signed-out message (parity H6).
  • The name in message, the same message with no data, and the name in prose data match nothing.
  • A Bedrock credential exception in the same frame keeps its own remedy (_RE_AUTH stays 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.py passed 8/8 each time, and one shuffled -n0 run (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 on PATH, 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. One hello was sent from the dashboard in headless Chromium (Playwright). The frame was captured with KIROCREW_ACP_RECORD_FRAMES.

Before (main ff344c78e), saved row and dashboard:

{"role": "error", "content": "❌ Sign in to Kiro to send a prompt.", ..., "meta": {"mid": "m-96aeeb1677fd4c92"}}
PLACEHOLDER: Last turn was interrupted — press Resume, or just type
card: ❌ Sign in to Kiro to send a prompt.   [Resume]

After (this branch), same path:

{"role": "error", "content": "❌ KAS runs on Kiro Crew's own engine because kiro-cli is not installed. Not signed in to Kiro. Sign in from Settings → Agent Harness → Kiro Agent → Kiro sign-in, then send your message again. Switching models will not help — this is a sign-in issue, not a backend error.", ..., "meta": {"kind": "auth_required", "mid": "m-06d3ff812c754104"}}
PLACEHOLDER: Last turn needs a sign-in — follow the message above, then press Resume or send your message again
card: ❌ KAS runs on Kiro Crew's own engine … Not signed in to Kiro. Sign in from Settings → Agent Harness → Kiro Agent → Kiro sign-in … [Sign in to Kiro]

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 stay sign_in_needed=False auth_required=False with 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:

before: raw engine text, Resume only

After, light and dark: the signed-out message with the "Sign in to Kiro" action, and the sign-in hint in the message box:

after, light

after, dark

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_needed tag (: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 pins transient 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 no data.errorType to read.

Pattern harvest

Rule candidate: review-prompt
Pattern: an engine refusal that carries a structured data.errorType is 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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|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)
  • No secrets, credentials, or internal references in the diff

@KiroCrewCaptain

KiroCrewCaptain commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: Approve

Why: 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 141053795a · 322 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@bolichen97
bolichen97 enabled auto-merge (squash) November 13, 2026 07:20
@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Nov 13, 2026
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 141053795abee1a854ec86afa0a1f620b0a9741d and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 1410537

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 141053795abee1a854ec86afa0a1f620b0a9741d false-positive: <reason, 20 to 500 characters>

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
@bolichen97
bolichen97 force-pushed the fix/36443-sign-in-required-frame branch from a80d5b4 to 1410537 Compare November 13, 2026 18:10
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules/acp-client.md since this head was built (ff344c7 -> 2b01afa); the new base also carries the mypy fix (#36457) for the only red check here, which was in a file this PR does not touch. CI re-running.

[operator: bolichen97]

@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 141053795abee1a854ec86afa0a1f620b0a9741d touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 141053795abee1a854ec86afa0a1f620b0a9741d — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the fix reads the engine's structured data.errorType with an exact match, feeds it into the existing sign-in branch and tags, removes nothing, and the description carries screenshots of this revision.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 141053795abee1a854ec86afa0a1f620b0a9741d — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing to check.

What this change ships

Inventory (5 items) — 5 justified

Intent: 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.

  1. A signed-out turn on the bundled engine shows the signed-out message and the "Sign in to Kiro" card instead of the engine's raw text. — justified
  2. That turn's saved error row is tagged auth_required, so the message box shows the sign-in hint instead of "press Resume". — justified
  3. The same frame on a harness without the host sign-in callback gets sign_in_needed and that harness's own signed-out wording, with no Kiro card. — justified
  4. New predicate module acp/sign_in_required_errors.py, which compares data.errorType exactly. — justified
  5. Corrected spec and docstring claims in kas-auth.md, acp-client.md, error-handling.md and kas_transport.py, plus the live frame fixture and its replay snapshot. — justified

[FIRST-PRINCIPLES-REVIEWED] 1410537

Description read

[DESCRIPTION-READ] 1c3d1731017cc4b6ea24fc7cd23b945fbf4d51fd69c85f2bf2c847a829ce254c

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 141053795abee1a854ec86afa0a1f620b0a9741d — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 1410537

Verdict parsed from the review's SHA-scoped output markers for commit 141053795abee1a854ec86afa0a1f620b0a9741d.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 141053795abee1a854ec86afa0a1f620b0a9741d false-positive: <reason, 20 to 500 characters>

@buluoray

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 16, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] Closing this as superseded by #38803, which merged into main as a228ee3 and maps the engine's SignInRequiredError refusal to the sign-in error. On main, the frame recorded for this PR (engine 0.66.104 on the bundled route, no Kiro sign-in) now shows "Not signed in to Kiro. Sign in from Settings → Kiro account, then send your message again." The row is tagged for the Kiro sign-in card and the turn is not retried. That is this PR's goal, and main pins it in test_kas_sign_in_required_frame_is_tagged_for_the_sign_in_card.

Thanks for the review and the rebase request. Rebasing this branch conflicts with main in docs/system-specs/modules/acp-client.md, and main has also changed transport_errors.py. Once rebased, all this PR would add is a second check for the same frame next to main's, plus tests and spec text repeating what main already covers. So there is no rebased head to push.

The fix is on main only for now: the 0.13.0 release branch does not include a228ee3 yet.

@bolichen97 bolichen97 closed this Nov 18, 2026
auto-merge was automatically disabled November 18, 2026 23:29

Pull request was closed

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Nov 18, 2026
@bolichen97
bolichen97 deleted the fix/36443-sign-in-required-frame branch November 20, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge conflict Branch has merge conflicts with its base — author must resolve before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A signed-out prompt on Kiro Crew's own engine is not shown as a sign-in error

3 participants