Repository navigation
fix(kilo-mcp): name the OAuth failure cause and record reuse revocations - #8636
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryThe incremental fix set is clean: the error-description lookup now requires an own property, and the telemetry Assumptions: Overview
Files Reviewed (5 files)
Previous Review Summary (commit e1a0169)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit e1a0169)Status: 2 Issues Found | Recommendation: Merge (suggestions only) Executive SummaryThe telemetry-only change is sound; two hardening suggestions concern the new failure-detail vocabulary's prototype lookup and its unbounded Assumptions: Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (7 files)
Reviewed by deepseek-flash-latest · Input: 29.3K · Output: 3.6K · Cached: 238.5K Review guidance: REVIEW.md from base branch |
Why
A production report says the Kilo Platform MCP signs the user out several times per day. The session is a month long, so repeated sign-ins cannot be expiry. Investigation shows two causes are indistinguishable in production telemetry:
kilo_mcp_oauth_sign_in_failedcarries only the OAuth error code, soClient ID mismatch,Grant not found,Invalid refresh tokenandRefresh token has expiredall look identical.onErrorhook and leaves no record at all.That gap blocks both diagnosis and any future reply to a report like this one.
What
onErrormaps the libraryerror_descriptionthrough a fixed 15-entry table to adetailslug and emits it. Unknown descriptions becomeother. The raw text never leaves the worker: the library interpolates into one of its descriptions.refresh_token_reuseand the account the destroyed grant belonged to. It never emits the grant id, the refresh token or the access token.kilo_mcp_oauth_sign_in_failedevent, so no new event name or dashboard is needed.Example line now produced by the real provider and Durable Object path:
[kilo-mcp] analytics kilo_mcp_oauth_sign_in_failed {"phase":"failed","reason":"invalid_grant","detail":"refresh_token_reuse",...,"userId":"..."}Testing
vitest runacrossrefresh-reuse,provider-hooks,analytics,indexandstore/oauth-store: 187 tests pass.otherfallback, the exact property allowlist, and the no-emission path when the guard forwards the request.Risk
Telemetry only. The guard's decision and every token response are unchanged. One new property on an existing event.