Repository navigation
fix(discord): check requester access before the bot answers - #9474
Conversation
The Discord bot resolves the author's access to the installation before it prepares an answer for a mention. A requester with access continues to the model with the Cloud Agent tool and the repository context. Every other requester receives the guidance reply for their case. The denial-only system-prompt notices are removed because the guidance is now the reply itself.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryIncremental review of HEAD Assumptions: Files Reviewed (3 files)
Previous Review Summaries (2 snapshots, latest commit 82c0493)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 82c0493)Status: No New Issues Found | Recommendation: Merge Executive SummaryRe-reviewed HEAD Assumptions: Files Reviewed (3 files)
Previous reviewStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (3 files)
Reviewed by deepseek-flash-latest · Input: 34.6K · Output: 3.3K · Cached: 275.6K Review guidance: REVIEW.md from base branch |
|
bot: Re: the kilobot Code Review Summary (1 Issue Found, SUGGESTION on That row is the same finding as the inline thread on that line, and it is answered there: the access decision runs ahead of reply preparation by intent of this change, and answering session-less questions separately is a separate product decision that needs its own scope. The thread is resolved and no code change follows from the summary row. The wording observation from that remark is noted for such a follow-up; each reason already has its own guidance text, so it reads as the answer for its case. |
eshurakov
left a comment
There was a problem hiding this comment.
Bot - Minor (non-blocking): the refusal reply is posted publicly in the channel, and account_unavailable states that the linked Kilo account "cannot start Cloud Agent sessions" for blocked_at, blocked_reason, or personal_account_disabled. Any guild member can now learn the state of another member's Kilo account by having them trigger a mention. Consider posting the account_unavailable denial as a DM (or a generic public message) while keeping the detailed guidance for the other reasons.
A requester whose Kilo account cannot start sessions gets one general guidance message that points to the connected-accounts page and Kilo support. The precise denial reason stays in the server log, and the other denial reasons keep their specific guidance.
|
bot: Addressed the approving review's minor remark. The reply for an unavailable account is one general message that keeps the connected-accounts page and Kilo support as the next step; the precise reason stays in the server log, and the other denial reasons keep their specific guidance. Verified on the local dev stack at 8f70ad2 by delivering a forwarded gateway mention: the bot posts that general message and the run log records the reason. Jest covers the account states behind that message. |
Evidence
Evidence: demonstrated — local dev stack at head 8f70ad2 (real Next.js route, Postgres, Redis) with the Discord REST API answered by a loopback fixture that records every request. A forwarded gateway mention is delivered to
/discord/webhook, and the bot's posted reply is read back from the fixture ledger.DISCORD_SESSION_DENIAL_MESSAGES[reason]for that reason. Reaction lifecycle is unchanged: hourglass added, removed, check mark added.toolCount 1).NODE_ENV=test pnpm exec jest src/lib/discord-botinapps/web— 7 suites, 71 tests pass.pnpm exec tsgo --noEmit --checkers 1inapps/web, oxlint and oxfmt on the changed files: clean.No visual surface changed (server-only route behavior), so no screenshots are attached. Design gate does not apply: no
apps/mobileUI change.Change
apps/web/src/lib/discord-bot.ts:processDiscordBotMessageresolves the installation authorization first and returnsDISCORD_SESSION_DENIAL_MESSAGES[reason]as the reply whenauthorizeDiscordSessionRequesterreports a reason.apps/web/src/lib/discord-bot/discord-session-authorization.ts: the reply for an unavailable account is one general message that keeps the connected-accounts page and Kilo support as the next step; the precise reason stays in the server log. The other denial reasons keep their specific guidance.DISCORD_SESSION_DENIAL_PROMPT_NOTICESand its four notice constants are removed, because the guidance is the reply itself.apps/web/src/lib/discord-bot.test.tscovers each reasonauthorizeDiscordSessionRequestercan return, a message with no Discord author context, and the account states behind the general message, asserting the exact guidance reply and no model call. The prompt-context test links the installation owner so it still exercises prompt assembly.Production prerequisites
None.
Proxy answers
Answer: Every reason.
Confidence: 0.72
Answer: First.
Confidence: 0.75
Answer: Deleted.
Confidence: 0.85
Answer: One general message that keeps the support path.
Confidence: 0.70