Skip to content

fix(connections): save a kas mcp sign-in where kas chats read it - #33737

Merged
bolichen97 merged 1 commit into
mainfrom
fix/sweep-g4-kas-mcp-oauth-vault
Nov 10, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/sweep-g4-kas-mcp-oauth-vault

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: On the KAS chat backend, signing in to a remote OAuth MCP server from Settings > MCP or a Connections card makes that server usable in every KAS chat.

On KAS, the default chat backend, Settings > MCP > Sign in and a Connections card's Connect both finish and the row reads Signed in. Every KAS chat still has the server signed out: the chat's MCP report lists it as failedAuthorization, with no tools. The user is told the server is ready, and it is not.

Why it matters

Anyone on the default backend who signs in to a remote OAuth MCP server from the dashboard hits this. The dashboard says Signed in while every chat says signed out, so the sign-in the dashboard offers does nothing for the chats people actually use. The only path that works is naming the server in each chat and approving its Authorize card.

Not a goal

What changed (motivation → approach → change)

A sign-in made on KAS from Settings or a Connections card is saved where KAS chats look for it. Both buttons ran a kiro-cli process, so the grant went to kiro-cli's own cache. A KAS chat never reads that cache: it reads Kiro Crew's grant vault (<data_home>/kas/mcp-grants) over _kiro/secret/*, and nothing copied one into the other.

While chats run on KAS and agent.kas_persist_mcp_sign_in is on (the default), the sign-in runs on a KAS engine process of its own (connections/mint_kas.py), started on the same one-server mint spec. What the engine stores lands in the vault every KAS chat reads. Its consent URL passes the same credential check a kiro-cli URL passes. The row turns granted only once the vault holds the server's tokens, and an attempt the engine ends before consent reads as a timed-out sign-in. Everything outside that rule keeps the kiro-cli sign-in (see Not a goal).

Surface For a server that signs in on the KAS engine
Connect (dashboard/handlers/connections.py) skips kiro-cli warm adoption, by the rule the mint applies; the premint does not warm it
Card grant check (connections/status.py) while chats run on KAS, reads the vault beside kiro-cli's cache, at the url of the entry a KAS chat mounts (mint_kas.kas_chat_sign_in_urls), so either holding the grant is Signed in; an entry with headers, and any other backend, get kiro-cli's cache alone, because those chats never read the vault
Disconnect (connections/ownership.py) removes the saved sign-in's tokens and client vault entries (mcp_grant_kas.py) for each owned url no surviving entry reads, judged in the same locked census by the vault's own url identity, not kiro-cli's; a sign-in kept for another entry names it in grantSharedWith
Test hidden on the card (crewHeld); the endpoint answers 409 kas_sign_in_test_unsupported
MCP tab KAS note (mcp_probe.py, McpTab.tsx, McpRowSignIn.tsx) per row, from a new kasChatSignIn field (types/index.capabilities.ts): chat while the row still signs in on kiro-cli, again when only kiro-cli's cache holds its grant; one new string, sign_in_kas_chat_again_note, in i18n/locales/en.manual.json and each translation

The MCP tab's old page-wide check, kasChatOwnsMcpSignIn in api/acpBackend.ts, is removed. The owning specs, connections.md, acp-client.md and architecture/mcp.md, describe the KAS route.

Backwards compatibility

Breaking: POST /api/connections/test answers 409 kas_sign_in_test_unsupported for a provider whose Connect signs in on the KAS engine, where main ran Test on kiro-cli's grant. That includes a provider connected through kiro-cli before this change. Writer sweep on origin/main @ b341cc6 (git grep -nE "connections/test|connectionsTest" over src, website/src, apps, scripts): the only caller is the Connections card, which offers no Test on a crewHeld row, and the status feed sets crewHeld for every such provider. No CLI command, MCP tool or app calls the endpoint.

Reader: website/src/pages/connections/ConnectionsPage.tsx:testConnection -- crew page -- the card hides Test on a crewHeld row (test_a_provider_that_signs_in_on_kas_is_offered_no_test, test_test_is_refused_for_a_provider_that_signs_in_on_kas)
Reader: website/src/pages/connections/ConnectionsPageCard.tsx:ConnectionCard -- crew page -- signInInChat is left off only when the KAS vault holds the grant, the one case a KAS chat reads it (test_the_card_reads_a_vault_sign_in_as_connected_with_no_kas_caveat)
Reader: website/src/pages/overview/McpTab.tsx:McpTab -- crew page -- the only caller of the removed kasChatOwnsMcpSignIn; it reads each row's kasChatSignIn instead (website/src/test/McpTab.kasChatNote.test.tsx)

Tests

New test/test_connections_mint_kas.py drives start_oauth_mint with a fake KAS engine that stores through Kiro Crew's real secret store. It locks in:

  • the tokens land where a KAS chat reads them, on one engine process that mounts only that server;
  • a server the vault already signs in is granted with no URL;
  • an attempt the engine ends without consent expires the row;
  • a consent URL carrying a credential is never published;
  • stale vault tokens do not grant before consent;
  • kiro-cli chats, an entry not sent as its bare url, and persistence off keep the kiro-cli sign-in;
  • Connect adopts no kiro-cli warm URL for a sign-in on the KAS engine, and still adopts one for a Connect the mint keeps on kiro-cli (an entry with headers, or none in the main spec); the premint warms only the latter;
  • the card reads a vault sign-in as connected, with no KAS caveat, and an entry with headers, which reaches the engine through Crew's bridge, does not read connected from vault tokens;
  • on Kiro CLI chats, a grant only the vault holds reads not connected, so the card offers Connect;
  • Test is hidden and refused with 409;
  • Disconnect removes the saved sign-in, keeps one another configured entry reads (a case-variant path), removes one only kiro-cli's pair is shared with (a query variant) and one an owned spelling kiro-cli folds into its pair (:443), keeps every one on a census gap or a refused purge, and names a holder only while the vault may still hold what it keeps;
  • each MCP row gets its chat or again caveat, or none.

The suites that drive the kiro-cli sign-in (test/connections_mint_helpers.py, test/test_connections_handoff.py, test/test_connections_premint.py) pin it off the KAS route by a string-target patch, so the reverted tree fails them at setup rather than aborting collection. test/test_agent_spec_hardened_reads.py registers the new spec read. test/test_pid_reader_ratchet.py counts the new module's four engine liveness reads as owner reads: mint_kas.py starts and ends that engine itself and no other session uses it, so each read carries # pid-owner-ok, _BASELINE_OWNER_MARKED is 13 and _BASELINE_SITES stays 143. test/test_connections_backend_oauth.py's config stub carries the persistence key. Frontend: website/src/test/McpRowSignIn.test.tsx and website/src/test/McpTab.kasChatNote.test.tsx pin the per-row note, and website/src/api/acpBackend.test.ts drops the removed helper's cases.

All runs were on a Linux DevSpace with PYTHONPATH=src and the repo venv, at 4acfe1af6c58 (base ae57c81) unless a line names another head. This head 418d051 (base 27cb69f) is that commit rebased, patch unchanged (git range-diff =).

  • Rebased onto main after review; patch unchanged (git range-diff =): the review fix was made on base b4b8a013fe2c, then carried to ae57c81 and to 27cb69f. Main's commits between change Google connection setup, registry entries, connections.md's Google paragraph, app approvals and chat rows, none of the code these suites cover. On this head 418d051 the two repros below (exit 0), the 33, 368 and 317 passed again, as did scripts/check_black_formatting.py, isort --check-only, flake8, scripts/check_file_line_cap.py and mypy src/kiro_crew/ (exit 0 each), and prove.py --base 27cb69f8f696 prints the line below.
  • test/test_connections_mint_kas.py::test_disconnect_keeps_a_kas_sign_in_another_configured_entry_still_holds: exit 1 on 128ede8 rebased (the vault lost notion's tokens and client while notion-team at /MCP stayed configured); exit 0 here; exit 1 again with only connections/ownership.py and dashboard/handlers/connections.py reverted. With those two reverted, the query-variant, :443 spelling and holder-url tests fail too (4 of the 8 Disconnect and card tests).
  • test/test_connections_mint_kas.py::test_a_vault_sign_in_an_entry_with_headers_cannot_use_does_not_read_connected: exit 1 on 128ede8 rebased (the card read connected, grantPresent: true); exit 0 here; exit 1 again with only connections/status.py and connections/mint_kas.py reverted.
  • pytest -n0 test/test_connections_mint_kas.py: exit 0, 33 passed. pytest -n 4 --dist loadgroup --max-worker-restart=2 over the changed backend test files and the 4 helper suites: exit 0, 368 passed. Over the related test_connections_status*, test_connections_disconnect*, test_mcp_probe_*, test_mcp_grant_kas, test_crew_oauth_dcr and test_agent_home_isolation_derived_specs files: exit 0, 317 passed. pytest -n0 test/test_flake_pattern_ratchet.py: exit 0, 68 passed.
  • scripts/check_black_formatting.py, black --check on the five changed Python files, scripts/check_subprocess_encoding.py, isort --check-only, flake8, mypy src/kiro_crew/, scripts/check_comment_history.py, scripts/check_brand_name.py, scripts/check_harness_parity.py, scripts/check_sync_io_in_async.py, scripts/check_file_line_cap.py, scripts/check_feature_map.py and scripts/docs-lint.sh: exit 0 each. semgrep scan --config semgrep/ --baseline-commit ae57c81fa498 --error: exit 0, 0 findings. prove.py --base ae57c81fa498 prints the line below.
  • Earlier heads of the same sign-in patch (cd6c8cf0707a, 68d814364cd3, 4f3e361b85a6): the frontend tests passed (Vitest on website/src/api/acpBackend.test.ts, website/src/test/McpRowSignIn.test.tsx and website/src/test/McpTab.kasChatNote.test.tsx, 3 files, 49 tests), and test/test_pid_reader_ratchet.py::test_pid_reader_sites_match_the_recorded_count_exactly, the red in Fast Gate run 42570846459, failed with the four # pid-owner-ok markers in mint_kas.py reverted. The frontend is unchanged since. Determinism (testing-conventions D12) on cd6c8cf0707a: test/test_connections_mint_kas.py passed 20 of 20 runs at -n0; with test_connections_premint.py and test_connections_handoff.py, 10 of 10 runs at -n 4 --dist loadgroup --max-worker-restart=2; one shuffled run, seed 27653, 87 passed.
  • Review fixes on head 16af9d3 (base ed80c1d): the vault key a KAS sign-in is watched under is now the mounted entry's own url (a trailing slash is a distinct key), and Disconnect deletes the saved sign-in inside remove_provider_entry's locked transaction, not after the lock is released. Two new tests in test/test_connections_mint_kas.py (test_a_sign_in_saved_under_the_mounted_urls_trailing_slash_reads_granted, test_disconnect_deletes_the_kas_sign_in_before_the_mcp_lock_is_released) failed with the product hunks reverted (state expired; sign-in entries still in the vault at lock release) and pass here. On a Linux DevSpace: pytest -n0 test/test_connections_mint_kas.py 35 passed; the related connections, mcp_probe, mcp_grant_kas, crew_oauth_dcr, pid_reader_ratchet, agent_spec_hardened_reads and flake_pattern_ratchet files 561 passed (exit 0). The end-to-end repro (md5 c023a930, kiro-cli 2.37.1): base ed80c1d exit 1 (bug present), this head exit 0 (vault holds tokens, KAS chat has the server ready). check_black_formatting.py, black --check, isort --check-only, flake8, mypy --platform linux src/kiro_crew, check_comment_history.py, check_brand_name.py, check_file_line_cap.py, check_harness_parity.py, check_sync_io_in_async.py and docs-lint.sh: exit 0 each.
  • The full backend, frontend and Electron suites run in CI.

Proof: PROVEN test/test_agent_spec_hardened_reads.py::TestCallSiteLabelRatchet::test_every_call_site_carries_the_expected_label[_read_agent_spec], test/test_connections_mint_kas.py::test_a_kas_sign_in_saves_its_tokens_where_a_kas_chat_reads_them, test/test_connections_mint_kas.py::test_a_server_the_vault_already_signs_in_is_granted_with_no_url, test/test_connections_mint_kas.py::test_a_consent_url_carrying_a_credential_is_never_published, test/test_connections_mint_kas.py::test_connect_on_kas_never_adopts_a_kiro_cli_warm_url (head 418d051)

Manual verification

A scripted end-to-end repro on the DevSpace: a real isolated gateway with the real kiro-cli 2.37.1 install (its KAS relay for the chat), a loopback OAuth MCP fixture that logs which token each request carries, driven only through the dashboard API. It adds the server, signs in from Settings > MCP, consents, probes the row, then opens a KAS chat.

  • This head 4acfe1af6c58 (base ae57c81), the same script (md5 c023a930) with kiro-cli 2.37.1: exit 0, bug absent. After the Settings sign-in kiro-cli's cache held no grant and the vault held the server's tokens and client entries; the KAS chat's engine logged "saved sign-in found", its server/discover, initialize, notifications/initialized and tools/list calls all carried the issued token, and the chat's MCP report had the server ready.
  • Base, main @ d2c6817: exit 1, bug present. The Settings sign-in completed (state granted) and its grant went to kiro-cli's cache, but the KAS grant vault held no tokens entry for the server. The KAS chat's engine was told "no saved sign-in", reached the server once with no token, and the chat's MCP report had it awaiting_auth.
  • Fix, the reviewed head cd6c8cf0707a: exit 0, bug absent. After the same sign-in kiro-cli's cache held no grant and the vault held the server's tokens and client entries. The KAS chat's engine logged "saved sign-in found", its server/discover, initialize, notifications/initialized and tools/list calls all carried the issued token, and the chat's MCP report had the server ready.
  • On 68d814364cd3, the same patch one base back, the same script (md5 c023a930) on a second DevSpace with kiro-cli 2.37.1. Base, main @ 445dd36: exit 1, bug present, with the same vault miss and awaiting_auth. Fix: exit 0, bug absent. The vault held the server's tokens and client entries and kiro-cli's cache held no grant. The KAS chat's engine logged "saved sign-in found", all four of its calls carried the token, and the server was ready.
  • On 4f3e361b85a6 (base fd5d9ef), the same patch as this head one base back, the same script (md5 c023a930) on a DevSpace with kiro-cli 2.37.1. Base, main @ fd5d9ef: exit 1, bug present: kiro-cli's cache held the grant, the vault held no entry, the KAS chat's engine was told "no saved sign-in", and the server was awaiting_auth. Fix: exit 0, bug absent: the vault held the server's tokens and client entries and kiro-cli's cache held no grant, the KAS chat's engine logged "saved sign-in found", all four of its calls carried the token, and the server was ready.

Screenshots / video

Captured from the built SPA with stubbed API answers, on the DevSpace, in dark and light.

MCP Servers while chats run on KAS. docs-internal signs in on the KAS engine and shows no line. legacy-oauth keeps the kiro-cli sign-in, so it says to sign in from the chat. wiki-internal is signed in only in kiro-cli's cache, so it says to sign in again.

MCP Servers rows on KAS, dark

Connections cards. Linear signed in on the KAS engine: Connected, no Test, no caveat. Notion holds only a kiro-cli grant: no Test, and the card's existing "Chats sign in separately" line.

Connections cards on KAS, dark

Light theme

MCP Servers rows on KAS, light

Connections cards on KAS, light

Related Issues

Fixes #24693

Draft #27974 targets the same issue.

Sibling sweep

Swept: git grep -nE "start_oauth_mint(|adopt_shared_mint(|warm_mint_all(|start_mint_row(" -- src
Sibling: src/kiro_crew/dashboard/handlers/connections.py:574 -- changed here
Sibling: src/kiro_crew/connections/warm_runtime/rearms.py:70 -- not affected -- a URL it re-warms for a KAS-route provider is never adopted by Connect, so no sign-in reaches kiro-cli's cache through it
Sibling: src/kiro_crew/connections/crew_oauth.py:854 -- not affected -- a Crew-held sign-in keeps its grant in Kiro Crew's own store, not kiro-cli's cache

Pattern harvest

Rule candidate: review-prompt
Pattern: a credential is written by one harness's process into its own store while chats on another harness read a different store, and no test reads the grant back through the reader

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

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 9, 2026 06:04
@bolichen97
bolichen97 requested a review from Zedmor November 9, 2026 06:04
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

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

UX-Verdict: PASS

No blockers: the blind reader correctly read both new per-row notes and the "Sign in again" action in shot-01.

Notes

  • On wiki-internal, the grey "Signed in" pill appears next to the new note "Chats on Kiro Agent don't use this sign-in yet." The blind reader said this "confused me." Suggested fix: rewrite sign_in_kas_chat_again_note so it opens with the fix, e.g. "Sign in again so Kiro Agent chats can use this server."
  • The Notion card in shot-02 still shows "Chats sign in separately: type notion in a chat once." Linear has no "In chats" line, and the reader couldn't tell whether Linear chats also need their own sign-in. Suggested fix: attach a still of a card whose sign-in is held for chats, so a reviewer can see the caveat disappear.

[UX-REVIEWED] 7d13e5f

Description read

[DESCRIPTION-READ] 0c695979aafe9f95594a570ce2e21f55deb571cba06d46ae53e59326a492f58c

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 9, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 7d13e5fe4eb0beebf8d3d805015e0d940339bab7 — 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. Each item supports the one fix: a dashboard sign-in now goes to the vault KAS chats read. The Test refusal also blocks providers whose kiro-cli grant still works, and it is justified only by symmetry.

Notes

  • Item 5 — inherited: the 409 copies crew_oauth_test_unsupported, and the description admits it "includes a provider connected through kiro-cli before this change", where Test still has a grant to run on. Subtraction: in api_connections_test, refuse only when the vault holds the grant (kas_grant_presence), and drop the refusal for providers that only kiro-cli's cache holds.

What this change ships

Inventory (8 items) — 7 justified

Intent: a dashboard MCP/Connections sign-in on KAS works in every KAS chat — FIX.

  1. On KAS, Sign in/Connect run their own KAS engine process (mint_kas.py) and save to the grant vault — justified
  2. On KAS, the card reads Signed in from either the vault or kiro-cli's cache — justified
  3. Disconnect deletes the vault's tokens/client entries unless another entry reads them — justified
  4. Connect skips the kiro-cli warm URL; premint does not warm these providers — justified
  5. Test is hidden and answers 409 for providers whose Connect signs in on KAS — rides along, inherited (mirrors crew_oauth)
  6. The MCP tab's page-wide KAS note becomes a per-row chat/again note — justified
  7. New string sign_in_kas_chat_again_note in all locales — justified
  8. SEL outcomes tagged route=kas; Disconnect reports kas_sign_ins_removed — justified

[FIRST-PRINCIPLES-REVIEWED] 7d13e5f

Description read

[DESCRIPTION-READ] 3349e7063d98d98eec5656a9109a074a6668367a6fa740de58d31513cd8ba93e

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 9, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks. The sign-in now writes to the vault that KAS chats already read, which fixes the cause rather than the symptom. The one removed helper has no readers left outside the patch.

Notes

  • The KAS mint copies the kiro-cli mint's row, TTL, URL-rejection and disposal logic by reaching into _mint's private names (_mints, _dispose_mint, _claim_mint_pid). The private names are the seam both routes share now, so a change to the kiro-cli mint's lifecycle can quietly break the KAS route.

[DESIGN-REVIEWED] 7d13e5f

Description read

[DESCRIPTION-READ] dc0c844cfa38f7c7e9a271cfd2187cb918ffc2e90f399a576fd806c3c0542731

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 9, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 7d13e5fe4eb0beebf8d3d805015e0d940339bab7 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 7d13e5f

Verdict parsed from the review's SHA-scoped output markers for commit 7d13e5fe4eb0beebf8d3d805015e0d940339bab7.

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

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 7d13e5fe4eb0beebf8d3d805015e0d940339bab7 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 7d13e5f

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

@bolichen97
bolichen97 enabled auto-merge (squash) November 9, 2026 06:17
@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Nov 9, 2026
@bolichen97
bolichen97 force-pushed the fix/sweep-g4-kas-mcp-oauth-vault branch from 5bdd127 to 279a226 Compare November 9, 2026 15:19
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 9, 2026
buluoray
buluoray previously approved these changes Nov 9, 2026

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved at 279a226. The earlier blocker is fixed: the 4 pid-reader sites in src/kiro_crew/connections/mint_kas.py now carry the owner marker, test/test_pid_reader_ratchet.py records 13, and Static Ratchet Gate and Fast Gate pass. The GPT finding at src/kiro_crew/connections/status.py:452-462, :510-512 is real but small: a grant stored only in the KAS vault shows Connected on a Kiro CLI card. It leaks nothing and matches the both-stores rule main already uses for server rows. It still needs a fix or an owner override before the GPT gate clears; this approval does not cover it.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • fixed span=2b3e4e4faa18

fixed in 128ede8: the card's verdict counts Crew's KAS grant vault only while ordinary chats run on KAS with agent.kas_persist_mcp_sign_in on (reads_vault = kas_chats and mcp_grant_kas.persistence_enabled() in status._grant_presence_maps). On Kiro CLI or any other backend the verdict is kiro-cli's own grant presence, so a grant only the vault holds reads not connected and the card offers Connect, which signs in on kiro-cli.
Repro test_on_kiro_cli_chats_a_grant_only_the_kas_vault_holds_is_not_connected (Kiro CLI chats, persistence on, vault tokens only, no native grant): exit 1 on 279a226 (status: connected, grantPresent: true), exit 0 on the fix, exit 1 again with only connections/status.py reverted.
KAS chats still read a vault sign-in as Connected (test_the_card_reads_a_vault_sign_in_as_connected_with_no_kas_caveat), and the parametrized no-Test test now stores each backend's own grant, so both rows stay Connected.
Only KAS declares secret storage to its engine (ACP_BACKENDS_OPEN_EXTERNAL_URL is KAS alone, runtime_spawn_launch._with_mcp_sign_in_storage), so no other chat backend reads the vault. The MCP Servers row rule (mcp_discovery_remote._runtime_grant_present) is main's and unchanged; connections.md records where the row and card differ off KAS.

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

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-approved at 128ede8. The only change since the approved 279a226 fixes the earlier GPT finding: the card now counts the KAS vault only while chats run on KAS (src/kiro_crew/connections/status.py:520-528, :595-598), so a vault-only grant no longer reads Connected on Kiro CLI chats. test_connections_mint_kas.py::test_on_kiro_cli_chats_a_grant_only_the_kas_vault_holds_is_not_connected pins it and a mutation turns it red. GPT raised two new security-class findings on this head: F2 (the vault is counted for a header-bridged entry) is real but status-only and already present at 279a226; F1 needs a hand-made pair of paths that differ only by case. This approval does not cover them; they need a code fix or your own override before merge. Opus and Security Scope pass.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • fixed span=e8c09e870de0

fixed in 418d051: Disconnect decides which saved KAS sign-ins to delete in the same locked census, by the vault's own identity (mcp_grant_kas.kas_connection_hash: whole url trimmed and lowercased, query kept), not kiro-cli's grant_key. ownership._kas_sign_in_split keeps an owned url while any surviving entry reads the same sign-in: another scope or agent spec, an open project's spec, a probe row, or a mirror whose purge was refused.
The handler forgets only DisconnectScope.kas_sign_in_urls, never attempted_urls. A census gap keeps every sign-in, and a holder url that is not an ASCII string holds every one. A kept sign-in is a deliberate keep: named in grantSharedWith while the vault may hold it, never grantSurviving.
Repro test_disconnect_keeps_a_kas_sign_in_another_configured_entry_still_holds (notion-team at https://mcp.notion.com/MCP, real census and judge): exit 1 on the pre-fix tree (vault emptied of notion's tokens and client), exit 0 at 418d051, exit 1 again with only ownership.py and handlers/connections.py reverted.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • fixed span=2b3e4e4faa18

fixed in 418d051: the card's verdict reads the vault only at the url a KAS chat reads it at, and not at all for an entry the engine is not sent bare. mint_kas.kas_chat_sign_in_urls resolves the main spec's entry in one read: its url when _sent_bare holds (no headers, no oauth, an ASCII url), None for any other entry, and the registry url while the spec holds none. status._grant_presence_maps answers saved=False for None, the same exclusion mcp_discovery_remote's has_headers applies.
Repro test_a_vault_sign_in_an_entry_with_headers_cannot_use_does_not_read_connected (KAS chats, vault tokens, an entry with an X-Notion-Workspace header, no kiro-cli pair): exit 1 on the pre-fix tree (status: connected, grantPresent: true), exit 0 at 418d051, exit 1 again with only status.py and mint_kas.py reverted.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Nov 10, 2026
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 10, 2026
buluoray
buluoray previously approved these changes Nov 10, 2026

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approve on 418d051. The only change since our approved head 128ede8 fixes both GPT findings from that head: Disconnect now keeps a saved KAS sign-in that any surviving entry still reads, judged by the vault's own lowercase url identity, and the card no longer counts vault tokens for an entry with headers. 332 tests pass and 3 mutations each turn named tests red. GPT raised 2 new findings on this head. F1 (the sign-in watcher checks the registry url, not the mounted entry's url) is real but narrow. It was already in the code at 128ede8 and 279a226, which we approved: it needs a hand-made entry under a registry slug whose url differs only by a trailing slash, and its only effect is a false "timed out" label on a sign-in that did save. F2 (a two-tab race after the lock is released) is flagged by GPT's own adjudicator as an edge case. Both are left for Bolin to fix or override. Decisive lines: src/kiro_crew/connections/ownership.py _kas_sign_in_split (holders judged by kas_connection_hash), src/kiro_crew/dashboard/handlers/connections.py for grant_url in scope.kas_sign_in_urls:, src/kiro_crew/connections/mint_kas.py kas_chat_sign_in_urls (str(entry["url"]) if _sent_bare(entry) else None), src/kiro_crew/connections/status.py _grant_presence_maps (vault_url = vault_urls.get(slug))

@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 10, 2026
@bolichen97
bolichen97 force-pushed the fix/sweep-g4-kas-mcp-oauth-vault branch from 418d051 to 16af9d3 Compare November 10, 2026 17:46
@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 10, 2026

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approve on 16af9d3. The only change since our approved head 418d051 fixes both GPT findings we had named for Bolin there. F1: the sign-in watcher and tokens_before now read the vault at the mounted entry's url, not the registry url. F2: Disconnect now deletes the KAS sign-in inside the locked census-and-purge transaction, shielded, not after the lock is released. GPT and Opus report no findings on 16af9d3, and no [BLOCK-MERGE] comment exists on the PR. 159 targeted tests pass. 2 mutations each turn a named new test red. The 4 red Linux backend shards fail with the same tests on main's base commit ed80c1d. Decisive lines: src/kiro_crew/connections/mint_kas.py:387 _mounted_url and :488 grant_url = _mounted_url(entry, mcp_url) (used at :503 tokens_before and :547 watcher); src/kiro_crew/connections/ownership.py:806-818 (forget_kas_sign_in via _offload_config_write, inside async with _get_mcp_lock() from :669); src/kiro_crew/dashboard/handlers/connections.py:961-962 (handler only reports scope.kas_sign_ins_removed / kas_sign_ins_unproven)

@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 10, 2026
- On KAS, Settings > MCP > Sign in and a Connections card Connect now
  run on a KAS engine of their own and save the tokens in the grant
  vault KAS chats read. They ran a kiro-cli mint whose grant landed in
  kiro-cli's cache, so a remote OAuth server read Signed in yet stayed
  signed out, with no tools, in every KAS chat.

The new route applies while agent.kas_persist_mcp_sign_in is on and the
engine is sent the server as its bare url. Pre-registered providers,
entries with an oauth block or headers, persistence off and other
backends keep the kiro-cli mint. The engine's consent URL passes the
same credential gate, and an attempt it ends unconsented reads as a
timed-out sign-in. Connect skips kiro-cli warm adoption for these
providers, the card's grant verdict reads the vault too while chats run
on KAS, at the url of an entry those chats read it with, and Disconnect
removes each saved sign-in no surviving entry reads, judged by the
vault's own url identity. Test runs on kiro-cli's grant, which such a
Connect does not write, so the card hides it and the endpoint refuses it
with 409 kas_sign_in_test_unsupported. The MCP tab's KAS caveat is now
per row: "chat" while a row still signs in on kiro-cli, "again" when the
grant it holds is kiro-cli's only.

Fixes #24693
@bolichen97
bolichen97 force-pushed the fix/sweep-g4-kas-mcp-oauth-vault branch from 16af9d3 to 7d13e5f Compare November 10, 2026 20:29
@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 10, 2026
@bolichen97
bolichen97 merged commit c84e4d7 into main Nov 10, 2026
96 of 97 checks passed
@bolichen97
bolichen97 deleted the fix/sweep-g4-kas-mcp-oauth-vault branch November 10, 2026 21:28
@github-actions github-actions Bot removed the readiness: checking Automated validation is still running label Nov 10, 2026
@bolichen97 bolichen97 mentioned this pull request Nov 11, 2026
5 tasks done
bolichen97 added a commit that referenced this pull request Nov 11, 2026
Backport of #33737 (head 7d13e5f).
Conflicts resolved on the release side with the crew_oauth parts dropped (absent on release); crewHeld is carried for the KAS sign-in only; the pid-reader owner-marked baseline is 12; the McpTab crew-held tests are dropped.
bolichen97 added a commit that referenced this pull request Nov 11, 2026
Backport of #33737 (head 7d13e5f).
Conflicts resolved on the release side with the crew_oauth parts dropped (absent on release); crewHeld is carried for the KAS sign-in only; the pid-reader owner-marked baseline is 12; the McpTab crew-held tests are dropped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KAS: Settings > MCP sign-in should run through KAS into the per-user grant vault

2 participants