Repository navigation
fix(cmd): return non-zero for partial operational failures - #1030
Conversation
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 3 selected item(s). |
c6ea09f to
4469700
Compare
|
@lizhengfeng101, would you be able to review the current head when you have a chance? We’re successfully using OpenCodeReview downstream, and we’re treating the fix for #1027 as the remaining upstream blocker before enabling a broader rollout. The current checks are green and GitHub reports the PR as mergeable. If additional changes are needed—or if you can share an approximate review timeline—we’d appreciate the guidance. We’re also happy to help with this PR in any way that would be useful. Thank you! |
NanaseInori
left a comment
There was a problem hiding this comment.
Thanks for addressing #1027. The implementation correctly distinguishes operational partial failures from budget-only truncation, preserves the emitted manifest/results before returning the process error, and aligns SARIF executionSuccessful with that manifest-based policy. I also checked the 14 successful GitHub checks on the current head.
Changes requested — update the remaining public exit-code contract:
cmd/opencodereview/shared_flags.gostill states for--max-tokens-budgetthat "Partial results are published and review exits 0; it exits non-zero only if every selected item failed". With this PR, a partial review containing a timeout/provider error exits non-zero, even if some items completed.action.ymland the CI integration guides still describe partial review exit0without restricting that statement to budget-only partial runs. Please qualify these texts to match the new policy. This should be a small documentation/help-text change.
Integration caveat (please clarify, or address separately): The current GitHub composite Action runs Fail job on OCR error when OCR_EXIT_CODE != '0' and executes Post review comments only when OCR_EXIT_CODE == '0'. After this fix, operationally partial reviews retain their CLI JSON/results (and optional artifacts) but their completed findings are not posted as PR review comments by this Action. If Action-level publication is out of scope, please make that distinction explicit.
I did not find a further blocking problem in the manifest classification logic itself.
This review was conducted by NanaseInori's review bot, using the model GPT-6. If you need a human review, please manually @NanaseInori.
|
Thanks for addressing #1027. The core exit-code policy and the shared CLI/SARIF success check look right. From the maintainer side, please address both items below in this PR before merging, rather than deferring them to follow-ups. 1. Synchronize the public exit-code contractThe CLI reference and FAQ have been updated, but
Please also distinguish emitting partial CLI results from displaying or publishing those results in downstream integrations. 2. Preserve partial findings in both IDE integrationsBoth the VS Code and IntelliJ Please update both integrations to preserve and display a valid partial review result while clearly reporting that the review did not complete successfully. Execution status and available findings need to be handled separately; this should not turn arbitrary non-zero exits into success or hide errors when output is missing or invalid. Updating only the result-to-view status mapping is insufficient because the current exception occurs before result parsing. Please add regression tests in both integrations for a non-zero exit with valid partial JSON containing at least one finding: the finding remains available, the incomplete status is surfaced, and ordinary CLI failures still follow the error path. The intended CLI exit-code change should remain. These additions are needed to make its public contract consistent and avoid regressing existing IDE workflows when users upgrade. AI assistance: OpenAI Codex was used for analysis and drafting this feedback. |
Resolved |
- Classify provider budget/quota exhaustion as session.FailureProvider instead of session.FailureBudget so partially completed reviews still exit non-zero under the alibaba#1030 contract, and add a regression test for partial success followed by quota exhaustion. - Preserve collected findings from applyResume() when grouping aborts on a provider quota error instead of returning nil comments. - Emit a safe, stable diagnostic message in provider_budget_exceeded warnings instead of raw provider error text.
Description
Summary
executionSuccessfulmetadata.Motivation and Scope
Issue #1027 reports that a review with one timed-out file produces a partial result but exits with status
0. That makes CI unable to distinguish complete coverage from an operationally incomplete review.The previous aggregate exit logic returned an error only for a fully failed manifest. This PR narrows the successful partial case to declared budget limits and makes other operational review-item failures visible to CI without discarding usable output from completed review items.
Implementation
reviewManifestRequiresNonZeroExitpolicy for terminal manifest evaluation.review incompletewith selected/failed item counts for operational partial failures.Compatibility and User Impact
0.0.1, allowing CI to detect incomplete coverage.Type of Change
How Has This Been Tested?
Initial Validation Environment
go1.26.5 windows/amd64cfbb62e2296d7684dc648e27fe1b906e8c960f9cInitial Automated Validation
make checktarget throughmingw32-make: license headers, English-only source check,go mod tidy, formatting, andgo vetmake testtarget throughmingw32-make: complete Go test suite with the race detectormake coveragetarget throughmingw32-make: 90.6% total statement coverage, above the required 90%git diff --checkDocumentation Completion and Main Sync
The Korean CLI reference and FAQ now describe operational partial failures, preserved review output, and budget-only partial success, matching the other four locales.
070805f86cc6ae4b987bfe733dfc14ecd5bb803ainecbf7dab0b6dfe89e7d0fef181592e698d063db1. The two retry-report E2E assertions now match upstream's four-file fixture.91b3bfa4452aaae710d6e4157f4cf4f40ed7ac69.make check,make testforcmd/opencodereviewandinternal/agentwith the race detector, and fullmake coveragepassed. Total statement coverage is 91.1%.git diff --checkpassed.Regression Coverage
The repository-requested self-review completed successfully:
Checklist
go fmt,go vet)Known Limitations
Related Issues
Closes #1027.