bug(rgr): prevent RED test authoring before RGR cycle starts #226

Closed
opened 2026-05-16 16:18:40 -07:00 by jwilger · 0 comments
Owner

Problem

During issue #218 work, the agent asked the RED test author to create a failing test before successfully starting an RGR ledger cycle. The RGR tool later refused rgr_start because the worktree was no longer clean, leaving the session in a weird state where RED existed on disk but could not be recorded/approved through the intended ledger flow.

The guardrails should prevent this ordering mistake before any test-writing handoff happens.

Expected

For behavior work, the orchestration flow should require a clean-worktree rgr_start before delegating to rgr-test-author or otherwise writing RED tests. If the ledger is not active, test-writing or RED-recording should be blocked with a clear recovery path.

Actual

A RED test was authored first. Then rgr_start failed due to the non-clean worktree, and subsequent rgr_record_red / rgr_approve_red calls could not proceed.

Impact

This creates confusing recovery states and risks production edits being attempted without an auditable RED ledger, even when the test itself is valid.

Suggested Fix

  • Add an enforceable guardrail or plugin check that blocks rgr-test-author delegation for behavior work unless an RGR cycle is already active.
  • Improve recovery guidance when rgr_start is attempted after test changes exist.
  • Consider making the RGR state tooling expose an explicit safe reset/recover operation for abandoned pre-ledger RED attempts.

Discovered While

Working on #218 (ADR-0018 just-based Forgejo CI jobs).

## Problem During issue #218 work, the agent asked the RED test author to create a failing test before successfully starting an RGR ledger cycle. The RGR tool later refused `rgr_start` because the worktree was no longer clean, leaving the session in a weird state where RED existed on disk but could not be recorded/approved through the intended ledger flow. The guardrails should prevent this ordering mistake before any test-writing handoff happens. ## Expected For behavior work, the orchestration flow should require a clean-worktree `rgr_start` before delegating to `rgr-test-author` or otherwise writing RED tests. If the ledger is not active, test-writing or RED-recording should be blocked with a clear recovery path. ## Actual A RED test was authored first. Then `rgr_start` failed due to the non-clean worktree, and subsequent `rgr_record_red` / `rgr_approve_red` calls could not proceed. ## Impact This creates confusing recovery states and risks production edits being attempted without an auditable RED ledger, even when the test itself is valid. ## Suggested Fix - Add an enforceable guardrail or plugin check that blocks `rgr-test-author` delegation for behavior work unless an RGR cycle is already active. - Improve recovery guidance when `rgr_start` is attempted after test changes exist. - Consider making the RGR state tooling expose an explicit safe reset/recover operation for abandoned pre-ledger RED attempts. ## Discovered While Working on #218 (ADR-0018 just-based Forgejo CI jobs).
jwilger added this to the 1.0 milestone 2026-05-16 16:18:52 -07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Slipstream/auto_review#226
No description provided.