fix: beta resolver typecheck + build smoke check#19060
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the beta-branch merge automation script to improve conflict-resolution prompts and add an end-of-run typecheck/build smoke verification for packages/opencode.
Changes:
- Refactors repeated PR-list formatting into a shared
lines(prs)helper. - Enhances the conflict-resolution prompt to require a
bun typecheckpass after resolving conflicts. - Adds a
smoke()step after merging to runbun typecheckand./script/build.ts --single, with optional auto-fix + commit if the working tree is dirty.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
script/beta.ts
Outdated
| "Run `bun typecheck` in `packages/opencode`.", | ||
| "Run `./script/build.ts --single` in `packages/opencode`.", | ||
| "Fix any merge-caused issues until both commands pass.", | ||
| "Do not create a commit.", | ||
| ].join("\n") | ||
|
|
||
| try { | ||
| await $`opencode run -m opencode/gpt-5.3-codex ${prompt}` | ||
| } catch (err) { | ||
| console.log(`Smoke fix failed: ${err}`) | ||
| return false | ||
| } | ||
|
|
||
| try { | ||
| await $`bun typecheck`.cwd("packages/opencode") | ||
| await $`./script/build.ts --single`.cwd("packages/opencode") | ||
| } catch (err) { |
There was a problem hiding this comment.
./script/build.ts --single in packages/opencode performs network fetches (models.dev) and generates/updates src/provider/models-snapshot.*. With the current git status/git add -A flow below, the smoke check can end up committing unrelated/generated snapshot changes (or new files) to the beta branch even when merges are otherwise clean. Consider making the build step deterministic for this script (e.g., pass MODELS_DEV_API_JSON/pin the snapshot), or explicitly restore/clean generated snapshot files before deciding whether to commit smoke fixes.
script/beta.ts
Outdated
| try { | ||
| await $`bun typecheck`.cwd("packages/opencode") | ||
| await $`./script/build.ts --single`.cwd("packages/opencode") | ||
| } catch (err) { |
There was a problem hiding this comment.
build.ts supports --skip-install, but the smoke check currently runs it without that flag. Because build.ts runs bun install by default, this smoke step can mutate bun.lockb/dependency state and then the later git add -A can commit those lockfile changes. If the goal is a build smoke test (not dependency updates), consider invoking ./script/build.ts --single --skip-install here.
| try { | ||
| await $`git add -A` |
There was a problem hiding this comment.
The smoke check auto-commits any dirty working tree via git add -A / git commit. As written, this can accidentally include files outside the intended smoke-fix scope (e.g., untracked/generated files created during the smoke commands). Consider restricting what gets staged (limit to known paths) or failing with a clear message listing git status --porcelain entries so a human can review, rather than committing everything blindly.
| try { | |
| await $`git add -A` | |
| // Only allow auto-committing changes within packages/opencode. | |
| // If there are changes elsewhere, list them and abort so a human can review. | |
| const statusLines = out.trim().split("\n") | |
| const unsafeChanges = statusLines.filter((line) => { | |
| // Porcelain format: "XY path" (at least 3 chars; path may contain spaces but starts at index 3). | |
| const path = line.length > 3 ? line.slice(3).trim() : "" | |
| return !(path === "packages/opencode" || path.startsWith("packages/opencode/")) | |
| }) | |
| if (unsafeChanges.length > 0) { | |
| console.log("Smoke check produced changes outside packages/opencode; refusing to auto-commit.") | |
| console.log("Please review and handle these changes manually:") | |
| console.log(unsafeChanges.join("\n")) | |
| return false | |
| } | |
| try { | |
| await $`git add packages/opencode` |
348245a to
8b36e37
Compare
No description provided.