Repository navigation
Refuse a malformed --github/--jira issue id as invalid_value (exit 2) - #96
Merged
Merged
Conversation
…alue A malformed GitHub issue id or Jira key was thrown as a plain Error, so the CLI exited 1 and --json reported "failed" — a coordinator branching on the exit code read a typo as a runtime failure worth retrying. Throw InvalidValueError instead, so it exits 2 with "invalid_value" as the documented contract says. A missing issue or a failed lookup still exits 1. Closes #85
craig-o-curtis
approved these changes
Oct 2, 2026
craig-o-curtis
left a comment
Contributor
There was a problem hiding this comment.
Ya, sure, you betcha. This one's a nice little fix and it's good to go.
Had a look at all of it:
- The three spots (
fetchGitHubIssue,assignGitHubIssue, Jira'sgetIssueKey) now throw theInvalidValueErrorthat's already inprompt.ts, which carriescode: "invalid_value"andoclif.exit: 2, soBaseCommand.catchdoes the right thing without any new plumbing. Messages are the same as before. - A well-formed id that isn't there, or a lookup that falls over, still exits
1. That's the right split, since a typo isn't something a coordinator ought to be retrying. - The tests check the code and the exit at each of the three sites, and the
branch.test.tscase runs the real validation end to end and makes sure no worktree got made. Good that it restores the stubs first so it isn't just testing a mock. - The README and skill tables already described
invalid_valuein general terms, so only thebranchpage needed the extra example, and it got it.patchchangeset is there, andciandchangesetare green.
One small thing for another day, and you already called it out yourself: --github abc comes back as Invalid issue id "NaN", which is a bit of a head-scratcher for whoever typed it. Might be worth a wee follow-up issue so it doesn't get lost.
I went by the diff and the green CI on this head; didn't run the suite on my own machine.
Pretty good deal. Thanks for sorting it out!
baldurpan
enabled auto-merge (squash)
October 2, 2026 21:49
baldurpan
added a commit
that referenced
this pull request
Oct 2, 2026
…ve-agent-as No conflicts and no overlap with this branch. Corrects verify.md's test-count snapshot in passing.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #85
worktree branch --github abc(or a malformed--jirakey) was refused with a plainError. That made the CLI exit1, and--jsonreportedfailed. The documented contract (the README's agent-mode error table, the skill, thebranchdocs page) gives a refused valueinvalid_valuewith exit2. A coordinator that branches on the exit code therefore treated a typo in an issue id as a runtime failure worth retrying.src/integrations/github.ts(fetchGitHubIssue,assignGitHubIssue) andsrc/integrations/jira.ts(getIssueKey) now throw the existingInvalidValueErrorfor a malformed id. The message text is unchanged. A well-formed id that doesn't exist, and a failed fetch, still throw a plainErrorand exit1.code: "invalid_value",oclif: { exit: 2 }. A command-level test inbranch.test.tsruns--github abc --jsonand a malformed--jirakey through the real validation and asserts theinvalid_valuedocument, exit2and no worktree created. With the integration code reverted tomain, that test fails withcode: 'failed'.branchdocs page'sinvalid_valuerow now lists a malformed--github/--jiraissue id among its examples.Known and left out of scope:
branch.tsconverts--githubwithNumber(...), so--github abcis refused asGitHub: Invalid issue id "NaN".The code and exit are now right; only the quoted value is unhelpful.