{{ message }}
Repository navigation
fix(issue create): resolve --type before creating the issue - #14727
Open
umairnaeem0309 wants to merge 1 commit into
Open
umairnaeem0309 wants to merge 1 commit into
umairnaeem0309 wants to merge 1 commit into
Conversation
gh issue create --type <name> resolved the type name only after api.IssueCreate had run. On a repository without issue types, or with a misspelled name, the issue was created and then the command exited 1 without printing its URL, so scripts and agents retried and filed duplicates. Resolve the name before the mutation. The lookup needs nothing from the new issue, and the interactive flow already carries the selected ID, so the query only happens when --type was passed. Signed-off-by: Umair Naeem <154259455+umairnaeem0309@users.noreply.github.com>
umairnaeem0309
requested review from
tidy-dev
and
a balanced review from Copilot
and removed request for
Copilot
October 17, 2026 15:21
Contributor
4 tasks done
TorresVisual
added a commit
to TorresVisual/null-ide
that referenced
this pull request
Oct 18, 2026
Fork PR head reads through the base repo (verified on cli/cli#14727), so the fork-PR limit is dropped from the spec. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
ywsfnra-boopasdf123
left a comment
There was a problem hiding this comment.
// No IssueCreate stub: an unresolvable type must fail before the
// mutation, otherwise the issue exists but its URL is never printed
// and automation retries, filing duplicates.
This branch has not been deployed
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.

Summary
Fixes #14703.
gh issue create --type <name>resolved the type name only afterapi.IssueCreatehad run. On a repository that has no issue types (all user-owned repositories, whererepository.issueTypesisnull) or with a misspelled name, the issue was created and then the command exited 1 without printing its URL, so scripts retried and filed duplicates.This resolves
--typebefore the mutation:Notes on the shape of the fix:
createRunimmediately beforeapi.IssueCreate, in theSubmitActionbranch, so the preview/--webpaths are untouched.opts.issueTypeID == ""guard means the interactive flow keeps reusing the ID it already resolved at the prompt (create.go:377), so no duplicateRepositoryIssueTypesquery is introduced.deferredUpdateIssueOptionsstill resolves--typeas a fallback for callers that arrive without a resolved ID; its comment now says so.I took the first of the two options in the issue ("Resolve
--typebeforeapi.IssueCreate") rather than printing the URL and warning, because the unknown-type case is a user error that should have no side effects at all, and#13899already covers the deferred-mutation error path for permission failures.Tests
Test_createRun/create_with_type_not_foundpreviously stubbedmutation IssueCreatebeforequery RepositoryIssueTypes, which pinned the reported ordering. That stub is now gone:The case still expects
type "Bugz" not found; available types: Bug, Feature, Task, and the registry'sVerifystill requires the types query to have run. With the stub absent, any attempt to create the issue fails the test instead of passing silently — which is exactly the property the issue asks for.Verification
Mutation check: flipping the new guard off (
if false && …) makesTest_createRun/create_with_type_not_foundfail, becauseIssueCreateis then attempted and no stub matches:So the test genuinely detects the reported behaviour, rather than merely passing.
Out of scope, same class, happy to follow up
--parent,--blocked-byand--blockingare still resolved afterapi.IssueCreateindeferredUpdateIssueOptions, so an unresolvable reference there has the same "issue created, URL not printed, exit 1" shape. I kept this PR to--typeso the change stays reviewable and each of those flags can get its own test; say the word and I will follow up with the same treatment for all three.