Skip to content

Persist Guided Reviews across sessions for PRs and branches #1112

Closed

Description

@alexanderkreidich

Problem

Guided Reviews are currently stored only in the running review server's memory. After Plannotator closes, reopening the same review with /plannotator-review <PR> or /plannotator-review from the same branch loses the generated guide and its per-section Reviewed state. The user must spend time and AI tokens generating the same guide again.

Durable guide persistence was intentionally left out of Guided Review v1, but it is important for using a guide as an ongoing review artifact that can be revisited later.

Proposed behavior

Persist successful Guided Reviews locally under PLANNOTATOR_DATA_DIR and associate them with the review target:

  • PR review: identify by canonical repository and PR number, while recording the PR head repository, branch, and revision/fingerprint.
  • Local branch review: identify by canonical repository and branch name, while recording the revision/diff fingerprint used to generate the guide.
  • When a PR's head branch can be reliably matched to the current local branch, the PR and branch review should discover and reuse the same saved guide.
  • Repository identity must be part of the key so branches with the same name in different repositories never share a guide.

When the user reopens /plannotator-review <PR> or runs /plannotator-review again from that branch, the existing guide should be available without launching another agent job.

Persist both:

  1. The generated guide content.
  2. The per-section Reviewed state.

Staleness behavior

A saved guide should remain accessible when the PR or branch has changed since generation:

  • Compare its saved revision/diff fingerprint with the currently reviewed changeset.
  • If they differ, show the saved guide with a clear Outdated warning.
  • Offer a Regenerate guide action; do not regenerate automatically.
  • Keep the old guide available if regeneration fails. Replace the active saved guide only after a new guide is generated successfully.

This lets users retain useful context and decide whether new commits warrant another AI run.

Acceptance criteria

  • A successfully generated Guided Review survives closing and restarting Plannotator.
  • Reopening the same PR makes its saved guide available without starting a new guide-generation job.
  • Running /plannotator-review again on the same local branch makes its saved guide available without starting a new guide-generation job.
  • A PR review and a local review of its matching head branch reuse the same saved guide when Plannotator can reliably establish that identity.
  • Guides are not reused across unrelated repositories or branches.
  • Per-section Reviewed state is saved and restored.
  • A changed PR head or branch diff shows the previous guide as Outdated rather than discarding or automatically regenerating it.
  • The stale state provides an explicit Regenerate guide action.
  • Failed regeneration does not overwrite the last successfully saved guide.
  • Missing or invalid persisted data fails gracefully and still allows generating a new guide.
  • Persistence works in both server implementations (Bun and Pi/Node).
  • Storage respects PLANNOTATOR_DATA_DIR.

Notes

The current createGuideSession() keeps guide results and reviewed state in in-memory maps keyed by ephemeral job ID. Durable storage will need a stable review-target identity in addition to the existing session/job lookup.

Cloud sync and publishing guide content to the PR are not required; this can remain local Plannotator data.

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