Skip to content

feat(review): support --resume for workspace-mode reviews #1880

Closed

Description

@happy-v587

Problem Statement

Workspace-mode reviews (ocr review with no --from/--to or --commit) cannot be resumed with --resume. An interrupted large workspace review loses all completed-file progress.

Reproduction:

  1. Start a workspace review on a large changeset: ocr review
  2. Interrupt it (or have it end with partial status, e.g. due to LLM endpoint errors)
  3. Try to resume:
$ ocr session list
SESSION ID                            MODE       RANGE  FILES           COMMENTS  STATUS   STARTED
1af4484a-9811-43c4-aeef-9975f42f3c14  workspace  -      49 (failed 22)  10        partial  2026-11-08 19:36:01

$ ocr review --resume 1af4484a-9811-43c4-aeef-9975f42f3c14
Error: resume requires --from/--to or --commit; workspace resume is not supported

Version: open-code-review v1.13.6 (891df1b6) (latest as of 2026-11-05).

The CLI docs and README describe --resume as resuming "an interrupted range or commit review", so workspace sessions seem to be silently out of scope.

Proposed Solution

ocr review --resume <session-id> should resume a partial workspace-mode session, skipping already-completed files and retrying the failed ones, consistent with the documented resume behavior for range/commit reviews and ocr scan --resume. This could likely reuse the same session-store item fingerprint logic as range/scan resume.

Alternatives Considered

Re-run ocr review as a fresh session; all previously completed files are re-reviewed, costing tokens. Existing comments remain viewable via ocr viewer / ocr session comments, but the review work is not reused.

Affected Area

  • CLI / Commands

Additional Context

None beyond the above; happy to provide more session details if useful.

Activity

  1. naivezip commented on Nov 11, 2026

    @naivezip

    if nobody is working on it, plz let me try to fix it.

  2. Walternater commented on Nov 13, 2026

    @Walternater
    Contributor

    I'd like to pick this up if nobody has started. @naivezip, are you still planning to take it? I don't see a branch or PR for it yet.

    I scoped the implementation against main (6386895) and the good news is that most of the machinery already exists: file-level fingerprints, input.mode=workspace with resolved_base (current HEAD) in the run manifest, JSONL checkpoints, and the applyResume / ReusableItem reuse path all work mode-agnostically. What blocks workspace resume today:

    • cmd/opencodereview/review_cmd.go rejects it early in loadReviewResumeState
    • session.ResumeState.ValidateOptions rejects ReviewModeWorkspace
    • session.ResumeState.ValidateResume compares comparison endpoints only for range/commit modes

    The design question I'd like to settle before writing code: a workspace is mutable, while resume currently requires the full input identity (source_artifact_sha256, a hash over the selected diffs) to match. So a strict v1 would allow resume only when the working tree is unchanged since the parent run — e.g. an interrupted run with no edits in between — and would still reuse per-file via the existing fingerprints. Any edit/new file after the interruption rejects the whole resume (with the existing "start a new review instead" hint). The alternative — allow edits and reuse only matching fingerprints — weakens the "never mix results computed from two different inputs" invariant that ValidateResume is built around.

    My suggestion is strict v1 plus a resolved_base (HEAD) comparison for workspace, with the docs updated (they currently state that workspace reviews cannot be resumed). I'm happy to open a PR with tests for this if that matches what you'd want.

    Disclosure: AI-assisted investigation and draft; no code written yet.

  3. Walternater commented on Nov 13, 2026

    @Walternater
    Contributor

    Since there is no branch/PR yet, I'll start on this now with the strict semantics described above (workspace unchanged + HEAD pinned, per-file reuse via existing fingerprints, docs updated). @naivezip if you have already started somewhere, ping me here and I'll hand it over.

    Disclosure: AI-assisted implementation; I'll review and answer maintainer comments myself.

  4. naivezip commented on Nov 13, 2026

    @naivezip

    yes, I am working on it, I now have a working implementation in my local repo (branch fix/review-support-resume-for-workspace-mode-reviews), with unit and E2E tests in place. Here is my plan:

    1. CLI target inference (ocr review --resume <id> without target flags)

      • Resolve the git top-level repo directory before loading the session, then infer workspace / range / commit mode and target flags (--from/--to, --commit) from the saved ResumeState, while rejecting conflicting target flags with a parameter conflict error.
    2. Workspace validation via base-commit ancestry + reusable overlap

      • Because a workspace has no immutable commit endpoint, a user may switch branches at the same commit, edit a few files, or commit part of their work after an interruption. Instead of matching the whole SourceArtifactSHA256, workspace resume enforces:
        • Base-commit ancestry (validateWorkspaceBase): record HEAD as ResolvedBase (input.resolved_base). On resume, require HEAD to either equal parentBase or descend from it (git merge-base --is-ancestor parentBase currentHead). Unborn repos, history rollbacks, and diverged/orphan branches are rejected.
        • Strict repo and rule identity: RepositorySHA256 and RuleConfigSHA256 must still match.
        • At least one reusable file (hasReusableItem): at least one currently selected non-deleted diff fingerprint must still match a Completed or Reused item in the parent manifest.
    3. Per-file runtime reuse on the live workspace

      • Unchanged uncommitted files reuse cached comments via reviewItemFingerprint with zero LLM calls; edited, newly added, or hunk-shifted files are reviewed again, and finalizeManifest updates ResolvedBase to the new HEAD for chained resumes.

    I saw you opened #1922 with the strict unchanged-worktree rule (SourceArtifactSHA256 + ResolvedBase). I'll finish syncing the docs and open my PR shortly so maintainers can decide between strict unchanged-worktree enforcement (#1922) and base-commit ancestry + per-file incremental reuse.
    And I use Antigravity + gemini 3.8 flash and gemini 4 hydrogen;I reviewed the code and design trade-offs myself.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions