-
Notifications
You must be signed in to change notification settings - Fork 0
feat: resume reviewer sessions across review rounds #530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2efaa77
feat: resume pull request reviewer sessions
rianjs 5f1acc5
fix: restore checkpointed discussion context
rianjs 13e683d
fix: resume Codex reviewers in fresh workspaces
rianjs 1db9505
fix: persist durable reviewer sessions
rianjs 8867e1d
fix: keep resumable LLM sessions durable
rianjs 45fe3c8
fix: preserve the orchestrator conversation chain
rianjs 45e3ab1
fix: address resumable review feedback
rianjs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| # Review Lifecycle | ||
|
|
||
| This document is the canonical end-to-end lifecycle for `cr review`. It covers | ||
| the resumable reviewer sessions and early thread checkpoints introduced by | ||
| issue #529. Task artifact details remain in | ||
| [llm-task-artifacts.md](llm-task-artifacts.md). | ||
|
|
||
| ## State ownership | ||
|
|
||
| | State | Scope | Authority | | ||
| |---|---|---| | ||
| | Review run, findings, and planned actions | PR head/base, profile, posting identity, attempt | Local ledger and run artifacts | | ||
| | Reviewer cohort and reviewer provider sessions | PR, profile, posting identity | Local ledger | | ||
| | Default orchestrator session | PR, profile, posting identity | Local named-session row | | ||
| | Explicit `--session` orchestrator session | Supplied name | Local named-session row | | ||
| | Posted thread summary | Posting identity and inline thread | PR marker; local action/task state is fallback until posting succeeds | | ||
| | Posted review actions | Run and action marker | PR state reconciled with the local outbox | | ||
|
|
||
| The reviewer cohort is ordered and fixed after its first selection. Each member | ||
| stores its agent ID, broad or scoped assignment, runtime compatibility fields, | ||
| and latest provider session ID. The explicit `--session` flag never changes the | ||
| reviewer cohort's PR scope. | ||
|
|
||
| ## First run | ||
|
|
||
| 1. Resolve the PR, changed files, discussion, reviewer catalog, and runtime. | ||
| 2. Run selection on the orchestrator provider session. | ||
| 3. Persist the selected reviewer cohort before starting reviewers. | ||
| 4. Analyze eligible human replies sequentially on the same orchestrator | ||
| session. | ||
| 5. Persist thread reply and resolution actions, then run the partial outbox. | ||
| Replies are attempted before resolutions. The run remains open. | ||
| 6. Give every active reviewer the analyzed discussion outcome and actual early | ||
| action status (`posted`, `pending`, or dry-run-only), then run reviewers. | ||
| 7. Run rollup on the latest orchestrator provider session, merge final planning | ||
| around the early action IDs and statuses, and run the final outbox. | ||
|
|
||
| A scoped cohort member whose rebased assignment is empty remains in the cohort | ||
| but does not receive a no-op LLM call. | ||
|
|
||
| ## Later runs and `--rerun` | ||
|
|
||
| Plain follow-up runs and `--rerun` both load the original PR-scoped cohort, | ||
| validate every member against the current catalog and reviewer runtime, and | ||
| deterministically rebase assignments onto the current changed files. Selection | ||
| does not run again. Active reviewers resume their exact saved provider session. | ||
|
|
||
| `--rerun` changes local gate behavior only: it bypasses approval, override, | ||
| resume, and marker gates to allocate a new review attempt. It does not select a | ||
| new cohort or start new provider conversations. | ||
|
|
||
| Reuse fails with `--fresh-session` guidance when a cohort member is missing or | ||
| runtime-incompatible, `--max-agents` is smaller than the saved cohort, or the | ||
| cohort cannot cover every changed file. | ||
|
|
||
| ## `--fresh-session` | ||
|
|
||
| `--fresh-session` clears the active PR-scoped reviewer cohort for this review, | ||
| does not resume the orchestrator provider session, runs selection again, and | ||
| persists the replacement cohort. It can be combined with `--rerun` when both | ||
| gate bypass and new reviewer/orchestrator conversations are required. | ||
|
|
||
| ## Interrupted-run recovery | ||
|
|
||
| Structured LLM task metadata resumes an interrupted task inside the same run. | ||
| If interruption occurs after early thread actions are persisted, those actions | ||
| are valid partial planning state: recovery retries/reconciles them and continues | ||
| the remaining planning phases. Final planning preserves their IDs, attempts, | ||
| posted state, and pending errors. | ||
|
|
||
| A posting-identity-authored `codereview:thread-summary` marker suppresses repeat | ||
| thread analysis. A newer human reply after that marker reopens the thread. Local | ||
| task and action state suppresses duplicate work only while the marked reply has | ||
| not reached the PR. | ||
|
|
||
| ## Failure and idempotency behavior | ||
|
|
||
| - Reviewer-local LLM failures remain isolated and retain any provider session | ||
| ID reported by the failed attempt. | ||
| - Early posting failures remain pending and do not prevent reviewer execution. | ||
| Final posting retries them. | ||
| - A moved head or base stops checkpoint posting before reviewer work. | ||
| - Outbox reconciliation checks markers before every dispatch, so a process | ||
| crash after a provider write but before the local update does not duplicate | ||
| the reply or final review. | ||
| - Thread replies are ordered before resolutions, and a resolution is not sent | ||
| until its reply is posted or reconciled. | ||
| - Completed summary markers on the PR outrank stale local fallback state. | ||
|
|
||
| `cr sessions` lists and manages named orchestrator sessions only. Reviewer | ||
| cohorts are automatic PR state and are replaced through | ||
| `cr review --fresh-session`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.