-
Notifications
You must be signed in to change notification settings - Fork 12
Introduce Submission bot & refactor bot feature, invite submission bot to a room #3821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
richardhjtan
commented
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a new submission bot for handling pull request submissions and refactors shared bot functionality into a reusable @cardstack/bot-core package. The submission bot can be invited to Matrix rooms to assist with submission workflows, and the refactoring reduces code duplication between bot services.
Changes:
- Created
@cardstack/bot-corepackage with shared utilities for Matrix bot services (client setup, room locking, shutdown handling, signal handlers, sliding sync, auto-join) - Implemented new
@cardstack/submission-botservice for handling PR submissions and review workflows - Refactored
@cardstack/ai-botto use the new bot-core utilities, eliminating duplicate code - Added
InviteSubmissionBotCommandin the host app to invite the submission bot to rooms with context - Added "Submit for Review" menu item to Listing cards in the catalog realm
Reviewed changes
Copilot reviewed 30 out of 31 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/bot-core/* | New shared package with Matrix bot utilities including client setup, room locking, shutdown/signal handlers, sliding sync, and membership management |
| packages/submission-bot/* | New bot service for handling submissions with room state context, greeting messages, and command handling |
| packages/ai-bot/main.ts | Refactored to use bot-core utilities instead of local implementations |
| packages/ai-bot/lib/signal-handlers.ts | Removed - moved to bot-core |
| packages/ai-bot/lib/shutdown.ts | Removed - moved to bot-core |
| packages/ai-bot/package.json | Added bot-core dependency |
| packages/host/app/commands/invite-submission-bot.ts | New command for inviting submission bot with context stored in room state |
| packages/host/app/commands/index.ts | Registered new InviteSubmissionBotCommand |
| packages/host/app/services/matrix-service.ts | Added submissionBotUserId getter and inviteToRoom method |
| packages/host/app/resources/room.ts | Updated to check for both AI bot and submission bot membership |
| packages/host/app/components/matrix/room.gts | Updated generatingResults to only show for AI bot streaming messages |
| packages/catalog-realm/catalog-app/listing/listing.gts | Added "Submit for Review" menu item using InviteSubmissionBotCommand |
| packages/runtime-common/constants.ts | Added submissionBotUsername constant |
| packages/base/command.gts | Added InviteSubmissionBotInput type definition |
| packages/matrix/package.json | Added register-submission-bot script and updated register-all |
| .github/workflows/ci-lint.yaml | Added linting steps for bot-core and submission-bot |
| pnpm-lock.yaml | Updated dependencies and lockfile entries |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| try { | ||
| await new InviteSubmissionBotCommand(commandContext).execute({ | ||
| submissionTarget: cardId, | ||
| submissionType: 'listing', |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The submissionType is set to 'listing' here, but the SubmissionContext interface in submission-bot/main.ts only allows 'pull-request', 'card', or 'other'. This will cause the type to fall through to the default case in the switch statement. Either update the SubmissionContext type to include 'listing', or map 'listing' to 'card' since listings are cards.
| submissionType: 'listing', | |
| submissionType: 'card', |
| legacyDecorators: true, | ||
| }, | ||
| }, | ||
| plugins: ['ember'], |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'ember' plugin is included in the plugins array but this is not an Ember package - it's a pure Node.js/TypeScript utility package. The ember plugin should be removed since it's not needed for bot-core.
| plugins: ['ember'], |
| legacyDecorators: true, | ||
| }, | ||
| }, | ||
| plugins: ['ember'], |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'ember' plugin is included in the plugins array but this is not an Ember package - it's a pure Node.js/TypeScript bot service. The ember plugin should be removed since it's not needed for submission-bot.
| plugins: ['ember'], |
| ecmaFeatures: { | ||
| legacyDecorators: true, | ||
| }, |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The legacyDecorators feature is enabled but this package doesn't use decorators. Since this is a utility package for Matrix bot services without class decorators, this setting can be removed.
| ecmaFeatures: { | |
| legacyDecorators: true, | |
| }, |
|
|
||
| // Room state event type for submission context | ||
| const SUBMISSION_CONTEXT_EVENT_TYPE = 'com.cardstack.submission_context'; | ||
|
|
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constant SUBMISSION_CONTEXT_EVENT_TYPE is duplicated between this file and packages/submission-bot/main.ts. Consider defining this constant in a shared location like @cardstack/runtime-common/matrix-constants to ensure consistency and avoid potential mismatches.
| // Room state event type for submission context | |
| const SUBMISSION_CONTEXT_EVENT_TYPE = 'com.cardstack.submission_context'; | |
| import { SUBMISSION_CONTEXT_EVENT_TYPE } from '@cardstack/runtime-common/matrix-constants'; |
| '', // empty state key | ||
| ); | ||
|
|
||
| // Open the AI assistant panel with the new room |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment mentions "AI assistant panel" but this is the submission bot command which opens a room for submission review, not the AI assistant. The comment should be updated to reflect the actual purpose, for example: "Open the room for submission review" or "Open the chat panel with the new submission room".
| // Open the AI assistant panel with the new room | |
| // Open the chat panel with the new submission review room |
| "lint:js:fix": "eslint . --report-unused-disable-directives --fix", | ||
| "lint:glint": "glint" |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lint:glint script is included but bot-core is a pure TypeScript package without Glint templates. This script should be removed as it's not applicable to this package.
| "lint:js:fix": "eslint . --report-unused-disable-directives --fix", | |
| "lint:glint": "glint" | |
| "lint:js:fix": "eslint . --report-unused-disable-directives --fix" |
| "lint:fix": "concurrently \"pnpm:lint:*:fix\" --names \"fix:\"", | ||
| "lint:js": "eslint . --report-unused-disable-directives --cache", | ||
| "lint:js:fix": "eslint . --report-unused-disable-directives --fix", | ||
| "lint:glint": "glint", |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lint:glint script is included but submission-bot is a pure TypeScript package without Glint templates. This script should be removed as it's not applicable to this package.
| "lint:glint": "glint", |
| ecmaFeatures: { | ||
| legacyDecorators: true, | ||
| }, |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The legacyDecorators feature is enabled but this package doesn't use decorators. Since this is a bot service without class decorators, this setting can be removed.
| ecmaFeatures: { | |
| legacyDecorators: true, | |
| }, |
| } from '@cardstack/bot-core'; | ||
| import { PgAdapter } from '@cardstack/postgres'; | ||
| import * as Sentry from '@sentry/node'; | ||
|
|
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sentry is imported and used for error capture but never initialized. The submission bot should either initialize Sentry (similar to how ai-bot has an instrument.ts file that calls Sentry.init) or remove the Sentry import and error capture calls if not needed.
| if (process.env.SENTRY_DSN) { | |
| Sentry.init({ | |
| dsn: process.env.SENTRY_DSN, | |
| tracesSampleRate: 1.0, | |
| }); | |
| } |
| export class OpenAiAssistantRoomInput extends CardDef { | ||
| @field roomId = contains(StringField); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the invite command shud invite any user. This input can be a subclass if neeeded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
submissionTarget and submissionType are obviously part of submission bot only
| // Room state event type for submission context | ||
| const SUBMISSION_CONTEXT_EVENT_TYPE = 'com.cardstack.submission_context'; | ||
|
|
||
| export default class InviteSubmissionBotCommand extends HostBaseCommand< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be invite user to room (roomId)