Skip to content

fix(mcp): say in chat when a kas server waits for a sign-in - #36135

Merged
buluoray merged 1 commit into
mainfrom
crew/slack/kas-mcp-sign-in-again-notice
Nov 14, 2026
Merged

buluoray merged 1 commit into
mainfrom
crew/slack/kas-mcp-sign-in-again-notice

Conversation

@buluoray

@buluoray buluoray commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: On the KAS backend, a chat says once when one of the user's MCP servers is waiting for a sign-in, and a remote server whose saved OAuth sign-in stopped working can be signed in to again from the chat.

Two users reported the same thing on Slack on 2026-11-12, on 0.12.2.x with the KAS backend: a remote MCP server that signs in with OAuth worked after the first sign-in, and about 18 to 20 hours later every new chat started without its tools. No sign-in card appeared, and the only way back was to remove the server and add it again, or to remove the whole saved sign-in store while the gateway was stopped.

Two things are missing on main:

  1. A chat never says a server is waiting for a sign-in. On KAS the sign-in is offered only when the user's message names the server, so a user who does not know that sees missing tools and nothing else (KAS: remote MCP sign-in needs the exact server name, and its consent link arrives after the turn ends #34492, problem 1).
  2. When the OAuth server refuses to renew the saved sign-in, naming the server does nothing either. The engine deletes the saved tokens, and reports failedAuthorization, only for invalid_grant, invalid_client and unauthorized_client. For any other refusal it keeps the tokens and reports the server failed, and only a failedAuthorization entry is tracked for a sign-in.

Why it matters

A user on the default backend loses a remote MCP server about once a day and cannot tell why or what to do. This is a Slack-reported KAS bug for 0.13.

Not a goal

What changed (motivation → approach → change)

What the engine reports. I ran a KAS 3.2.1 engine against a local OAuth MCP server and made its token endpoint answer a refresh in five ways:

Token endpoint answers the refresh with Engine reports Saved tokens
400 invalid_grant failed, failedAuthorization: true deleted
401, no OAuth error failed, Sign-in for <name> could not be refreshed (token endpoint answered 401). … kept
401 invalid_token failed, invalid_token kept
403 unknown_error failed, unknown_error kept
500 server_error failed, … (token endpoint answered 500 server_error). … kept

Fix 1: track a refused saved sign-in. acp/mcp_reattempt.is_refused_sign_in reads rows 2 to 4: the "could not be refreshed" text with a 4xx and nothing after the status, or a message that is one bare OAuth error code. The session's sign-in tracker (session_handle_mcp._note_mcp_sign_in_status) and the session MCP report (through its one status reader, mcp_report_bound.read_status_snapshot) treat such an entry like failedAuthorization: the server is listed as waiting for a sign-in, and a message naming it starts the existing KAS sign-in. Row 5, temporarily_unavailable and an unreachable token endpoint are left as failures, because a later attempt may succeed with the same tokens and a sign-in reset deletes them.

Fix 2: say it once in the chat. When the session MCP report is published with a server waiting for a sign-in that has no open sign-in card in the chat, the dashboard adds one notice row (_notice_mcp_sign_in_needed in src/kiro_crew/dashboard/chat_turn/mcp_session.py). It names up to five servers and the message that signs in from the chat; when it names several, it says each one needs its own sign-in. It is shown once per chat (a flag on the chat slot, in memory, so a gateway restart shows it once more). The chat page draws the row as a notice card (McpSignInNeededNotice), and a long server name wraps inside the card; other surfaces show the row's text. A kiro-cli chat already has the engine's own sign-in card for the server, so it gets no row. The notice names only the chat way in, because a page sign-in does not always reach a KAS chat.

The MCP Servers row. The MCP Servers page probes without a token, so a server whose saved sign-in stopped working reads there like a working one: Signed in, no tools listed. For a server the owner added from the page, that row already offers Sign in again, which #35396 made replace the dead tokens; a test now pins it against the probe's real output shape. For a server added any other way the gateway refuses to start a sign-in, and the row showed nothing. It now says in words how to sign in: send a chat message that names the server, or add it with Add Custom to sign in from the page (website/src/pages/overview/McpTab.tsx, one new string in website/src/i18n/locales/en.manual.json and the 11 translated catalogs).

The KAS sign-in section of docs/system-specs/modules/acp-client.md and the MCP Servers row section of docs/system-specs/modules/connections.md describe these.

Overlap with #35802. That PR edits the same branch of _note_mcp_sign_in_status, and the report's status branch that main has since moved into read_status_snapshot, for a different entry: a failed server with no saved sign-in, decided by a tokenless probe. It leaves a server with a saved sign-in alone; this PR is that other half. The two conditions do not contradict each other. Whichever merges second rebases those hunks.

Backwards compatibility

Compatible: a failed KAS entry whose error is one of the two refused-sign-in shapes moves from "failed" to "waiting for a sign-in" in the session report, and a chat gains at most one notice row. Every other entry reads as before.

Removes nothing: the diff adds a condition to two branches, one notice row and one chat-page renderer.

Tests

  • test/test_kas_mcp_refused_sign_in.py: the texts the engine reported read as refused or not; a refused entry is tracked, starts nothing by itself, and starts one sign-in when the message names the server; a 5xx, an unreachable endpoint and a bad command are not tracked; a server that connects again leaves the tracker; the session report lists a refused entry under awaiting_auth and a curable one under failed.
  • test/test_mcp_sign_in_needed_notice.py: one row, once per chat, with the servers in its meta; a long list is capped and counted; a server with an open sign-in card is left to that card; a finished card does not count; nothing waiting shows nothing; a row that cannot be built does not raise; publishing a report with a refused entry shows the row.
  • website/src/pages/chat/McpSignInNeededNotice.test.tsx: the card shows the row text with no page link, a 128-character server name carries no class that stops it wrapping, and the chat page picks it for this row ahead of the plain notice.
  • website/src/test/McpTab.refusedSignIn.test.tsx: with the probe's output for a server that holds a saved sign-in, a server added from the page offers Sign in again; a server added any other way shows the new sentence and no button; a server whose tools the page lists shows neither.
  • test/test_state_parts_facade.py, website/src/test/chatRolesParity.contract.test.ts, website/src/test/CrewChatWindow.test.tsx: the three inventories list the new slot flag and the new row.

Proof: not provable -- other: re-run on ead7f0cc276b: prove.py reverts every production hunk at once, which removes the new function the tests import, so its run errors at collection (INCONCLUSIVE); --per-hunk ends with an environment error (pytest wrote no report for one mutated run).

By hand, seven mutations of the new production lines, one at a time, each turned a new test red: the tracker condition, the report condition, the passing-error exemption, the 4xx anchor, the once-per-chat flag, the open-card filter, and the open-link check on a card. The dead-child read gate on a card is pinned by test_a_card_whose_child_is_gone_does_not_count[c2] and [""], which were red on 895fcbaacb94 before the gate was added.

Determinism: the new tests use no clock, sleep, port or network.

Manual verification

  • Real engine, local server (table above): kiro-cli acp --agent-engine v3, engine 3.2.1, against an OAuth MCP server on loopback with made-up tokens. No real OAuth client or account.
  • Pod (isolated gateway on this branch, KAS backend): added that local server with Add Custom, sent one message that does not name it in a new chat. The notice row appeared before the reply. (That run predates the removal of the page link from the notice.)
  • Not verified in the pod: fix 1 end to end. Crew's consent-link check refuses a plain-http link with a port, so the local server cannot complete a sign-in through the dashboard, and the pod never held a saved sign-in to refuse. Fix 1 rests on the engine run, the unit tests and the mutations.
  • Not verified: what the engine reports when a refusal also carries an error_description. The spec names this limit.
  • The MCP Servers row was checked in a component test with the probe's output shape, not in the pod. The probe counts a server's sign-in challenge only when its metadata link is https, so the pod's plain-http local server reads "Not verified" there and cannot reach the row state this PR is about.
  • builder-security checked: the change adds no listener, route or handler. It reads status frames the engine already sends and writes one transcript row. The row holds server names (redacted like every engine string shown in chat), no URL and no token. Nothing logs a token or a link. No sign-in starts without the user's own message or click on the MCP Servers page.

Screenshots / video

Component render, not the live page. The shots below are the real McpSignInNeededNotice (through the transcript renderer) and the real McpTab, drawn from fabricated rows by a local capture entry in website/capture/ (not part of this PR) on head 6d22b48881d1. No gateway ran.

The notice for one server, two servers, and five servers plus two more:

Three notice rows naming the chat way to sign in, with no MCP Servers page link

The same rows in German:

The notice rows in German

A 320px-wide chat with a 128-character server name, which wraps inside the card:

A narrow chat where a long server name wraps inside the notice card

The MCP Servers row for a server added by hand, which holds a sign-in and lists no tools on this page:

The MCP Servers row: Signed in; this page can't list this server's tools; if a tool fails, send a chat message that names it

Related Issues

Part of #34492

Refs #34476

Sibling sweep

Swept: git grep -n 'failedAuthorization' -- src/ and git grep -n 'awaiting authorization' -- src/
Sibling: src/kiro_crew/acp/mcp_session_report.py:389 -- not affected -- the readiness barrier reads it only for Crew's own managed servers, which do not sign in with OAuth
Sibling: src/kiro_crew/acp/client_mcp_array.py:1442 -- not affected -- a start-timeout summary; a refused sign-in is still named there as failed with its error text
Sibling: src/kiro_crew/acp/runtime_session_registry.py:591 -- not affected -- the same start-timeout summary on the shared runtime
Sibling: src/kiro_crew/connections/mint_kas.py -- not affected -- an explicit Connect already replaces saved tokens for a failed server (#35396)

Pattern harvest

Not generalizable: one engine reports a refused token renewal as a plain failure; the fix reads that engine's two texts.

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

@buluoray
buluoray requested review from a team and KiroCrewCaptain as code owners November 12, 2026 22:12
@buluoray
buluoray requested a review from mbriones98 November 12, 2026 22:12
@buluoray
buluoray enabled auto-merge (squash) November 12, 2026 22:14
@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention labels Nov 12, 2026
@buluoray
buluoray force-pushed the crew/slack/kas-mcp-sign-in-again-notice branch from 9d462e4 to c6dbee4 Compare November 12, 2026 22:49
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 12, 2026
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 4b3593d62bf54b0884946a4466363840f5912f30 — 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 blocks. Two small subtractions are open: a duplicated sign-in predicate, and a McpTab sentence outside the chat-scoped Goal.

Notes

  • Item 1 — symptom-level: the same predicate, "failedAuthorization is True or (failed and is_refused_sign_in)", is now written twice, in session_handle_mcp._note_mcp_sign_in_status and in mcp_report_bound.read_status_snapshot. These are the 2 user-server sites a grep of failedAuthorization finds; the third, in mcp_session_report, reads only required servers. Two spellings of one predicate can drift apart. Subtraction: replace both with one entry_needs_sign_in(entry) in mcp_reattempt.
  • Item 5 — oversized: the Goal says the server "can be signed in to again from the chat", but this item adds text to the MCP Servers page. By the diff's own comment, "a working server lands here too", so the sentence also shows on healthy hand-added servers. Subtraction: delete the mcp-signed-in-no-row-sign-in branch in McpTab.tsx, its 12 catalog strings and McpTab.refusedSignIn.test.tsx's no-button case. Clears when: the mechanism is removed, or a human amends the Goal.

What this change ships

Inventory (7 items) — 5 justified

Intent: on KAS, a user whose OAuth MCP server's saved sign-in stopped working learns this in chat and can sign in again there. FIX.

  1. A failed server whose sign-in renewal was refused now counts as "waiting for a sign-in", and naming it starts a sign-in — symptom-level (predicate spelled at 2 sites)
  2. A chat shows one warning row naming the servers that wait for a sign-in — justified
  3. The chat page draws that row as a translated warning card — justified
  4. Notice cards can show caller-built text in place of the plain text — justified
  5. The MCP Servers row of a signed-in, hand-added server with no tools now shows a how-to-sign-in sentence — oversized
  6. The "shown once per chat" mark resets when the gateway restarts — justified
  7. Feature map and spec rows describe the notice — justified

[FIRST-PRINCIPLES-REVIEWED] 4b3593d

Description read

[DESCRIPTION-READ] 35baffbd0844abe029113e871fadb6ad99aab7c82d1e35ead57168cd28a9e8a4

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

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks. The fix works from the engine's real output, adds no take-away, and the notice is informational, shown once per chat and bounded.

Notes

  • _OAUTH_ERROR_CODE.fullmatch reads any bare snake_case errorMessage on any failed entry as a refused sign-in. That includes a stdio server, since the check never asks whether the server is remote or OAuth. If a non-OAuth server's error is a bare snake_case token, it moves to awaiting_auth, and naming that server starts a sign-in that cannot cure it. Limiting the check to entries the engine knows as OAuth-backed would close this, if KAS exposes that.

[DESIGN-REVIEWED] 4b3593d

Description read

[DESCRIPTION-READ] 3171eb43293798153f6adef07428f7a8d682da64c73ceefe1b8daad6a5a96ac1

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

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 4b3593d62bf54b0884946a4466363840f5912f30 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks. The screenshots show both new surfaces, and the blind reader understood the chat notice and said they would act on it.

Notes

  • The signed_in_no_row_sign_in line on the MCP Servers page starts with "Signed in." and then tells the user how to sign in. The Status pill already says "Signed in", and the reader said "I can't tell whether I'm already signed in or not." Drop the "Signed in." opener so the line starts with "If a tool fails…".
  • The PR description says the MCP Servers row also points to "add it with Add Custom to sign in from the page". The shipped string and shot-04 say nothing about Add Custom. Either add that part to the string or remove the claim from the description.
  • In shot-03, a long server name appears three times in mcp_sign_in_needed_single, and the card becomes a wall of text on a narrow screen. Name the server once and shorten the example to "such as "Sign in to "" without repeating the name in "names ".

[UX-REVIEWED] 4b3593d

Description read

[DESCRIPTION-READ] ab0f66517f7f7c66448820a6b28c62d07c2a91236b3f98b26a4a07b24902b8e9

That sha256 names everything this verdict read: the PR description, plus the 7 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

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 4b3593d62bf54b0884946a4466363840f5912f30 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 4b3593d

Verdict parsed from the review's SHA-scoped output markers for commit 4b3593d62bf54b0884946a4466363840f5912f30.

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

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 4b3593d62bf54b0884946a4466363840f5912f30 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 4b3593d

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

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 12, 2026
@buluoray
buluoray force-pushed the crew/slack/kas-mcp-sign-in-again-notice branch from c6dbee4 to 895fcba Compare November 13, 2026 20:22
@buluoray

Copy link
Copy Markdown
Contributor Author

span=e1cdc88504ba

fixed in 895fcba: _notice_mcp_sign_in_needed now counts a sign-in card only while it has its oauth_url and none of completed, failed, superseded or expired is set, so a finished card that kept its link (as _mark_mcp_oauth_completed and transcript restore leave it) no longer hides the notice.
test_a_finished_card_that_kept_its_link_does_not_count covers each of the four flags (red on c6dbee4, green after); the test where a live card still suppresses the notice is unchanged.

  • A finished sign-in card that kept its link hid the sign-in notice

@buluoray

Copy link
Copy Markdown
Contributor Author

span=436eddf3b05d

fixed in 895fcba: the chat page now builds the notice from meta.servers and a new meta.more count through catalog keys pages.chatPage.mcp_sign_in_needed_single, _several and the plural _more, in all 12 shipped locales; the English content stays as the fallback for channel mirrors and SSE readers.
McpSignInNeededNotice.test.tsx renders the card in de for one server and for five plus two more (both red on c6dbee4, green after).

  • The sign-in notice was English in every language

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 13, 2026
@buluoray

Copy link
Copy Markdown
Contributor Author

span=4a5a646367e3

fixed in 895fcba: the notice now opens with "notes (a tool server you added) needs you to sign in", says "Send a message that names notes, such as "Sign in to notes"", and makes the in-sentence "MCP Servers" the only link; the separate second link is gone, in the English fallback and in every locale.

  • A first-time user would not know what "MCP Servers" is or that the message is only an example

@KiroCrewCaptain

KiroCrewCaptain commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider thinks the change is probably fine but estimates a 20% chance that this change introduces a defect, above the 12% limit for approving on its own.

I'd approve this. The change does what it says: KAS refresh refusals that keep the tokens (a 4xx 'could not be refreshed' error that isn't 408, 425 or 429, or a bare OAuth error code other than server_error or temporarily_unavailable) are now counted as needing a sign-in. Both readers apply the same check: the session handle's tracker and the report's read_status_snapshot. I checked the other code that reads the awaiting_auth/failed buckets: the KAS mint server_state (a dead-token server still goes to the consent step), the session_capabilities status (now 'pending, auth required' instead of 'failed', which is more accurate), the needs_sign_in part of not_ready, and the start-timeout summaries (unchanged). None of them regresses. The notice row is limited to KAS (ACP_BACKENDS_OPEN_EXTERNAL_URL), shown once per chat through an in-memory slot flag, skips servers that have an open sign-in card (using the same dead-child check the transcript does), never raises, and starts no sign-in. The frontend card handles the 'N more' count correctly because fmtList drops empty items, and every catalog has the plural forms it needs. The new tests cover the classifier, the tracker

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 4b3593d62b · 939 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 13, 2026
@buluoray
buluoray force-pushed the crew/slack/kas-mcp-sign-in-again-notice branch from 895fcba to ead7f0c Compare November 13, 2026 23:17
@buluoray

Copy link
Copy Markdown
Contributor Author

span=436eddf3b05d

fixed in ead7f0c: _notice_mcp_sign_in_needed now resolves _live_child_instance(state, slot) once and counts a card only while _expire_dead_child_oauth_meta("mcp_oauth", meta, live_child) is meta, the same read gate mcp_oauth_expiry_watch.check_once uses, so a card whose child is gone (gateway restart, exited child) no longer hides its server from the notice.
test_a_card_whose_child_is_gone_does_not_count[c2] and [] in test/test_mcp_sign_in_needed_notice.py were red on 895fcba and are green after; the live-child card test still suppresses the notice.

  • A card whose child died still hid its server from the sign-in notice

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Nov 13, 2026
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 14, 2026
@buluoray
buluoray force-pushed the crew/slack/kas-mcp-sign-in-again-notice branch from ba79e59 to 6d22b48 Compare November 14, 2026 04:16
@buluoray

Copy link
Copy Markdown
Contributor Author

span=e1cdc88504ba
resolution: removed -- the page clause, its page check and its two catalog keys are deleted; the notice names only the chat way in

fixed in 6d22b48: removed the MCP Servers page clause. _page_signs_in, meta.page_sign_in, the page link and both *_no_page keys (12 locales) are gone, so the notice never sends a KAS chat to a page whose sign-in it cannot read.
Evidence: test_a_waiting_server_is_named_once_with_how_to_sign_in pins the meta to kind/servers/more and the text to end at the chat example; says what the server is and names the chat way in, with no link asserts no link in en and de; the tests that pinned the page check were deleted with it.

  • Do not offer page sign-in when its grant cannot reach the KAS chat: the notice now has one sentence per branch, naming only a chat message that names the server.

@buluoray

Copy link
Copy Markdown
Contributor Author

span=2751f6c2ef16
resolution: removed -- the one-line class is deleted from every server name, so the card's break-words wraps a long name

fixed in 6d22b48: removed whitespace-nowrap from both server-name spans in McpSignInNeededNotice.tsx; NoticeCard's break-words now wraps a 128-character name inside a 320px chat.
Evidence: vitest lets a long server name wrap instead of running past a narrow chat renders a 128-character name and asserts no .whitespace-nowrap element: red on the unedited file (expected length 0, got 3), green after.

  • Keep long server names readable in narrow chat panes: the name wraps like the rest of the sentence; no class was added.

@github-actions github-actions Bot added readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention labels Nov 14, 2026
@buluoray
buluoray force-pushed the crew/slack/kas-mcp-sign-in-again-notice branch from 6d22b48 to 2002f87 Compare November 14, 2026 04:49
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 14, 2026
@buluoray
buluoray force-pushed the crew/slack/kas-mcp-sign-in-again-notice branch from 2002f87 to d841bed Compare November 14, 2026 05:10
@buluoray

Copy link
Copy Markdown
Contributor Author

span=3a8aea8b4ca1

fixed in d841bed: the shared is_refused_sign_in (acp/mcp_reattempt.py) reads the token endpoint's status and returns False for 408, 425 and 429, so those stay ordinary failures. They no longer enter the sign-in tracker or awaiting_auth, and naming the server starts no sign-in that would discard tokens that are still good. The four readers are unchanged; 400/401/403 stay refused.
Evidence: test/test_kas_mcp_refused_sign_in.py adds 408/425/429 to the not-refused, not-tracked and report-failed cases and 400/403 to the refused ones: 9 failed on 2002f87, all 42 pass after. Emptying the transient set turns the same 9 red. 425 is included because it rejects early data, not the credentials (RFC 8470 section 5.2).

  • Keep transient refresh failures out of the sign-in tracker: 408, 425 and 429 are read as failures a later attempt may clear, like temporarily_unavailable already is.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 14, 2026
@buluoray
buluoray force-pushed the crew/slack/kas-mcp-sign-in-again-notice branch from d841bed to 97bb2e8 Compare November 14, 2026 06:41
@github-actions github-actions Bot added readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention labels Nov 14, 2026
On KAS a remote MCP server whose saved OAuth sign-in stopped working
left every new chat without its tools and with nothing that said why.
The engine deletes saved tokens, and reports failedAuthorization, only
for invalid_grant, invalid_client and unauthorized_client. Any other
refusal of a refresh keeps the tokens and reports the server failed, so
nothing tracked it for a sign-in and naming it in a message did nothing.

A failed entry whose error says the token endpoint refused the saved
sign-in is now tracked like failedAuthorization and listed as waiting
for a sign-in. A 5xx, server_error or an unreachable endpoint is left
alone: a sign-in reset would delete tokens that may still work.

A chat also adds one notice row, once, naming the servers that wait for
a sign-in and have no open sign-in card, with how to sign in. The chat
page draws it with a link to the MCP Servers page. It starts no sign-in.

On the MCP Servers page a server with a saved sign-in that the page
cannot sign in to (added outside the page) says how to sign in, where
the row used to show nothing. A server added from the page already
offers Sign in again; a test pins it.
@buluoray
buluoray force-pushed the crew/slack/kas-mcp-sign-in-again-notice branch from 97bb2e8 to 4b3593d Compare November 14, 2026 08:20
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 14, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head 4b3593d. We traced every changed backend path. On a scratch export of this head, the two new backend test files pass (63/63), and reverting each production hunk turns a test red: the tracker condition, the report bucket, the notice, its backend gate, the once-per-chat flag and the dead-child gate. The tests use no sleeps, clocks, ports or network. Nothing blocking was found. Well done: the classifier counts only the refusal shapes captured from a real engine run. Transient answers (408, 425, 429, 5xx, server_error, temporarily_unavailable) are left out on purpose, and both sides are pinned in a table test.

Security: more KAS OAuth failures now make a server a sign-in candidate. The reset that deletes saved tokens still starts only after the user's own message names the server (want_mcp_sign_in_named then begin_mcp_sign_in), so tracking a server never resets it on its own. Transient failures keep their reattempt path. The chat notice is gated on positive membership in ACP_BACKENDS_OPEN_EXTERNAL_URL. Server names pass through redaction, with both the count and the length bounded, and render as React children with no raw HTML.

The design is signed off under the standing maintainer sign-off for changes by team members.

Optional:

  • connections/mint_kas.py:448: the mint watcher ends an answered sign-in only on a failed bucket. A bare OAuth code now lands in awaiting_auth, so a refused consent row could stay waiting until its 600 s TTL. One mint_kas test for whichever behaviour you choose would settle it.
  • McpTab.tsx:1283: the new "send a chat message that names X" line is not gated on onKas, but naming a server starts a sign-in only on KAS. Adding onKas && would make it true on every backend.
  • The status == "failed" guard at both classifier sites (session_handle_mcp.py:918, mcp_report_bound.py:107) survives deletion. A case with a connected entry that carries invalid_token would pin it.

@buluoray
buluoray merged commit 6b75355 into main Nov 14, 2026
97 of 98 checks passed
@buluoray
buluoray deleted the crew/slack/kas-mcp-sign-in-again-notice branch November 14, 2026 10:10
buluoray added a commit that referenced this pull request Nov 14, 2026
On KAS a remote MCP server whose saved OAuth sign-in stopped working
left every new chat without its tools and with nothing that said why.
The engine deletes saved tokens, and reports failedAuthorization, only
for invalid_grant, invalid_client and unauthorized_client. Any other
refusal of a refresh keeps the tokens and reports the server failed, so
nothing tracked it for a sign-in and naming it in a message did nothing.

A failed entry whose error says the token endpoint refused the saved
sign-in is now tracked like failedAuthorization and listed as waiting
for a sign-in. A 5xx, server_error or an unreachable endpoint is left
alone: a sign-in reset would delete tokens that may still work.

A chat also adds one notice row, once, naming the servers that wait for
a sign-in and have no open sign-in card, with how to sign in. The chat
page draws it with a link to the MCP Servers page. It starts no sign-in.

On the MCP Servers page a server with a saved sign-in that the page
cannot sign in to (added outside the page) says how to sign in, where
the row used to show nothing. A server added from the page already
offers Sign in again; a test pins it.

Hand-resolved backport; original author: Ray Xu.

(cherry picked from commit 6b75355)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

readiness: passed Eligible automated validation passed for the current revision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants