fix(feedback): submit feedback when the repo has no feedback label - #1396
Conversation
📝 WalkthroughWalkthroughThe feedback command centralizes GitHub issue creation, retries without the ChangesFeedback submission flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant FeedbackCommand
participant ghCLI
participant Console
FeedbackCommand->>ghCLI: Create issue with feedback label
ghCLI-->>FeedbackCommand: Issue URL or missing-label error
FeedbackCommand->>ghCLI: Retry issue creation without labels
ghCLI-->>FeedbackCommand: Issue URL or CLI error
FeedbackCommand->>Console: Print URL, label note, or error details
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/commands/feedback.ts`:
- Around line 160-178: Update submitViaGhCli so the fallback createIssue call
without labels is attempted only when the first createIssue error indicates the
missing “feedback” label condition. For all other failures, call handleFallback
directly with the original error via describeGhError, avoiding retries that
could create duplicate issues.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 83f7b7c8-017d-4ebf-adae-3c94f53e88fa
📒 Files selected for processing (2)
src/commands/feedback.tstest/commands/feedback.test.ts
6b5b245 to
9c22939
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/commands/feedback.ts`:
- Around line 122-130: Update isMissingLabelError to inspect only error.stderr
when detecting the gh “could not add label” response; remove error.message from
the combined output so user-provided command arguments cannot trigger an
incorrect retry.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1d2683b3-ca8a-4e45-9b7c-213f39b6257f
📒 Files selected for processing (4)
.changeset/feedback-missing-label-retry.mdopenspec/specs/cli-feedback/spec.mdsrc/commands/feedback.tstest/commands/feedback.test.ts
`openspec feedback` passed `--label feedback` unconditionally, but the repository does not define that label. gh resolves label names before creating the issue, so it failed with "could not add label: labels not found: feedback" on every invocation and the command exited non-zero, discarding the feedback the user had just composed. Retry once without the label when — and only when — gh's stderr reports that it could not add the label, and tell the user the label was not applied. Every other failure keeps its existing behavior: print gh's error and exit with gh's exit code, with no retry. Only stderr is matched, because the error message also embeds the command line, which carries the user's own feedback text. The cli-feedback spec gains a scenario for the unlabeled path, and its gh-failure scenario is narrowed to exclude it. The fallback scenarios are unchanged. Refs Fission-AI#1091 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
9c22939 to
1bf085f
Compare
alfred-openspec
left a comment
There was a problem hiding this comment.
Verified against GitHub CLI v2.96.0 that label resolution happens before the issue-create mutation, so this narrow stderr-gated retry cannot duplicate an issue. All 16 focused feedback tests pass locally at 4b9ec3d and the exact-head CI matrix is green, so this is approved.
Status: Ready for review. Refs #1091 (see Scope — this does not remove the need to create the label).
What was wrong
openspec feedback "..."fails for every user, on every run.The command always asks GitHub to apply a
feedbacklabel, but this repository does not define one.ghresolves label names before creating the issue, so it refuses outright:The command then exits non-zero and throws away the feedback the user just composed.
Easy to confirm:
gh label list --repo Fission-AI/OpenSpecreturns 29 labels and nofeedback. EveryFeedback:-titled issue in this repo (#1263, #1092, #1093, #1094) carries no labels at all.How it was fixed
When — and only when —
gh's stderr reports it could not add the label, retry once without it and say so:If the
feedbacklabel is created later, the first attempt succeeds again and the retry never runs.Matching stderr only is deliberate. Node puts the whole command line into
error.message, and that command line contains the user's own title and body — so matching the message would let feedback text like "gh could not add label bug report" trigger a retry on an unrelated failure. There is a regression test for exactly that.Proof it works
Verified against a stubbed
ghon an isolatedPATH(no realghreachable, no issues created):gh issue createcalls0--label feedback011Before/after on the reported bug:
could not add label: labels not found: feedback✓ Feedback submitted successfully!10Tests: 16 in
feedback.test.ts, including no-retry-on-other-errors, no-retry-when-the-text-mentions-the-label-error, exit-code preservation when the unlabeled retry fails, and silence about the label on the happy path. Full suite2026 passed(only the 17 known environment-onlyzsh-installerfailures).tsc --noEmitandeslintclean.Why this is not a breaking change
Every failure mode that exists today behaves identically, verified by running both builds side by side: gh missing, gh unauthenticated, network, 403, 422, 502, issues-disabled (exit 4) — same stdout, same stderr, same exit code, same number of
ghcalls.handleFallbackis byte-identical tomainand does not appear in the diff.The retry cannot duplicate an issue:
ghmaps label names to IDs client-side before the create mutation (params.go→LabelsToIDs), so a label failure means nothing was created. And if gh ever rewords that error, the retry simply stops firing and behavior reverts to today's.Spec
openspec/specs/cli-feedback/spec.mdgains a scenario for the unlabeled path, and itsgh CLI execution failurescenario is narrowed to exclude that case (it still requires gh's exit code and no retry for everything else). The network-failure and fallback scenarios are unchanged and still hold.openspec validate cli-feedback --type specpasses.Scope
This makes the CLI resilient; it does not do what #1091 primarily asks. Creating the
feedbacklabel is still worth doing, and is strictly better on reach: it fixes every already-released version immediately, whereas this change only helps after the next release. HenceRefsrather thanCloses— please close #1091 when the label exists.🤖 Generated with Claude Code
Summary by CodeRabbit
openspec feedbacknow succeeds when the repository lacks thefeedbacklabel by creating the issue without that label.