Skip to content

PIR prompt repair: review prompt disagrees with porch on reviewers, verdicts, the pr gate and post-approval steps; {{issue.number}} never substituted #1903

Closed

Description

@waleedkadous

Problem

A prompt sweep on 2026-11-15 found that PIR's prompts, mainly protocols/pir/prompts/review.md, disagree with pir/protocol.json and with what porch does. A builder following them literally stalls or skips steps. Mirror every change in BOTH codev-skeleton/ and codev/. Line numbers are for codev-skeleton/ at d3ffaa1. Verify each claim against porch source before editing.

Findings

  1. Reviewer count. pir/protocol.json:81 lists ["gemini","codex"]; prompts/review.md:7,146,172 and consult-types/pr-review.md:5 say three. Porch uses the JSON. Owner ruling (2026-11-15): three reviewers by default, reducible per project via .codev/config.json porch.consultation.
  2. Wrong reviewer prompt at the PR. protocol.json:80 has "type": "impl", so the PR-time review loads consult-types/impl-review.md, which describes the already-passed dev-approval gate and demands a review file that implement.md:141 forbids. consult-types/pr-review.md is never used. Also implement.md:110 says the implement phase has no AI consult.
  3. Who runs consult. review.md:146,248 says porch runs it automatically and a manual run doubles it; porch emits the consult commands as a task for the builder (next.ts:584-592). review.md:148 (verdicts in porch done output) is wrong for the same reason.
  4. REQUEST_CHANGES handling. review.md:147-161: rebuttal mechanism, "do not re-run porch done", output file names ({{project_id}}-gemini.txt; porch writes <id>-<phase>-iter<N>-<model>.txt), and a grep at :170-172 for a line starting approve when reviewers write VERDICT: APPROVE, so every verdict reads UNKNOWN. :161 vs :194 contradict each other on re-running porch done.
  5. pr gate. Four accounts of who approves and merges (protocol.md:33,35-36; review.md:7,178,186-192,217; protocol.json:73). The rule: the architect relays the human's approval, the builder runs porch approve <id> pr --a-human-explicitly-approved-this, then the builder merges with gh pr merge --merge. Remove the "wait for porch wake-up" and "human merges on GitHub" accounts. Same for plan.md:103, implement.md:126.
  6. Gate notification. plan.md:97 says porch notifies the architect; protocol.md:38 says it does not (correct). builder-prompt.md:63 requires an afx send at every gate; the phase prompts give no such step. Porch's own task text at next.ts:354 ("The architect has already been notified") is stale too; fix it.
  7. Post-approval verification. review.md:201-204 waits for gate_status: approved in porch next (exists only in porch status --json); :210 reads a .pr/history field (porch stores pr_history[].pr_number); :136 same.
  8. {{issue.number}} / {{issue.title}} never substituted in phase prompts. porch/prompts.ts:138 matches \w+ only. Affects pir/prompts/plan.md, implement.md, review.md and air/prompts/implement.md, pr.md. Fix once (support the variables in porch, or use ones that exist) and cover both protocols.
  9. Baked Decisions section is absent from PIR's protocol.md, builder-prompt, prompts and consult-types; the other protocols carry it.
  10. Minor: signal block used two ways (plan.md:110 vs review.md:237); hardcoded main at review.md:48; "View Diff" vs "Review Diff"; dangling <slug> at plan.md:48; implement.md:161 cites a verify block that is null; PR title/commit prefix conventions.

Scope

Owns protocols/pir/** in both trees, the {{issue.number}} fix (including the AIR prompt occurrences), and the stale porch task text. Another builder is editing the rest of the skeleton under a sibling issue; do not touch files outside this scope.

Testing

Unit test for the prompt-variable fix. Then walk a PIR project through review with porch in a scratch workspace (or by reading each emitted task) and confirm every command and field the prompt names exists and matches. Say in the PR which path you exercised.

Activity

  1. added
    area/protocols
    on Nov 16, 2026
  2. waleedkadous commented on Nov 16, 2026

    @waleedkadous
    ContributorAuthor

    On it! Working on a fix now.

  3. added 6 commits that reference this issue on Nov 16, 2026
    da6c545
    21e8579
    1d5b861
    10a06e5
    a847835
    e701f2e
  4. waleedkadous commented on Nov 16, 2026

    @waleedkadous
    ContributorAuthor

    Fixed by PR #1904 (merge commit 618612d): porch renders the issue variables, and the PIR prompts now match porch. On main; not yet in a published release.

  5. added a commit that references this issue on Nov 16, 2026
  6. added a commit that references this issue on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/protocols

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions