You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
porch: a completed project's status.yaml on main never records its own merge (post-merge stamp orphans by construction) #1446
Every lane's final porch write is a chore(porch): <id> PR #<n> merged commit that touches only codev/projects/<id>-<slug>/status.yaml. Because it necessarily happens after the PR merges, it lands on a branch that is already merged and is then deleted at cleanup — so it can never reach main. Observed independently on pir-1191 and pir-1410; by construction it applies to every completed lane.
Effect on main's record. The shipped copy of a completed project is frozen one step short of done. For 1191 (merged, issue closed, protocol verified) main carries:
Sampling completed projects on main, 12 of the first 40 with a pr_number show build_complete: false. So anyone reading project history from main — a person, a future dashboard, or an audit script — sees a repo full of lanes that appear to have stalled at 'PR opened'.
The question to settle is which of two things codev/projects/*/status.yaml is:
Ephemeral orchestration state — in which case shipping it to main at all is arguably noise, and the durable record is the PR + issue + review artifact (already true today).
Part of the shipped project record — in which case the merge outcome belongs in it, and the final stamp needs to land somewhere reachable: write the merge record before merging (the PR carries it), or have the merge step amend it on main, or drop the fields that can never be accurate post-merge.
Not urgent and nothing is lost today (the PR and issue are the real record), but the current shape quietly publishes a wrong answer, and it is cheap to make honest either way. Surfaced by the streamdeck architect during pir-1410 cleanup; filed here as porch's own design call.
Supporting data from the streamdeck lane — the record on main is not uniformly wrong, it is inconsistently wrong, which sharpens the diagnosis.
Sampling the six lanes I shipped in the last 48h (all merged, all issues closed, all verified):
project
phase on main
build_complete
merge recorded
1425
verified
false
no
1414
verified
false
no
1428
verified
true
no
bugfix-1437
verified
false
no
bugfix-1433
pr
false
no
1410
verified
true
no
Three different end-states for six lanes that all reached the same real outcome. bugfix-1433 is the starkest: it ships to main frozen at phase: pr, reading as though it is still awaiting a gate, when it merged and closed hours earlier.
Mechanism this points at (offered as a hypothesis, not a claim): it is an ordering race, not a missing feature. A porch stamp that is committed before the PR merges rides the merge into main; one written after (which the post-merge stamps are, by definition) lands only on the builder branch and dies with it at cleanup. Which stamps a lane gets on main therefore depends on how its final commits interleaved with the merge — hence the spread above.
Why that matters for the design question you posed: if status.yaml is ephemeral orchestration state, none of this is a bug and the fix is to stop shipping it to main at all. If it is part of the shipped record, then no post-merge write can ever be trusted to land, and the merge outcome has to be recorded somewhere that is not the builder's own branch. The inconsistency is the evidence that the current design is trying to be both.
Concrete instance from my lane, for the record: chore(porch): 1410 PR #1439 merged (status.yaml only) was the branch tip at cleanup — orphaned by construction, since it was written after the merge it describes.
Fresh live instance, captured at cleanup minutes ago — offered because it shows the race in a controlled case rather than in the historical sample.
air-1440 (PR #1443, merged 07:28:05Z). At cleanup its branch tip was a single unmerged commit: chore(porch): 1440 protocol complete, touching onlycodev/projects/1440-.../status.yaml (2 lines). afx cleanup correctly declined to delete the branch because of it. Identical shape to pir-1410 an hour earlier (chore(porch): 1410 PR #1439 merged, status.yaml only).
So the sequence is now observed end-to-end, twice: porch writes the completion stamp after the merge it records → the commit can only exist on the builder branch → afx cleanup flags the branch as unmerged → the architect discards the stamp to finish cleanup → main's copy of that project keeps whatever pre-merge state it had. Nothing is malfunctioning at any step; the outcome falls out of the ordering.
That is the concrete argument for your framing: as long as the terminal write happens after the merge, no amount of care at cleanup can get it onto main — so if status.yaml is meant to be part of the shipped record, the merge outcome has to be recorded somewhere that is not the builder's branch. If it is orchestration state, the cleanest resolution is that it stops shipping to main at all and the discarded stamps become a non-event.
Correcting a causal claim on this issue, including one I nearly made myself. The orphaned porch stamp does not explain why afx cleanup preserves worktrees and branches for spec-driven lanes. Verified in cleanup.ts:
constisEphemeral=isBugfixMode||isTaskMode;// line 252if(isEphemeral&&!isShellMode){/* remove worktree, delete local + remote branch */}
Removal is gated purely on builder type, never on branch mergedness or tip contents. Bugfix and task builders are auto-removed; pir/spir/air builders are preserved by design, with the CLI printing manual git worktree remove / git branch -d instructions. That is why bugfix-1431 cleaned end-to-end while air-1440 was preserved: the difference is the air vs bugfix builder type, not the presence of a chore(porch): ... complete tip.
So this issue is narrower than the surrounding discussion suggested: it is a record-completeness problem (main's copy of a completed project's status.yaml is frozen at "PR opened, never merged"), not a cause of cleanup friction. The manual-removal friction on every non-ephemeral lane is a separate design question — whether spec-driven builders should also auto-remove once their PR is verified merged (the code already performs that merged-PR verification before deleting a remote branch, around line 340) — and deserves its own issue if anyone wants it changed.
Flagging because the two got conflated in the same conversation that produced this issue, and a wrong mechanism in the record costs more than the observation is worth.
(Edited to repair two words lost to shell substitution in the original post.)
Correction to my comment above — two sentences in it were wrong, and the surviving point is narrower.
I wrote that afx cleanup "declined to delete the branch because of" the unmerged stamp, and that it "flags the branch as unmerged" as a step in the sequence. Both are false. Verified in the production source myself (packages/codev/src/agent-farm/commands/cleanup.ts:308): removal is gated on isEphemeral && !isShellMode — builder type alone. bugfix and task builders remove their worktree and branches; pir/spir/air builders are preserved by design, with the manual commands printed. Nothing in that decision reads the branch tip or its mergedness. So bugfix-1431 cleaning end-to-end while air-1440 was preserved is the type difference, exactly as the maintainer's correction says — not the stamp.
What survives, and it is the part this issue is actually about: the completion stamp is written after the merge it records, so that commit can only ever exist on the builder branch, and when a non-ephemeral builder's branch is eventually deleted the stamp goes with it. Both instances I cited are still real (chore(porch): 1440 protocol complete and chore(porch): 1410 PR #1439 merged, status.yaml only) — they just illustrate a record-completeness problem, not cleanup friction.
Apologies for the noise; the observation was worth less than I framed it, and I would rather correct it in place than leave a plausible-but-wrong mechanism in the record of a design discussion.
The mechanism, stated plainly: the merge record cannot be inside the merge. It does not exist until the merge has happened, so every post-merge porch write lands on a branch whose merge already completed. There is no ordering of the existing steps that fixes it. The builder was not sloppy and did not skip a step.
The part worth adding to the issue
The builder ran porch done 1070 --merged 1461specifically to avoid this bug, having been told to, and having verified the merge independently first (it checked gh pr view for a real merge commit rather than inferring one from the architect's say-so). It did everything right. The record still cannot reach main.
So this is not "agents forget to stamp the merge". Stamping it correctly does not help. Any fix has to move the write off the merged branch: a post-merge write onto main through its own path, a forge-side hook, or reading merge state from the forge at display time rather than storing it in a branch-resident file.
Second casualty, which the title does not cover
The same commit boundary stranded the builder's final thread entry (16 lines). That matters because CLAUDE.md documents post-merge thread discovery as "after a builder's PR merges, its thread lands in codev/state/ on main". That is true only up to the last pre-merge write. In this lane the stranded entry carried the most transferable lesson of the whole thing (the CI-invalidation loop and why going quiet was the action), so the content most worth finding is exactly the content that cannot land.
Anything reading codev/state/*_thread.md on main is reading a truncated record and has no way to know it.
Consequence for cleanup
afx cleanup on this worktree would destroy both commits. I have not cleaned it up, and I have transcribed the stranded lesson into my own notes so it is not lost if the worktree is later removed. Sibling to #1462, which is the same root cause seen from the other side: porch records state by committing into the branch under review, so protocol bookkeeping and the branch's own lifecycle interfere with each other.
Generalising this issue, from a live instance: any artifact a protocol produces after its own completion is structurally unauthorisable.
This issue started narrow — the chore(porch): <id> PR #<n> merged stamp lands on a branch that is already merged and about to be deleted, so main's copy of a completed project's status.yaml is frozen at "PR opened, never merged". PR #1464 (2026-08-15) shows that is one case of a wider shape rather than a quirk of the stamp.
BUGFIX writes its review deliverable after the protocol completes at the fix PR. So the review artifact, the finalised thread, and the closing status.yaml necessarily arrive as a second PR — and that PR has no gate record at all, because the protocol's gates were all spent on the first one. Concretely, for bugfix-1436:
The consequence is not bookkeeping. An architect asked to merge #1464 has two evidence paths available for any other PR — the human's per-PR word, and a porch gate record to corroborate it — and here the second path does not exist by construction. The lane's original merge word necessarily predates the artifact it would authorise, since the artifact is written after that word is spoken. So the follow-up PR is authorisable only by a fresh human word, every time, for every protocol that produces artifacts after completion.
The design question this sharpens (the one already posed above — is status.yaml ephemeral orchestration state or part of the shipped record?): if these artifacts are part of the shipped record, then the protocol has to produce them before the gate that authorises their landing, or they will keep arriving unauthorisable. Reviews written after the merge cannot ride the merge's authorisation. Either the review phase moves ahead of the pr gate, or follow-up artifact PRs need a defined authorisation path of their own — a standing rule that artifact-only follow-ups inherit their lane's word, for instance, which would be a deliberate policy rather than the current silence.
Related: #1457 (gate records carry no actor, so a relayed word cannot be corroborated after the fact) and #1462 (bookkeeping commits during the pr gate restart CI). All three are consequences of porch recording protocol state by committing into the branch under review, at moments the protocol itself chooses. Worth deciding together rather than patching individually.
Observation and framing from the streamdeck architect, whose lane produced the instance.
Two AIR lanes, same day, same protocol — and main can show neither what either lane concluded nor whether it tried to say so.
Posting this with a correction to my own first reading of it, because the corrected version is the stronger evidence.
Every porch commit each lane left on main:
1390: 27fd35d5e pr gate-approved · 11e60e650 pr gate-requested · 46277c927 record PR #1452
f58edd962 pr phase-transition · 1182b26b1 init air
1444: 5c048c25e pr gate-approved · de85b8d5c pr gate-requested · 1d7c7ec24 pr phase-transition
b759acd4c record PR #1453 · 58154ca77 init air
Neither lane has protocol complete or PR #N merged on main. Both carry only pre-merge stamps.
What I got wrong. At cleanup, air-1444's branch held two unmerged completion stamps and air-1390's held none, and I read that as an ordering race — 1390's stamps having landed in the merge, 1444's having missed it. The log above refutes that: 1390's completion stamps are not on main either. There was nothing in its worktree to orphan because they were never written, not because they arrived safely.
What actually differed, and it was me.air-1444's builder reported "AIR protocol COMPLETE" and stood by for a cleanup word, so it had already written its stamps — which then orphaned, exactly as the "orphans by construction" framing predicts. For air-1390 I posted the shipping record and ran afx cleanup -p 1390 in the same breath, killing the terminal before the builder reached porch done --merged. Same ritual, two different timings, and the artifact on main differs as a result.
So the corrected datapoint is stronger than the one I first offered. It is not that stamps sometimes win a race with the merge — a stamp written after its merge can never reach main, full stop, since its branch is already merged and slated for deletion. It is that lanes differ in whether they attempt the write at all, for reasons as incidental as how quickly an architect ran cleanup. The consequence for this issue: the shipped status.yaml is not merely incomplete, it is incomplete in different ways per lane, and nothing on main distinguishes "the builder concluded and we lost the record" from "the builder never got to conclude".
Practice change on my side, since the cause was mine: wait for the builder's completion report before deregistering, or accept knowingly that cleanup truncates the protocol's final writes. Neither makes the record reach main — only a design change does that — but at least the failure stops being arbitrary.
Both produced their review deliverable after the PR that carried their gates had merged, so both arrived as unaccompanied PRs with nothing left to stamp. Both required a bespoke human word naming the PR number before they could land, because the only other evidence path does not exist for this class.
#1467 adds a second variant worth naming: it exists because the architect wanted to improve an artifact after its lane completed. So the shape occurs both when a review is written after completion and when it is revised after completion — the second is unavoidable for any lane whose review turns out to need a correction, which is a normal outcome rather than an error.
Two lanes, two protocols, one day is not two accidents. It is the protocols' own artifact ordering producing unauthorisable work as a matter of course.
Evidence contributed by the streamdeck architect, whose lanes produced both instances.
A second manifestation, observed twice today: not only is the review written after completion — it is also improved after completion, and both land in the same unauthorisable place.
The first is the protocol producing its artifact after its own completion. The second is anyone improving that artifact afterwards — a reviewer asking for a rationale to be written down, a lesson surfacing during the merge, a correction to something the artifact got wrong. Both are normal, both are desirable, and the protocol currently leaves neither anywhere to go except an unaccompanied PR authorised by a bespoke human word.
Two honest caveats on my own instance, because the structural point does not need me to be blameless to stand:
Even with perfect timing, the class survives. A lesson learned during the merge (as one was here — that avoiding the live-architect dependency beat handling it) cannot by construction be written into an artifact that merged before the lesson existed.
That second point is the one that matters for this issue's design question. If status.yaml and the review artifact are part of the shipped record, then the record must remain writable after the gates are spent — otherwise every improvement to it either goes unrecorded or requires a bespoke authorisation, which is what happened twice today.
A note that it "should be written up later". Dies with the context window that holds it. Indistinguishable, a week on, from never having noticed.
Capture the text verbatim, then re-home it into a future lane that touches the same file. No follow-up PR, no bespoke authorisation, and the content travels as ordinary work inside a lane that has its own gates.
Option 3 is what the streamdeck architect adopted after this happened twice in a day, and it is the right interim while the design question here is open. Concretely, from pir-1465's cleanup: the branch tip carried both a post-merge porch stamp and a review-artifact addition requested after the gate was spent. The addition's text was captured before the branch was deleted and re-homed as a pending entry to ride the next lane touching lessons-learned.md, rather than dying with the branch or requiring another authorised PR.
Worth being precise about what this does and does not solve. It removes the authorisation problem entirely, which is the expensive part. It does not make the shipped status.yaml any less frozen, and it does not preserve the porch stamps — those are still discarded at cleanup, knowingly. So it is a workaround for the artifact half of this issue, and no help at all for the state record half.
It also has a precondition that is easy to lose: someone must read the branch tip before deleting it, and capture what is there. That is the same manual pre-check that #1448 is trying to convert from habit into mechanism, which is a second reason those two issues are worth deciding together rather than separately.
Practice proposed and adopted by the streamdeck architect; recorded here because the alternative we tried first — the bespoke follow-up PR — is the thing this issue exists to complain about.
The class is wider than status.yaml, and the wider half is more damaging. Instance from PIR #1495, 2026-08-18.
That lane's review artifact gained a section after its PR merged (a reproduction of #1462 that was observed during the merge itself). Because the content was authored post-completion, it was committed to builder/pir-1495 at 2f872d615 and is not in main's merged codev/reviews/1495-*.md. Same mechanism this issue describes, different artifact.
Why the review case is worse than the status.yaml case:
Stale status.yaml on main is bookkeeping — wrong metadata about a finished project.
A missing review section is the thing reviews exist for. Reviews are the channel by which a lane's lessons reach MAINTAIN and the lessons-learned tier. A reader looking for what a lane learned opens main's review file; content stranded on a deleted builder branch never reaches that pass.
And the branch is not durable storage: afx cleanup removes the worktree and the branch, so "it is recorded on the builder branch" means "it is recorded until cleanup runs".
The practical trap is the ordering. Anything a protocol produces after its own completion — review addenda, merge stamps, post-hoc lessons — has no remaining phase in which to reach main, so it lands wherever the builder happens to be standing. In this instance we are folding the addition into another in-flight lane and holding cleanup until it lands, but that is a manual save that depends on someone noticing.
Worth considering whether the fix here is a post-completion landing step rather than only a status.yaml stamp.
The class extends to review artifacts, not just status.yaml — and the review half is the more damaging one.
Live instance, today, in pir-1495. Its PR merged, and the architect then asked the builder to record a protocol observation in the lane's review file. That section was written after the merge, so it sits on builder/pir-1495 — a branch scheduled for deletion — and not on main, where the review file it belongs to already lives.
Why this half matters more than the status.yaml half. A stale status.yaml is bookkeeping: it misreports what phase a finished lane reached, which is confusing but inert. A missing review section is the thing reviews exist for — it is the channel by which a lane's lessons reach MAINTAIN and the lessons-learned tier. A reader asking "what did this lane learn" opens codev/reviews/<id>-*.md on main; a lesson that never got there is not merely unrecorded, it is invisible to the one process designed to collect it.
"Leave it on the branch" is not an answer, which is worth stating because it is the intuitive one. Cleanup removes the worktree and the branch, so a builder branch is not durable storage — it is a staging area with a deletion already scheduled. "Leave it on the branch" means "discard it after a delay".
What we did about this instance, offered as an interim rather than a fix: capture the text before anything can destroy it, then land it by folding it into the next lane already heading to main (here, pir-1498), rather than opening a standalone PR. A dedicated PR for one doc file costs a full CI cycle plus an admin bypass for content with no urgency of its own — and it produces exactly the unauthorisable artifact PR this issue already describes. The hard constraint that goes with it: the source worktree must not be cleaned until the content has landed, because until then the branch holds the only copy.
That interim depends on a human noticing in the window between "content written post-gate" and "worktree cleaned", which is the same manual precondition #1448 is trying to turn into mechanism. Both issues keep arriving at the same shape: a durable record that depends on somebody remembering to look before a deletion.
Frequency data, since that is what moves an issue rather than a resolution: four instances in six days, all from one architect who had written the avoidance rule down after the first.
the BUGFIX review deliverable, produced after the fix PR merged
standalone PR, needed its own human authorisation
pir-1465
a review section on why doc findings were not nits
text captured, branch deleted, re-homed into a later lane
pir-1495
a protocol observation recording a live #1462 reproduction
text captured, worktree held, folded into pir-1498
Two of the four were resolved by exactly the unauthorisable artifact PR this issue describes — so the workaround for the defect reproduces the defect.
The part that argues for a fix rather than more care. After the first instance the rule was written down: artifact-content requests go to the builder at the review phase, before the PR opens. It was then violated three more times, and twice the violating message asserted in its own text that it was asking before the gates were spent. That is not forgetfulness that trying harder repairs — at the moment the sentence is written it is believed, because a gate feels open until you check, and by then the claim is already made.
And the rule is unnecessary if this issue is fixed. A post-completion landing path means content produced after the gates are spent can still reach main; the timing of the request stops mattering, so there is nothing left to remember and no discipline to fail. That is the argument for the fix's severity: the current design makes a permanent demand on human attention at a moment when attention is demonstrably unreliable, and it does so on the artifacts that carry a lane's lessons.
Complete instance with the full commit sequence, bugfix-1502 / PR #1507, 2026-08-18. This one is worth having because every commit is visible and every one was generated by porch itself after the merge.
PR #1507 merged as ee548df21. Everything porch wrote from that moment on landed on builder/bugfix-1502 and nowhere else. git log origin/main..origin/builder/bugfix-1502:
Four bookkeeping commits, all orphaned by construction. So codev/projects/bugfix-1502-*/status.yaml on main is frozen at the state it held when the PR merged — pr gate pending — while the branch copy records the gate approved and the protocol complete. Main is not merely stale here; it is wrong in the specific way this issue predicts.
Three things this instance adds:
It is not one stamp, it is a sequence.record PR, PR merged, gate-approved and protocol complete all fire post-merge. Any fix that lands only the final state still leaves main disagreeing with the branch about the intervening ones.
The window has no upper bound and no owner. These commits accrue on a branch whose PR is closed. Nothing will ever merge them, and afx cleanup deletes the branch that holds them.
Cross-referencing #1229 (terminal state systemically never reaching main; 106/179 projects stranded, 140 phantom pending gates) — this lane is a fresh, fully-traced addition to that count rather than a separate phenomenon.
Fourth instance of the class, from pir-1497's cleanup (2026-08-18): the deleted branch tip was a thread close-out commit — 31 lines appended to codev/state/pir-1497_thread.mdafter the merge, so main's copy of the thread simply ends before the close-out. Not just status.yaml, then: post-merge thread narration orphans the same way. Handled per the interim practice above: text captured before deletion, judged redundant with durable artifacts (the review file, PR #1500's body, and the consult verdicts all carry the same facts), and discarded knowingly — logged here so the discard is a decision on the record rather than a silent loss.
Frequency instance, 2026-08-25 (spir-1049 / PR #1551): the merged PR shipped its worktree's porch state at 'PHASE: review'; the architect's post-merge porch done --merged 1551 recorded completion only in the worktree copy, so main's shipped status view is frozen pre-completion. Correctly diagnosed by the builder as instrument staleness (it declined to run conflicting porch commands). Same shape as the issue's thesis: any artifact a protocol produces after its own completion misses the merge. A post-completion landing step remains the structural fix.
Activity
amrmelsayed commentedon Aug 13, 2026
Supporting data from the streamdeck lane — the record on main is not uniformly wrong, it is inconsistently wrong, which sharpens the diagnosis.
Sampling the six lanes I shipped in the last 48h (all merged, all issues closed, all verified):
phaseon mainbuild_completeThree different end-states for six lanes that all reached the same real outcome.
bugfix-1433is the starkest: it ships to main frozen atphase: pr, reading as though it is still awaiting a gate, when it merged and closed hours earlier.Mechanism this points at (offered as a hypothesis, not a claim): it is an ordering race, not a missing feature. A porch stamp that is committed before the PR merges rides the merge into main; one written after (which the post-merge stamps are, by definition) lands only on the builder branch and dies with it at cleanup. Which stamps a lane gets on main therefore depends on how its final commits interleaved with the merge — hence the spread above.
Why that matters for the design question you posed: if
status.yamlis ephemeral orchestration state, none of this is a bug and the fix is to stop shipping it to main at all. If it is part of the shipped record, then no post-merge write can ever be trusted to land, and the merge outcome has to be recorded somewhere that is not the builder's own branch. The inconsistency is the evidence that the current design is trying to be both.Concrete instance from my lane, for the record:
chore(porch): 1410 PR #1439 merged(status.yaml only) was the branch tip at cleanup — orphaned by construction, since it was written after the merge it describes.amrmelsayed commentedon Aug 13, 2026
Fresh live instance, captured at cleanup minutes ago — offered because it shows the race in a controlled case rather than in the historical sample.
air-1440(PR #1443, merged 07:28:05Z). At cleanup its branch tip was a single unmerged commit:chore(porch): 1440 protocol complete, touching onlycodev/projects/1440-.../status.yaml(2 lines).afx cleanupcorrectly declined to delete the branch because of it. Identical shape topir-1410an hour earlier (chore(porch): 1410 PR #1439 merged, status.yaml only).So the sequence is now observed end-to-end, twice: porch writes the completion stamp after the merge it records → the commit can only exist on the builder branch →
afx cleanupflags the branch as unmerged → the architect discards the stamp to finish cleanup → main's copy of that project keeps whatever pre-merge state it had. Nothing is malfunctioning at any step; the outcome falls out of the ordering.That is the concrete argument for your framing: as long as the terminal write happens after the merge, no amount of care at cleanup can get it onto main — so if
status.yamlis meant to be part of the shipped record, the merge outcome has to be recorded somewhere that is not the builder's branch. If it is orchestration state, the cleanest resolution is that it stops shipping to main at all and the discarded stamps become a non-event.amrmelsayed commentedon Aug 13, 2026
Correcting a causal claim on this issue, including one I nearly made myself. The orphaned porch stamp does not explain why
afx cleanuppreserves worktrees and branches for spec-driven lanes. Verified incleanup.ts:Removal is gated purely on builder type, never on branch mergedness or tip contents. Bugfix and task builders are auto-removed;
pir/spir/airbuilders are preserved by design, with the CLI printing manualgit worktree remove/git branch -dinstructions. That is why bugfix-1431 cleaned end-to-end while air-1440 was preserved: the difference is theairvsbugfixbuilder type, not the presence of achore(porch): ... completetip.So this issue is narrower than the surrounding discussion suggested: it is a record-completeness problem (main's copy of a completed project's
status.yamlis frozen at "PR opened, never merged"), not a cause of cleanup friction. The manual-removal friction on every non-ephemeral lane is a separate design question — whether spec-driven builders should also auto-remove once their PR is verified merged (the code already performs that merged-PR verification before deleting a remote branch, around line 340) — and deserves its own issue if anyone wants it changed.Flagging because the two got conflated in the same conversation that produced this issue, and a wrong mechanism in the record costs more than the observation is worth.
(Edited to repair two words lost to shell substitution in the original post.)
amrmelsayed commentedon Aug 13, 2026
Correction to my comment above — two sentences in it were wrong, and the surviving point is narrower.
I wrote that
afx cleanup"declined to delete the branch because of" the unmerged stamp, and that it "flags the branch as unmerged" as a step in the sequence. Both are false. Verified in the production source myself (packages/codev/src/agent-farm/commands/cleanup.ts:308): removal is gated onisEphemeral && !isShellMode— builder type alone.bugfixandtaskbuilders remove their worktree and branches;pir/spir/airbuilders are preserved by design, with the manual commands printed. Nothing in that decision reads the branch tip or its mergedness. Sobugfix-1431cleaning end-to-end whileair-1440was preserved is the type difference, exactly as the maintainer's correction says — not the stamp.What survives, and it is the part this issue is actually about: the completion stamp is written after the merge it records, so that commit can only ever exist on the builder branch, and when a non-ephemeral builder's branch is eventually deleted the stamp goes with it. Both instances I cited are still real (
chore(porch): 1440 protocol completeandchore(porch): 1410 PR #1439 merged,status.yamlonly) — they just illustrate a record-completeness problem, not cleanup friction.Apologies for the noise; the observation was worth less than I framed it, and I would rather correct it in place than leave a plausible-but-wrong mechanism in the record of a design discussion.
amrmelsayed commentedon Aug 15, 2026
Worked instance from pir-1070 / PR #1461, including the part that surprised me
Adding a concrete reproduction, because this lane produced the failure while actively trying to avoid it, which sharpens the issue title.
State on
mainafter the merge (3f7061d4a, 2026-08-15T02:40:06Z):State on the builder branch, two commits ahead of what merged and never pushed:
The mechanism, stated plainly: the merge record cannot be inside the merge. It does not exist until the merge has happened, so every post-merge porch write lands on a branch whose merge already completed. There is no ordering of the existing steps that fixes it. The builder was not sloppy and did not skip a step.
The part worth adding to the issue
The builder ran
porch done 1070 --merged 1461specifically to avoid this bug, having been told to, and having verified the merge independently first (it checkedgh pr viewfor a real merge commit rather than inferring one from the architect's say-so). It did everything right. The record still cannot reachmain.So this is not "agents forget to stamp the merge". Stamping it correctly does not help. Any fix has to move the write off the merged branch: a post-merge write onto
mainthrough its own path, a forge-side hook, or reading merge state from the forge at display time rather than storing it in a branch-resident file.Second casualty, which the title does not cover
The same commit boundary stranded the builder's final thread entry (16 lines). That matters because
CLAUDE.mddocuments post-merge thread discovery as "after a builder's PR merges, its thread lands incodev/state/on main". That is true only up to the last pre-merge write. In this lane the stranded entry carried the most transferable lesson of the whole thing (the CI-invalidation loop and why going quiet was the action), so the content most worth finding is exactly the content that cannot land.Anything reading
codev/state/*_thread.mdonmainis reading a truncated record and has no way to know it.Consequence for cleanup
afx cleanupon this worktree would destroy both commits. I have not cleaned it up, and I have transcribed the stranded lesson into my own notes so it is not lost if the worktree is later removed. Sibling to #1462, which is the same root cause seen from the other side: porch records state by committing into the branch under review, so protocol bookkeeping and the branch's own lifecycle interfere with each other.amrmelsayed commentedon Aug 15, 2026
Generalising this issue, from a live instance: any artifact a protocol produces after its own completion is structurally unauthorisable.
This issue started narrow — the
chore(porch): <id> PR #<n> mergedstamp lands on a branch that is already merged and about to be deleted, somain's copy of a completed project'sstatus.yamlis frozen at "PR opened, never merged". PR #1464 (2026-08-15) shows that is one case of a wider shape rather than a quirk of the stamp.BUGFIX writes its review deliverable after the protocol completes at the fix PR. So the review artifact, the finalised thread, and the closing
status.yamlnecessarily arrive as a second PR — and that PR has no gate record at all, because the protocol's gates were all spent on the first one. Concretely, forbugfix-1436:The consequence is not bookkeeping. An architect asked to merge #1464 has two evidence paths available for any other PR — the human's per-PR word, and a porch gate record to corroborate it — and here the second path does not exist by construction. The lane's original merge word necessarily predates the artifact it would authorise, since the artifact is written after that word is spoken. So the follow-up PR is authorisable only by a fresh human word, every time, for every protocol that produces artifacts after completion.
The design question this sharpens (the one already posed above — is
status.yamlephemeral orchestration state or part of the shipped record?): if these artifacts are part of the shipped record, then the protocol has to produce them before the gate that authorises their landing, or they will keep arriving unauthorisable. Reviews written after the merge cannot ride the merge's authorisation. Either the review phase moves ahead of the pr gate, or follow-up artifact PRs need a defined authorisation path of their own — a standing rule that artifact-only follow-ups inherit their lane's word, for instance, which would be a deliberate policy rather than the current silence.Related: #1457 (gate records carry no actor, so a relayed word cannot be corroborated after the fact) and #1462 (bookkeeping commits during the pr gate restart CI). All three are consequences of porch recording protocol state by committing into the branch under review, at moments the protocol itself chooses. Worth deciding together rather than patching individually.
Observation and framing from the streamdeck architect, whose lane produced the instance.
amrmelsayed commentedon Aug 15, 2026
Two AIR lanes, same day, same protocol — and
maincan show neither what either lane concluded nor whether it tried to say so.Posting this with a correction to my own first reading of it, because the corrected version is the stronger evidence.
Every porch commit each lane left on
main:Neither lane has
protocol completeorPR #N mergedonmain. Both carry only pre-merge stamps.What I got wrong. At cleanup,
air-1444's branch held two unmerged completion stamps andair-1390's held none, and I read that as an ordering race — 1390's stamps having landed in the merge, 1444's having missed it. The log above refutes that: 1390's completion stamps are not onmaineither. There was nothing in its worktree to orphan because they were never written, not because they arrived safely.What actually differed, and it was me.
air-1444's builder reported "AIR protocol COMPLETE" and stood by for a cleanup word, so it had already written its stamps — which then orphaned, exactly as the "orphans by construction" framing predicts. Forair-1390I posted the shipping record and ranafx cleanup -p 1390in the same breath, killing the terminal before the builder reachedporch done --merged. Same ritual, two different timings, and the artifact onmaindiffers as a result.So the corrected datapoint is stronger than the one I first offered. It is not that stamps sometimes win a race with the merge — a stamp written after its merge can never reach
main, full stop, since its branch is already merged and slated for deletion. It is that lanes differ in whether they attempt the write at all, for reasons as incidental as how quickly an architect ran cleanup. The consequence for this issue: the shippedstatus.yamlis not merely incomplete, it is incomplete in different ways per lane, and nothing onmaindistinguishes "the builder concluded and we lost the record" from "the builder never got to conclude".Practice change on my side, since the cause was mine: wait for the builder's completion report before deregistering, or accept knowingly that cleanup truncates the protocol's final writes. Neither makes the record reach
main— only a design change does that — but at least the failure stops being arbitrary.amrmelsayed commentedon Aug 15, 2026
Two protocols, one day, same shape — offered as data rather than further argument.
bugfix-1436pir-1463Both produced their review deliverable after the PR that carried their gates had merged, so both arrived as unaccompanied PRs with nothing left to stamp. Both required a bespoke human word naming the PR number before they could land, because the only other evidence path does not exist for this class.
#1467 adds a second variant worth naming: it exists because the architect wanted to improve an artifact after its lane completed. So the shape occurs both when a review is written after completion and when it is revised after completion — the second is unavoidable for any lane whose review turns out to need a correction, which is a normal outcome rather than an error.
Two lanes, two protocols, one day is not two accidents. It is the protocols' own artifact ordering producing unauthorisable work as a matter of course.
Evidence contributed by the streamdeck architect, whose lanes produced both instances.
amrmelsayed commentedon Aug 15, 2026
A second manifestation, observed twice today: not only is the review written after completion — it is also improved after completion, and both land in the same unauthorisable place.
Two lanes, two protocols, same day, same shape:
The first is the protocol producing its artifact after its own completion. The second is anyone improving that artifact afterwards — a reviewer asking for a rationale to be written down, a lesson surfacing during the merge, a correction to something the artifact got wrong. Both are normal, both are desirable, and the protocol currently leaves neither anywhere to go except an unaccompanied PR authorised by a bespoke human word.
Two honest caveats on my own instance, because the structural point does not need me to be blameless to stand:
That second point is the one that matters for this issue's design question. If
status.yamland the review artifact are part of the shipped record, then the record must remain writable after the gates are spent — otherwise every improvement to it either goes unrecorded or requires a bespoke authorisation, which is what happened twice today.amrmelsayed commentedon Aug 15, 2026
Interim practice for this class, arrived at the hard way — and it is better than what we actually did earlier the same day.
When an artifact improvement is identified after its lane's gates are spent, there are three things one can do with it:
Option 3 is what the streamdeck architect adopted after this happened twice in a day, and it is the right interim while the design question here is open. Concretely, from
pir-1465's cleanup: the branch tip carried both a post-merge porch stamp and a review-artifact addition requested after the gate was spent. The addition's text was captured before the branch was deleted and re-homed as a pending entry to ride the next lane touchinglessons-learned.md, rather than dying with the branch or requiring another authorised PR.Worth being precise about what this does and does not solve. It removes the authorisation problem entirely, which is the expensive part. It does not make the shipped
status.yamlany less frozen, and it does not preserve the porch stamps — those are still discarded at cleanup, knowingly. So it is a workaround for the artifact half of this issue, and no help at all for the state record half.It also has a precondition that is easy to lose: someone must read the branch tip before deleting it, and capture what is there. That is the same manual pre-check that #1448 is trying to convert from habit into mechanism, which is a second reason those two issues are worth deciding together rather than separately.
Practice proposed and adopted by the streamdeck architect; recorded here because the alternative we tried first — the bespoke follow-up PR — is the thing this issue exists to complain about.
amrmelsayed commentedon Aug 18, 2026
The class is wider than
status.yaml, and the wider half is more damaging. Instance from PIR #1495, 2026-08-18.That lane's review artifact gained a section after its PR merged (a reproduction of #1462 that was observed during the merge itself). Because the content was authored post-completion, it was committed to
builder/pir-1495at2f872d615and is not in main's mergedcodev/reviews/1495-*.md. Same mechanism this issue describes, different artifact.Why the review case is worse than the
status.yamlcase:status.yamlon main is bookkeeping — wrong metadata about a finished project.And the branch is not durable storage:
afx cleanupremoves the worktree and the branch, so "it is recorded on the builder branch" means "it is recorded until cleanup runs".The practical trap is the ordering. Anything a protocol produces after its own completion — review addenda, merge stamps, post-hoc lessons — has no remaining phase in which to reach main, so it lands wherever the builder happens to be standing. In this instance we are folding the addition into another in-flight lane and holding cleanup until it lands, but that is a manual save that depends on someone noticing.
Worth considering whether the fix here is a post-completion landing step rather than only a
status.yamlstamp.amrmelsayed commentedon Aug 18, 2026
The class extends to review artifacts, not just
status.yaml— and the review half is the more damaging one.Live instance, today, in
pir-1495. Its PR merged, and the architect then asked the builder to record a protocol observation in the lane's review file. That section was written after the merge, so it sits onbuilder/pir-1495— a branch scheduled for deletion — and not onmain, where the review file it belongs to already lives.Why this half matters more than the
status.yamlhalf. A stalestatus.yamlis bookkeeping: it misreports what phase a finished lane reached, which is confusing but inert. A missing review section is the thing reviews exist for — it is the channel by which a lane's lessons reach MAINTAIN and the lessons-learned tier. A reader asking "what did this lane learn" openscodev/reviews/<id>-*.mdonmain; a lesson that never got there is not merely unrecorded, it is invisible to the one process designed to collect it."Leave it on the branch" is not an answer, which is worth stating because it is the intuitive one. Cleanup removes the worktree and the branch, so a builder branch is not durable storage — it is a staging area with a deletion already scheduled. "Leave it on the branch" means "discard it after a delay".
What we did about this instance, offered as an interim rather than a fix: capture the text before anything can destroy it, then land it by folding it into the next lane already heading to
main(here,pir-1498), rather than opening a standalone PR. A dedicated PR for one doc file costs a full CI cycle plus an admin bypass for content with no urgency of its own — and it produces exactly the unauthorisable artifact PR this issue already describes. The hard constraint that goes with it: the source worktree must not be cleaned until the content has landed, because until then the branch holds the only copy.That interim depends on a human noticing in the window between "content written post-gate" and "worktree cleaned", which is the same manual precondition #1448 is trying to turn into mechanism. Both issues keep arriving at the same shape: a durable record that depends on somebody remembering to look before a deletion.
amrmelsayed commentedon Aug 18, 2026
Frequency data, since that is what moves an issue rather than a resolution: four instances in six days, all from one architect who had written the avoidance rule down after the first.
pir-1463(#1467)bugfix-1436(#1464)pir-1465pir-1495pir-1498Two of the four were resolved by exactly the unauthorisable artifact PR this issue describes — so the workaround for the defect reproduces the defect.
The part that argues for a fix rather than more care. After the first instance the rule was written down: artifact-content requests go to the builder at the review phase, before the PR opens. It was then violated three more times, and twice the violating message asserted in its own text that it was asking before the gates were spent. That is not forgetfulness that trying harder repairs — at the moment the sentence is written it is believed, because a gate feels open until you check, and by then the claim is already made.
And the rule is unnecessary if this issue is fixed. A post-completion landing path means content produced after the gates are spent can still reach
main; the timing of the request stops mattering, so there is nothing left to remember and no discipline to fail. That is the argument for the fix's severity: the current design makes a permanent demand on human attention at a moment when attention is demonstrably unreliable, and it does so on the artifacts that carry a lane's lessons.amrmelsayed commentedon Aug 18, 2026
Complete instance with the full commit sequence,
bugfix-1502/ PR #1507, 2026-08-18. This one is worth having because every commit is visible and every one was generated by porch itself after the merge.PR #1507 merged as
ee548df21. Everything porch wrote from that moment on landed onbuilder/bugfix-1502and nowhere else.git log origin/main..origin/builder/bugfix-1502:Four bookkeeping commits, all orphaned by construction. So
codev/projects/bugfix-1502-*/status.yamlon main is frozen at the state it held when the PR merged —prgate pending — while the branch copy records the gate approved and the protocol complete. Main is not merely stale here; it is wrong in the specific way this issue predicts.Three things this instance adds:
record PR,PR merged,gate-approvedandprotocol completeall fire post-merge. Any fix that lands only the final state still leaves main disagreeing with the branch about the intervening ones.afx cleanupdeletes the branch that holds them.writeStateAndCommit, which pushes. On a still-open PR that restarts CI (porch: bookkeeping commits during the pr gate restart CI and invalidate the merge window (self-sustaining loop) #1462); after merge it silently strands state (this issue). Same mechanism, two different failure modes depending on timing.Cross-referencing #1229 (terminal state systemically never reaching main; 106/179 projects stranded, 140 phantom pending gates) — this lane is a fresh, fully-traced addition to that count rather than a separate phenomenon.
amrmelsayed commentedon Aug 18, 2026
Fourth instance of the class, from pir-1497's cleanup (2026-08-18): the deleted branch tip was a thread close-out commit — 31 lines appended to
codev/state/pir-1497_thread.mdafter the merge, so main's copy of the thread simply ends before the close-out. Not juststatus.yaml, then: post-merge thread narration orphans the same way. Handled per the interim practice above: text captured before deletion, judged redundant with durable artifacts (the review file, PR #1500's body, and the consult verdicts all carry the same facts), and discarded knowingly — logged here so the discard is a decision on the record rather than a silent loss.amrmelsayed commentedon Aug 25, 2026
Frequency instance, 2026-08-25 (spir-1049 / PR #1551): the merged PR shipped its worktree's porch state at 'PHASE: review'; the architect's post-merge
porch done --merged 1551recorded completion only in the worktree copy, so main's shipped status view is frozen pre-completion. Correctly diagnosed by the builder as instrument staleness (it declined to run conflicting porch commands). Same shape as the issue's thesis: any artifact a protocol produces after its own completion misses the merge. A post-completion landing step remains the structural fix.