Skip to content

Auto-review local signal is lost across restart #349

@cbusillo

Description

@cbusillo

Summary

Auto-review did not provide a reliable visible signal for PR #348 (Fix resume replay after history snapshots) at merge-decision time.

PR: #348
Head commit: 4db78b88dc012a27c66b95d055221107c87277d9
Merge commit: f034774cbc2ab39b61ac71a29094a62e080869c1

Updated diagnosis

This is not currently a GitHub PR-commenting/review-posting failure. The codebase appears to implement auto-review as a local TUI background agent flow:

  • run_background_review creates an Every Code agent with AgentSourceKind::AutoReview.
  • TUI observes agent status and writes ~/.code/state/review/.../auto-review/runs.json.
  • Results surface through TUI footer/notices and the local review ledger.
  • I did not find a code path that posts auto-review output as a GitHub PR comment or GitHub review.

The concrete issue is that the local/TUI auto-review signal can disappear or be stale around restarts, so the user cannot tell whether the current PR/change was reviewed.

Evidence from PR #348 session

GitHub state after #348:

  • gh pr view 348 --json comments,reviews,statusCheckRollup,reviewDecision showed no PR comments and no reviews.
  • GitHub Blob size policy completed successfully.
  • PR was mergeable and later merged.

Local auto-review store for this repo (~/.code/state/review/repo-a093bd7f/auto-review/runs.json) did contain chatwidget.rs runs from the same session, but the latest relevant run was lost after restart:

{
  "run_id": "1e5138bb-ee8a-4e1c-80c0-eb360d7b631c",
  "status": "lost",
  "freshness": "lost",
  "owner_session_id": "8e18be4f-ff91-4264-a402-d89aa6741cbc",
  "agent_id": "7bfd3c0a-41c7-451a-83ee-460c312947f1",
  "branch": "auto-review",
  "snapshot_commit": "12b9231d1c8fb41bc5a84a9018450119d69c9677",
  "base_commit": "45e92129fb94d3bdf24d014a8f7a18ce4fbb3691",
  "changed_path_count": 1,
  "listed_paths": ["code-rs/tui/src/chatwidget.rs"],
  "cancel_reason": "agent_missing_after_restart"
}

There were also older chatwidget.rs auto-review runs in the store, including completed/cancelled runs, but none provided a clear current review signal for the final PR state after restart.

Expected

After restart, Every Code should preserve or clearly restore the review state enough that the user can answer:

  • Did auto-review run for the current change/snapshot?
  • Is the latest review current, stale, lost, or superseded?
  • If lost, should the TUI surface a retry/notice instead of silently leaving the user to infer from the local store?

Candidate fix direction

Investigate the restart reconciliation path:

  • ChatWidget::reconcile_auto_review_store_after_restart() currently calls reconcile_orphaned_in_flight(std::iter::empty::<&str>(), now), which marks all in-flight review agents as lost because no live agent IDs are supplied.
  • Determine whether restart can recover live agents from AGENT_MANAGER, or whether the TUI should surface a visible “auto review lost after restart; rerun review” notice/status for the latest relevant run.
  • Consider whether merge-decision workflows should consult the local auto-review ledger instead of expecting GitHub comments/reviews.

Validation already done for PR #348 code fix

  • cargo test --manifest-path code-rs/Cargo.toml -p code-tui replay_snapshot --features test-helpers
  • ./build-fast.sh
  • local read-only agent reviews against the replay patch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions