Skip to content

fix(review): prevent fast-path planned-action ID collisions #518

Description

@rianjs

Problem

A live approval-override review failed before posting:

ledger: insert planned action: constraint failed: UNIQUE constraint failed: planned_actions.action_id (1555)

The approval-override and partial-repair fast paths allocate a fresh run, but each inserts a process-wide constant planned-action ID:

  • approval-override-submit-review
  • repair-submit-review

The ledger defines planned_actions.action_id as a table-wide primary key, so the first persisted action with either constant prevents the same fast path from running again in that ledger.db, even for a different PR and run.

Empirical evidence

This was reproduced and validated without mutating GitHub or local review data:

Expected behavior

Every planned action must have a globally unique ID. A prior approval override or repair action must not block a later fast-path execution.

Acceptance criteria

  • Approval-override planned-action IDs are scoped by their owning run.
  • Partial-repair planned-action IDs are scoped by their owning run.
  • Existing legacy constant-ID rows remain valid; no ledger migration or purge is required.
  • Posted action markers use valid marker-safe IDs.
  • Regression tests cover collisions with pre-existing legacy rows for both paths.
  • The full test suite passes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions