Repository navigation
Conversation
[Medium impact] The PR appears safe to merge; no blocking issues were found. SummaryThe PR lets
Reviews (4) · Last reviewed commit: "test(automations): move the base-branch ..." · Reviewed by Greptile |
|
No actionable comments were generated in the recent review. Walkthrough
Severity of issue fixed: Medium Merge Risk:
|
`orca automations edit --base-branch=` (or a whitespace-only value) now clears the saved base branch so new-per-run automations fall back to the repository default. Previously the empty value was dropped and whitespace was saved as a branch name. Values are trimmed on create and edit, and edit help documents the reset syntax. Fixes stablyai#52229 Co-authored-by: Neil <[email protected]>
a1aee02 to
26f4023
Compare
The main typecheck project can't see CLI files, so a src/main test importing them failed TS6307. The test now asserts the edit RPC's parsed updates instead of importing main persistence code.
ELI5
If an automation was set to start each run from a particular branch, you can now clear that choice from the command line, and it goes back to the repository's default branch.
What Changed
orca automations edit <id> --base-branch=exited 0 but kept the old branch, because the flag reader dropped empty strings.--base-branch ' 'saved three spaces as the branch name.editsendsbaseBranch: null, which clears the override. Branch values are trimmed on bothcreateandedit, so' main 'savesmain. Oncreate, a blank value leaves the field out, so the default applies. Leaving the flag off still keeps the saved value. A bare--base-branchwith no value is still rejected withinvalid_argument.getBaseBranchFlaginsrc/cli/automations/automation-handler-flags.tsreuses the existinggetOptionalStringFlagAllowingEmptyreader and maps blank values tonull. The update RPC already accepts that throughOptionalNullablePlainString. The help text foreditnow shows how to reset.Why
Scripts got a success exit code while the automation kept its old override or saved a ref that cannot work. Clearing with a blank value works the same way as the existing
--precheck ""reset, and matches how the desktop automation editor already clears the base branch (it sendsnull). No new flag or contract change was needed.Linked Issue
Fixes #52229
Visual Proof
N/A for screenshots: this changes CLI behavior only, with no UI change. Terminal transcripts from a disabled test automation (from the original PR, Linux headless server), each run starting with
releasesaved:Before
After
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
automation-base-branch-round-trip.test.tsruns real argv parsing, theedithandler,AutomationUpdateschema validation after a JSON round-trip, and the real automation definition store. It covers empty (null), whitespace-only (null) and padded (main) values. On the old CLI, the empty and whitespace cases fail.automation-handler-flags.test.tschecks thatcreatesendsundefinedfor a blank value andmainfor' main '.An extra probe on macOS checked:
--base-branch=,""and"\t \n"givenull;--base-branch=origin/mainis kept;" feature/x\t"becomesfeature/x; leaving the flag off givesundefined; a bare flag and--base-branch --jsonboth throw;nullsurvives JSON plus schema validation on update;createnever sendsnull.On macOS,
vitest run src/cli/automations/plus the round-trip test passed (8 files, 52 tests). oxlint, oxfmt, anti-slop, native code-quality plugins, ast-grep and the changed-code quality gate are all clean on the touched files.The original PR was also verified on Linux x86_64 against an isolated headless server.
Performance
None, because this only runs once per
orca automations create/editCLI call, to parse one flag. It adds no RPCs, storage writes, polling or subprocesses. A microbenchmark (bun, 200k iterations) measured, old vs new: typicalmain33 vs 25 ns/call; flag omitted 13 vs 13 ns/call; adversarial 20k-character padded value 9 ns vs 6.5 µs (the cost of the trim, paid once per CLI process).Risk
Level: Low
Scripts that passed an empty value as a placeholder will now clear the saved override. To keep it, they can leave the flag off. Branch names with leading or trailing whitespace are now trimmed (git refs cannot contain them anyway). The change uses the update RPC's existing nullable
baseBranchfield, so it needs no migration, and older runtimes and remote hosts already acceptnull. Reverting the commit restores the old CLI behavior. Base branches already cleared stay cleared.Review
Reviewed the parsing for
--base-branch=,--base-branch ' 'and bare--base-branch, and the nullable path from the update RPC through the runtime patch into the definition store. The string handling works the same on every platform. Help text notes that--base-branch=is the safer form on Windows PowerShell 5.1, which can drop""arguments.Agent skill upstream boundary
Notes
Original fix by @SeungWoonSong in #52235. Authorship is preserved on the landing commit, and the maintainer follow-ups (trimming, create coverage, help text) are squashed in with a
Co-authored-bytrailer.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)