Repository navigation
[Spec 1951] Read-only PR check for architects: codev check pr | deploy | worktree - #1958
Merged
Merged
Conversation
…n context (architect, 2026-11-23)
… PR mechanics - pr-view gains optional headRefOid, isDraft, mergeable, mergeStateStatus, mergeCommit, mergedAt, reviewDecision (github, gitlab, gitea) - new read concepts commit-checks and workflow-runs: github implements them, gitlab and gitea disable them explicitly (no silent fall-through to gh) - dispatcher: timeoutMs option and a timedOut flag on ForgeCommandError - gitlab pr-view now captures before piping (#1645) and declares forge-executable: glab (#1455); it also maps body/baseRefName/headRefName - forge.md documents the concepts and fields
…ries the new nullable fields
…ab empty-output guard and body default, paginate legacy statuses
… settings, report core and git plumbing - allow-list.ts: closed per-subcommand git grammar; diff/log/show forced to --no-ext-diff --no-textconv; ref-neutral fetch only; four read forge concepts - runner.ts: the only subprocess path; argv spawn, GIT_TERMINAL_PROMPT=0, ls-remote/fetch and forge calls bounded, with its own deadline race - validate.ts, roots.ts (roots from git), settings.ts (check.* with key+file on error) - report.ts (schema 1, verdict, exit codes, check.skip, summarizeRuns), render.ts - git-facts.ts: live tips, ensureCommits, ancestry, :(top,glob) pathspec filters - test helpers: fixture repos with state snapshot, stub git/gh PATH recorders - audited-imports test keeps child_process and the forge dispatcher in runner.ts
…check reference - Architect role (both trees): run `codev check pr` before choosing review depth (mechanics; consult --type integration reviews content), again before a merge word with its verdict line in the PRFT Testing paragraph; new "Closing the loop": `codev check deploy` after merges, `codev check worktree` before afx cleanup. REMOVABLE means no data would be lost, not that the builder is finished. - risk-triage Step 1 and the workflow reference (both trees) start from `codev check pr`. Fixed in place: `gh pr diff --stat` does not exist; Step 1 now names `gh pr view --json additions,deletions,changedFiles` and `gh pr diff --name-only`, and the worked examples use `git diff --stat origin/main...origin/<branch>`. - codev.md (both trees): the three subcommands with samples pasted from real runs, statuses, exit codes, check ids, configuration (check.* and cleanup.keepIgnored, `:(glob)` pathspecs), forges, the only writes (object-store additions), the trust boundary (a project's own concept overrides, the user's merge drivers), and the JSON reports as shipped: nullable pr.baseTip and worktree.baseRef/baseTip, commits.unsafe, ignored.links/scaffold, what `regenerable` counts, spawn's entries as scaffold, links among keep-list files, checks.lastCodeCommit null, head.relation, forge.reviewDecision, linked-issue.references. - overview.md rows (both trees); the codev skill in four copies (hashes regenerated); the forge skill gains commit-checks and workflow-runs; arch.md Core Components §9. - Thread log: Phase 7.
…eads git status with -z - cleanup's hasUncommittedChanges read `git status --porcelain` line by line, so git quoted a path holding a space, a quote or a non-ASCII letter, linkAt could not read it, and a spawn-made entry with such a name counted as dirty (codex; claude note 3). It now runs `git status --porcelain -z --untracked-files=all` through execFile (windowsHide), not the shared run(), which trims stdout and would drop the first entry's leading status space. A rename's source path is dropped, so a rename counts once. - Tests: a hard link and an unchanged copy at paths git would quote are not counted (fails with the old parsing); pinned the safe direction: a lone ' M' first entry, a quoted untracked name and a staged rename are each counted once, and a failing git status is still "Unable to check status" (dirty). - codev.md (both trees): an identical copy is scaffold whoever made it; nothing is lost while the main checkout holds the file (claude note 1). - Rebuttal and thread log.
…y notice's real path; hang tests survive load
- cleanup's dirty notice calls execFile(cmd, args, options, cb), but three cleanup suites mocked
the 3-argument form, so the options object was called as the callback and the notice always
read "Unable to check status" (claude, Phase 7 iter2 note 2; architect order). The mocks now
take both forms:
- air-1950-cleanup-keep-ignored: git status answers from the test; a new case asserts the
notice reads "1 uncommitted file(s)", not "Unable to check status".
- air-1950-cleanup-keep-ignored-e2e: git status runs for real in the fixture repository; the
case asserts the notice counts notes.md.
- spec-1658-cleanup-worktree-removal: records 'ps' only for ps.
Both new assertions fail with the old mocks put back (checked).
- check-deploy / check-pr-forge hang tests: the 1 s limit bounds every call of the run, so at
load ~31 an earlier call timed out first (1 failure in a targeted run, passes alone). The
limit is 5 s; the stub still sleeps 60 s.
… routed to the cold tier - codev/reviews/1951-read-only-pr-check-for-archite.md: spec compliance, live runs (check pr 1958 at a four-commit porch tail, 1640, earlier phases), deviations per phase, commits no reviewer has seen, per-round consultation dispositions with the allow-list/stub tightening table, flaky tests. - lessons-learned.md (cold): callback-mock arity; three-layer read-only proof; per-run timeouts under load; realpathSync.native on Windows; git status -z parsing; porch review-round order. - pr.ts: one comment on checkCi's own check.skip test (claude, Phase 4 iter2 note 5). - Thread log: review phase.
waleedkadous
marked this pull request as ready for review
November 24, 2026 20:13
… the PR as it is at the end; config validated before any git call but discovery - check pr re-reads pr-view at the end and now compares the base branch, the state and the draft flag as well as the head (codex). A change needs attention, the line naming what changed and asking for a re-run: `state changed during check (OPEN → CLOSED)`, `… (OPEN → OPEN (draft))` even with `state` skipped, `base branch changed during check (main → release)` on the trial merge. - forge: when the first read was UNKNOWN and the head moved, the re-read's answer says which head it is about, `(for the new head <sha>)` (claude note 1). - The origin check runs after the configuration is validated, in all three commands, so the only subprocesses before validation are the two that find the main checkout, where the configuration lives: rev-parse --show-toplevel and worktree list --porcelain (codex; option (a), architect). The pr, deploy and worktree config-error tests record every spawn and assert exactly those two. The spec's "before any subprocess" wording is unchanged; the review records the difference for the owner. - parseWorktreeList takes a path verbatim (a trailing space survives) and reads CRLF like LF. Not -z: that needs git 2.36, and the commands run on older git (claude note 3; architect). - codev.md (both trees): check.attribution patterns are trusted and run without a time limit (claude note 2). - Each new test fails with its change taken out (checked).
…ded for the owner - Review file: the config-validation order under Deviations in plain words (what the spec says, what the code does, why; the approved spec and plan text unchanged, for the owner to accept at the pr gate); PR review round 1 under Consultation Feedback; d5bc0b2 under Commits No Reviewer Has Seen; the input-validation and no-race criteria qualified. - Rebuttal 1951-review-iter1-rebuttals.md. - lessons-learned.md (cold, Process): re-read spec criteria when a plan revision changes their premise; record the conflict, do not retitle the test. - Thread log.
… run on the final head - Review file: the architect-run Codex review of d5bc0b2 (one finding, rejected by the architect, with the reason); the full local run after ci-first's retirement (440 files, 9,286 tests passed, 363 s, load 18.4 → 27.7). - Thread log.
# Conflicts: # codev/resources/lessons-learned.md
…the Cockpit and PR #1980
waleedkadous
added a commit
that referenced
this pull request
Nov 25, 2026
waleedkadous
added a commit
that referenced
this pull request
Nov 25, 2026
waleedkadous
added a commit
that referenced
this pull request
Nov 25, 2026
…d build; protocol complete
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
codev checkis a read-only command group:codev check pr <N>collects what an architect reads before recommending a merge. It reports:codev check deploy <N>…says whether merged PRs reached the deploy branch and, if a deploy workflow is configured, its latest green run.codev check worktree <id|path>says whether removing a builder's worktree and branch would lose data.Each prints a summary a person can read in ten seconds, a
--jsonreport (schema: 1), and exit 0 (clear), 1 (needs attention) or 2 (the command failed). They never merge, push, comment or delete.Closes #1951
For the owner to accept: when configuration is validated
git rev-parse --show-toplevelandgit worktree list --porcelain.findWorkspaceRoot()returns the worktree itself). Neither call takes a configuration value. No config value reaches any subprocess, forge call or network call before it is validated..gitandcommondirby hand, would reimplement git's discovery and could disagree with it.origincheck) also ran first, and the test said only "before any forge call". It now runs after validation. The pr, deploy and worktree config-error tests record every spawn and assert exactly the two calls.How read-only is enforced
commands/check/runner.tsis the only module allowed to spawn. Every git argv must fit a closed per-subcommand grammar. Diff-family commands are forced to--no-ext-diff --no-textconv, and the only fetch allowed is ref-neutral, by SHA. The only forge concepts allowed arepr-view,pr-search,commit-checksandworkflow-runs. Anything else is refused before it is spawned (exit 2). An audited-imports test keepschild_processand the forge dispatcher insiderunner.ts.gitandghfirst onPATH. Each stub keeps its own grammar and records every argv, and any write form fails the test.HEAD, the index bytes,FETCH_HEADandstatusbefore and after each command. The runs include a conflicting trial merge and a fetch of missing objects. The only writes are object-store additions.Changes
pr-viewgains optionalheadRefOid,isDraft,mergeable,mergeStateStatus,mergeCommit,mergedAtandreviewDecision.commit-checksandworkflow-runs. github implements them; gitlab and gitea disable them explicitly.timeoutMs.pr-viewpipefail (tower: overview cache burns the user's entire GitHub GraphQL quota (3 gh calls × N workspaces every 30s, failures uncached) — every gh command on the machine then fails #1645) and itsforge-executable(pr-create is not a forge concept: gh pr create is hardcoded in the skeleton prompts, so non-GitHub forges need a gh shim #1455).check.*settings, the report and its renderer, and the git plumbing.check pr(Phases 3–4): eleven checks, an end-of-run re-read of the head and base, and the porch-only walk.check deploy(Phase 5):merged,on-branch,deploy-runandmerge-checks.check worktree(Phase 6):uncommitted,commits,remote,prandignored. New shared modulesagent-farm/lib/keep-list.tsandbuilder-scaffold.tsare used byafx cleanupas well.afx cleanup:git status -z, so quoted paths are judged correctly.codev check prbefore choosing review depth and before a merge word,check deployafter merges, andcheck worktreebeforeafx cleanup.risk-triage.mdStep 1 starts fromcodev check pr. Fixed in place: it namedgh pr diff --stat, a flag that does not exist.workflow-reference.md,overview.md, thecodev.mdreference (with real samples and the shipped JSON),forge.md, thecodevskill in all four copies (hashes regenerated), the forge skill, andarch.md§9.execFilein the four-argument form the dirty notice calls. Before, it always read "Unable to check status".d5bc0b227):check pr's end-of-runpr-viewcompares the base branch, state and draft flag as well as the head. A PR closed, merged, marked draft or retargeted during the run needs attention, with a line naming what changed.origincheck runs after config validation (see above).-z, which needs git 2.36.codev.mdsays attribution patterns run without a time limit.Testing
Full local run, the local evidence (owner ruling main-39 retired ci-first). After merging main's worker cap (PR Fix #1956: cap packages/codev vitest at 3 workers (singleFork was dead since Vitest 4) #1965), on the final head
30853b1fe,npm test -- --exclude='**/e2e/**'frompackages/codev: 440 files passed and 14 skipped; 9,286 tests passed and 116 skipped; exit 0. Wall time 363 s; one-minute load 18.4 at the start, peak 27.7. Main then moved (Spec 1940), andcodev check pr 1958found a conflict inlessons-learned.mdbefore the gate; the forge agreed. After merging main (5d802799f), a second full run: 449 files passed and 14 skipped; 9,885 tests passed and 116 skipped; exit 0; 342 s; load 11.0 at the start, peak 39.0.Test scenarios 1–28a each have at least one test. Targeted local run after the PR review fixes: 1028/1028 in 36 files. An earlier run's one failure was a load-sensitive hang test of this PR's own, fixed in
017f0baea.Locally: the build, the type-check on the source and on the check tests, and the tmp-residue check. Governance doc tests: 153/153.
Live runs, with no ref changed:
codev check pr 1958at a head four porch-only commits above the code: 7.3 s.codev check pr 1640(44 files):CONFLICTING, DIRTY, agreeing with a 15-file trial-merge conflict: 7.6 s.check deploywith and without a deploy workflow.check worktreeon four builders.The architect repeated runs of each command from the main checkout.
Windows:
1a6eb69dd, after the PR review round 1 fixes (full suites pluscommands/check): green, and GitHub was 8/8 there;e9baeeec0: green. GitHub is 8/8 one9baeeec0and on the final head5bede631e;41fb24c3e, after merging main with Spec 1940: green;7b2e06b8aadds only a merge of main with PR [Bugfix #1853] porch: save failed check output to a log, print its last lines #1964 (porch code, the porch skill's four copies, and the hash file, which regenerates identically) plus a thread-log line. No Windows run was dispatched for it (no platform code; architect). GitHub is 8/8 on it, andcodev check pr 1958reads CLEAR there (trial merge clean into main @ 88bc5e9).arch.mdandlessons-learned.md, auto-merged) and PR Fix #1978: a workspace runs while it has an open terminal, not while it has a map slot #1980 (overlap only the hash file, which regenerates identically). Local set on06462ce91: build, both type-checks, governance, doc and skill tests 131/131,commands/check784/784, 1951's agent-farm tests 31/31. Main changedwindows.yml, so one Windows run on the final head275f01461: 45521351185, green (unit tests, CLI tests, targetedcommands/check, install verification, both probes). GitHub 8/8 on275f01461.cbd70ecd8passed, and GitHub's 8 checks oncbd70ecd8were green;f93aa60e1.Under owner ruling main-38 ("ci-first"), the builder never ran the full suite locally. GitHub's 8/8 run stood in for porch's local
testscheck at each phase head. Every skip is listed at the end.Spec
codev/specs/1951-read-only-pr-check-for-archite.md
Review
codev/reviews/1951-read-only-pr-check-for-archite.md
Commits no reviewer has seen (look at these specifically)
Porch force-advanced two phases at the three-iteration ceiling, so CMAP never reviewed their round-3 fixes:
Phase 2 (
readonly_core). Confined tocommands/check/test helpers, plus a one-line guard ingit-facts.ts.aa7e34f58:git'sls-remoteaccepts onlyorigin, thenHEADorrefs/…names.--no-indexdiff of files outside the repository.ls-filesandstatustake no arguments, andfor-each-reftakesrefs/patterns only.liveTipbranch-name guard.c42251ec5: theext::refusal case no longer uses a/tmppath.Phase 6 (
check_worktree).a1ccc442b: spawn's native-Windows link fallbacks count as scaffold. That is a hard link of the main checkout's file, or a copy whose bytes still equal it; a changed copy is data.f93aa60e1, moved this rule intoagent-farm/lib/builder-scaffold.ts. At the architect's request, the Phase 7 reviewers reviewed it, and both approved in iteration 2.PR review, round 1.
d5bc0b227(the fixes) and1a6eb69dd(review file, rebuttal) were made after the PR-phase consultation. Porch ran no second round. The architect had Codex reviewd5bc0b227: one finding (normalised state words, soOPENED→OPENis not flagged), rejected by the architect because those are two spellings of one state, and one run reads one forge.1a6eb69ddis documents only.The review-phase commits
017f0baeaandcbd70ecd8were reviewed by the PR-phase consultation (Claude APPROVE; Codex's two issues are fixed ind5bc0b227).Local tests check skipped once, under owner ruling main-32.
Phase 1 (
forge_read_concepts), headbb2ad2710.Porch's local
testscheck failed under machine load (tests: one run of the packages/codev unit suite takes an 18-core Mac from load 8 to 59, and its own spawn-heavy tests then time out #1956). The failing tests were unrelated to this change and each passed alone, and the builder's own full run passed.The architect confirmed GitHub's run on this PR at
bb2ad2710was 8/8 green.porch.checks.tests.skipwas set in the worktree's own.codev/config.local.jsonfor a singleporch doneand removed in the same command. It was never committed. The build check still ran and passed.Phase 2 (
readonly_core), head9081d4367.porch doneat load 9.5. Itstestscheck failed on four unrelated, spawn-heavy files:agy-auth-cache,windows-console-spawn-guard,pir-1233-session-launch-loopandbugfix-1267-launch-loop. Porch's output did not name them (porch done truncates failing check output; the failing test is never named #1853); vitest's results cache did.9081d4367was 8/8 green. The skip was then applied once, in the same way, and the build check passed.Phase 3 (
check_pr_mechanics), head5bef2f503, under owner ruling main-38 ("ci-first": no local full suite until tests: one run of the packages/codev unit suite takes an 18-core Mac from load 8 to 59, and its own spawn-heavy tests then time out #1956 is fixed).porch done. Locally: the targeted tests (551/551 in 14 files), the build and the type-check.5bef2f503was 8/8 green. The skip was then applied once, in the same way, and the build check passed.Phase 4 (
check_pr_forge), head410d5ec14, under the same ruling main-38.No local full-suite run and no plain
porch done. Locally: the targeted tests (644/644 in 17 files), the build, and the type-check on the source and on the check tests.The architect confirmed GitHub's run at
410d5ec14was 8/8 green. The skip was then applied once, in the same way, and the build check passed.Review iteration 1 fixes, head
e1cece6f6: targeted tests 664/664, build. The architect confirmed GitHub's run ate1cece6f6was 8/8 green. The skip was then applied once, in the same way, and the build check passed.Phase 5 (
check_deploy), head53f7e6522, under the same ruling main-38.porch done. Locally: the targeted tests (719/719 in 19 files), the build, and the type-check on the source and on the check tests.53f7e6522was 8/8 green. The skip was then applied once, in the same way, and the build check passed.Phase 6 (
check_worktree), headb6f7d4d74, under the same ruling main-38.No local full-suite run and no plain
porch done. Locally: the targeted tests (906/906 in 29 files), the build, and the type-check on the source and on the check tests.The architect confirmed GitHub's run at
b6f7d4d74was 8/8 green. The skip was then applied once, in the same way, and the build check passed.Review iteration 1 fixes, head
dd21e15ce: targeted tests 910/910, build. The architect confirmed GitHub's run atdd21e15cewas 8/8 green. The skip was then applied once, in the same way, and the build check passed.Iteration 2, head
95ae544b5: this commit is porch's status file only; the code is unchanged sincedd21e15ce. The architect confirmed GitHub's run at95ae544b5was 8/8 green. The skip was applied once more, and the build check passed.Review iteration 2 fixes, head
a56bf9a37: targeted tests 925/925 (24 files), build. The architect confirmed GitHub's run ata56bf9a37was 8/8 green. The skip was applied once for the rebuttal'sporch done, then once more for iteration 3'sporch doneat8a66ff91a(porch's status file only; the architect's standing word covers this). The build check passed both times.Review iteration 3 fixes, head
a1ccc442b: targeted tests 926/926 (24 files), build. The architect confirmed GitHub's run ata1ccc442bwas 8/8 green. The skip was applied once for the rebuttal'sporch done, and the build check passed. Porch then force-advanced to Phase 7.Phase 7 (
docs_guidance), head827eed9d4, under the same ruling main-38. The architect confirmed it still stands; retiring it is part of open decision main-39.porch done. Locally: the targeted tests (977/977 in 32 files), the doc-integrity tests (158/158) and other doc-reading tests (147/147), the build, the type-check on the source and on the check tests, and the tmp-residue check.f93aa60e1and at827eed9d4, and the Windows run atf93aa60e1was green. The architect confirmed the run at827eed9d4. The skip was then applied once, in the same way, and the build check passed (porch commitd92a07d70).0c02478dd: cleanup readsgit statuswith-z. Locally: targeted tests 989/989 (33 files), both type-checks, build, tmp-residue. GitHub was 8/8 green at0c02478dd, and Windows run 45471312317 was green. The architect confirmed both. The skip was applied once for the rebuttal'sporch done, then once more for iteration 2'sporch doneat32d7a57db(porch's status file only; the architect's standing word covers this). The build check passed both times.Review phase, head
cbd70ecd8, under the same ruling main-38.017f0baea(77/77 after the fix). Also the governance doc tests and imports audit (153/153), both type-checks, the build and the tmp-residue check.cbd70ecd8was 8/8 green, and Windows run 45478428811 passed.porch done(porch commitd97668c21). The review phase's checks turned out to bepr_existsand the two review headings, with notestscheck, so the skip changed nothing.config.local.jsonwas restored, andcmpshowed it identical.Ci-first retired (owner ruling main-39, 2026-11-24). The rebuttal's
porch doneran the ordinary way at load 17.8, after mergingorigin/main(e9baeeec0), with no skip. Its checks (pr_existsand the two review headings) passed, and porch requested theprgate (30853b1fe).