Skip to content

fix(vscode): show partial and failed reviews as failed, not "No issues found" - #1882

Merged
lizhengfeng101 merged 4 commits into
alibaba:mainfrom
divya0795:fix/vscode-partial-review-state
Nov 16, 2026
Merged

lizhengfeng101 merged 4 commits into
alibaba:mainfrom
divya0795:fix/vscode-partial-review-state

Conversation

@divya0795

Copy link
Copy Markdown
Contributor

Description

The VS Code extension shows a partially failed review as "No issues found".

ocr review --format json reports the manifest terminal state in status: complete, partial, failed or skipped (cmd/opencodereview/output.go:403-405, values from internal/session/manifest.go:166-169). completed_with_errors is only set when there is no manifest, which is the ocr scan path. resultToState in the extension only checks for completed_with_errors:

// extensions/vscode/src/extension/services/ReviewSession.ts:7-11
export function resultToState(result: CliResult): ReviewState {
  if (result.comments.length > 0) return 'done';
  if (result.status === 'completed_with_errors') return 'failed';
  return 'empty';
}

partial exits 0 by design (reviewResultError, review_cmd.go:339-345), so the CLI promise resolves normally. Example: 2 of 5 selected files fail with an LLM error and the other 3 have no findings. The result is status: "partial" with no comments, and the sidebar shows the empty "No issues found" view. Three files were never reviewed. The IntelliJ plugin already treats partial/failed as failed (extensions/idea/.../services/ReviewSession.kt:15-25).

Fix: treat completed_with_errors, partial and failed as not-clean when there are no comments. Also pass the CLI's message to the failed state, so the Failed view says why. That matches what the IntelliJ side does. Results with comments still show as done, and complete/skipped/success without comments still show the empty view.

Behaviour before and after, for every status (output of a throwaway jest run against the old and new resultToState):

status                  comments  old     new
complete                0         empty   empty
complete                1         done    done
partial                 0         empty   failed   <- changed
partial                 1         done    done
failed                  0         empty   failed   <- changed
failed                  1         done    done
skipped                 0         empty   empty
skipped                 1         done    done
success                 0         empty   empty
success                 1         done    done
completed_with_errors   0         failed  failed
completed_with_errors   1         done    done
completed_with_warnings 0         empty   empty
completed_with_warnings 1         done    done

(failed normally exits non-zero and is caught as an error already. It is listed for completeness.)

To confirm that the CLI emits the manifest vocabulary, here is a real run of ocr review --format json --audience agent built from main, against an unreachable LLM endpoint:

ocr exit=1
status= failed | message= Review failed: 0 finding(s); 2 of 2 selected item(s) failed. | comments= None

Out of scope: the shared CliResult.status union in extensions/frontend/src/shared/types.ts still lists the older values. I left it alone because open PRs #1379 and #1519 touch that file. The Set<string> check here needs no type change.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring (no functional changes)
  • Documentation update
  • CI / Build / Tooling

How Has This Been Tested?

  • Added 4 resultToState cases and 1 ReviewSession.run case. Before the fix, 3 of them failed (partial/failed without comments → "empty", and run reported no failure). After the fix, all pass.

  • Ran the vscode-ext CI steps locally on Node 24.22.1, the version CI uses: yarn install --frozen-lockfile, yarn lint, yarn compile and yarn test. Baseline on main was 11 suites / 99 tests passing. With the fix it is 11 suites / 104 tests passing, lint is clean and the compile succeeds.

  • make test passes locally (Go side untouched; the extension's own CI gate is above)

  • Manual testing (describe below)

Checklist

  • My code follows the project's coding style (go fmt, go vet)
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly (if applicable)
  • I have signed the CLA
  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

AI disclosure: I found this issue and drafted the fix and tests with Claude Code (Claude Opus 5.5). The commit has no AI attribution.

Related Issues

None. I searched issues and PRs for "resultToState", "No issues found partial", "vscode partial review" and "partial status vscode empty" and found nothing. No open PR touches ReviewSession.ts.

🤖 Generated with Claude Code

…s found"

ocr review reports the manifest terminal state (complete, partial, failed,
skipped), but resultToState only recognised completed_with_errors, so a
partial review with no findings was shown as a clean pass.
@CLAassistant

CLAassistant commented Nov 9, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🔍 OpenCodeReview found 2 issue(s) in this PR.

  • ✅ Successfully posted inline: 2 comment(s)

Comment on lines +7 to +9
// `ocr review` reports the manifest terminal state (complete | partial | failed | skipped);
// completed_with_errors is the manifest-less status. None of these is a clean pass.
const INCOMPLETE_STATUSES: ReadonlySet<string> = new Set(['completed_with_errors', 'partial', 'failed']);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

documentation · low
The comment states "None of these is a clean pass", implying skipped should also be treated as incomplete/failed. However, skipped is not included in INCOMPLETE_STATUSES, and the test at line 14-15 confirms that skipped maps to 'empty' rather than 'failed'. Either the comment is misleading and should clarify that skipped is intentionally excluded (e.g., "None of the error statuses is a clean pass"), or skipped should be added to the set.


// `ocr review` reports the manifest terminal state (complete | partial | failed | skipped);
// completed_with_errors is the manifest-less status. None of these is a clean pass.
const INCOMPLETE_STATUSES: ReadonlySet<string> = new Set(['completed_with_errors', 'partial', 'failed']);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

bug · medium
The CliResult.status type (defined in shared/types.ts) only includes 'success' | 'completed_with_errors' | 'completed_with_warnings' | 'skipped', but this set also checks for 'partial' and 'failed'. While the runtime behavior is correct (the set is ReadonlySet<string> so it accepts any string), the type definition is out of sync with actual CLI output. The tests confirm this by needing as any casts for these values.

Consider updating CliResult.status to include 'partial' | 'failed' (and potentially 'complete') so that callers get proper type coverage and the as any casts in tests can be removed.

@lizhengfeng101

Copy link
Copy Markdown
Contributor

Please preserve access to the review process logs before merging this PR.

The status correction is right, but it also changes which result view is displayed in the VS Code extension sidebar (not the standalone HTML result viewer):

  • Previously, a partial result with no comments reached EmptyView. Although its "No issues found" message was incorrect, users could still expand the process logs after the run.
  • With this change, the same result reaches FailedView, which receives the error message but has no log viewer. Users see an aggregate message such as "2 of 5 selected items failed" but can no longer inspect the existing process logs to investigate what happened.

The logs remain in frontend state; the new result view simply does not expose them. See the different props passed to the two views in App.tsx and the current FailedView.

Please keep the corrected failed state and CLI message, pass the existing logs into FailedView, and provide an expandable log viewer there. Please also add regression coverage showing that a partial result with no comments remains failed while its process logs are still accessible after completion.

AI assistance disclosure: drafted with Codex; the model identifier is not available in this session.

@lizhengfeng101

Copy link
Copy Markdown
Contributor

@divya0795 Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

A partial review with no comments now reaches FailedView instead of
EmptyView. FailedView had no log viewer, so the run's process log,
still held in webview state, could no longer be opened.

Pass state.logs to FailedView and give it the same expandable
"Process log" disclosure as EmptyView and DoneView, with a
view.failed.processLog string in every locale. Add a regression test
that drives the reducer through a partial run and renders FailedView
(preact-render-to-string, dev-only) to check the toggle is offered.

Also reword the ReviewSession status comment, which read as if
complete and skipped were not clean passes.

@NanaseInori NanaseInori left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The status correction is justified: a partial review without findings must not be presented as a clean result. I checked the two-file diff, SidebarProvider's callbacks, the frontend reducer and the destination view. The reducer preserves the failed state when reviewDone arrives, so the new routing does take effect.

[P2] Preserve the existing process-log access on the new failure path. The maintainer's earlier request remains unresolved at this head. App.tsx passes logs to EmptyView but supplies only error/onRetry to FailedView, and FailedView contains no log viewer. Consequently the newly rerouted partial/zero-finding result loses the post-run diagnostics that were previously accessible, precisely when users need to inspect the failed groups.

Please keep the corrected status and CLI message, pass the retained logs into FailedView, render an expandable log viewer, and add a frontend regression proving that a completed partial run remains failed while its logs stay accessible. The existing helper/session tests cannot detect this view-level regression.

References: maintainer request, view routing, FailedView.

The symptom-focused duplicate search returned only this PR. The stale shared status union and the comment wording can be cleaned up, but they are not the runtime blocker described above. This was a source review; I did not run the extension suites locally.

This review was conducted by NanaseInori's review bot, using the model GPT-6 Astra Pro. If you need a human review, please manually @NanaseInori.

@abhisheksharma2411 abhisheksharma2411 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice find — the before/after table made this easy to follow, and keeping the process log reachable from the failed view is a good addition.

Two things I noticed while reading, both about the IntelliJ side you're matching.

The supportedReviewStatuses clause didn't come across. ReviewSession.kt has two rules, and the first one runs before the comments check:

result.status !in supportedReviewStatuses -> ReviewState.FAILED
result.comments.isNotEmpty() -> ReviewState.DONE
result.status in setOf("completed_with_errors", "partial", "failed") -> ReviewState.FAILED
else -> ReviewState.EMPTY

with the comment "Only recognized, non-failing terminal results can report an empty review." The TS version after this PR falls through to 'empty' for anything it doesn't recognise, so a status outside the set and no comments still shows "No issues found" — the same shape as the bug you're fixing. An empty status from a truncated JSON read lands there too. Adding a known-statuses set and failing on anything outside it would close that, and it's a couple of lines.

The type still says partial can't happen. CliResult.status in shared/types.ts is 'success' | 'completed_with_errors' | 'completed_with_warnings' | 'skipped' — no complete, partial or failed, which is why each new test needs status: 'partial' as any. supportedReviewStatuses on the Kotlin side lists all seven, and output.go can emit all seven ("success" at :361 and :381, completed_with_errors / completed_with_warnings at :420-422, and the four manifest states at :405). Widening the union would drop the casts and let INCOMPLETE_STATUSES be typed rather than ReadonlySet<string>.

Small one: expect(html).toContain('Process log') pins the English copy, and the logs-toggle assertion on the next line already covers that the toggle rendered — worth dropping one of them so a reworded string doesn't fail the test.

I read the code rather than ran it, so take the first one as "this is what the three lines do" rather than a reproduction.

resultToState fell through to 'empty' for any status it did not know, so
a result with a missing or unrecognized status and no comments still
showed "No issues found". Mirror the IntelliJ plugin's resultToState:
only a recognized, non-failing status may report an empty review; a
missing or unknown one is a failure, checked before the comments.

Widen CliResult.status to the seven statuses cmd/opencodereview/output.go
emits (adds complete, partial and failed), type both status sets, and
drop the `as any` casts the tests needed for those values. The FailedView
test no longer pins the English "Process log" label; the logs-toggle
assertion already covers that the toggle rendered.
@divya0795

Copy link
Copy Markdown
Contributor Author

Thanks for the reviews. Both follow-ups are pushed.

Process log on the failed view, for @lizhengfeng101 and NanaseInori's review: e6583a3

  • App.tsx now passes state.logs to FailedView. It has the same expandable "Process log" disclosure as EmptyView and DoneView, with a view.failed.processLog string in all five locales.
  • The corrected failed state and the CLI message are unchanged.
  • New test extensions/frontend/src/webview/__tests__/FailedView.test.ts:
    • It drives the reducer through a completed partial run with no comments and checks that it stays failed with its logs kept.
    • It then renders FailedView and checks that the log toggle is offered.
    • It failed on the previous head (logs kept, no toggle) and passes now.
    • Rendering needed preact-render-to-string as a dev-only dependency, pinned to 6.8.1.
  • The same commit rewords the status comment the bot flagged as ambiguous.

IntelliJ parity and the status type, for @abhisheksharma2411: be3c88c

Local results on Node 24.22.1:

  • Webview: typecheck clean, 65/65 tests, and OCR_TARGET=vscode|idea npm run build both compile.
  • VS Code extension: lint, compile and tsc --noEmit clean, 109/109 tests.

The workflow runs on this PR are waiting for approval because this is my first contribution here. Could a maintainer approve them?

AI disclosure: these changes and this reply were drafted with Claude Code (Claude Opus 5.5).

@lizhengfeng101 lizhengfeng101 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants