Plan Review Operations Rollout

Move plan-review activity into a durable local service while preserving the authoritative plan source on disk.

Part 1Context and choices

1.1 / Review decisions

Review decisions

The remaining choices set the persistence and rollout boundaries.

Decision

Where should review-event persistence live?

The first release runs locally, but the storage boundary should admit shared review later.

Where should review-event persistence live?

Compare the options

Choose one to continue

Ship the workspace behind a local feature flag?

Ship the workspace behind a local feature flag?

Lets maintainers exercise the full review loop before it becomes the default.

Proposed

Which event store should back the first release?

The store must preserve thread order, anchor updates, and crash-safe writes.

Which event store should back the first release?
CriterionSQLitePostgreSQL
Atomic review updates

A thread event and its latest anchor must commit together.

Strong

Transactions cover the event and anchor rows in one file.

Strong

Relational transactions provide the required boundary.

Local setup

Contributors should not need a separately managed database service.

No setup

The service opens the database directly.

Extra service

Every contributor must start and maintain a database server.

SQLite - Use one embedded database owned by the review service.
PostgreSQL - Run the same server store planned for shared review.

Reversibility · somewhat hard

The repository seam contains the code change, but persisted local data still needs a migration.

Part 2Architecture

2.1 / System shape

System shape

How one authoritative plan reaches the service, browser, and authoring agent.

Author

Plan sourceplans/review-rollout.mdx

Review

Local review servicesrc/review/service.ts
serves
notifies

Consume

Review document
Authoring agent
One source file, one feedback stream, and two coordinated readers.

Review acceptance can also cycle a plan back to its source before execution begins.

acceptrevisePlan sourceCompileReviewExecute
acceptrevisePlan sourceCompileReviewExecute
Mermaid LR diagram with 4 nodes and 4 edges Plan source, Compile, Review, Execute.
Review module layout
  • src/
    • review/
      • service.ts- Coordinates plan reads and review events.
      • repository.ts- Owns durable event transactions.
      • anchors.ts- Reconciles selections after source edits.
    • render/
      • shell/
        • viewer-script.ts- Sends review actions to the local service.
Planned changes+5~1
  • src/
    • review/Added
      Note
      New review-service vertical slice.
      • service.tsAdded
        Note
        Coordinates review workflows.
      • repository.tsAdded
        Note
        Persists ordered events.
    • render/
      • shell/
        • viewer-script.tsModified
          Note
          Connect review controls.
  • test/
    • review-service.spec.tsAdded
      Note
      Exercises the durable browser journey.
  • docs/
    • review-workflow.mdAdded
      Note
      Explains the local review loop.
Current
  • src/
    • render/
      • shell/
        • viewer-script.ts
          Note
          Connect review controls.
  • test/
  • docs/
Planned
  • src/
    • review/Added
      Note
      New review-service vertical slice.
      • service.tsAdded
        Note
        Coordinates review workflows.
      • repository.tsAdded
        Note
        Persists ordered events.
    • render/
      • shell/
        • viewer-script.tsModified
          Note
          Connect review controls.
  • test/
    • review-service.spec.tsAdded
      Note
      Exercises the durable browser journey.
  • docs/
    • review-workflow.mdAdded
      Note
      Explains the local review loop.
  • src/
    • review/
      Note
      New review-service vertical slice.
      • service.ts
        Note
        Coordinates review workflows.
      • repository.ts
        Note
        Persists ordered events.
    • render/
      • shell/
        • viewer-script.ts
          Note
          Connect review controls.
  • test/
    • review-service.spec.ts
      Note
      Exercises the durable browser journey.
  • docs/
    • review-workflow.md
      Note
      Explains the local review loop.
Part 3Implementation contracts

3.1 / Service contracts

Service contracts

The code, storage, and transport contracts that make review events durable.

src/review/service.ts
export const appendReviewEvent = async (
command: AppendReviewEvent,
): Promise<ReviewThread> =>
repository.transaction((tx) => tx.append(command));
src/render/shell/viewer-script.ts5 added, 1 removed
@@ -412,2 +412,6 @@ const saveDraft = async () => {
Removed line: sessionStorage.setItem(draftKey, body);
Added line: await reviewClient.append({
Added line: planId,
Added line: body,
Added line: selection: currentSelection(),
Added line: });
};
@@ -412,2 +412,6 @@ const saveDraft = async () => {
Removed line: sessionStorage.setItem(draftKey, body);
};
Added line: await reviewClient.append({
Added line: planId,
Added line: body,
Added line: selection: currentSelection(),
Added line: });
};
review.review_eventsAppend-only review events in durable thread order.
ColumnTypeConstraintsDefaultComment
idbigintPK·Identity·not null·INDX 1
plan_idtextnot null·INDX 1
thread_idtextnot null·INDX 1
kindtextnot nullcomment | reply | resolve | accept
bodytextnullable
anchor_jsontextnullable
created_attimestamptznot nullnow()
  • INDX 1review_events_thread_idxplan_id, thread_id, id
Rollout gates3 rows
GateOwnerError budgetEvidence
Event durabilityService0Crash-recovery integration test
Anchor reconciliationRenderer1Edited-source replay fixture
Workspace rolloutProduct2Maintainer dogfood sessions
POST /api/plans/{planId}/review-events Append one review event
Local review session

Persists one ordered event and its current source anchor in the same transaction. Clients use clientEventId to retry safely after a lost response.

planId string required

Stable identifier for the authoritative plan source.

application/json
threadId string required

Thread receiving the event.

clientEventId string required

Client-generated idempotency key for this append attempt.

kind comment | reply | resolve | accept required

Review action represented by the event.

body string optional

Comment or reply text. Omitted for resolve and accept events.

anchor SourceAnchor optional

Source location the event refers to, captured against the current plan revision.

{
  "threadId": "thr_01K1Q8WZ3B4N6M7P9R2T5V8X0Y",
  "clientEventId": "evt_client_01K1Q91C8Y2F6G4H7J3M5N0PQS",
  "kind": "comment",
  "body": "Keep the retry budget explicit in the service contract.",
  "anchor": {
    "path": "src/render/shell/viewer-script.ts",
    "startLine": 414,
    "endLine": 417,
    "planRevision": "sha256:7a1d56c4"
  }
}
201 Review event appended
{
  "eventId": "evt_01K1Q91DD5Z8A2B4C6E7F9G0HJ",
  "threadId": "thr_01K1Q8WZ3B4N6M7P9R2T5V8X0Y",
  "sequence": 7,
  "status": "open",
  "createdAt": "2026-08-05T19:42:11.392Z"
}
409 Thread changed before append
{
  "error": "thread_sequence_conflict",
  "expectedSequence": 6,
  "currentSequence": 7
}
422 Source anchor is invalid
{
  "error": "invalid_source_anchor",
  "field": "anchor.startLine",
  "message": "startLine must exist in plan revision sha256:7a1d56c4"
}
mutation reviewEventAppend
Requires plan write access
bigplan.v1.ReviewService
rpc WatchReviewEvents(WatchReviewEventsRequest) returns (stream ReviewEvent) Server streaming
Part 4Human validation

4.1 / Desired experience

Operator workspace

The operator opens unresolved threads, sees the selected plan excerpt, and records a resolution without leaving the review queue.

Local review queue
Review queueDesktop · 1200 × 820px workspace viewport
/plans/cache-rollout/review

Big Plan

Local review

Plan review

3 open

Threads

  • Keep the retry budget explicitCode change
  • Clarify the migration ownerDecision
  • Add the rollback queryRollout

The plan is ready to execute when every gate has an owner, every unresolved thread has a verdict, and the reviewer explicitly accepts the plan.