Skip to content

feat(bot): add GitHub adapter#3024

Merged
RSO merged 27 commits intomainfrom
RSO/jet-degree
May 6, 2026
Merged

feat(bot): add GitHub adapter#3024
RSO merged 27 commits intomainfrom
RSO/jet-degree

Conversation

@RSO
Copy link
Copy Markdown
Contributor

@RSO RSO commented May 4, 2026

Summary

  • Adds the Chat SDK GitHub adapter to the shared Kilo Bot infrastructure so GitHub issue and PR comment mentions route through the same bot flow as Slack.
  • Preserves existing GitHub App webhook behavior for PR code reviews while forwarding GitHub comment events to the bot adapter.
  • Adds GitHub platform identity handling and tests for GitHub webhook routing.

Verification

N/A (no manual verification performed).

Visual Changes

N/A

Reviewer Notes

  • GitHub comment webhooks are now double-verified: once by the existing GitHub webhook handler and once by the Chat SDK adapter using a cloned request body.
  • PR code review handling remains on the existing pull_request webhook path.

@RSO RSO force-pushed the RSO/jet-degree branch from 4506db1 to d894d74 Compare May 5, 2026 08:04
@RSO RSO marked this pull request as ready for review May 5, 2026 13:18
Comment thread apps/web/src/lib/bot.ts Outdated
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented May 5, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (27 files)
  • apps/web/package.json
  • apps/web/src/app/api/chat/link-account/route.test.ts
  • apps/web/src/app/api/chat/link-account/route.ts
  • apps/web/src/app/api/integrations/github/callback/route.test.ts
  • apps/web/src/app/api/integrations/github/callback/route.ts
  • apps/web/src/app/api/webhooks/github/route.test.ts
  • apps/web/src/app/api/webhooks/github/route.ts
  • apps/web/src/app/github/link/route.test.ts
  • apps/web/src/app/github/link/route.ts
  • apps/web/src/lib/bot-identity.ts
  • apps/web/src/lib/bot.ts
  • apps/web/src/lib/bot/agent-runner.ts
  • apps/web/src/lib/bot/constants.ts
  • apps/web/src/lib/bot/conversation-context.test.ts
  • apps/web/src/lib/bot/conversation-context.ts
  • apps/web/src/lib/bot/github-link-state.ts
  • apps/web/src/lib/bot/github-link-token.ts
  • apps/web/src/lib/bot/link-account.test.ts
  • apps/web/src/lib/bot/link-account.tsx
  • apps/web/src/lib/bot/platform-helpers.test.ts
  • apps/web/src/lib/bot/platform-helpers.ts
  • apps/web/src/lib/bot/webhook-handler.ts
  • apps/web/src/lib/integrations/core/constants.ts
  • apps/web/src/lib/integrations/platforms/github/webhook-handler.test.ts
  • apps/web/src/lib/integrations/platforms/github/webhook-handlers/installation-handler.ts
  • apps/web/src/tests/setup/__mocks__/lib/integrations/platforms/github/adapter.ts
  • pnpm-lock.yaml

Reviewed by gpt-5.5-20260423 · 2,118,844 tokens

RSO added 26 commits May 6, 2026 09:26
Wrap the bot.webhooks.github call in after() with try/catch so
unhandled exceptions from the chat adapter are surfaced to Sentry
instead of being silently dropped.
Replace the manual last-page / previous-page pagination dance with a
single octokit call using sort=created&direction=desc. GitHub already
supports returning the newest comments first, so one request suffices.
The review-thread context helper previously paged through every
review comment on the pull request with no upper bound. For PRs with
thousands of review comments this produced a long cascade of API
calls on every bot mention. Cap at 500 comments (5 pages of 100) and
log when the cap is reached so we can spot pathological PRs.
Both /github/link and the bot-link branch of the GitHub App callback
were hard-coded to 'standard' credentials, so account linking would
fail for installations of the lite app. Look up the integration by
installation_id and pick credentials / exchange the OAuth code using
its stored github_app_type.
Replace the global `identity:github:user:<githubUserId>` link with the
same per-installation identity Slack uses. GitHub link URLs now carry an
HMAC-signed token binding them to a specific platform integration, so
they remain safe to post in public issue/PR comments.
@RSO RSO force-pushed the RSO/jet-degree branch from 5ed3398 to 39e0ec0 Compare May 6, 2026 07:29
@RSO RSO requested a review from markijbema May 6, 2026 08:38
Copy link
Copy Markdown
Contributor

@markijbema markijbema left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • This GitHub adapter has so many webhook feelings it should come with a therapist and a retry queue.
  • The account linking flow says "seamless" the way a merge conflict says "almost done."
  • Prompt context is stuffed so full even Copilot would ask for a smaller diff.
  • The mocks are bravely pretending concurrency is a myth invented by flaky CI.
  • Overall, PR #3024 adds GitHub support with the confidence of a bot that just learned await means "eventually."

@RSO RSO merged commit f15728b into main May 6, 2026
41 checks passed
@RSO RSO deleted the RSO/jet-degree branch May 6, 2026 10:19
@Kilo-Org Kilo-Org deleted a comment from kilo-code-bot Bot May 6, 2026
@Kilo-Org Kilo-Org deleted a comment from kilo-code-bot Bot May 6, 2026
@RSO
Copy link
Copy Markdown
Contributor Author

RSO commented May 6, 2026

@kilocode-bot hi, how are you?

@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented May 6, 2026

Hi! I'm doing great, thanks for asking! 😊

I'm Kilo Bot, ready to help you with code analysis, making changes, fixing bugs, implementing features, and more on your repositories.

Is there anything I can help you with on this PR or elsewhere? For more on what I can do, check out the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants