Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/qwen-code-pr-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ jobs:
return
fi
case "$RESULT_TEXT" in
*"[API Error"*)
*"[API Error: "[0-9]*)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Critical] The narrowed glob drops the retry safety net for API error formats whose message does not begin with a digit — Failure scenario: model connection drops mid-review → CLI exits 0 in stream-json mode with subtype=success, is_error=false, RESULT_TEXT="[API Error: Connection error.]" → the AlreadyReportedError throw is guarded by outputFormat === OutputFormat.TEXT (nonInteractiveCli.ts:1651) and is never taken in stream-json → the case is the sole safety net → new glob requires [0-9] after [API Error: but Connection error. starts with C → falls through to OUTCOME='success' → review silently treated as successful, no retry, no comment posted. Same applies to [API Error: Rate limit exceeded], [API Error: An unknown error occurred.], and every other non-digit-prefixed format from parseAndFormatApiError.

Consider anchoring at the start of the string instead of requiring a digit, since the error format always begins with [API Error: :

Suggested change
*"[API Error: "[0-9]*)
"[API Error: "*)

This matches real API errors (which always start with [API Error: ) while excluding prose that merely mentions the pattern mid-sentence.

— qwen3.8-max-preview via Qwen Code /review

if printf '%s' "$RESULT_TEXT" | grep -qiE 'quota.*(exhaust|exceed|limit|reset)'; then
OUTCOME='quota'
KIND='quota'
Expand Down
11 changes: 11 additions & 0 deletions scripts/tests/qwen-pr-review-workflow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ function runScenario(scenario, { timeoutMinutes = 180 } = {}) {
' transient_persist) r success false "[API Error: 503 upstream overloaded]" ;;',
' quota) r success false "[API Error: 429 Your token-plan quota has been exhausted. The quota will reset at 07-19 13:17:00 UTC.]" ;;',
' quota_noreset) r success false "[API Error: 429 Your quota has been exhausted.]" ;;',
' success_mentions_api_error) r success false "Review of [API Error: ...] handling — quota and rate.?limit keywords look correct." ;;',
' errresult) r error true "connection dropped mid-review" ;;',
' hardexit) exit 3 ;;',
'esac',
Expand Down Expand Up @@ -158,6 +159,16 @@ describe('qwen pr review transient retry', () => {
expect(r.attempts).toBe(1);
});

it('does NOT misclassify a successful review that mentions [API Error: ...] in its summary', () => {
// A review of PR #7247 (API error retry) quoted "[API Error: ...]" and
// "quota … limit" in its result text. The old pattern *"[API Error"*
// matched the prose and the quota grep hit "quota … limit", falsely
// reporting quota exhaustion on a successful review.
const r = runScenario('success_mentions_api_error');
expect(r.line).toContain('OK outcome=success');
expect(r.attempts).toBe(1);
});

it('retries an aborted (error-result) run', () => {
const r = runScenario('errresult');
expect(r.line).toContain('FAIL');
Expand Down
Loading