DRAFT: Submission bot opens a github PR #4044
DRAFT: Submission bot opens a github PR #4044tintinthong wants to merge 9 commits intoget-bot-runner-to-run-headless-commandfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 935b2c0665
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let prParams: Parameters<CreatePullRequest>[0] = { | ||
| ...params, | ||
| head: HARDCODED_PR_HEAD_BRANCH, | ||
| }; |
There was a problem hiding this comment.
Respect caller-provided PR head branch
openPullRequest currently replaces params.head with a hardcoded branch, so every PR is opened from test-submissions regardless of the event/listing-specific branch passed by callers. This breaks branch isolation and can open the wrong PR (or fail if that branch is absent), which makes the submission flow unreliable for any room-specific listing updates.
Useful? React with 👍 / 👎.
| if (eventContent.type === 'pr-listing-create') { | ||
| // Temporary workaround: handle PR creation directly until this flow is moved to a proper command path. | ||
| await openCreateListingPR({ | ||
| eventContent, |
There was a problem hiding this comment.
Return after direct pr-listing-create handling
For pr-listing-create, this function calls openCreateListingPR but then continues into the generic enqueue path instead of exiting, so the same trigger can both open a PR directly and enqueue a run-command job. In environments where that event type has an allowed command registration, this causes duplicated/competing side effects for a single Matrix event.
Useful? React with 👍 / 👎.
Preview deployments |
6317949 to
2bfa7ec
Compare
49fabaa to
ff1a5c3
Compare
There was a problem hiding this comment.
Pull request overview
This pull request implements a submission bot feature that automates the creation of GitHub pull requests for catalog listings. The bot listens to Matrix events, processes submission requests, collects listing files, and creates PRs in the boxel-catalog repository.
Changes:
- Added GitHub API integration using Octokit for creating branches, commits, and pull requests
- Implemented submission workflow with
create-submissioncommand that generates SubmissionCard instances - Refactored bot-runner timeline handling to support the new pr-listing-create event type with userId tracking
Reviewed changes
Copilot reviewed 32 out of 33 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Added @octokit/rest and @octokit/types dependencies for GitHub API integration |
| packages/runtime-common/github-submissions.ts | New module for encoding/decoding Matrix room IDs into branch names using base64url |
| packages/runtime-common/tests/github-submissions-test.ts | Test coverage for branch name encoding and submission metadata extraction |
| packages/runtime-common/bot-trigger.ts | Added required userId field to BotTriggerEvent validation |
| packages/runtime-common/index.ts | Exported github-submissions module |
| packages/base/matrix-event.gts | Added userId field to BotTriggerContent interface |
| packages/base/command.gts | Added CreateSubmissionInput and CreateSubmissionResult types |
| packages/host/app/commands/create-submission.ts | New command to prepare submission data and create SubmissionCard instances |
| packages/host/app/commands/index.ts | Registered CreateSubmissionCommand in the command registry |
| packages/host/app/commands/bot-requests/send-bot-trigger-event.ts | Added userId to bot trigger events |
| packages/host/app/commands/bot-requests/create-listing-pr-request.ts | Updated to use pr-listing-create event type and include listingName |
| packages/host/tests/integration/commands/* | Test coverage for bot trigger events and submission creation |
| packages/bot-runner/lib/github.ts | New GitHub client implementation using Octokit for PR operations |
| packages/bot-runner/lib/create-listing-pr-handler.ts | Handler for pr-listing-create events including branch creation and PR opening |
| packages/bot-runner/lib/command-runner.ts | Command runner with special handling for pr-listing-create workflow |
| packages/bot-runner/lib/timeline-handler.ts | Refactored to use CommandRunner for event processing |
| packages/bot-runner/tests/* | Comprehensive test coverage for GitHub operations and command handling |
| packages/bot-runner/main.ts | Integrated GitHub client into bot-runner initialization |
| packages/bot-runner/package.json | Added Octokit dependencies |
| packages/catalog-realm/submission-card/submission-card.gts | New SubmissionCard definition for tracking submissions |
| packages/catalog-realm/* | Added submission card listing and demo instance |
| packages/matrix/scripts/setup-submission-bot.ts | Updated to register create-submission command for pr-listing-create events |
| packages/experiments-realm/bot-request-demo.gts | Updated demo to use pr-listing-create event type |
| docs/* | Added comprehensive documentation for the submission flow |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| Headless command execution details are documented here: | ||
|
|
||
| - [commands-in-headless-chrome.md](/Users/tintinthong/github/boxel/docs/commands-in-headless-chrome.md) |
There was a problem hiding this comment.
This documentation link contains an absolute path to a user's local file system ("/Users/tintinthong/github/boxel/..."). This should be a relative path like "commands-in-headless-chrome.md" or "./commands-in-headless-chrome.md".
| - [commands-in-headless-chrome.md](/Users/tintinthong/github/boxel/docs/commands-in-headless-chrome.md) | |
| - [commands-in-headless-chrome.md](./commands-in-headless-chrome.md) |
| commitSha: string; | ||
| } | ||
|
|
||
| const HARDCODED_REVIEWER = 'tintinthong'; |
There was a problem hiding this comment.
The HARDCODED_REVIEWER constant contains a specific GitHub username ('tintinthong'). This should be configurable via an environment variable to allow different reviewers for different deployments or to support multiple reviewers.
| const HARDCODED_REVIEWER = 'tintinthong'; | |
| const HARDCODED_REVIEWER = process.env.GITHUB_DEFAULT_REVIEWER ?? 'tintinthong'; |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b9ab851b3b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let result: RunCommandResponse = await job.done; | ||
| await this.createListingPRHandler.addContentsToCommit(eventContent, result); | ||
| await this.createListingPRHandler.openCreateListingPR( |
There was a problem hiding this comment.
Skip PR side effects when run-command fails
The pr-listing-create branch continues into addContentsToCommit/openCreateListingPR even when job.done resolves to a non-ready result. run-command returns { status: 'error', error: ... } for common failures (permissions/invalid command input) without throwing, so this path can create an empty branch and then silently exit on “No commits between” instead of surfacing the real failure. Gate the GitHub write/PR steps on result.status === 'ready' and propagate result.error when it is not.
Useful? React with 👍 / 👎.
|
No description provided.