Skip to content

fix(loop-memory): canonicalize trusted check reruns#189

Merged
abiorh-claw merged 7 commits into
mainfrom
codex/ws-eng-007-00r2-canonical-check-recovery
Jul 23, 2026
Merged

fix(loop-memory): canonicalize trusted check reruns#189
abiorh-claw merged 7 commits into
mainfrom
codex/ws-eng-007-00r2-canonical-check-recovery

Conversation

@Abiorh001

@Abiorh001 Abiorh001 commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

PR Trust Bundle: WS-ENG-007-00R2

Goal

Make signed loop-memory reconciliation stable under legitimate trusted check
reruns and recover the exact PR #187 → PR #188 → 00R2 sequence once.

Design

Every same-name protected check candidate is validated before selection.
Completed trusted invocations are ordered by timezone-normalized started_at
and strict positive check-run ID. Completion time cannot reorder invocations;
the newest invocation must succeed. Any malformed, foreign, incomplete,
wrong-head, unknown-conclusion, or duplicate-ID evidence fails closed.

Policy schema v3 names at most two recovered merges and the activation. The
production certificate pins PR #187, PR #188, and direct-next 00R2 in exact
first-parent order. Protected provenance is checked on every head. Temporary
identities are consumed before signing and never serialize or replay.

Recovery-file schema v1 remains limited to two identities. Schema v2 is emitted
only for an exact three-identity result and requires exactly three on every
reload.

Evidence

  • 231 focused tests passed.
  • 98 manual agent-gate tests passed.
  • The real PR docs(loop): plan concurrent PR review reconciliation #187 duplicate-success and PR fix(loop-memory): repair planning intake tree reconciliation #188 check histories validate.
  • Legacy schema-v1 and new schema-v2 CLI recovery round trips pass.
  • Merge intent, Markdown links, stale wording, and committed diff checks pass.
  • All nine internal tracks passed exact reviewed SHA
    bb3f03b3b9026a7eb3a9adb40e657e07c4eafac3 after findings were repaired.
  • No workflow, required-check name, coverage, dependency, signing key, secret,
    permission, product behavior, or human merge authority changed.

Human Review Focus

Confirm newer invocation failure cannot be hidden, all three merge heads receive
protected provenance validation, and recovery transport/policy versions remain
closed and non-reusable.

Human Merge Ownership

Only the user may approve and merge this PR. No other PR may merge first. After
signed reconciliation, both successors remain stopped pending separate explicit
starts.

Summary by CodeRabbit

  • Reliability

    • Improved reconciliation for concurrent pull requests and interrupted merge recovery, ensuring the correct “exactly once” outcome.
    • GitHub Actions reruns are now selected deterministically; stale, malformed, or mismatched evidence is rejected to prevent success masking failures.
    • Recovery preserves a strict, approved merge sequence and blocks replay or unauthorized continuation.
  • Documentation

    • Added operational guidance for canonical check-evidence recovery, including review requirements and recovery boundaries.
  • Tests

    • Expanded regression coverage for deterministic rerun handling, schema v3 recovery validation, ordering, and replay protection.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 09f0f075-9bd8-4500-b58a-4e487417081c

📥 Commits

Reviewing files that changed from the base of the PR and between 020d2c2 and 55a11d9.

📒 Files selected for processing (4)
  • .agent-loop/initiatives/WS-ENG-007-concurrent-pr-review-reconciliation/reviews/WS-ENG-007-00R2-external-review-response.md
  • .agent-loop/initiatives/WS-ENG-007-concurrent-pr-review-reconciliation/reviews/WS-ENG-007-00R2-internal-review-evidence.md
  • .agent-loop/initiatives/WS-ENG-007-concurrent-pr-review-reconciliation/reviews/WS-ENG-007-00R2-pr-trust-bundle.md
  • docs/operations_post_merge_memory.md

📝 Walkthrough

Walkthrough

WS-ENG-007 adds canonical protected-check rerun selection, Schema v3 recovery certificates with ordered recovered merges, adjacent merge validation, versioned recovery transport, regression tests, and updated recovery documentation and state.

Changes

WS-ENG-007 canonical recovery

Layer / File(s) Summary
Recovery contract and state
.agent-loop/initiatives/WS-ENG-007-concurrent-pr-review-reconciliation/*, .agent-loop/merge-intents/*, .agent-loop/policies/*, docs/operations_post_merge_memory.md
Defines deterministic rerun handling, bounded Schema v3 recovered_merges, exact merge bindings, adjacency and consumption rules, and successor stop conditions.
Canonical validation and recovery execution
scripts/update_post_merge_memory.py
Validates trusted check runs by provenance and latest invocation, supports Schema v3 policies and transport inventories, verifies adjacent recovery plans, and emits versioned recovery data.
Regression coverage and review evidence
scripts/test_agent_gates.py, scripts/test_update_post_merge_memory.py, .agent-loop/.../reviews/*
Adds rerun, malformed-policy, deterministic recovery, CLI round-trip, consumption, replay, and review-evidence coverage.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GitHubCheckRuns
  participant ProtectedCheckValidator
  participant RecoveryPlanner
  participant LoopMemory
  GitHubCheckRuns->>ProtectedCheckValidator: provide matching check-run history
  ProtectedCheckValidator->>ProtectedCheckValidator: validate provenance and select latest completed invocation
  ProtectedCheckValidator->>RecoveryPlanner: return canonical protected-check results
  RecoveryPlanner->>LoopMemory: prepare ordered adjacent merge exemptions
  LoopMemory->>RecoveryPlanner: consume and validate recovery inventory
Loading

Possibly related PRs

Suggested reviewers: abiorh-claw

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 47.83% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description covers the goal and evidence, but omits most required template sections like Chunk, What Changed, Scope Control, tests, and reviewer tables. Add the missing template sections: Chunk, Human-Approved Intent, What Changed, Why It Changed, Scope Control, Commands Run, Test Delta, and Internal/External Review.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and accurately describes the main change: canonicalizing trusted check reruns in loop-memory.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/ws-eng-007-00r2-canonical-check-recovery

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@abiorh-claw
abiorh-claw self-requested a review July 23, 2026 07:09
abiorh-claw
abiorh-claw previously approved these changes Jul 23, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/operations_post_merge_memory.md`:
- Around line 264-267: Update the paragraph under “WS-ENG-007 Canonical
Check-Evidence Recovery” so the “#187” PR reference does not begin a Markdown
heading; keep it attached to the preceding line or indent the continuation while
preserving the paragraph’s wording.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a6c7225f-9935-4a43-96af-7852878d8050

📥 Commits

Reviewing files that changed from the base of the PR and between c65633f and 020d2c2.

📒 Files selected for processing (17)
  • .agent-loop/initiatives/WS-ENG-007-concurrent-pr-review-reconciliation/CHUNK_MAP.md
  • .agent-loop/initiatives/WS-ENG-007-concurrent-pr-review-reconciliation/DECISIONS.md
  • .agent-loop/initiatives/WS-ENG-007-concurrent-pr-review-reconciliation/DISCOVERY.md
  • .agent-loop/initiatives/WS-ENG-007-concurrent-pr-review-reconciliation/INTENT.md
  • .agent-loop/initiatives/WS-ENG-007-concurrent-pr-review-reconciliation/PLAN.md
  • .agent-loop/initiatives/WS-ENG-007-concurrent-pr-review-reconciliation/RISKS.md
  • .agent-loop/initiatives/WS-ENG-007-concurrent-pr-review-reconciliation/STATUS.md
  • .agent-loop/initiatives/WS-ENG-007-concurrent-pr-review-reconciliation/chunks/WS-ENG-007-00R2-canonical-check-recovery.md
  • .agent-loop/initiatives/WS-ENG-007-concurrent-pr-review-reconciliation/reviews/WS-ENG-007-00R2-external-review-response.md
  • .agent-loop/initiatives/WS-ENG-007-concurrent-pr-review-reconciliation/reviews/WS-ENG-007-00R2-internal-review-evidence.md
  • .agent-loop/initiatives/WS-ENG-007-concurrent-pr-review-reconciliation/reviews/WS-ENG-007-00R2-pr-trust-bundle.md
  • .agent-loop/merge-intents/WS-ENG-007-00R2.json
  • .agent-loop/policies/loop-memory-recovery.json
  • docs/operations_post_merge_memory.md
  • scripts/test_agent_gates.py
  • scripts/test_update_post_merge_memory.py
  • scripts/update_post_merge_memory.py

Comment thread docs/operations_post_merge_memory.md Outdated
@abiorh-claw
abiorh-claw merged commit d332169 into main Jul 23, 2026
8 of 9 checks passed
@Abiorh001

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants