Skip to content

Define planning-chat lifecycle and replay contract - #157

Merged
justin808 merged 6 commits into
mainfrom
codex/issue-117-planning-chat-lifecycle
Jul 13, 2026
Merged

Define planning-chat lifecycle and replay contract#157
justin808 merged 6 commits into
mainfrom
codex/issue-117-planning-chat-lifecycle

Conversation

@justin808

@justin808 justin808 commented Jul 13, 2026

Copy link
Copy Markdown
Member

Closes #117\n\n## Summary\n- define the prompt-only and parent-orchestrator planning-chat lifecycle\n- require durable handoff to a distinct batch coordinator when the parent retains planning duties\n- add fail-closed complete-batch audit replay grammar and lifecycle fixtures\n- harden canonical finding/reference handling, blocker unions, and final readiness rendering\n\n## Validation\n- ruby skills/pr-batch/bin/goal-completion-contract-test.rb (66 runs, 977 assertions)\n- ruby skills/post-merge-audit/bin/post-merge-audit-policy-test.rb (14 runs, 242 assertions)\n- ruby skills/plan-pr-batch/scripts/check_goal_prompt_size.rb\n- bin/validate\n- exact-head Sol/xhigh review: CLEAN\n- exact-head Sol/xhigh QA: SATISFIED, identical START/MID/END receipt on 786a8b6

Summary by CodeRabbit

  • Documentation

    • Clarified planning-chat lifecycle roles, transitions, durable audit handoffs, and when archival/closeout is permitted.
    • Added explicit response ordering plus exact final Conversation status wording for both planning and triage workflows.
    • Defined stricter completed-batch audit ownership, evidence and marker grammar requirements, and fail-closed behavior that keeps outcomes in follow-up state when information is incomplete, malformed, or UNKNOWN.
  • Tests

    • Expanded contract and policy coverage for lifecycle gating, completed-batch audit replay, marker parsing/normalization, blocker-union rendering, and archival safeguards against malformed or unresolved data.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@justin808, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 55 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 696abcf4-ea62-40ab-960a-f774ecbaa6ff

📥 Commits

Reviewing files that changed from the base of the PR and between b2e782c and ada81c8.

📒 Files selected for processing (7)
  • skills/plan-pr-batch/SKILL.md
  • skills/post-merge-audit/SKILL.md
  • skills/pr-batch/SKILL.md
  • skills/pr-batch/bin/goal-completion-contract-test.rb
  • skills/triage/SKILL.md
  • workflows/post-merge-audit.md
  • workflows/pr-processing.md

Walkthrough

The PR defines portable planning-chat roles and archival rules, moves completed-batch audit ownership to batch coordinators, adds strict audit-marker replay semantics, and expands contract tests and prompt validation for lifecycle, reconciliation, readiness, and final conversation status behavior.

Changes

Planning-chat and completed-batch lifecycle

Layer / File(s) Summary
Planning-chat roles and handoffs
skills/plan-pr-batch/SKILL.md, skills/triage/SKILL.md, skills/pr-batch/SKILL.md, workflows/pr-processing.md, CHANGELOG.md
Defines prompt-only and parent-orchestrator roles, durable handoffs, retained responsibilities, response ordering, and archive conditions.
Coordinator-owned completed-batch audit
skills/post-merge-audit/SKILL.md, skills/pr-batch/SKILL.md, workflows/post-merge-audit.md, workflows/pr-processing.md
Assigns completed-batch audits and final status emission to batch coordinators, with checker-assurance, marker, blocker, readiness, and replay rules.
Audit policy contract coverage
skills/post-merge-audit/bin/post-merge-audit-policy-test.rb
Tests ownership, archive readiness, fail-closed parsing, coordinator-only handoff output, required marker fields, and obsolete marker forms.
Completed-batch marker replay and lifecycle tests
skills/pr-batch/bin/goal-completion-contract-test.rb
Adds marker parsing, validation, canonical reference handling, disposition replay, blocker computation, readiness coupling, and extensive lifecycle and adversarial tests.
Planning lifecycle prompt validation
skills/plan-pr-batch/scripts/check_goal_prompt_size.rb
Extracts the planning lifecycle section and validates required source pins and parent reconciliation scenarios.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PlanningChat as Planning chat
  participant BatchCoordinator as Batch coordinator
  participant AuditMarker as Completed-batch audit marker
  participant ParentOrchestrator as Parent orchestrator
  PlanningChat->>BatchCoordinator: durable handoff
  BatchCoordinator->>AuditMarker: emit validated audit marker
  AuditMarker->>ParentOrchestrator: durable audit handoff
  ParentOrchestrator->>PlanningChat: reconcile state and render final status
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the PR’s main change: defining the planning-chat lifecycle and replay contract.
Linked Issues check ✅ Passed The changes implement the prompt-only vs parent-orchestrator roles, archive criteria, coordinator audit ownership, and replay tests required by #117.
Out of Scope Changes check ✅ Passed The edits remain focused on lifecycle, archive, audit replay, and supporting tests/docs, with no clear unrelated feature work.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/issue-117-planning-chat-lifecycle

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.

Comment thread skills/pr-batch/bin/goal-completion-contract-test.rb Outdated
Comment thread workflows/pr-processing.md Outdated
@claude

claude Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Summary

This PR reassigns ownership of the completed-batch audit from the "parent orchestration agent" to the "batch coordinator," formalizes a two-role "Planning-Chat Lifecycle" (prompt-only / parent-orchestrator), and hardens the completed-batch-audit v1 marker grammar (fail-closed parsing, Unicode-safe canonicalization, HTML-comment-token rejection). It's a documentation/prompt-spec change (no application runtime code) backed by a large, well-designed Ruby fixture-test harness that models the marker parser.

Note: I was unable to execute the Ruby test suites in this sandboxed review environment (shell commands required interactive approval that wasn't available), so I could not independently confirm the "66 runs / 977 assertions" pass claim from the PR description — this review is based on static reading of the diff. Please make sure CI is green before merging.

Strengths

  • The obsolete-phrase refute_includes assertions (e.g. OBSOLETE_PARENT_AUDIT_OWNERSHIP, OBSOLETE_COMPLETED_BATCH_AUDIT_TRIGGER, OBSOLETE_BATCH_IDENTITY_FIELD) are a good pattern — they guarantee the old wording is fully retired everywhere, not just that new wording was added somewhere.
  • The marker-parsing fixtures are genuinely adversarial: control characters (CR/LF/CRLF/NUL/VT/FF/LS), embedded <!--/--> tokens, fullwidth Unicode homoglyphs after NFKC normalization, case-fold collisions (ß/SS), and ambiguous comma/whitespace ref-matching are all exercised. This is solid defensive parsing for text that will eventually be produced by an LLM and consumed by another automated step.
  • Fail-closed defaults are consistent throughout (UNKNOWN/malformed/missing → blocked, never silently treated as ready).

Findings (posted inline)

  1. skills/pr-batch/bin/goal-completion-contract-test.rbrelease_or_archive_batch_identity? (line 341) duplicates well_formed_batch_identity? (line 362) with a looser regex for the same non-backend:/not-applicable: grammar. Its only caller (completed_batch_audit_state_ready?) only ever sees already-well-formed state, so this isn't exploitable today, but the two independent regexes are a latent drift risk if one is edited without the other.
  2. Cross-file duplication — The full completed-batch-audit marker grammar (~600+ words, several paragraphs) is copy-pasted verbatim into workflows/pr-processing.md, workflows/post-merge-audit.md, skills/post-merge-audit/SKILL.md, and skills/pr-batch/SKILL.md, kept in sync only by string-equality tests. The PR already uses a "canonical + link" pattern for the Planning-Chat Lifecycle section elsewhere in the same diff — applying that same pattern to the marker grammar would remove a real maintenance/drift burden.

Other observations (not blocking)

  • check_goal_prompt_size.rb asserts PARENT_RELEASE_OR_ARCHIVE_PRESSURE_SCENARIOS twice in a row (once unconditionally, once under enforce_restart_docs_drift) — harmless but redundant.
  • No security-relevant runtime code paths are introduced (no shell/network/file-write execution); the new Ruby is pure regex/string validation used only by the test suite, so there's no performance concern in production.
  • The prompt-instruction text is internally consistent on read-through (prompt-only vs. parent-orchestrator archive conditions, self-launch transition, retained-duty blocking) — no logical contradictions spotted between the lifecycle rules across the four skill/workflow files that reference them.

@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: 3

🧹 Nitpick comments (2)
skills/post-merge-audit/SKILL.md (1)

371-371: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make the shared case-fold contract implementation-neutral.

The portable documentation currently exposes Ruby syntax, while both contract suites require that syntax verbatim.

  • skills/post-merge-audit/SKILL.md#L371-L371: specify Unicode full case folding without naming a Ruby method.
  • workflows/post-merge-audit.md#L56-L56: mirror the implementation-neutral wording.
  • skills/post-merge-audit/bin/post-merge-audit-policy-test.rb#L40-L40: assert the semantic wording.
  • skills/pr-batch/bin/goal-completion-contract-test.rb#L98-L98: keep downcase(:fold) confined to implementation-level tests.

As per coding guidelines, shared skill files must remain concise and portable.

🤖 Prompt for 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.

In `@skills/post-merge-audit/SKILL.md` at line 371, Replace the Ruby-specific
case-fold wording with implementation-neutral “Unicode full case folding” in
skills/post-merge-audit/SKILL.md lines 371-371 and workflows/post-merge-audit.md
lines 56-56. Update the semantic assertion in
skills/post-merge-audit/bin/post-merge-audit-policy-test.rb lines 40-40
accordingly, while retaining downcase(:fold) only in the implementation-level
assertion in skills/pr-batch/bin/goal-completion-contract-test.rb line 98.

Source: Coding guidelines

skills/pr-batch/SKILL.md (1)

515-542: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider referencing the canonical marker grammar instead of duplicating it.

Lines 534–542 duplicate the completed-batch audit marker grammar verbatim from workflows/pr-processing.md lines 1611–1619. The skill file already defers to the canonical closeout lane at lines 515–516 ("follow the canonical closeout lane in .agents/workflows/pr-processing.md"), so the inline duplication creates a drift risk — the contract test in check_goal_prompt_size.rb validates against pr-processing.md, not this copy, so silent divergence would go undetected.

If the duplication is intentional for self-containment, consider adding a sync comment (like the one at line 400: <!-- Keep this handoff summary in sync with ... -->) to flag the paired location. As per coding guidelines, skills/*/SKILL.md files should be kept concise and portable.

♻️ Proposed sync comment
 <!-- Keep this marker grammar in sync with `.agents/workflows/pr-processing.md` -> `### Planning-Chat Lifecycle` marker paragraphs. -->
 Replay only the exact versioned `<!-- completed-batch-audit v1` wrapper through its single final `-->`,
🤖 Prompt for 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.

In `@skills/pr-batch/SKILL.md` around lines 515 - 542, Replace the duplicated
completed-batch audit marker grammar in the numbered sequence with a concise
reference to the canonical definition in `.agents/workflows/pr-processing.md`,
preserving the existing delegation at the start of the sequence. If the inline
details must remain for self-containment, add a sync comment identifying that
canonical source and the paired section instead of changing the grammar.

Source: Coding guidelines

🤖 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 `@skills/plan-pr-batch/scripts/check_goal_prompt_size.rb`:
- Around line 627-649: Remove the conditional duplicate require_phrases call for
PARENT_RELEASE_OR_ARCHIVE_PRESSURE_SCENARIOS in the enforce_restart_docs_drift
block, since the same check already runs unconditionally against
planning_chat_lifecycle_text. Only retain it if the intended source-checkout
comparison uses a distinct source-checkout text variable, and update the
argument accordingly.

In `@skills/pr-batch/bin/goal-completion-contract-test.rb`:
- Around line 435-469: Update followups_disposition_records and its
value-validation rules to reserve or escape the record delimiters semicolon and
pipe consistently across ref, owner, status, disposition, and evidence fields.
Ensure accepted records round-trip through the split/parsing logic, reject
unescaped delimiter-containing values if that is the chosen contract, and add
fixtures covering delimiter characters in each relevant value type.

In `@workflows/post-merge-audit.md`:
- Around line 50-75: Scope the completed-batch rules under their mode guard in
workflows/post-merge-audit.md (lines 50-75), using a nested block or dedicated
subsection so ownership and marker requirements are structurally conditional.
Update skills/post-merge-audit/bin/post-merge-audit-policy-test.rb (lines
177-186) to verify those ownership and marker rules occur within the
completed-batch-only scope rather than merely checking their text globally.

---

Nitpick comments:
In `@skills/post-merge-audit/SKILL.md`:
- Line 371: Replace the Ruby-specific case-fold wording with
implementation-neutral “Unicode full case folding” in
skills/post-merge-audit/SKILL.md lines 371-371 and workflows/post-merge-audit.md
lines 56-56. Update the semantic assertion in
skills/post-merge-audit/bin/post-merge-audit-policy-test.rb lines 40-40
accordingly, while retaining downcase(:fold) only in the implementation-level
assertion in skills/pr-batch/bin/goal-completion-contract-test.rb line 98.

In `@skills/pr-batch/SKILL.md`:
- Around line 515-542: Replace the duplicated completed-batch audit marker
grammar in the numbered sequence with a concise reference to the canonical
definition in `.agents/workflows/pr-processing.md`, preserving the existing
delegation at the start of the sequence. If the inline details must remain for
self-containment, add a sync comment identifying that canonical source and the
paired section instead of changing the grammar.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fed60feb-be18-42cc-a223-ed55e79eede0

📥 Commits

Reviewing files that changed from the base of the PR and between e058a92 and 786a8b6.

📒 Files selected for processing (10)
  • CHANGELOG.md
  • skills/plan-pr-batch/SKILL.md
  • skills/plan-pr-batch/scripts/check_goal_prompt_size.rb
  • skills/post-merge-audit/SKILL.md
  • skills/post-merge-audit/bin/post-merge-audit-policy-test.rb
  • skills/pr-batch/SKILL.md
  • skills/pr-batch/bin/goal-completion-contract-test.rb
  • skills/triage/SKILL.md
  • workflows/post-merge-audit.md
  • workflows/pr-processing.md

Comment thread skills/plan-pr-batch/scripts/check_goal_prompt_size.rb Outdated
Comment thread skills/pr-batch/bin/goal-completion-contract-test.rb
Comment thread workflows/post-merge-audit.md Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 76ebd99d86

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread skills/pr-batch/bin/goal-completion-contract-test.rb Outdated

@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.

🧹 Nitpick comments (2)
skills/pr-batch/SKILL.md (1)

536-536: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Completed-batch audit contract is duplicated verbatim across three files.

The same detailed contract text — batch_id rules, record fields, disposition enums, normalization/dedup logic, delimiter rejection, well-formedness/archive-ready/blocker-union semantics, and replay status-line rules — appears in all three files. Any contract change must be manually mirrored in every location, risking drift. The coding guidelines require keeping skills/*/SKILL.md files concise; both SKILL.md files contain the full block when one should be canonical and the other should reference it.

  • skills/pr-batch/SKILL.md#L536-L536: Replace the duplicated contract block with a reference to the canonical source in skills/post-merge-audit/SKILL.md (or a shared workflow section), following the same reference pattern already used at lines 515-516 for the closeout lane.
  • skills/post-merge-audit/SKILL.md#L371-L392: Keep as the canonical source for the completed-batch audit contract, or extract to a shared workflow section that both SKILL.md files reference.
  • workflows/post-merge-audit.md#L51-L75: This file's duplication is acknowledged as intentional for self-containment (lines 17-19). If the SKILL.md files are deduplicated, consider whether this file should also reference the canonical source or retain the full text for copy-paste audits.
🤖 Prompt for 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.

In `@skills/pr-batch/SKILL.md` at line 536, Deduplicate the completed-batch audit
contract: in skills/pr-batch/SKILL.md at lines 536-536, replace the full block
with a reference to the canonical contract in skills/post-merge-audit/SKILL.md
at lines 371-392, preserving the existing reference pattern near lines 515-516.
Keep skills/post-merge-audit/SKILL.md lines 371-392 as the sole canonical
source, or move the contract to a shared workflow section referenced by both
files. For workflows/post-merge-audit.md lines 51-75, retain the self-contained
contract unless the implementation deliberately changes it to reference the
canonical source.

Source: Coding guidelines

skills/post-merge-audit/SKILL.md (1)

371-371: 📐 Maintainability & Code Quality | 🔵 Trivial

Duplicated completed-batch audit contract text across three files.

Lines 371 and 392 are parts of the same detailed completed-batch audit contract that appears verbatim in skills/pr-batch/SKILL.md (line 536) and workflows/post-merge-audit.md (lines 55-59). Any contract change must be mirrored in all three locations. The coding guidelines require keeping skills/*/SKILL.md files concise — this duplicated block works against that goal. Deferring to consolidated comment for the cross-file recommendation.

Also applies to: 392-392

🤖 Prompt for 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.

In `@skills/post-merge-audit/SKILL.md` at line 371, Consolidate the duplicated
completed-batch audit contract currently embedded in the post-merge audit skill,
pr-batch skill, and post-merge workflow, replacing repeated prose with a single
authoritative reference while preserving all validation and normalization
requirements. Update the affected sections around the completed-batch follow-up
contract and ensure future changes have one source of truth.

Source: Coding guidelines

🤖 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.

Nitpick comments:
In `@skills/post-merge-audit/SKILL.md`:
- Line 371: Consolidate the duplicated completed-batch audit contract currently
embedded in the post-merge audit skill, pr-batch skill, and post-merge workflow,
replacing repeated prose with a single authoritative reference while preserving
all validation and normalization requirements. Update the affected sections
around the completed-batch follow-up contract and ensure future changes have one
source of truth.

In `@skills/pr-batch/SKILL.md`:
- Line 536: Deduplicate the completed-batch audit contract: in
skills/pr-batch/SKILL.md at lines 536-536, replace the full block with a
reference to the canonical contract in skills/post-merge-audit/SKILL.md at lines
371-392, preserving the existing reference pattern near lines 515-516. Keep
skills/post-merge-audit/SKILL.md lines 371-392 as the sole canonical source, or
move the contract to a shared workflow section referenced by both files. For
workflows/post-merge-audit.md lines 51-75, retain the self-contained contract
unless the implementation deliberately changes it to reference the canonical
source.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cc48952f-2022-41f3-abfb-8280de5e9dfd

📥 Commits

Reviewing files that changed from the base of the PR and between 786a8b6 and b2e782c.

📒 Files selected for processing (7)
  • skills/plan-pr-batch/scripts/check_goal_prompt_size.rb
  • skills/post-merge-audit/SKILL.md
  • skills/post-merge-audit/bin/post-merge-audit-policy-test.rb
  • skills/pr-batch/SKILL.md
  • skills/pr-batch/bin/goal-completion-contract-test.rb
  • workflows/post-merge-audit.md
  • workflows/pr-processing.md
💤 Files with no reviewable changes (1)
  • skills/plan-pr-batch/scripts/check_goal_prompt_size.rb
🚧 Files skipped from review as they are similar to previous changes (1)
  • workflows/pr-processing.md

Comment thread skills/pr-batch/bin/goal-completion-contract-test.rb
Comment thread skills/pr-batch/bin/goal-completion-contract-test.rb
@claude

claude Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review: Define planning-chat lifecycle and replay contract

Overview

This PR is entirely documentation/spec + contract-test changes (no product runtime code): it defines a new "Planning-Chat Lifecycle" section in workflows/pr-processing.md (canonical source), replicated into skills/plan-pr-batch/SKILL.md, skills/pr-batch/SKILL.md, and skills/triage/SKILL.md, plus a hardened completed-batch-audit v1 marker grammar in workflows/post-merge-audit.md / skills/post-merge-audit/SKILL.md. It also ships a large Ruby "executable spec" (goal-completion-contract-test.rb, post-merge-audit-policy-test.rb) that both string-matches the canonical prose across all the duplicated copies and re-implements a full reference parser/validator for the marker grammar, with dozens of fixture cases.

Code quality / conventions

  • Follows the existing repo convention well: canonical text lives in workflows/*.md, each skills/*/SKILL.md links back to it, and Ruby contract tests enforce that the copies stay phrase-identical (after whitespace normalization). This keeps the four-way duplication from drifting silently.
  • The prose itself is extremely dense (near machine-grammar level: "before comma/delimiter fallback...", "nested/case-varied UNKNOWN", "Unicode NFKC... full case folding"). That's consistent with this repo's established style for agent-facing instructions, but it raises the bar for any future edit — a single word change likely requires touching 4 files. Test coverage largely mitigates the drift risk.
  • The reference Ruby parser (completed_batch_audit_* family of functions) is thorough and mostly correct. An independent trace of the regex/Unicode/delimiter logic found no bypass in the marker-wrapper regex, the ß/SS case-fold claim, the multi-word ref matching, or delimiter rejection.

Potential issues (posted inline)

  1. unknown_value? (skills/pr-batch/bin/goal-completion-contract-test.rb:422-424) does a case-insensitive substring match for UNKNOWN anywhere in a scalar, not just as a standalone token. Intentional per the "nested UNKNOWN" fixtures, but it means legitimate evidence text merely containing the word "unknown" (e.g. an issue about an "unknown-user" bug) will make the whole marker fail closed. Worth a short callout in the spec.
  2. completed_batch_audit_fields_are_consistent? (same file, line 377-394) only special-cases "all three of audit_status/verdict/findings are UNKNOWN" vs. "all concrete." A partial-UNKNOWN combo (e.g. audit_status: complete, verdict: clean, findings: UNKNOWN) falls through both branches, so the entire marker becomes structurally invalid rather than surfacing a field-specific blocker. This is exercised by the fixture "exact UNKNOWN findings remains structurally valid", whose name is inconsistent with its own asserted result (false). Please confirm whether whole-marker invalidation is the intended fail-closed behavior for partial-UNKNOWN states, and if so, rename the fixture for clarity.

Test coverage

Very thorough — the new fixture matrix covers delimiter escaping, Unicode canonicalization/case-folding, embedded HTML-comment-token injection, duplicate/case-insensitive ref collisions, and cross-field consistency. I could not execute the ruby test suites in this sandboxed review environment to independently confirm they pass as claimed in the PR description — recommend confirming green CI before merge if not already gated.

Security

No concerns — these are prose specs and test fixtures for LLM-agent behavior, not executable product code with external inputs. The marker grammar is defensively designed: it explicitly rejects embedded <!--/--> tokens and control-line breaks inside field values, preventing a crafted evidence string from breaking out of the HTML-comment marker or forging a status line.

Performance

N/A — no hot-path runtime code; the Ruby helpers only run in test/CI context.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0a8882a013

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread workflows/pr-processing.md Outdated
Comment thread workflows/pr-processing.md Outdated
@claude

claude Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review

This PR defines the planning-chat lifecycle (prompt-only vs. parent-orchestrator) and a fail-closed completed-batch-audit v1 marker grammar, plus an extensive Ruby fixture suite that encodes a reference implementation of that grammar and validates it against the prose in the docs. Overall this is a very carefully constructed change — I traced the reference parser (goal-completion-contract-test.rb) against dozens of its own fixtures by hand (marker well-formedness, readiness, blocker-union dedup, Unicode NFKC/case-folding, delimiter rejection, control-character rejection) and found the logic internally consistent in every case I checked. Note: I was not able to execute ruby in this sandboxed review environment to run the suites directly (permission-gated), so this is based on static/manual tracing rather than a live test run — the PR description's own reported run should still be treated as the source of truth for actual pass/fail.

Code quality / maintainability

  • Significant duplication of the audit-marker grammar paragraph. The ~900-word paragraph beginning "A coordination-backed batch_id is an opaque nonempty single-line string…" is copy-pasted verbatim into four files: workflows/pr-processing.md:1613, skills/pr-batch/SKILL.md:536, skills/post-merge-audit/SKILL.md:371, and workflows/post-merge-audit.md:56. Several sibling paragraphs (readiness rule, replay rule, structural-vs-readiness rule) are duplicated the same way. This is inconsistent with the pattern the PR itself introduces for the lifecycle section, which is written once in workflows/pr-processing.md and linked from consumers (Use the canonical [Planning-Chat Lifecycle](../../workflows/pr-processing.md#planning-chat-lifecycle)). Consider applying the same "canonical + link" pattern to the marker grammar instead of copy-pasting it, since any future wording tweak now requires four synchronized doc edits plus matching string-literal updates in two separate Ruby test files (goal-completion-contract-test.rb and post-merge-audit-policy-test.rb), and the tests only catch exact-string drift, not semantic drift between the copies.
  • The two Ruby test files (skills/pr-batch/bin/goal-completion-contract-test.rb, skills/post-merge-audit/bin/post-merge-audit-policy-test.rb) each independently re-declare large overlapping sets of string constants for the same grammar rules (e.g. the followups_dispositions field grammar, the marker header, the terminal-disposition rules). Since neither file requires the other's constants to be equal, the two suites could silently diverge if one is edited without the other.

Minor

  • Left an inline nit on workflows/pr-processing.md:1603 — a forward reference calls the reconciliation gate "the post-batch/pre-release gate below," but the section it points to actually names itself the "post-batch/pre-release-or-archive" gate.

Security / performance

No security concerns — this PR only changes prose specs and offline Ruby validation scripts, with no user input handling, network calls, or runtime code paths. Performance is a non-issue (validators run only in CI/manually against small markdown files); a couple of the new regexes (e.g. well_formed_batch_identity?'s (?:[^;]*[^;\s])? groups) have mild nested-quantifier shape but operate only on short, non-adversarial doc/test strings, so not a real risk.

Test coverage

The new fixture matrix in goal-completion-contract-test.rb is unusually thorough (Unicode canonicalization, case-insensitive dedup, comma/whitespace ref-splitting ambiguity, control-character rejection, cross-field consistency, fail-closed invalid-marker replay) and is a strong positive for this PR.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 13603999f4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread skills/pr-batch/bin/goal-completion-contract-test.rb
@claude

claude Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review

Overview

This PR (closes #117) formalizes a "Planning-Chat Lifecycle" (prompt-only vs parent-orchestrator) and moves completed-batch-audit ownership from the parent orchestration agent to the batch coordinator, with the parent limited to reconciling a durable audit handoff. It also hardens the completed-batch-audit v1 marker grammar (Unicode NFKC normalization, case-folded identity, terminal-disposition/OUTSTANDING-findings semantics, fail-closed parsing) and adds a large embedded Ruby reference implementation + fixture matrix in skills/pr-batch/bin/goal-completion-contract-test.rb to pin that behavior, mirrored by consistency checks in skills/post-merge-audit/bin/post-merge-audit-policy-test.rb and skills/plan-pr-batch/scripts/check_goal_prompt_size.rb.

Correctness (reference parser logic)

I traced the new marker-parsing helpers (completed_batch_audit_marker_fields, completed_batch_audit_fields_are_consistent?, completed_batch_audit_finding_refs/_group_refs, deduped_blockers, canonical_completed_batch_audit_ref, etc.) against the fixture matrix by hand (couldn't execute ruby in this sandbox — the tool requires approval that isn't available in this review context). The logic is internally consistent with the fixtures: NFKC-based UNKNOWN detection, exact-vs-nested UNKNOWN handling, comma/whitespace finding-ref disambiguation (whole-record-match before delimiter fallback), and the clean/blocked/UNKNOWN cross-field consistency rules all check out against the described contract. I did not find a logic bug in the sampled paths, but I'd recommend actually running ruby skills/pr-batch/bin/goal-completion-contract-test.rb and the other two test files in CI before merge, since I could not execute them here to confirm the fixtures actually pass against the implementation as committed.

Consistency across surfaces

I grepped for the old "parent orchestration agent must run the completed-batch audit" phrasing and for any other completed-batch audit mentions repo-wide; every surface (workflows/pr-processing.md, workflows/post-merge-audit.md, skills/pr-batch/SKILL.md, skills/post-merge-audit/SKILL.md, skills/plan-pr-batch/SKILL.md, skills/triage/SKILL.md, CHANGELOG.md) was updated consistently, and no stale copies of the old ownership model remain (skills/pr-monitoring/SKILL.md and workflows/adversarial-pr-review.md don't reference this concept at all, so nothing there needed touching).

Maintainability concern (duplication)

The same very large paragraph (marker grammar: batch_id/audit_status/verdict/scope_evidence/checker_evidence/findings/followups_dispositions, NFKC/case-fold rules, delimiter rules, etc.) is copy-pasted near-verbatim across at least 5 markdown files and re-declared as matching string constants across 3 Ruby test files. This is clearly deliberate (the tests enforce byte-for-byte sync via assert_includes/require_phrases), but it means any future wording tweak requires touching ~8 files in lockstep, and a missed constant update anywhere will silently pass everywhere else while only failing in the one file that was missed — worth being aware of as this contract evolves further. Similarly, the ~230-line reference parser embedded directly in goal-completion-contract-test.rb (rather than a small shared helper module) is a lot of nontrivial logic to keep as inline test code; if this parsing behavior needs to be referenced from another test file in the future it risks getting re-implemented rather than reused.

Security / Performance

No runtime application code changed — this is documentation plus CI-only test tooling (fixtures are hardcoded, not fed from untrusted external input), so there's no security-relevant attack surface and no performance-sensitive path introduced.

Test coverage

The fixture matrix is unusually thorough (fail-closed cases for malformed wrappers, embedded HTML-comment tokens, control characters, Unicode confusables like ß/SS, duplicate refs, comma-vs-whitespace finding disambiguation, etc.), which is appropriate given how much fail-closed parsing behavior this contract now depends on.

@justin808

Copy link
Copy Markdown
Member Author

Address-review summary

Scan scope: full PR review history through 2026-07-13T17:47:37Z at exact head ada81c8e9fcfc7226d95b7f845fca25e91b7c4b5; 11 review threads inspected and resolved.

Mattered

  • Removed the duplicate readiness regex in 76ebd99.
  • Reserved record delimiters and structurally scoped completed-batch rules in b2e782c.
  • Rejected duplicate canonical OUTSTANDING refs in 0a8882a.
  • Clarified prompt-only pre-launch durable handoff versus retained-duty coordinator launch in ada81c8.
  • Fixed the NFKC-equivalent UNKNOWN readiness bypass with red-first scope/terminal evidence fixtures in ada81c8.
  • Removed a redundant aggregate lifecycle test after independent pre-commit review.

Optional

  • Removed the duplicate pressure-scenario assertion and made Unicode full-fold wording implementation-neutral in b2e782c.
  • Clarified the partial-UNKNOWN fixture label in 1360399.
  • Aligned the forward reference to post-batch/pre-release-or-archive in ada81c8.

Skipped

  • Grammar centralization was declined: portable execution surfaces intentionally retain the full self-contained fail-closed contract, with equality assertions guarding drift.
  • Another generic UNKNOWN prose warning was declined because nested/case-varied rejection was already explicit and fixture-covered.
  • Partial-UNKNOWN parser semantics were unchanged: cross-field inconsistency intentionally fails closed; only the misleading fixture label needed correction.
  • CodeRabbit docstring coverage was status-only and is not a repository merge gate; pure status posts required no action.

Validation and disposition

  • Exact head: ada81c8e9fcfc7226d95b7f845fca25e91b7c4b5; base/merge-base: e058a9280b888d53e4f20c2896553664141399be; clean 10-path diff.
  • Goal contract: 69 runs / 1021 assertions; post-merge policy: 15 / 257; lifecycle: 5 / 61; NFKC regression: 1 / 6; mirror: 1 / 36.
  • Full bin/validate: passed; RuboCop: 49 files, no offenses.
  • Hosted validate, Claude review, and CodeRabbit: passed on current head.
  • Independent exact-head Sol/xhigh review: CLEAN. Independent exact-head Sol/xhigh QA: SATISFIED.
  • Deferred tracking: none. All review threads have recorded outcomes and are resolved.

Future review scans start after this marked summary unless the request explicitly says check all reviews.

@justin808
justin808 merged commit 9bcb744 into main Jul 13, 2026
9 checks passed
@justin808
justin808 deleted the codex/issue-117-planning-chat-lifecycle branch July 13, 2026 17:48
@justin808

justin808 commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

QA Evidence

  • QA lane: aw-e-qa; gpt-5.6-sol/xhigh; independent read-only exact-head checker
  • Scope checked: issue Define when planning chats should be archived after batch launch #117 planning-chat lifecycle, completed-batch replay grammar, Unicode fail-closed behavior, prompt-size guards, and the full ten-file diff
  • Tested at: PR Define planning-chat lifecycle and replay contract #157 head ada81c8
  • Identity receipts: START = MID = END; clean worktree; base/merge-base e058a92; unchanged ten-path diff
  • Automated checks: goal completion contract 69 runs/1021 assertions; post-merge audit policy 15/257; lifecycle focus 5/61; NFKC UNKNOWN focus 1/6; cross-surface mirror 1/36; both prompt-size checks PASS; git diff --check PASS; RuboCop 1.87.0 three files clean; coordinator exact-head bin/validate PASS; 3/3 hosted checks green
  • Manual checks: independent full-diff inspection and fail-closed replay probes
  • Findings: none
  • QA required: yes
  • QA required rationale: planning lifecycle and replay-contract changes require independent exact-head validation
  • QA lane status: satisfied
  • Release-blocking status: clear
  • Process-gap disposition: checklist+replay; recovered durable exact-head receipt and published its marker

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.

Define when planning chats should be archived after batch launch

1 participant