alibaba/open-code-review · error

resume session %q recorded operation %q, not %q; %s

Error message

resume session %q recorded operation %q, not %q; %s

What it means

validateInputIdentity rejects resuming a session whose manifest records an operation other than review (OperationReview). Resume is only defined for review runs; a manifest tagged with a different operation has incompatible semantics and input layout, so verification is refused.

Source

Thrown at internal/session/resume_identity.go:99

		return nil
	}

	m := s.Manifest
	switch {
	case m == nil && !s.Closed:
		// Distinguishing all of these from "manifest present, zero completed
		// items" is the whole point: that one is resumable, none of these are.
		return fmt.Errorf("resume session %q was interrupted before it closed, so it never recorded a run manifest and its input identity cannot be verified; %s", s.SessionID, resumeHint)
	case m == nil:
		// It closed cleanly, so blaming an interruption would send the user
		// looking for a crash that never happened. A session_end with no manifest
		// is a session older than run manifests, or a run that failed before
		// freezing one.
		return fmt.Errorf("resume session %q closed without a run manifest, so its input identity cannot be verified — it either predates run manifests or failed before recording one; %s", s.SessionID, resumeHint)
	case m.SchemaVersion != ManifestSchemaVersion:
		return fmt.Errorf("resume session %q carries manifest schema %q, but this build can only verify %q; %s", s.SessionID, m.SchemaVersion, ManifestSchemaVersion, resumeHint)
	case m.Operation != OperationReview:
		return fmt.Errorf("resume session %q recorded operation %q, not %q; %s", s.SessionID, m.Operation, OperationReview, resumeHint)
	case len(m.Coverage.Selected) == 0:
		// Without this, an empty parent and an empty child would both hash to the
		// canonical empty digest, pass every comparison, and produce a run that
		// reuses nothing and dispatches nothing.
		return fmt.Errorf("resume session %q selected no input, so it has nothing to resume; %s", s.SessionID, resumeHint)
	}

	if m.Input.Mode != id.Mode {
		// Mode feeds item_id derivation, so parent and child items cannot even be
		// put side by side.
		return fmt.Errorf("resume rejected: input mode changed from %q to %q; %s", m.Input.Mode, id.Mode, resumeHint)
	}
	// Both sides empty means a repository with no remote, which is unchanged.
	if m.Repository.IdentitySHA256 != id.RepositorySHA256 {
		return fmt.Errorf("resume rejected: repository identity changed, so this is not the repository the parent run reviewed; %s", resumeHint)
	}
	if m.Input.SourceArtifactSHA256 != id.SourceArtifactSHA256 {
		return fmt.Errorf("resume rejected: the reviewed input changed since session %q — a ref may now point at a different commit, or the selected file set changed; %s", s.SessionID, resumeHint)

View on GitHub (pinned to 5cf97d0d15)

Solutions

  1. Verify the session ID refers to a review session; list sessions and pick the correct one
  2. Run the intended operation again instead of resuming a non-review session
  3. Start a new review if the target session was never a review run

Example fix

// before
ocr review --resume ops-session-id   # wrong session (not a review)
// after
ocr review --resume review-session-id  # pick a session whose operation is review
Defensive patterns

Strategy: validation

Validate before calling

// Only resume sessions recorded as review operations
if sess.Manifest != nil && sess.Manifest.Operation != session.OperationReview {
    return fmt.Errorf("session %s is a %q run, not a review", sess.SessionID, sess.Manifest.Operation)
}

Type guard

func isReviewSession(m *session.Manifest) bool {
    return m != nil && m.Operation == session.OperationReview
}

Try / catch

if err := ValidateResume(s, req); err != nil {
    if strings.Contains(err.Error(), "recorded operation") {
        return fmt.Errorf("wrong session ID: pick a review session")
    }
    return err
}

Prevention

When it happens

Trigger: ValidateResume where m.Operation != OperationReview — e.g. pointing --resume at a session created by a non-review command that shares the session store.

Common situations: User passes the wrong session ID (a session from another subcommand); a future/other operation type wrote to the same store and the user assumed all sessions are resumable reviews.

Related errors


AI-assisted analysis of alibaba/open-code-review@5cf97d0d15 (2026-09-02). Data as JSON: /api/errors/1d192b9ff09fc600. Report an issue: GitHub.