feat(bot): add PR signature to Cloud Agent prompts in bot SDK#1914
Merged
Conversation
Port the PR signature feature from the old slack-bot/discord-bot implementations into the new bot SDK. When the Cloud Agent creates a PR/MR, the description now includes a 'Built for [User](link) by [Kilo for Platform]' attribution line.
| */ | ||
| export function buildPrSignature(requesterInfo: RequesterInfo): string { | ||
| const requesterPart = requesterInfo.messageLink | ||
| ? `[${requesterInfo.displayName}](${requesterInfo.messageLink})` |
Contributor
Author
There was a problem hiding this comment.
WARNING: Escape requester names before interpolating them into markdown
displayName comes from Slack/Discord user profiles and is user-controlled. Names containing markdown metacharacters like ], (, or ) will break the generated Built for [...]() link, and can also inject unintended markdown/instructions into the prompt sent to Cloud Agent. Escape the name before building the link, or render the linked case without reusing raw markdown syntax.
Contributor
Author
Code Review SummaryStatus: 1 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Fix these issues in Kilo Cloud Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (4 files)
Reviewed by gpt-5.4-20260305 · 760,813 tokens |
marius-kilocode
approved these changes
Apr 2, 2026
4 tasks
Merge main into feat/bot-pr-signature, resolving conflicts in: - run.ts: Accept refactored main version (thin wrapper) and add rawMessage for PR signature - spawn-cloud-agent-session.ts: Merge botRequestId + callbackTarget from main with prSignature/chatPlatform options, use dynamic chatPlatform - agent-runner.ts: Add PR signature imports, rawMessage param, signature building logic, and pass options to spawnCloudAgentSession
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports the PR signature feature from the old
src/lib/slack-bot.tsandsrc/lib/discord-bot.tsimplementations into the new bot SDK (src/lib/bot/). When the Cloud Agent creates a PR or MR via the bot, the description now includes a "Built for User by Kilo for Platform" attribution line at the end, matching the behavior of the legacy bot implementations.Changes:
src/lib/bot/pr-signature.ts— Platform-awarebuildPrSignature()andgetRequesterInfo()functions. For Slack, fetches a message permalink via the Slack API; for Discord, constructs the link from guild/channel/message IDs; for other platforms, degrades gracefully (name only, no link).src/lib/bot/agent-runner.ts— Imports PR signature functions, gathers requester info when a fullMessageis available (viarawMessage), deriveschatPlatformfrom the thread ID, and passes both as options tospawnCloudAgentSession.src/lib/bot/run.ts— PassesrawMessagetorunBotAgentso the fullMessage(withrawfor platform-specific fields) is available for PR signature building.src/lib/bot/tools/spawn-cloud-agent-session.ts— Accepts an optionaloptionsparameter withprSignatureandchatPlatform. Appends the signature to the Cloud Agent prompt when present. Uses dynamicchatPlatforminstead of hardcoded'slack'forcreatedOnPlatform. RetainsbotRequestIdandcallbackTargetfrom the main branch refactor.Verification
oxfmt --list-different .— passes (no formatting issues)Visual Changes
N/A
Reviewer Notes
run.tschanges were adapted to main's refactored architecture where tool setup lives inagent-runner.tsrather thanrun.ts.rawMessagefield onRunBotAgentParamsis optional so the callback route (which creates syntheticBotAgentMessageLikemessages withoutraw) continues to work — PR signature is simply skipped whenrawMessageis not provided.chatPlatformdefaults to'slack'inspawnCloudAgentSessionto maintain backward compatibility if called without options.