{"record":{"id":"0fb21f9a8694eb5a","repo":"alibaba/open-code-review","slug":"resolve-current-input-identity-w","errorCode":null,"errorMessage":"resolve current input identity: %w","messagePattern":"resolve current input identity: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/opencodereview/review_cmd.go","lineNumber":395,"sourceCode":"// so a provider that changed via config file or environment stays implicit —\n// which is the transition this check exists to reject.\nfunc validateResumeIdentity(ctx context.Context, cc *commonContext, opts reviewOptions, rt *llmRuntime, state *session.ResumeState) (*agent.SealedInput, error) {\n\tif state == nil {\n\t\treturn nil, nil\n\t}\n\tsealed, err := agent.ResolveIdentity(ctx, agent.Args{\n\t\tRepoDir:    cc.RepoDir,\n\t\tFrom:       opts.from,\n\t\tTo:         opts.to,\n\t\tCommit:     opts.commit,\n\t\tReviewMode: reviewModeFromOptions(opts),\n\t\tTemplate:   *cc.Template,\n\t\tSystemRule: cc.Resolver,\n\t\tFileFilter: cc.FileFilter,\n\t\tGitRunner:  cc.GitRunner,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"resolve current input identity: %w\", err)\n\t}\n\tif err := state.ValidateResume(session.ResumeRequest{\n\t\tIdentity:         sealed.Identity,\n\t\tProvider:         rt.Provider,\n\t\tModel:            rt.Model,\n\t\tProviderExplicit: opts.provider != \"\",\n\t\tModelExplicit:    opts.model != \"\",\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\treturn sealed, nil\n}\n\n// fileReadRef picks the ref file_read resolves paths against.\n//\n// A sealed input replaces the ref the user typed with the commit that ref\n// resolved to at admission. The diff under review is pinned to that same commit,\n// so leaving the reader on a moving ref would let the model read one version of a","sourceCodeStart":377,"sourceCodeEnd":413,"githubUrl":"https://github.com/alibaba/open-code-review/blob/5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f/cmd/opencodereview/review_cmd.go#L377-L413","documentation":"validateResumeIdentity re-derives the input identity of the current invocation (via agent.ResolveIdentity) so it can be compared against the saved resume state. If identity resolution itself fails — e.g. the diff or git data cannot be recomputed — the error is wrapped as \"resolve current input identity\". It signals that a resume cannot even be validated, before any mismatch check runs.","triggerScenarios":"Running `ocr review --resume` (validateResumeIdentity called from executeReviewContext or an anonymous runner) when agent.ResolveIdentity fails: bad --from/--to/--commit refs, git command failures, unreadable repo, or template/rule loading problems.","commonSituations":"Resuming a review after the branch or commits the resume state pointed at were rebased/deleted; running resume outside the original repo; broken git worktree.","solutions":["Fix the underlying git/ref error reported by the wrapped %w cause (e.g. use refs that still resolve via `git rev-parse <ref>^{commit}`).","Run `git status`/`git rev-parse --git-dir` in the repo to confirm the repository is intact before resuming.","If the original inputs are gone, discard the resume state and start a fresh review instead of resuming."],"exampleFix":"// before\nocr review --resume --from deleted-branch --to main\n// after\ngit rev-parse --verify deleted-branch^{commit}  # fails -> rebase happened\nocr review --from origin/main --to HEAD         # fresh run instead of resume","handlingStrategy":"validation","validationCode":"if !gitRevParseOK(repoDir, from) || !gitRevParseOK(repoDir, to) {\n    return errors.New(\"resume refs no longer resolve; start a fresh review\")\n}","typeGuard":null,"tryCatchPattern":"sealed, err := validateResumeIdentity(ctx, cc, opts, rt, state)\nif err != nil {\n    var mergeErr *session.IdentityMismatchError\n    if errors.As(err, &mergeErr) { /* prompt fresh run */ }\n    return fmt.Errorf(\"cannot resume: %w\", err)\n}","preventionTips":["Confirm resume refs still resolve (`git rev-parse <ref>^{commit}`) before resuming.","Avoid rebasing/deleting branches referenced by an in-flight resume state.","Run resume commands from the same repo/worktree as the original run."],"tags":["git","resume","identity"],"backgroundTag":"resume-input-identity-mismatch","analyzedSha":"5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f","analyzedAt":"2026-09-02T02:08:09.116Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}