Skip to content

Fix #1902: prompt sweep — broken commands, porch-approve contradiction, owner rulings, stale text - #1905

Merged
waleedkadous merged 26 commits into
mainfrom
builder/bugfix-1902
Nov 16, 2026
Merged

waleedkadous merged 26 commits into
mainfrom
builder/bugfix-1902

Conversation

@waleedkadous

@waleedkadous waleedkadous commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This sweeps every prompt outside protocols/pir/: roles, skills, templates and the non-PIR protocols, in codev-skeleton/, codev/ and the repo-local skill trees. It fixes commands that fail when run as written, the contradiction over who runs porch approve, the three owner rulings, and the stale and contradictory text listed in the issue. Every claim was checked against the CLI source before editing.

Fixes #1902

Root Cause

Prompts drifted from the CLIs and from each other:

  • Commands were renamed or removed: porch run, --type integration pr <N>.
  • Mechanisms were never wired up: signals, TOO_COMPLEX, on_too_complex, and the phase consultation block in BUGFIX/AIR.
  • The same rule was copied into several files and edited in only some of them: gate lists, commit formats, PR timing, the 300-line figure, who runs porch approve.

The C2 part is a code gap. Porch never read a once-phase consultation block, so the BUGFIX/AIR PR prompts hardcoded three consult lines and ignored .codev/config.json porch.consultation. This repo is configured for codex+claude, yet every BUGFIX builder here also ran gemini.

Fix

Porch code (one small mechanism, per C2):

  • A once phase can declare consultation: {type, models}. Porch resolves the lanes through resolveConsultationModels, the same resolver a verify step uses, and renders {{consult_commands}} and {{consult_verdicts}} into the prompt. BUGFIX and AIR declare {type: pr, models: [gemini, codex, claude]}.
  • A malformed block throws at load. No shipped protocol.json, past or present, has one.
  • Found while verifying, fixed in place: porch <cmd> --help executed the command. porch done --help ran porch done on the auto-detected project, checks and all. --help/-h after a subcommand now prints help and returns.

A. Commands that failed as written:

  • --type integration --issue <N>.
  • RESEARCH critique uses one --prompt.
  • porch next/porch verify instead of porch run.
  • --protocol on every protocol review type.
  • No stdin --context or filesystem-less mode.
  • The afx spawn --protocol <name> --help check is dropped; it exits 0 for any name.

B. Who runs porch approve: the builder runs porch approve <id> <gate> --a-human-explicitly-approved-this after the architect relays the human's decision. Fixed in the porch skill, bugfix/prompts/pr.md, both roles and lifecycle.md.

C. Owner rulings:

  • C1: builders write specs and plans, architects review them.
  • C2: three reviewers by default, narrowed by config, and the configured lanes are what actually runs.
  • C3: fix-in-place in both roles; 300 lines is a guideline everywhere.

D. Contradictions and stale text:

  • Gate lists now match protocol.json.
  • Signal machinery replaced with porch done + afx send architect.
  • SPIR/ASPIR: the builder runs the consult commands porch emits, commits its own work, and opens the PR in Review (its pr_exists check requires it).
  • Branch names are builder/<protocol>-<id>.
  • ASPIR: gate wording fixed, shared rules inlined, dropped rules restored.
  • AIR: Baked Decisions wording and escalation target fixed.
  • MAINTAIN: own reviewer prompts, git rm, gate named, no hardcoded path, codev/ synced, orphan templates removed.
  • BUGFIX: one commit format ([Bugfix #N] Fix:/Test:), flaky tests, Fixes #N.
  • RESEARCH: JSON and prose agree.
  • afx/porch/consult/codev skills match the CLIs and are now byte-identical in all four trees, enforced by the parity test.
  • Cheatsheet, templates/CLAUDE.md, architect.md, doctor list.
  • <id>/<N> placeholders.
  • protocol-schema.json rewritten to describe the shipped files.

Spec 1280 deletion guard: it tripped on 10 prompts because of removals the issue requires. Re-baselined under register entry R7, which the architect (main) approved 2026-11-16. The guard is kept. Four more baselines were re-captured under R8 for the flaky-test ruling below.

Fold-ins from the pr gate review (architect, plus owner rulings main-13 and main-17):

  • roles/builder.md: the post-merge message depends on the protocol. "Ready for cleanup" is sent right after the merge only for protocols with no verify phase; SPIR/ASPIR send "Entering verify" and announce cleanup after verify-approval. The gate list names every protocol's gates.
  • Phase consultation has no enabled/parallel switch: they are dropped from the schema and from RESEARCH's blocks (both were true, so nothing changes). A false is rejected at load; a legacy true is tolerated so older local copies keep loading.
  • Porch fails fast when {{consult_commands}}/{{consult_verdicts}} is still in a prompt after substitution (a local protocol.json older than its prompt). It caught the same skew in two test fixtures, #1455 and #1903; both now carry the shipped block.
  • docs/faq.md and docs/tips.md fixed (porch run, flagless approve, retired TICK, nonexistent afx ports, integration review without --issue). Live docs/ pages are now a sweep root.
  • Flaky tests (main-13, "report"): a builder leaves a flaky pre-existing test running, names it under Flaky Tests and tells the architect. It no longer skips it. Changed everywhere the skip rule appeared, both trees, PIR included now that PR Fix #1903: PIR prompts match porch; porch renders {{issue.number}}/{{issue.title}} #1904 has landed.
  • RELEASE (main-17, "exception"): roles/architect.md names the release commit and tag, made under RELEASE after the owner's go, as the one exception to "don't commit to the default branch". RELEASE's notes filename (vX.Y.Z-<codename>.md) and codename table (through 3.3 Luxor, from docs/releases/; 2.1 left blank because no codename is recorded) are fixed.

Main merged in after PR #1904. The one conflict, in porch/prompts.ts, kept both new substituteVariables parameters (issue, consultation).

Test Plan

  • Regression test: bugfix-1902-prompt-sweep.test.ts has 29 checks over every agent-facing surface. 28 of them fail against a snapshot of the pre-fix tree; the 29th is a coverage sanity check.
  • Additional tests:
    • bugfix-1902-pr-consultation.test.ts: default lanes, config override, per-protocol override, none/parent, the rendered BUGFIX/AIR prompts, and malformed-block rejection.
    • bugfix-1902-subcommand-help.test.ts.
    • protocol-schema-validates.test.ts: all 18 protocol.json files, PIR included read-only, plus the three schema copies identical.
  • Build passes.
  • Full suite before the fold-ins: 349 files, 7343 tests passing. After the main merge, one full run (the owner asked to limit full runs): build passes, and 7449 tests pass with 6 failing. Four were the #1903 fixture skew above, now fixed and passing. Two are the flaky session-manager tests listed below. CI covers the final head.
  • CLAUDE.md ≡ AGENTS.md (byte-identical).
  • Grep of both trees for porch run, TICK, TOO_COMPLEX and integration pr: the only remaining hits are historical records (archives, lessons attributed to old TICK projects, audits, bench output, the 1280 register).
  • Every command written into a prompt was run with --help through this branch's binaries (32 invocations, all exit 0), covering porch next/done/status/check/gate/pending/approve/verify/rollback/init, consult, afx spawn/send/inbox (show, dismiss)/self-refresh/cleanup/interrupt/refresh/dev/setup/workspace start/tower connect/tower register/status/architect, and codev doctor/import/init/adopt/update. Each documented flag was grep-checked in the help text.
  • Negative probes: consult --type integration pr 1 → Unknown subcommand: pr; --prompt + --prompt-file → Cannot use both.
  • End to end: this branch's porch next for this very PR phase renders consult -m codex … / consult -m claude …, which are this repo's configured lanes.

Flaky Tests

Pre-existing tests that failed intermittently under machine load, unrelated to this PR. Per the owner's ruling, none was skipped. Each passed standalone:

  • bootstrap-docs.test.ts › "a missing, edited or older installed skill gets the packaged text inlined": 5000 ms timeout.
  • session-manager.test.ts › "bounds a harness that exits 0 immediately", and (post-merge run) "respects maxRestarts limit" and "applies crashLoopFallback after repeated fast failures": process-timing assertions; 97/97 standalone.
  • bugfix-1267-launch-loop.test.ts › "keeps resuming across a CRASH…" and "the switch to fresh is sticky…": 5000 ms timeouts.

One porch done test check also failed intermittently, with output truncated, and passed on rerun.

For the architect

  • Transition hazard in this repo: BUGFIX/AIR PR prompts in codev/protocols now use {{consult_commands}}. Until the installed porch includes this change (local-install or the next release), builders here will see that token unrendered. Adopters are unaffected, because prompts and code ship together.
  • RELEASE: resolved by owner ruling main-17 (see the fold-ins). The direct commit to main is now the architect's written exception, and the filename and codename facts are fixed.
  • Left for their own issues:
    • INSTALL.md is pre-v2 throughout (SPIDER, Ruler, TICK).
    • The two resources/commands/*.md trees have drifted apart. I fixed what was broken in both but did not sync them.

waleedkadous and others added 16 commits November 15, 2026 21:15
…g; subcommand --help no longer executes

A once phase (BUGFIX/AIR PR) can now declare consultation: {type, models}. Porch resolves
the lanes through resolveConsultationModels, the same resolver as a verify step, and
renders {{consult_commands}} / {{consult_verdicts}} into the phase prompt, so
.codev/config.json porch.consultation decides what the builder runs.

porch <command> --help / -h now prints help and returns. Before, porch done --help ran
porch done on the auto-detected project, checks included.
…ontradictions

- BUGFIX/AIR: PR phase declares three pr reviewers (configurable); prompts take the
  consult lines from porch; builder runs porch approve with the human-approval flag;
  one commit format ([Bugfix #N] Fix:/Test:); fix-in-place; 300 lines is a guideline;
  escalation via afx send architect, not TOO_COMPLEX.
- Dead signal machinery removed from prompts and JSON (signals, on_too_complex,
  unread defaults.consultation); phases finish with porch done.
- SPIR/ASPIR: builder runs the consult commands porch emits; builder commits its own
  work; PR opens in the Review phase; gate lists include verify-approval; branch names;
  ASPIR gate wording, inline shared rules, restored builder-prompt rules.
- MAINTAIN: own reviewer prompts; git rm for tracked removals; gate named; no
  hardcoded package path; codev/ copy synced; orphan templates removed.
- RESEARCH: JSON and prose agree on three models; no --prompt + --prompt-file.
- protocol-schema.json describes the shipped files; a test validates every one.
- ID placeholders: <id>/<N>, not XXXX/NNN.
- Spec 1280 deletion guard re-baselined under register entry R7, approved by the
  architect (main) 2026-11-16.
…he CLIs and owner rulings

- Roles: gate lists per protocol; the builder runs porch approve with
  --a-human-explicitly-approved-this; fix-in-place in both roles; flaky tests in the
  review (PR body for BUGFIX/AIR); porch's post-merge message; integration review
  takes --issue; afx only from the main root; Fixes #N closes the issue.
- Templates: builders write specs and plans (lifecycle, cheatsheet); gates from
  protocol.json; Tower on 4100; full protocol table; codev import; background tasks
  instead of & + wait; CLAUDE/AGENTS list porch, drop afx start and the
  afx spawn --help check; pr-overview without stdin or a filesystem-less mode.
- Resources: integration review syntax, command reference (no afx ports or
  workspace -p/--remote, complete spawn flags, porch next/done), protocol-format
  documents consultation and consult_commands.
- Root CLAUDE.md/AGENTS.md (identical): gates by protocol, branch names, builders
  write specs and plans, porch (next, done, status, approve).
…Is, identical in all four trees

- porch: no porch run; next/done/verify/pending documented; full gate table; the
  builder runs porch approve with the human-approval flag; no TICK.
- afx: PIR listed; --branch/--remote exist; --delay; afx inbox; afx self-refresh;
  addressing without the zero-padding claim; send reaches any agent; no TICK or
  --amends (eval 5 now exercises --branch/--remote).
- consult: pir in the protocol list; --branch/--base/--model-id; protocol review
  types need --protocol except integration; background tasks instead of & + wait.
- codev: doctor's real AI-model list.
- afx, porch and consult join TOUCHED_SKILLS in the four-tree parity test; shipped
  skill hashes regenerated.
Asserts across both trees, the four skill trees, root CLAUDE/AGENTS and the command
docs (PIR and RELEASE excluded) that the broken commands and contradictions #1902
named stay gone: integration pr, --prompt with --prompt-file, porch run, bare
protocol review types, stdin --context, afx spawn --help as a check, trailing-& consult,
porch approve without the flag, TICK, TOO_COMPLEX/signals, zero-padded ids, port
blocks; plus BUGFIX/AIR/RESEARCH lane JSON and gate tables derived from protocol.json.
28 of its 29 checks fail against the pre-fix tree.
…ICK; thread log

arch.md documented porch run as a live command and porch approve as human-only;
conceptual-model listed TICK among Codev's protocols. Thread log records the fix
phase: decisions, the porch --help surprise, R7, and verification.
Codex flagged the thread-log commit against the Fix:/Test: format. The rule never covered
the other commits a BUGFIX branch carries (thread log, review follow-ups); every commit
now starts with [Bugfix #N], with Fix:/Test: for the fix and the regression test and a
short label (CMAP:, Thread:) for the rest.
Claude's review: nothing asserted that a prompt using {{consult_commands}} /
{{consult_verdicts}} belongs to a phase declaring consultation, so a future author could
ship a literal token. The sweep now checks every protocol phase (using porch's own
prompt lookup: build.prompt, else <phase>.md) and asserts it sees the BUGFIX/AIR PR
prompts, so the guard cannot pass vacuously.
…l flag

porch status and the gate message printed 'To approve: porch approve <id> <gate>'
without --a-human-explicitly-approved-this; an agent copying it gets a refusal. Both
hints now carry the flag, and the sweep test checks every approve hint in porch source.
@waleedkadous

Copy link
Copy Markdown
Contributor Author

Thank you, this is a careful sweep. The porch change is the right size, the tests got stronger rather than weaker, and catching porch gate --help firing a gate was a real find.

Independent integration reviews: codex REQUEST_CHANGES, claude COMMENT. For the record, the R7 approval is real: I gave it as architect main on 2026-11-16 UTC (claude's review queried the date).

I would like five things folded in before merge:

  1. Post-merge notification vs verify (codex). roles/builder.md (around line 57, both trees) has the builder announce "Ready for cleanup" right after every PR merge, while the next lines require SPIR/ASPIR to continue through verify and verify-approval. An architect could clean up the worktree before verification. Perhaps make that row protocol-specific, or send the cleanup message only when the protocol is terminal.
  2. Builder role gate list (codex). roles/builder.md:20-22 still omits the PIR, RESEARCH and EXPERIMENT gates, while the porch skill, lifecycle template and CLAUDE.md now carry the full list.
  3. consultation.enabled / parallel (both). The schema permits them on a phase-level consultation but normalizePhase keeps only type and models, so enabled: false validates and is ignored. Either drop them from the phase-level schema or honour them; I lean towards whichever keeps RESEARCH's blocks valid with least machinery.
  4. Fail fast on an unrendered token (claude). If a rendered prompt still contains {{consult_commands}} or {{consult_verdicts}}, porch should error rather than hand the builder a prompt with no reviewers. That covers version skew and a local protocol.json without the block.
  5. docs/faq.md:99 still shows porch run 42 and a flagless porch approve. One line; perhaps add docs/ live pages to the sweep test's roots if that is cheap.

Also: PR #1904 (PIR repair) changes porch/prompts.ts too and a trial merge conflicts there. It is likely to merge first; I will tell you when, and would ask you to merge main in and resolve.

Not asking for: the flaky-test wording (pre-existing rule in the builder role; I will raise it with the owner), RELEASE, INSTALL.md, or the resources/commands drift.

…ll gate list; live docs swept

Architect review of PR #1905:
- builder.md had every builder announce 'Ready for cleanup' after a PR merge, while SPIR/ASPIR
  still need the worktree through verify. The row is now per protocol: cleanup right after the
  merge only for protocols with no verify phase; SPIR/ASPIR announce verify, then cleanup after
  verify-approval.
- builder.md's gate list now names PIR, RESEARCH and EXPERIMENT too. The sweep checks every
  gate list (builder role, lifecycle, CLAUDE.md, porch skill) against protocol.json.
- docs/faq.md showed 'porch run 42' and a flagless 'porch approve', and listed retired TICK;
  docs/tips.md showed a nonexistent 'afx ports' and an integration review without --issue.
  The sweep now covers live docs/ pages (release notes excluded); its trailing-& rule stays
  agent-only, since a human at a shell backgrounds with & + wait correctly.
…h; fail fast on an unrendered consult token

Architect review of PR #1905:
- The schema allowed enabled/parallel on a phase-level consultation, but normalizePhase reads
  only type and models, so enabled: false validated and was ignored. Dropped from the schema
  and from RESEARCH's two blocks (both were true, so nothing changes). At load, a false value
  is now an error naming porch.consultation as the place to turn reviewers off; a legacy true
  is a tolerated no-op, so older local copies keep loading.
- A prompt still holding {{consult_commands}} / {{consult_verdicts}} after substitution now
  throws (a local protocol.json older than its prompt), instead of handing the builder a PR
  step with no reviewers. The #1455 fixture rendered the real BUGFIX pr.md against a phase
  without the block; it now carries the shipped one.
Conflict in porch/prompts.ts: both sides added a substituteVariables parameter (main: issue,
for {{issue.number}}; this branch: consultation). Kept both, consultation after issue, and
main's dotted-name regex now feeds this branch's unrendered-consult-token check.
…nning, not skipped

Owner ruling (decision main-13, 'report'), relayed by the architect: a builder does not skip
a flaky pre-existing test. It leaves it running, names it under Flaky Tests in the review (the
PR body for BUGFIX/AIR) and tells the architect. Changed in both trees wherever the old
skip-with-annotation rule appeared: builder role (plus a notification row), BUGFIX edge cases,
SPIR review template, the SPIR/ASPIR/AIR/PIR pr-review checklists, PIR implement and review
prompts. Four guarded baselines re-captured under register entry R8; the sweep asserts no
agent-facing file, PIR included, says to skip a flaky test.
…s one written exception; RELEASE facts corrected

Owner ruling (decision main-17, 'exception'), relayed by the architect: RELEASE keeps its
direct commit and push to main. roles/architect.md (both trees) now names it as the one
exception to 'don't commit to the default branch': the release commit and tag, made by the
architect under RELEASE after the owner's go. RELEASE says the same at its commit step.

Two stale RELEASE facts fixed: notes are docs/releases/vX.Y.Z-<codename>.md (git mv from
UNRELEASED.md when the cycle kept one), and the codename table runs to 3.3 Luxor, filled from
the docs/releases/ filenames and headings. 2.1 records no codename, so its row is blank. The
sweep pins both facts to docs/releases/ and the architect exception.
…'s shipped consultation block

The #1903 test (from main) renders every shipped PIR/AIR/BUGFIX prompt against a hand-built
phase. BUGFIX/AIR pr.md use {{consult_commands}}, which porch now refuses to leave unrendered,
so the fixture takes the phase's consultation block from the shipped protocol.json, as porch does.
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.

Prompt sweep: fix broken commands, the porch-approve contradiction, and three owner rulings across roles, skills, templates and non-PIR protocols

1 participant