Repository navigation
fix(mcp): one explanation for an externally spawned kirocrew-core - #13690
Conversation
|
Intent: Make the three refusals a kirocrew-core started outside a Kiro Crew session can hit (identity_unattested, the strict no-identity-channel diagnosis, learn_add's missing X-Session-Key) say one thing: identity-bearing tools are unsupported from such a process and KIROCREW_SESSION_KEY is not a credential. |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 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: |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Confirm nothing downstream matches on the lesson writers' old [DESIGN-REVIEWED] 0e5eba0 |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify the note's promise on a real unspawned server: tests pin the wording, not that What this change shipsInventory (7 items) — 7 justifiedIntent: give a person who wired
[FIRST-PRINCIPLES-REVIEWED] 0e5eba0 |
Opus 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: |
50dfbe0 to
4d12185
Compare
|
|
|
|
A kirocrew-core started outside a Kiro Crew session (an editor's own MCP config) has no identity channel, and the same missing identity surfaced as three unrelated errors: identity_unattested on every tool when KIROCREW_SESSION_KEY was copied into that config, the strict "no identity channel" diagnosis from memory_recall without it, and learn_add echoing the gateway's bare "missing X-Session-Key". None of them said that the server is unsupported there or that the env var is not a credential, so the reader bounced between the two errors. All three refusals now append one shared note when the process carries neither the session token nor a launcher host pid, so nothing the gateway does at spawn happened to it. learn_add maps the 400 missing_session_key code onto the same established-session refusal memory_recall uses. Which calls are refused is unchanged; a server the gateway did spawn keeps its existing wording.
4d12185 to
0e5eba0
Compare
|
…rodotdev#13690) A kirocrew-core started outside a Kiro Crew session (an editor's own MCP config) has no identity channel, and the same missing identity surfaced as three unrelated errors: identity_unattested on every tool when KIROCREW_SESSION_KEY was copied into that config, the strict "no identity channel" diagnosis from memory_recall without it, and learn_add echoing the gateway's bare "missing X-Session-Key". None of them said that the server is unsupported there or that the env var is not a credential, so the reader bounced between the two errors. All three refusals now append one shared note when the process carries neither the session token nor a launcher host pid, so nothing the gateway does at spawn happened to it. learn_add maps the 400 missing_session_key code onto the same established-session refusal memory_recall uses. Which calls are refused is unchanged; a server the gateway did spawn keeps its existing wording. Co-authored-by: w <w@k.local>
Problem / Motivation
A
kirocrew-corestarted outside a Kiro Crew session -- listed in an editor's own MCP config -- shows three different errors for one missing identity. WithKIROCREW_SESSION_KEYcopied into that config every tool answersidentity_unattested. Without it,memory_recallsays "No identity channel on this install" andlearn_addechoes the gateway's baremissing X-Session-Key. None of the three says the two things the reader needs: that server has no identity channel and its identity-bearing tools are not supported there, and the env var is a gateway-injected fallback, not a credential. The reader bounces between the two errors.Why it matters
Anyone who wires
kirocrew-coreinto Kiro IDE (a leftover from older installs) hits this on every memory write, reads the header name as a missing setting, and copies a live session key into their config -- which makes it worse. The refusal is correct; the words leave no next step.What changed (motivation → approach → change)
mcp_shared.pytool-policy gateidentity_unattestedmcp_core.pystrict_identity_diagnosismemory_recalland every reflexive tool)mcp_tools/learn.pylearn_add,learn_remove400 missing_session_keyechoed asmissing X-Session-Keylearn_removekeeps saying nothing was removedOne shared string,
mcp_shared.external_client_identity_note, says it once: a server not started by a Kiro Crew session has no identity channel and its identity-bearing tools are not supported from it;KIROCREW_SESSION_KEYis not a credential and set by hand refuses every call; the read-only tools work without it; use a Kiro Crew session; the supported editor direction is connecting into one rather than spawning the server, and that server's entry in~/.kiro/settings/mcp.jsonis leftover install state. The note names the refusing server throughout; the "leftover from an older install" clause appears only for the names Kiro Crew itself once wrote into the shared config (mcp_cleanup.STALE_MANAGED_MCP_SERVERS), since an opt-in server found there is the user's own wiring, and the read-only tool list appears only forkirocrew-core, whose tools they are. It names no pull request: the gateway-backed ACP server (PR #7415) is the direction in progress and is cited here, not in shipped text.mcp_shared.spawned_without_gateway_identitygates it on the process environment alone, so a server the gateway did start (token on the element, or a launcher host pid) keeps its existing wording -- its problem is a trust root or a quoted spawn denial, not an editor config.docs/architecture/mcp.mddocuments the shared note beside theidentity_unattestedwording it extends.Existing-user visible behaviour: unchanged for every server the gateway spawns (dashboard, Slack, cron, subagent, sandboxed) -- pinned by tests that assert the old text byte-for-byte and the note absent with a gateway caller or a token on the element. Changed only for a process with neither, where the three refusals gain the appended note and the lesson writers' wording changes from the HTTP body to the established-session refusal. No refusal decision moves: what is allowed and what is refused is identical before and after.
Backwards compatibility
Compatible: no gate, header, route or accepted input changes; only the text of three refusals that already refused grows, and only for a process the gateway did not spawn.
Tests
test_strict_identity_diagnostics.py::TestExternalClientNote-- the note is actionable and names no machine path;strict_identity_diagnosisappends it with no spawn evidence and keeps its wording byte-identical with a token or host pid;memory_recallcarries it;learn_addandlearn_removemapmissing_session_keyonto it while every other error passes through unchanged; the note names only the refusing server, carries the leftover clause only for always-on names and the read-only list only forkirocrew-core, and names no pull request; all three refusals share one string.test_mcp_shared.py-- theidentity_unattestedrefusal appends the note for a caller-less process with onlyKIROCREW_SESSION_KEY, and stays unchanged with a gateway caller (existing test extended) or with a token on the element.prove.py --base origin/main: PROVEN (tests fail with the production hunks reverted).Manual verification
N/A -- unit coverage sufficient: the three refusal texts are exercised end to end through the stdio loop harness and the tool functions; the gate decisions are untouched.
Related Issues
no linked issue: reported in an internal support thread; the supported editor direction is tracked by PR #7415.
Pattern harvest
Rule candidate: review-prompt
Pattern: one missing precondition surfaced through several tools with per-tool wording, none naming the shared cause or the next step -- check that sibling refusals for the same condition share their explanation.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)