Repository navigation
fix(kas): say when a remote MCP server's oauth block cannot reach the backend - #27712
Conversation
55330be to
0a4b6bf
Compare
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the fix sends one less field to KAS and adds one more key to the existing session-start notice for lost spec keys. Nothing new is exposed. Notes
[DESIGN-REVIEWED] 987bfc0 Description read[DESCRIPTION-READ] 4cb535535be43621029b4dbffd04d3039ff254ce303547200f69fef2b3e3f0eb 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 Every item points to a cause: KAS drops the Notes
What this change shipsInventory (5 items) — 4 justifiedIntent: a KAS user whose remote MCP server needs a pre-registered OAuth client learns that sign-in won't work there, and the client secret stays off the wire. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 987bfc0 Description read[DESCRIPTION-READ] 53fdc48f906363e2a9c711867fcf45ed5b8179b6e410d0547817449db268e35a That sha256 names the PR description this verdict read. Recompute it with |
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: |
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: |
0a4b6bf to
ade0a9d
Compare
ade0a9d to
ee2af70
Compare
|
Holding for human review, reviewed at The change itself looks sound: Before approval, please also fix the follow-up tracking: the body says AI findings judged non-blocking:
— crew-pr-reviewer (r141) |
|
Both done in the PR description: the issue link is now "Part of #27711" so the issue stays open for the KAS schema change and the follow-ups, and the What changed bullet now says the log carries a fixed message with a key count only. No code change or push. |
|
Holding for human review, reviewed at The code looks sound. KiroCrew/src/kiro_crew/mcp_oauth_projection.py Lines 77 to 102 in b94550a acp/kas_env_literals.py is a byte-identical move, and the NON_EGRESS_REDACTION_MODULES row moves with it; kas_agents.py no longer calls the redactor directly, so no coverage is lost (KiroCrew/src/kiro_crew/security_posture.py Line 116 in b94550a AI findings judged non-blocking:
To clear: a maintainer reviews the credential-handling change and approves. — crew-pr-reviewer (r145) |
|
[operator: bolichen97] Review note at b94550a: the oauth-reporting change itself looks correct to me, and nothing in it is on main yet. The PR now conflicts with main because #26786 already landed the same Small things to consider while rebasing: pin AI-assisted, approved by bolichen97 |
b94550a to
a678f4e
Compare
|
Rebased onto main as a678f4e. Kept main's |
Sensitive change review
|
… backend KAS rebuilds each remote MCP entry from url, headers, env and timeout only, so a pre-registered OAuth client never arrives and sign-in cannot start, with nothing logged and nothing shown. Withhold the block from the wire (it can hold a client secret), log its key names only, and name the server in the existing session-start notice for spec keys this backend never receives, saying sign-in will not work here and kiro-cli supports it. Part of #27711
a678f4e to
987bfc0
Compare
bolichen97
left a comment
There was a problem hiding this comment.
[operator: bolichen97] Approving at 987bfc0.
No blocking issue found. On KAS the oauth block is now kept off the wire (it is a field KAS drops anyway), the log carries only the server name and a count, and the user is told sign-in will not work there. The kiro-cli path is unchanged. The earlier conflict I noted is gone: this head no longer touches kas_env_literals.py or security_posture.py. Nothing equivalent is on main.
Non-blocking suggestions:
- The log reads "(1 keys)"; pluralize or say "key count N".
test_the_log_names_keys_and_never_valuesasserts key names are not logged, and the module docstring intest/test_kas_agents_mcp_oauth.pystill says it logs key names. Both could be renamed or reworded.- Pinning
oauth's absence in the KAS wire schema keys would make the withhold step go red once KAS starts carryingoauth. servers_with_discarded_oauthdoes not skip stub server names the way the projection does. Harmless today, but the notice could drift.
This still needs the Sensitive Change sign-off from another maintainer.
AI-assisted, approved by bolichen97
bolichen97
left a comment
There was a problem hiding this comment.
Maintainer decision (security sign-off): not adopted as written. The maintainer's rule for security changes is that we do not raise security strictness, so the maintainer will not add the new restriction here: stripping a remote MCP server's oauth block from the KAS projection before it is sent.
Reviewed at 987bfc0. Please drop the tightening part and keep the rest:
- Drop: the
withhold_oauthcall in_project_mcp_serversand thewithhold_oauthhelper inmcp_oauth_projection.py, plus the tests that pin the block being removed (test_the_oauth_block_is_not_sent,test_a_non_object_block_is_withheld_and_named_without_its_value, and the log tests that only exist for the pop). - Keep: the session-start notice that names each server whose sign-in will not work on KAS (
spec_keys_without_carrierwithdiscards_mcp_oauth,oauth_lost_keys,oauth_servers_in,_spec_keys_notice), and theregistry_withheldrefactor. These tell the user something true without changing what is sent.
If you would rather not keep the notice on its own, closing the PR is fine too. Thank you for the careful work on this.
Problem / Motivation
Goal: On the KAS backend, a user whose agent declares a remote MCP server with a pre-registered OAuth client is told that sign-in will not work there, and the client secret stays off the wire.
KAS rebuilds each remote MCP entry from
url/headers/env/timeoutonly, so a server'soauthblock never reaches the backend. No sign-in card appears, the server's tools never load, and Crew logs nothing and shows nothing. Part of #27711.Why it matters
Any KAS user with a provider that needs a pre-registered client (no Dynamic Client Registration) gets a server that silently does nothing, with no hint that the kiro-cli backend would work. The block can also hold a
clientSecret, which was being sent to a backend that throws it away.Not a goal
oauth(ClientAgentMcpServerSchema/mapClientMcpServers). That is a KAS change, recorded in KAS backend drops a remote MCP server's oauth block, so a pre-registered OAuth client can never sign in #27711.What changed (motivation → approach → change)
Symptom: a silent, unusable server. Cause:
_project_mcp_serversforwardsoauth, KAS drops it, andspec_keys_without_carrierhas no entry for it, so the existing session-start notice never fires.The change reuses the existing loss-reporting path rather than adding one:
src/kiro_crew/mcp_oauth_projection.py(new leaf outside the ACP layer, sokas_agents.pystays under the 2,000-line cap and the dashboard notice can read the key format); the log carries a fixed message and a key count only: the predicates, the key format, and the withhold-and-log step.src/kiro_crew/acp/kas_agents.py:_project_mcp_serverswithholdsoauthfrom the projected entry and logs a fixed message with the block's key count only (no key name or value).spec_keys_without_carriertakes a newdiscards_mcp_oauthflag and, when set, addsmcpServers.<name>.oauthfor each server the projection actually declares. Muted and registry-withheld entries are skipped throughregistry_withheld, a predicate the projection now shares, so the notice never names a server that does not run.src/kiro_crew/dashboard/chat_turn/tool_approval.py:_spec_keys_noticeadds one sentence for those keys: "Sign-in to MCP server will not work on this backend. The kiro-cli backend supports it." The row still passes through_redact_display_text.src/kiro_crew/agent_sdk/spec_hooks.py,src/kiro_crew/dashboard/chat_turn/turn_spec_hooks.py: threaddiscards_mcp_oauth, set only for a KAS session. kiro-cli reads the block off disk and gets no notice.Backwards compatibility
Compatible: kiro-cli is unchanged, and on KAS the only removed field is one the backend already discarded.
Reader: KAS
mapClientMcpServers-- chat -- never readoauth, so withholding it changes nothing the backend sees (test_kas_agents_mcp_oauth.py::TestProjection::test_the_oauth_block_is_not_sent)Tests
test/test_kas_agents_mcp_oauth.py: the block is not sent; the log names keys and carries neither the client id nor the secret; a non-object block is withheld without its value; KAS names the server, kiro-cli and thetoolsSettings-only flag name nothing; muted, registry-mode and registry-marked servers are not named; dotted and multiple names read back whole; other notices are unchanged.Proof: PROVEN test/test_kas_agents_mcp_oauth.py::TestProjection::test_the_oauth_block_is_not_sent, test/test_kas_agents_mcp_oauth.py::TestProjection::test_the_log_names_keys_and_never_values, test/test_kas_agents_mcp_oauth.py::TestProjection::test_a_non_object_block_is_withheld_and_named_without_its_value, test/test_kas_agents_mcp_oauth.py::TestNotice::test_the_notice_names_the_server_and_the_supported_backend, test/test_kas_agents_mcp_oauth.py::TestNotice::test_a_dotted_name_and_several_servers_read_back_whole (head ee2af70)
Local gate:
test/test_kas_*.py, every*contract*suite and the spec-hook and tool-approval suites, 9,277 passed. Two reds are not this PR:test_kas_project_agents.py::test_a_shadowing_project_spec_changes_nothing_about_the_user_agentis red on clean origin/main 7f8700a (and still on the rebased base), andtest_kas_skill_scope.py::test_an_inheriting_agent_keeps_the_default_trees_and_gets_no_rulepasses alone. black, flake8, mypy and semgrep clean on the changed files.Manual verification
N/A — unit coverage sufficient: the change is a projection field drop plus one notice string, both asserted directly.
Pattern harvest
Not generalizable: a single backend-specific field that KAS's mapper drops; the existing spec-keys notice path now names it, and the KAS schema change is tracked in #27711.