From 3ee681020d227258a06fa9c9cf517b3ad31edb58 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 17:41:44 -0700 Subject: [PATCH 01/68] docs(fathom): add stacked reviews design Gives the reserved stackedReviews forge capability its behavior: one issue may produce a short stack of dependent reviews when its breakdown is large enough, with the split proposed at breakdown time and confirmed by the user. Single-review behavior remains the default for every repository, forge, and tier that does not opt in. --- ...026-08-07-fathom-stacked-reviews-design.md | 249 ++++++++++++++++++ 1 file changed, 249 insertions(+) create mode 100644 docs/plans/2026-08-07-fathom-stacked-reviews-design.md diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-design.md b/docs/plans/2026-08-07-fathom-stacked-reviews-design.md new file mode 100644 index 00000000..69f30dbc --- /dev/null +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-design.md @@ -0,0 +1,249 @@ +# Fathom stacked reviews design + +Date: 2026-08-07 + +## Problem + +Fathom's `execute` skill drives one tracker issue to exactly one code review. +The breakdown at `execute/SKILL.md:73-97` plans three to seven sub-issues and commits one change per task, then `execute/SKILL.md:99-117` opens a single review covering all of them. + +For a large issue that produces a review that is too big to review well. +The units of work are already sequential and independently verifiable, so they could reach reviewers as a stack of smaller reviews instead. + +The forge contract anticipated this. +`forges.md:54` declares a `stackedReviews` capability with values `retarget`, `declared-dependency`, and `none`, and `forges.md:59-60` records that it is declared but drives no behavior, precisely so that adding it later would not mean revisiting every adapter file. +This design gives that capability its behavior. + +Two forge models are already documented and both must work. +On a `retarget` forge such as GitHub, stacking is branch retargeting, and the forge retargets a dependent review automatically when its upstream merges. +On a `declared-dependency` forge, stacking is an explicit dependency plus a manually scoped commit range, with no automatic rebase. +On a `none` forge there is no forge-level stacking at all, but chaining the branches in git is still useful, so the agent targets the previous bundle's branch and declares the relationship in prose. + +## Goals + +Let one issue produce a short stack of dependent reviews when the work is large enough to warrant it. +Keep the existing single-review behavior as the default for every repository, forge, and issue that does not opt in. +Make the split a decision the user can see, override, and pin, rather than something the agent does silently. + +## Non-goals + +No change to the `scaffold` skill. +Bundling is decided at `execute` time, after the sub-issues exist. + +No size estimation before the breakdown. +The threshold reads the breakdown that already exists at step 8, rather than adding a second and less accurate estimator for the same question. + +No stacks in the manual tier. +No new forge operation beyond one optional argument. + +## Design + +### 1. The bundle + +A bundle is a contiguous run of the sub-issue dependency chain that `execute/SKILL.md:76` already builds. +Bundles inherit the chain's ordering rather than inventing an ordering of their own. +Each bundle maps to one branch and one review. + +A bundle boundary may fall only at a point where the work up to that point is independently mergeable. +That means the repository builds, that bundle's tests pass, and merging the bundle alone would not break the base branch. +When no such point exists there is no valid split, and the run proceeds as a single review. + +### 2. When a split is proposed + +Both conditions must hold before the agent proposes a split at all: + +- the breakdown produced five or more sub-issues, and +- at least one valid cut point exists. + +At most three bundles, and every bundle holds at least two sub-issues. +Both constraints apply together, so a five sub-issue breakdown can produce at most two bundles and a six sub-issue breakdown is the smallest that can produce three. +The cap is deliberate. +Sub-issues are sized commit-sized rather than review-sized, so one review per sub-issue would turn an ordinary issue into a stack of five to seven tiny reviews, and multiple reviews are a real cost for some teams and workflows. +An explicit user request may exceed the cap; the heuristic never does. + +The manual tier does not propose a split. +A tier-3 forge (`forges.md:123-126`) cannot create reviews, so a three-bundle stack would become three separate sets of instructions for a human to follow by hand. +In tier 3 the agent says the split was not offered and why. +Tier 1 and tier 2 both propose. + +### 3. The split proposal stop + +The stop fires at step 8, after the breakdown exists and before any branch is created. +It shows the proposed bundles, which sub-issues fall in each, and the resolved forge's stacking behavior. + +It goes on the skip list in `approval.md`, not the never-skip list. +It fires before any branch, commit, or review exists, so being wrong costs nothing and is trivially corrected. +That is the shape of every existing skip-list item, and unlike every never-skip item it destroys nothing and misdirects nothing. +In `ask` mode the run waits for an answer; in `auto` mode it applies the split and reports it. + +`approval.md:69` requires every new stop to be classified explicitly, so this classification is recorded there alongside the existing entries. + +### 4. The profile field + +`.fathom/config.md` gains `stacking`, with two values. + +`propose` is the default and means the agent may propose a split, with the approval mode deciding whether that is a question or a report. +`never` makes single-review behavior permanent for the repository, in the same spirit as `forge: none`. + +The field has two values rather than three on purpose. +An `ask` or `auto` value here would duplicate the `approval` field two lines above it in the same file, and two fields that can disagree about the same question is a defect waiting to be filed. + +### 5. Branch naming + +Bundle 1 keeps today's name unchanged, for example `feat/ONC-5-add-webhooks`. +Bundles 2 and 3 append their index: `feat/ONC-5-add-webhooks-2` and `-3`. + +The pattern is predictable and matchable, which is what lets a resumed run find the stack it already built. + +### 6. Ordering is enforced in data + +When a split is confirmed, add a dependency edge from the first task of bundle k+1 to the last task of bundle k. + +`claimNext` then structurally cannot hand out a bundle-2 task while a bundle-1 task is still open, and the implementation loop needs no bundle-ordering logic of its own. + +This edge is necessary rather than decorative. +`execute/SKILL.md:76` sets `deps` so tasks chain sequentially "whenever order matters", which leaves parallel-claimable tasks legal. +Without the boundary edge a stack could be built out of order. + +### 7. Durable record + +Bundle membership is written at step 8 to the plan document and to the issue's file under `.fathom/`. +It records, for each bundle, its index, the sub-issue refs and task ids it contains, and its branch name. + +This is required rather than optional. +`execute/SKILL.md:22` states that every run begins by reading durable state from the repository and the tracker, never from memory of a previous run. +A resumed run recovers the whole stack from this record. + +### 8. Reviews open incrementally + +Step 11 splits into a per-bundle finish routine and a smaller issue-level close. + +The per-bundle routine runs when the last task of bundle k closes: + +1. Reconcile bundle k's task count against the commits on branch k, and stop hard on a mismatch, as the single-review flow does today. +2. Call `resolveBase`. Bundle 1's base is the resolved base branch; bundle k's base is branch k-1. +3. Push branch k, unless the adapter declares `pushesForYou`. +4. Call `openReview`, then `publishReview`. +5. Record `- Review: (bundle k/N)` in the issue's file under `.fathom/`. +6. When another bundle remains, create branch k+1 from branch k and continue the implementation loop. When bundle k was the last one, fall through to the issue-level close instead. + +The issue-level close runs once, after the last bundle. +It closes the parent task, posts the completion comment listing all N reviews, and commits the run's task state onto branch N, which is the stack tip. + +The `inReview` phase is applied once, when the first bundle's review publishes, and is not re-applied per bundle. +The issue genuinely is in review from that moment. + +Opening incrementally rather than at the end avoids retroactive history surgery. +Building each bundle on the correct branch from the start is free, whereas committing everything to one branch and later cherry-picking commit ranges onto a chain of branches is the failure-prone path. +The bundle boundary is known at claim time, and `execute/SKILL.md:97` guarantees one commit per task, so no reconstruction is needed. + +Opening incrementally also preserves the one-resumable-pass property stated in `execute/SKILL.md:20-21`. +Requiring one invocation per bundle would contradict it by design. + +A useful side effect: when bundle 2 hits an unfixable test failure, bundle 1's review is already open and reviewable. + +### 9. The closing keyword + +`execute/SKILL.md:107` puts `Closes ` in the review body for a Linear issue, or the task's URL for an Asana task. + +In a stack that closing keyword appears in the last bundle's review only. +Earlier bundles reference the issue without a closing keyword and carry two additional lines: `Part k of N`, and `Depends on `. + +Without this rule the first bundle's merge closes the issue while most of the work is still open. + +### 10. Forge contract change + +`openReview` gains one optional fifth argument, `dependsOn`, holding the previous bundle's review id. +The other four operations are unchanged, and no operation is added. + +Adapters key their behavior off their declared `stackedReviews` value: + +| `stackedReviews` | Behavior | +| --- | --- | +| `retarget` | Ignore `dependsOn`. The `base` argument does the work, and the forge retargets on upstream merge. | +| `declared-dependency` | Pass `dependsOn` to the forge's dependency mechanism and scope the commit range. | +| `none` | Ignore `dependsOn`. The `base` argument gives git-level chaining, and the body's `Depends on` line carries the rest. | + +`forges.md:59-60` stops saying the capability is declared and unused. + +### 11. The rebase obligation + +After an upstream bundle merges, the remaining stack may need rebasing. + +The test is forge-agnostic rather than capability-keyed: check whether the merged content is an ancestor of each remaining stack branch, and rebase only when it is not. + +This is deliberately not keyed on `stackedReviews`. +A squash-merge on a `retarget` forge produces exactly the same problem as a merge on a `none` forge, because the squash commit is not an ancestor of the dependent branch and the dependent review then redisplays the upstream bundle's changes. +The ancestry check catches both cases with one rule, which is the evidence that it is the right check. + +Rebasing pushes with `--force-with-lease`, never a bare force push. + +### 12. The sweep + +The done-on-merge sweep (`execute/SKILL.md:56`) reads every `- Review:` line recorded for the issue rather than one, and calls `getReviewState` on each. + +- All bundles `merged`: move the issue to `done`, as today. +- Some merged and some open: do not close the issue. Report progress, for example `bundle 1/3 merged`, then run the ancestry check from section 11 and rebase the remaining branches bottom-up when needed. +- Any bundle `closed-unmerged`: fire the existing never-skip stop from `approval.md:48`, and name which bundles above it are now orphaned. Close nothing and rebase nothing. +- `reviewLookup: none`: the sweep is unavailable, exactly as today. + +### 13. Failure handling + +Three hold conditions are added, each matching existing precedent rather than introducing a new kind of stop. + +| Condition | Behavior | +| --- | --- | +| `--force-with-lease` rejected during a stack rebase | Stop and hold. Someone else's commits are on that branch, and force-pushing over them is the discarding-someone's-changes hazard that `approval.md:46` already names. | +| Rebase conflict while restacking | Stop and hold, naming the conflicting files, exactly as `execute/SKILL.md:72` does for a base-branch update conflict. | +| Unfixable test failure in bundle k | The existing stop, with an added reporting requirement: name which bundles have open reviews and which were never built. | + +### 14. Resume + +A re-invoked run recovers the stack from the record in `.fathom/`, matches existing branches by the naming pattern from section 5, and reads the recorded review ids. + +The existing rule at `execute/SKILL.md:108`, skip when a review already exists for the branch and reuse that one, becomes per-bundle. +A resumed run must never open a second review for a bundle that already has one. + +### 15. Tier drop mid-stack + +When a later run's `verifyForge()` fails, bundles whose reviews are already open stay as they are, and the remaining bundles are handed off manually per `forges.md:114-116`. + +Say this plainly at handoff, including the consequence already documented in `forges.md:149-158`: no later run will move the issue to `done` on its own, so closing it becomes a manual step. + +## Files touched + +All changes are prose in skill files. No code changes. + +- `skills/fathom-shared/forges.md`: the `dependsOn` argument, the per-capability behavior table, removal of the declared-and-unused paragraph, and the tier-3 no-stack rule. +- `skills/fathom-shared/forges/github.md`: stacking behavior for `retarget`, including the squash-merge caveat. +- `skills/fathom-shared/forges/generic-git.md`: stacking behavior for `none`. +- `skills/fathom-shared/forges/TEMPLATE.md`: guidance for an adapter author implementing `dependsOn`. +- `skills/fathom-shared/approval.md`: the split proposal on the skip list, and the `stacking: propose | never` profile field. +- `skills/fathom-shared/conventions.md`: bundle membership in the plan document, and per-bundle commit reconciliation. +- `skills/fathom-shared/memory.md`: the cross-bundle dependency edge, where the backends need it spelled out. +- `skills/execute/SKILL.md`: steps 7, 8, 10, and 11, plus the sweep in step 2. + +## Verification + +This repository has no unit tests, so verification is what it already runs: + +- `bin/scan-skills.sh` clean against `.skillspector-baseline.yaml`, with any new baseline entry carrying a written reason. +- `bin/sync-versions.sh` for version consistency. +- The `.github/workflows/skillspector.yml` CI workflow. + +Internal consistency is checked by reading the changed files together: every `execute/SKILL.md` step that references a review must be unambiguous about whether it means one review or one bundle's review. + +## Decisions and rationale + +| Decision | Alternative rejected | Why | +| --- | --- | --- | +| Bundles of sub-issues | One review per sub-issue | Sub-issues are sized commit-sized by `execute/SKILL.md:76`, so one review each produces a five to seven review stack of trivial reviews. | +| Single review stays the default | Stack whenever possible | Keeps every existing repository, forge, and tier behaving exactly as today unless something opts in. | +| Agent proposes, user confirms | Agent decides silently | The structural shape of a change's review is a judgment call with real cost to reviewers. | +| Skip-list stop | Never-skip stop | It fires before any branch, commit, or review exists, so being wrong costs nothing. | +| `stacking` with two values | `stacking` with `ask`, `auto`, and `never` | Three values would duplicate the `approval` field in the same profile and could disagree with it. | +| Incremental review opening | All reviews at the end | Opening at the end requires cherry-picking commit ranges onto a chain of branches after the fact. | +| Ordering via dependency edge | Ordering logic in the loop | Encoding it in the task graph means `claimNext` cannot violate it, so the loop needs no new branch. | +| Ancestry check for rebase | Rebase keyed on `stackedReviews` | A squash-merge on a `retarget` forge has the same problem as a merge on a `none` forge, and one rule covers both. | +| All bundles merged closes the issue | Top of stack merged closes it | Cheaper, but wrong when someone merges out of order or squashes the stack by hand. | +| No stacks in tier 3 | Stacks with N manual handoffs | Three sets of hand-open-this instructions is worse than one review. | From 3494deffc7eb0d3b182181f94919a92202919338 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 17:48:05 -0700 Subject: [PATCH 02/68] docs(fathom): add stacked reviews implementation plan --- .../2026-08-07-fathom-stacked-reviews-plan.md | 907 ++++++++++++++++++ 1 file changed, 907 insertions(+) create mode 100644 docs/plans/2026-08-07-fathom-stacked-reviews-plan.md diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md new file mode 100644 index 00000000..81bb4e49 --- /dev/null +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md @@ -0,0 +1,907 @@ +# Fathom stacked reviews implementation plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Give the reserved `stackedReviews` forge capability real behavior, so one tracker issue can produce a short stack of dependent code reviews when its breakdown is large enough, with the split proposed at breakdown time. + +**Architecture:** Every change is prose in skill markdown files that an agent reads at runtime. There is no source code, no test framework, and no build. The contract files (`forges.md`, `approval.md`, `conventions.md`, `memory.md`) are edited before the adapter files that implement them and before `execute/SKILL.md`, which consumes all of them, so each task lands on top of vocabulary that already exists. + +**Tech Stack:** Markdown skill files under `skills/`. Verification is NVIDIA SkillSpector v2.5.0 via `bin/scan-skills.sh`, version propagation via `bin/sync-versions.sh`, and grep-based cross-file consistency checks. + +**Design document:** `docs/plans/2026-08-07-fathom-stacked-reviews-design.md` + +## Global constraints + +- Never use the em dash character. Use a plain hyphen instead. This applies to every file you touch. +- Put each full sentence on its own physical line in markdown prose. Preserve normal markdown structure otherwise. +- Never write `TODO`, `TBD`, or a placeholder into a skill file. These files are read by an agent at runtime, and a placeholder becomes agent behavior. +- Never stage with `git add -A`, `git add .`, or `git add --all`. Stage the exact paths the task changed. This is the repository's own rule, recorded in `skills/fathom-shared/conventions.md:12-14`. +- Commit subjects follow `type(scope): summary`, lowercase imperative, under 72 characters, no trailing period. Scope is `fathom`. +- Do not add a co-author trailer to any commit. +- Work on the branch `feat/stacked-reviews`, which already exists and already holds the design commit. +- The three values of `stackedReviews` are exactly `retarget`, `declared-dependency`, and `none`. Never invent a fourth. +- The two values of the new `stacking` profile field are exactly `propose` and `never`. +- The bundle cap is at most 3 bundles, each holding at least 2 sub-issues, proposed only when the breakdown has 5 or more sub-issues. + +## Verification model for this repository + +This repository has no unit tests and no test framework, so the ordinary write-a-failing-test cycle does not apply. Do not invent one. Each task below instead ends with two real checks and a commit: + +1. **Scanner check.** `bin/scan-skills.sh` runs NVIDIA SkillSpector against every skill and exits non-zero on any finding not suppressed in `.skillspector-baseline.yaml`. SkillSpector v2.5.0 is already installed at `~/.local/bin/skillspector` and matches the SHA pinned in `.github/workflows/skillspector.yml`. This checks for prompt-injection and unsafe-instruction patterns. It does **not** check that your prose is correct, which is why every task also has check 2. +2. **Consistency check.** A concrete `grep` whose expected output is stated in the step. These exist because the real failure mode for this change is two skill files disagreeing about the same rule, and no tool in this repository catches that. + +If `bin/scan-skills.sh` reports a new finding, do not add a baseline suppression to silence it without reading the finding first. A suppression requires a written reason in `.skillspector-baseline.yaml`, and the existing entries show the expected format. + +--- + +## Task 1: Correct the design document, then change the forge contract + +The design document has one ambiguity found while reading the adapter files, and it must be resolved before any adapter is written against it. + +The design says a `stackedReviews: none` forge stacks branches in git and declares the dependency in prose. It also says the manual tier never proposes a split. But `generic-git.md` is the only bundled adapter declaring `none`, and `forges.md:124` makes generic-git exactly what the manual tier runs on, so those two rules together mean the `none` path is unreachable through any bundled adapter. + +The `none` path is still correct and still needed, but only for a **tier-1 repo-local adapter** at `.fathom/forge.md` that creates real reviews and has no stacking model of its own. Making that explicit is the first step of this task. + +**Files:** +- Modify: `docs/plans/2026-08-07-fathom-stacked-reviews-design.md` (sections 2 and 10) +- Modify: `skills/fathom-shared/forges.md:53-60` (capability table row and the reserved paragraph) +- Modify: `skills/fathom-shared/forges.md:17` (the `openReview` contract row) +- Modify: `skills/fathom-shared/forges.md:105-129` (capability tiers, tier-3 rule) + +**Interfaces:** +- Produces: the argument name `dependsOn`, the phrase `stackedReviews`, and the three behavior rows that Task 2's adapter files implement verbatim. +- Produces: the tier-3 no-stack rule that Task 6 reads when deciding whether to propose a split. + +- [ ] **Step 1: Amend the design document's section 2** + +In `docs/plans/2026-08-07-fathom-stacked-reviews-design.md`, find the paragraph in section 3 (`When a split is proposed`) that begins "The manual tier does not propose a split." Append these two lines to that paragraph: + +```markdown +This makes the `none` behavior in section 10 reachable only through a tier-1 repo-local adapter at `.fathom/forge.md` that creates real reviews but has no stacking model of its own. +No bundled adapter reaches it, because `generic-git.md` is the only bundled adapter declaring `none` and it is exactly what the manual tier runs on. +``` + +- [ ] **Step 2: Amend the design document's section 10** + +In the same file, in section 10, replace the `none` row of the behavior table with this row: + +```markdown +| `none` | Ignore `dependsOn`. The `base` argument gives git-level chaining, and the body's `Depends on` line carries the rest. Reachable only from a tier-1 repo-local adapter, per section 3. | +``` + +- [ ] **Step 3: Change the `openReview` row in the contract table** + +In `skills/fathom-shared/forges.md`, line 17 currently reads: + +```markdown +| `openReview(branch, base, title, body)` | Create the review for a branch against a base. Return a stable review id and the review's URL - or, on a forge where no review can be created, the manual-handoff result defined below. | +``` + +Replace it with: + +```markdown +| `openReview(branch, base, title, body, dependsOn?)` | Create the review for a branch against a base. Return a stable review id and the review's URL - or, on a forge where no review can be created, the manual-handoff result defined below. `dependsOn` is optional and carries the review id this one is stacked on; it is absent for a standalone review and for the first bundle of a stack. | +``` + +- [ ] **Step 4: Replace the `stackedReviews` capability row** + +In the same file, line 54 currently reads: + +```markdown +| `stackedReviews` | `retarget` / `declared-dependency` / `none` | Reserved. No behavior depends on it yet. | +``` + +Replace it with: + +```markdown +| `stackedReviews` | `retarget` / `declared-dependency` / `none` | How this adapter expresses that one review is stacked on another, in `openReview`. | +``` + +- [ ] **Step 5: Replace the reserved paragraph with the behavior rules** + +In the same file, lines 59-60 currently read: + +```markdown +`stackedReviews` is declared and unused. +It is recorded now because the difference is real - `retarget` describes a forge where stacking is branch retargeting with automatic retarget when the upstream merges, and `declared-dependency` describes one where stacking is an explicit dependency plus a manually scoped commit range with no auto-rebase - and because adding a capability key later means revisiting every adapter file. +``` + +Replace both lines with: + +```markdown +`stackedReviews` decides what an adapter does with `openReview`'s optional `dependsOn` argument. + +| Value | What `openReview` does with `dependsOn` | +| --- | --- | +| `retarget` | Ignore it. Passing the previous bundle's branch as `base` is the whole mechanism, and the forge retargets the dependent review automatically when its upstream merges. | +| `declared-dependency` | Pass it to the forge's own dependency mechanism, and scope the review's commit range to this bundle's commits only. Nothing is retargeted automatically. | +| `none` | Ignore it. The `base` argument still chains the branches in git, and the calling skill writes the relationship into the review body in prose. | + +A `none` adapter is still stackable in the only sense that matters to a reader: the branches chain, each review shows one bundle's diff, and the body says what it depends on. +What it lacks is any forge-side record of the relationship, so nothing retargets and nothing warns when the stack is merged out of order. + +Only a repo-local adapter reaches the `none` row in practice. +The one bundled adapter that declares `none` is `generic-git.md`, which is what the manual tier runs on, and the manual tier never proposes a stack. +``` + +- [ ] **Step 6: Add the tier-3 no-stack rule** + +In the same file, in the `Capability tiers` section, find the paragraph beginning "**Tier 3, manual.**" and append this line to the end of that paragraph: + +```markdown +A stack is never proposed in this tier: with no review object to create, a three-bundle stack would become three separate sets of open-this-by-hand instructions, which is worse for the user than one review. +``` + +- [ ] **Step 7: Run the consistency check** + +Run: + +```bash +grep -n "declared and unused\|Reserved. No behavior" skills/fathom-shared/forges.md +``` + +Expected: no output, exit code 1. The reserved language is gone. + +Run: + +```bash +grep -c "dependsOn" skills/fathom-shared/forges.md +``` + +Expected: `5` or more. The argument is named in the contract row, the capability table rows, and the surrounding prose. + +- [ ] **Step 8: Run the scanner** + +Run: + +```bash +bin/scan-skills.sh +``` + +Expected: exit code 0, no non-suppressed findings. + +- [ ] **Step 9: Commit** + +```bash +git add docs/plans/2026-08-07-fathom-stacked-reviews-design.md skills/fathom-shared/forges.md +git commit -m "feat(fathom): give stackedReviews behavior in the forge contract" +``` + +--- + +## Task 2: Implement the capability in the three adapter files + +**Files:** +- Modify: `skills/fathom-shared/forges/github.md:21` and `:53-68` +- Modify: `skills/fathom-shared/forges/generic-git.md:20-26` and `:46` +- Modify: `skills/fathom-shared/forges/TEMPLATE.md:40` and `:71-83` + +**Interfaces:** +- Consumes: the `dependsOn` argument and the three-row behavior table from Task 1. +- Produces: the squash-merge caveat that Task 7's rebase rule cites. + +- [ ] **Step 1: Update the GitHub adapter's capability note** + +In `skills/fathom-shared/forges/github.md`, line 21 currently reads: + +```markdown +`stackedReviews` is `retarget` because GitHub stacking is branch retargeting, and GitHub retargets a dependent pull request automatically when its upstream merges. +``` + +Append these three lines directly after it: + +```markdown +That automatic retarget is real but partial, and the gap matters to the caller. +When the upstream pull request is **squash-merged**, the squash commit is not an ancestor of the dependent branch, so the dependent pull request retargets to the base and then redisplays the upstream bundle's changes as if they were new. +The dependent branch has to be rebased for its diff to be honest again, which is why the calling skill's rebase rule is keyed on commit ancestry rather than on this capability value. +``` + +- [ ] **Step 2: Update the GitHub adapter's `openReview` heading and body** + +In the same file, change the section heading on line 53 from: + +```markdown +## `openReview(branch, base, title, body)` +``` + +to: + +```markdown +## `openReview(branch, base, title, body, dependsOn?)` +``` + +Then, directly after the paragraph beginning "Return the pull request number as the review id", insert: + +```markdown +Ignore `dependsOn` when it is supplied. +`stackedReviews` is `retarget`, so passing the previous bundle's branch as `base` is the entire mechanism, and GitHub needs no separate dependency declaration. +Never encode the dependency a second way, such as by adding a label or an extra API call; the base branch already carries it and a second representation can disagree with the first. +``` + +- [ ] **Step 3: Update the generic-git adapter** + +In `skills/fathom-shared/forges/generic-git.md`, find the paragraph starting "`reviewLookup: none` is the consequential one." and insert this paragraph directly before it: + +```markdown +`stackedReviews: none` is never exercised through this adapter. +This adapter is what the manual tier runs on, and `../forges.md` states that the manual tier never proposes a stack, so `openReview` here is only ever called for a standalone review. +The value is declared truthfully rather than left absent, because a repo-local adapter author reading this file as the minimum viable example needs to see every capability filled in. +``` + +Then change the section heading on line 46 from: + +```markdown +## `openReview(branch, base, title, body)` +``` + +to: + +```markdown +## `openReview(branch, base, title, body, dependsOn?)` +``` + +Then append this line to the end of the paragraph beginning "There is no review to create": + +```markdown +`dependsOn` is ignored here for the same reason the id is absent: there is no review object to attach a dependency to. +``` + +- [ ] **Step 4: Update the adapter template's guidance** + +In `skills/fathom-shared/forges/TEMPLATE.md`, line 40 currently reads: + +```markdown +> `stackedReviews` - declared but currently unused. `retarget` if stacking means retargeting a branch; `declared-dependency` if it means declaring a dependency plus a commit range. +``` + +Replace it with: + +```markdown +> `stackedReviews` - how your forge expresses that one review is stacked on another, which decides what your `openReview` does with the optional `dependsOn` argument. `retarget` if stacking is just pointing a review at the previous branch, and your forge retargets automatically when the upstream merges. `declared-dependency` if stacking means declaring an explicit dependency and scoping the commit range yourself, with no automatic retarget. `none` if your forge has no stacking model at all, which is a fine answer: the calling skill still chains the branches in git and writes the relationship into the review body. +``` + +- [ ] **Step 5: Update the template's `openReview` section** + +In the same file, change the section heading on line 71 from: + +```markdown +## `openReview(branch, base, title, body)` +``` + +to: + +```markdown +## `openReview(branch, base, title, body, dependsOn?)` +``` + +Then, directly before the line reading `Return the review id and the review's URL.`, insert: + +```markdown +> **Say what you do with `dependsOn`, explicitly, even when the answer is nothing.** It arrives holding the review id this one is stacked on, and it is absent for a standalone review and for the first review in a stack. If you declared `retarget` or `none`, write "Ignore `dependsOn`" and say that the `base` argument carries the relationship. If you declared `declared-dependency`, give the exact command that records the dependency, and say how you scope the review to this bundle's commits only - a declared dependency with an unscoped range shows the upstream bundle's changes twice. +``` + +- [ ] **Step 6: Run the consistency check** + +Run: + +```bash +grep -rn "openReview(branch, base, title, body)" skills/ +``` + +Expected: no output, exit code 1. Every signature now carries `dependsOn?`. + +Run: + +```bash +grep -rln "dependsOn" skills/fathom-shared/forges/ +``` + +Expected: exactly three paths, `github.md`, `generic-git.md`, and `TEMPLATE.md`. + +- [ ] **Step 7: Run the scanner** + +Run: + +```bash +bin/scan-skills.sh +``` + +Expected: exit code 0. + +- [ ] **Step 8: Commit** + +```bash +git add skills/fathom-shared/forges/github.md skills/fathom-shared/forges/generic-git.md skills/fathom-shared/forges/TEMPLATE.md +git commit -m "feat(fathom): implement dependsOn in the bundled forge adapters" +``` + +--- + +## Task 3: Add the split proposal to the approval contract + +**Files:** +- Modify: `skills/fathom-shared/approval.md:22-34` (the skip list) +- Modify: `skills/fathom-shared/approval.md:71-79` (recording it) + +**Interfaces:** +- Consumes: nothing from earlier tasks. +- Produces: the `stacking: propose | never` profile field name, and the classification that Task 6 cites when it fires the proposal stop. + +`approval.md:69` states that when a new stop is added, it must be explicitly placed in the skip list, the never-skip list, or the unconditional stops. This task performs that classification. + +- [ ] **Step 1: Add the skip-list entry** + +In `skills/fathom-shared/approval.md`, in the `What auto mode skips` section, append this entry to the end of the bullet list: + +```markdown +- The bundle-split proposal in `execute`. + Apply the proposed split and report the bundles rather than asking for confirmation first. + This belongs here rather than on the safety list because it fires before any branch, commit, or review exists, so a wrong answer costs nothing and is corrected by re-running with `stacking: never` or a different instruction. + It is skipped only when the profile's `stacking` field permits a split at all; `stacking: never` suppresses the split itself, in both modes, rather than suppressing the question. +``` + +- [ ] **Step 2: Add the profile field** + +In the same file, in the `Recording it` section, append these lines after the paragraph beginning "First-run setup asks for the mode": + +```markdown +A second field, `stacking`, sits alongside `approval` and answers a different question: whether `execute` may split one issue into a stack of dependent reviews at all. +It holds `propose` or `never`, and it defaults to `propose` when the field is absent. + +`propose` means the agent may propose a split when the breakdown crosses the threshold in `execute`, with the `approval` field above deciding whether that proposal is a question or a report. +`never` means this repository always produces one review per issue, in both approval modes, in the same permanent way that `forge: none` makes the manual tier permanent. + +The field deliberately has two values rather than three. +An `ask` or `auto` value here would restate the `approval` field recorded a few lines above it in the same profile, and two fields that can disagree about the same question will eventually disagree. +``` + +- [ ] **Step 3: Run the consistency check** + +Run: + +```bash +grep -n "stacking" skills/fathom-shared/approval.md +``` + +Expected: at least 4 matching lines, all using only the values `propose` and `never`. + +Run: + +```bash +grep -n "stacking: ask\|stacking: auto" skills/fathom-shared/approval.md +``` + +Expected: no output, exit code 1. The rejected three-value form appears nowhere. + +- [ ] **Step 4: Run the scanner** + +Run: + +```bash +bin/scan-skills.sh +``` + +Expected: exit code 0. + +- [ ] **Step 5: Commit** + +```bash +git add skills/fathom-shared/approval.md +git commit -m "feat(fathom): classify the bundle-split stop and add the stacking field" +``` + +--- + +## Task 4: Extend the working conventions for bundles + +**Files:** +- Modify: `skills/fathom-shared/conventions.md:44-64` (the plan document) +- Modify: `skills/fathom-shared/conventions.md:78-85` (reconcile before finishing) + +**Interfaces:** +- Consumes: the bundle vocabulary established in Task 1. +- Produces: the `- Bundles:` plan-document section and the per-bundle reconciliation rule that Task 6 invokes. + +Do not touch the `Issue`, `Ref`, and `Branch` labels described at `conventions.md:51-56`. Those exact strings are matched by the merge-closer GitHub Action, and renaming or reformatting them makes the Action close nothing while still exiting successfully. + +- [ ] **Step 1: Add the bundles section to the plan document spec** + +In `skills/fathom-shared/conventions.md`, in the bullet list of plan document sections, insert this bullet directly after the `- **Tasks**` bullet: + +```markdown +- **Bundles** - present only when this issue was split into a stack, and omitted entirely otherwise. + One line per bundle, in stack order, each reading `- Bundle /: - `. + Add a `- Review: ` line beneath a bundle once its review exists. + This section is the durable record a resumed run reads to recover the stack, so write it when the split is confirmed rather than when the first review opens. +``` + +- [ ] **Step 2: Add the per-bundle reconciliation rule** + +In the same file, in the `Commit verification` section, find the paragraph beginning "Reconcile before finishing." and append these lines to the end of that section, directly before the paragraph beginning "This check guards a hazard": + +```markdown +When the issue was split into a stack, reconcile once per bundle rather than once per issue, and do it before that bundle's review opens rather than at the end of the run. +Count over the range from that bundle's own base to that bundle's head: the resolved base branch for bundle 1, and branch k-1 for bundle k. +Compare that count to the number of tasks closed for that bundle only. +A stack-wide count over the whole range would pass even when one bundle carried another bundle's commits, which is exactly the mistake the check exists to catch. +Stop on a mismatch the same way, and do not open that bundle's review. +``` + +- [ ] **Step 3: Add the review body rule** + +In the same file, append this new section at the end of the file, after `Progress reporting`: + +```markdown +## Review bodies in a stack + +When one issue produced a stack of reviews, the issue-closing reference goes in the last bundle's review body only. + +`execute` puts `Closes ` in the body for a Linear issue, or the task's URL for an Asana task, and both are read by the forge's tracker integration on merge. +Repeating either in every bundle means the first bundle's merge closes the issue while most of the work is still open and unreviewed. + +Every bundle's body carries two additional lines instead: + +- `Part of ` so a reviewer knows this diff is a slice rather than the whole change. +- `Depends on `, omitted for bundle 1, which depends on nothing. + +Earlier bundles still name the issue for context, as a plain link with no closing keyword. +The distinction is between referencing an issue and instructing the forge to close it, and only the last bundle does the second one. +``` + +- [ ] **Step 4: Run the consistency check** + +Run: + +```bash +grep -n "Issue: \|Ref: \|Branch: " skills/fathom-shared/conventions.md +``` + +Expected: the same output as before your edits, one line containing all three labels. If this changed, you altered the merge-closer contract and must revert that part. + +Run: + +```bash +grep -n "Part of \|Depends on \|Bundle /" skills/fathom-shared/conventions.md +``` + +Expected: 3 matching lines. + +- [ ] **Step 5: Run the scanner** + +Run: + +```bash +bin/scan-skills.sh +``` + +Expected: exit code 0. + +- [ ] **Step 6: Commit** + +```bash +git add skills/fathom-shared/conventions.md +git commit -m "feat(fathom): add bundle records, per-bundle reconciliation, and stack bodies" +``` + +--- + +## Task 5: Extend the memory contract for multiple reviews + +**Files:** +- Modify: `skills/fathom-shared/memory.md:14` (the `createTask` row) +- Modify: `skills/fathom-shared/memory.md:59-66` (the no-dual-truth section) + +**Interfaces:** +- Consumes: the `- Bundles:` plan-document section from Task 4. +- Produces: the cross-bundle dependency edge rule that Task 6 applies at breakdown. + +No new memory operation is added. `createTask` already accepts `deps`, which is all the cross-bundle edge needs. + +- [ ] **Step 1: Note the cross-bundle edge on `createTask`** + +In `skills/fathom-shared/memory.md`, append this sentence to the end of the `createTask` row's cell in the contract table, keeping it on the same table line: + +``` +When the issue was split into a stack, the first task of each bundle after the first also takes a dep on the last task of the previous bundle, so the backend itself enforces bundle order and `claimNext` cannot hand out a later bundle's task while an earlier bundle is still open. +``` + +- [ ] **Step 2: Update the record requirement for stacks** + +In the same file, line 65 currently reads: + +```markdown +Whichever backend is active, at least one file under `.fathom/` must record the issue's branch, its review id once one exists, and its tracker URL, because the merge sweep finds an issue by searching that directory, and a merge-closer running on the forge's own CI finds one the same way. +``` + +Append these lines directly after it: + +```markdown +A stacked issue has more than one branch and more than one review id, so it records one of each per bundle, in stack order, in the plan document's `Bundles` section described in `conventions.md`. +The single `Branch` line at the top of the plan document keeps naming bundle 1's branch and is never removed, because the merge-closer Action matches that exact label and knows nothing about stacks. +This is a record of structure rather than of status, so it does not violate the no-dual-truth rule above: task status still lives only in the resolved backend, and the sweep reads review ids from these lines the same way it reads the single-review one. +``` + +- [ ] **Step 3: Run the consistency check** + +Run: + +```bash +grep -n "Bundles" skills/fathom-shared/memory.md skills/fathom-shared/conventions.md +``` + +Expected: at least one line from each file, both naming the same `Bundles` section. + +Run: + +```bash +grep -c "^| \`" skills/fathom-shared/memory.md +``` + +Expected: `6`. The contract still has exactly six operations and you added none. + +- [ ] **Step 4: Run the scanner** + +Run: + +```bash +bin/scan-skills.sh +``` + +Expected: exit code 0. + +- [ ] **Step 5: Commit** + +```bash +git add skills/fathom-shared/memory.md +git commit -m "feat(fathom): record stack structure and cross-bundle task deps" +``` + +--- + +## Task 6: Add bundling to the execute breakdown and branch steps + +**Files:** +- Modify: `skills/execute/SKILL.md:69-72` (step 7, branch creation) +- Modify: `skills/execute/SKILL.md:73-80` (step 8, breakdown) + +**Interfaces:** +- Consumes: the `stacking` field from Task 3, the `Bundles` plan section and cap from Task 4, the cross-bundle dep edge from Task 5, and the tier-3 no-stack rule from Task 1. +- Produces: the branch naming pattern `-` that Tasks 7 and 8 match against. + +Steps are renumbered nowhere. Insert into the existing numbered steps 7 and 8 without changing any step number, because `execute/SKILL.md` steps are referenced by number from other files in this repository. + +- [ ] **Step 1: Add the bundle branch naming rule to step 7** + +In `skills/execute/SKILL.md`, append these lines to the end of step 7, after the paragraph about conflicts: + +```markdown + These rules describe bundle 1's branch, which is the only branch a single-review run has. + When step 8 confirms a stack, later bundles take the same name with their index appended, so bundle 2 of `feat/ONC-5-add-webhooks` is `feat/ONC-5-add-webhooks-2`. + Create each of those from the previous bundle's branch at the moment that bundle starts, not up front: creating them all at breakdown time would leave empty branches behind whenever a run stops early. +``` + +- [ ] **Step 2: Add the bundling decision to step 8** + +In the same file, insert these bullets into step 8, directly after the bullet beginning "- When the issue already has children": + +```markdown + - Decide whether this issue produces one review or a stack, once the child tasks exist and before any dependency edge is added. + Read the profile's `stacking` field per `../fathom-shared/approval.md`; treat an absent field as `propose`, and stop considering a split immediately when it reads `never`. + Do not consider a split when the resolved forge tier is the manual tier, and say once that the split was not offered because the tier cannot create reviews. + Otherwise propose a split only when both conditions hold: the breakdown has five or more sub-issues, and at least one valid cut point exists. + A cut point is valid only where the work up to it is independently mergeable, meaning the repository builds, that bundle's tests pass, and merging it alone would not break the base branch. + When no valid cut point exists, proceed as a single review and say so rather than forcing a boundary. + - Shape the bundles as contiguous runs of the sub-issue dependency chain, so bundles inherit its order rather than inventing one. + Produce at most three bundles, each holding at least two sub-issues; those two limits together mean five sub-issues yield at most two bundles, and six is the smallest breakdown that can yield three. + Exceed the cap only when the user asked for a specific larger split; never exceed it on the heuristic's own judgment. + - Present the proposed split before creating anything: the bundles, which sub-issues fall in each, and the resolved forge's `stackedReviews` value with what it means for this run. + This is a skip-list stop per `../fathom-shared/approval.md`, so `ask` mode waits for an answer and `auto` mode applies the split and reports it. + - When a split is confirmed, add a dependency edge from the first task of each bundle after the first to the last task of the previous bundle, alongside the edges the steps above already add. + This is what makes `claimNext` structurally unable to hand out a later bundle's task while an earlier bundle is open, so the implementation loop needs no bundle-ordering logic of its own. + Then write the `Bundles` section of the plan document described in `conventions.md`, and commit it with the breakdown. +``` + +- [ ] **Step 3: Run the consistency check** + +Run: + +```bash +grep -n "^1\?[0-9]\. " skills/execute/SKILL.md | head -20 +``` + +Expected: steps numbered 1 through 12 with no gaps and no duplicates, exactly as before your edits. + +Run: + +```bash +grep -n "stacking" skills/execute/SKILL.md +``` + +Expected: at least 1 line, referencing `../fathom-shared/approval.md`. + +- [ ] **Step 4: Run the scanner** + +Run: + +```bash +bin/scan-skills.sh +``` + +Expected: exit code 0. + +- [ ] **Step 5: Commit** + +```bash +git add skills/execute/SKILL.md +git commit -m "feat(fathom): propose a bundle split during breakdown" +``` + +--- + +## Task 7: Split the finish step into a per-bundle routine + +**Files:** +- Modify: `skills/execute/SKILL.md:82-97` (step 10, the implementation loop) +- Modify: `skills/execute/SKILL.md:99-117` (step 11, finishing) + +**Interfaces:** +- Consumes: the branch naming pattern from Task 6, the per-bundle reconciliation and review-body rules from Task 4, and `dependsOn` from Task 1. +- Produces: the `(bundle k/N)` review record format that Task 8's sweep reads. + +Step 11 keeps its number and its single-review text. The stack behavior is added as a clearly scoped alternative within it, so a reader on a single-review run is never asked to follow stack rules. + +- [ ] **Step 1: Add the bundle boundary to the implementation loop** + +In `skills/execute/SKILL.md`, append this bullet to step 10's inner bullet list, directly after the bullet beginning "- Print the per-task progress line": + +```markdown + - When this issue was split into a stack and the closed task was the last one in its bundle, run the per-bundle finish routine in step 11 for that bundle before claiming again, then create the next bundle's branch from this one and continue the loop on it. + Do not wait until the loop drains to open any review: building each bundle on the correct branch from the start is what avoids having to cherry-pick commit ranges onto a chain of branches afterwards. +``` + +- [ ] **Step 2: Add the per-bundle routine to step 11** + +In the same file, insert this block into step 11, directly before the paragraph beginning "Finally, post a completion comment": + +```markdown + When this issue was split into a stack, the review-opening portion above is a per-bundle routine rather than a single closing action, and step 10 invokes it once per bundle as that bundle's last task closes. + For bundle k of N: + - Reconcile bundle k's closed tasks against the commits on its branch, over that bundle's own range, per the per-bundle rule in `conventions.md`; stop and do not open this bundle's review when they disagree. + - Call `resolveBase` on bundle 1's base, which is the resolved base branch, or on branch k-1 for every later bundle. + - Push branch k, unless the adapter declares `pushesForYou`, exactly as the single-review path does. + - Call `openReview` with branch k, that base, a title naming the bundle, and a body built per the stack rules in `conventions.md`: the closing reference only in bundle N, plus `Part k of N`, plus `Depends on` the previous bundle's review URL for every bundle after the first. + Pass the previous bundle's review id as `dependsOn` for every bundle after the first, and omit it for bundle 1. + - Call `publishReview` with the returned id. + - Record `- Review: (bundle k/N)` beneath that bundle's line in the plan document's `Bundles` section, since the sweep looks reviews up by id and needs every one of them. + - Apply `inReview` when bundle 1's review publishes, and never again for the later bundles; the issue is genuinely in review from that moment and re-applying a phase it already holds reports progress that did not happen. + Skip a bundle whose review already exists and reuse it, the same way the single-review path does, so a resumed run never opens a second review for a bundle that has one. + After bundle N's routine completes, continue into the closing actions below, which run once for the issue rather than once per bundle. +``` + +- [ ] **Step 3: Point the closing commit at the stack tip** + +In the same file, in step 11's final paragraph about the closing commit, append: + +```markdown + On a stacked issue this closing commit goes on branch N, the stack tip, because that branch contains every bundle's history and is the only one whose review shows the completed task state. +``` + +- [ ] **Step 4: Extend the hold report for partial stacks** + +In the same file, append this line to step 10's bullet beginning "- On a failure that cannot be fixed": + +```markdown + On a stacked issue, also name which bundles already have open reviews and which were never built, since some of the work is already in front of reviewers and the user needs to know which part held. +``` + +- [ ] **Step 5: Run the consistency check** + +Run: + +```bash +grep -n "bundle k/N" skills/execute/SKILL.md skills/fathom-shared/conventions.md +``` + +Expected: at least one line from each file, both using the identical `(bundle k/N)` format. + +Run: + +```bash +grep -n "^1\?[0-9]\. " skills/execute/SKILL.md | tail -5 +``` + +Expected: steps 9 through 12 still present, in order, unrenumbered. + +- [ ] **Step 6: Run the scanner** + +Run: + +```bash +bin/scan-skills.sh +``` + +Expected: exit code 0. + +- [ ] **Step 7: Commit** + +```bash +git add skills/execute/SKILL.md +git commit -m "feat(fathom): open one review per bundle as each bundle completes" +``` + +--- + +## Task 8: Teach the sweep about stacks and restacking + +**Files:** +- Modify: `skills/execute/SKILL.md:56-61` (step 2, the done-on-merge sweep) + +**Interfaces:** +- Consumes: the `(bundle k/N)` record format from Task 7 and the squash-merge caveat from Task 2. +- Produces: nothing later tasks depend on. + +- [ ] **Step 1: Add the multi-review sweep rules** + +In `skills/execute/SKILL.md`, append these lines to the end of step 2: + +```markdown + An issue split into a stack has one recorded review per bundle rather than one in total, so call `getReviewState` on every recorded id before deciding anything about the issue. + Move the issue to `done` only when every bundle reports `merged`. + When some bundles are merged and others are still open, close nothing: report the partial progress, naming which bundles merged, then run the restack check below. + When any bundle reports `closed-unmerged`, apply the closed-without-merging path for that bundle, name which bundles above it in the stack are now orphaned by it, and neither close the issue nor restack anything; whether to retry, rescope, or drop the orphaned work is the user's judgment call. + When the adapter declares `reviewLookup: none` the whole sweep is unavailable here as it already is for single reviews, so say so once and act on nothing. + + The restack check asks one forge-agnostic question: is the merged bundle's content an ancestor of each remaining stack branch? + Rebase a remaining branch onto its updated base only when the answer is no, and leave it alone when the answer is yes. + Ancestry is the right test rather than the adapter's `stackedReviews` value, because a squash-merge on a `retarget` forge leaves a dependent review redisplaying the merged bundle's changes exactly as an unretargeted `none` forge would, and one check covers both. + Rebase the remaining branches bottom-up, so each one lands on a base that is already correct. + Push a rebased branch with `--force-with-lease` and never with a bare force push. + When the lease is rejected, stop and hold: another commit reached that branch, and overwriting it discards someone's work, which is the hazard `../fathom-shared/approval.md` already refuses to take unattended. + When the rebase conflicts, stop and hold naming the conflicting files, exactly as a base-branch update conflict does in step 7. +``` + +- [ ] **Step 2: Add the mid-stack tier drop rule** + +In the same file, append this line to step 1, after the sentence about stating the resolved tier: + +```markdown + When a resumed run resolves the manual tier on an issue whose earlier bundles already have open reviews, leave those reviews alone and hand the remaining bundles off manually, saying that the tier changed between runs so the stack is now half automated and half manual. +``` + +- [ ] **Step 3: Run the consistency check** + +Run: + +```bash +grep -n "force-with-lease" skills/execute/SKILL.md +``` + +Expected: exactly 2 lines, one requiring the flag and one handling its rejection. There must be no line permitting a bare `--force`. + +Run: + +```bash +grep -n "git push --force[^-]" skills/execute/SKILL.md +``` + +Expected: no output, exit code 1. + +- [ ] **Step 4: Run the scanner** + +Run: + +```bash +bin/scan-skills.sh +``` + +Expected: exit code 0. + +- [ ] **Step 5: Commit** + +```bash +git add skills/execute/SKILL.md +git commit -m "feat(fathom): sweep every bundle and restack on ancestry" +``` + +--- + +## Task 9: Bump the version and run the full verification + +**Files:** +- Modify: `.claude-plugin/plugin.json` (the `version` field) +- Modify: `.claude-plugin/marketplace.json` and `README.md` (written by the sync script, not by hand) + +**Interfaces:** +- Consumes: every preceding task. +- Produces: nothing. + +- [ ] **Step 1: Bump the plugin version** + +In `.claude-plugin/plugin.json`, change: + +```json + "version": "2.1.0", +``` + +to: + +```json + "version": "2.2.0", +``` + +This is a minor bump because the change adds behavior and every existing repository, forge, and tier keeps behaving exactly as before unless it opts in. + +Do not edit `.claude-plugin/marketplace.json` or `README.md` by hand. `plugin.json` is the source of truth and the next step propagates it. + +- [ ] **Step 2: Propagate the version** + +Run: + +```bash +bin/sync-versions.sh +``` + +Expected: exit code 0, and `git status --short` now shows `.claude-plugin/marketplace.json` and `README.md` as modified. + +- [ ] **Step 3: Run the full scanner** + +Run: + +```bash +bin/scan-skills.sh +``` + +Expected: exit code 0, no non-suppressed findings across all three skills. + +- [ ] **Step 4: Run the whole-change consistency check** + +Run: + +```bash +grep -rn "declared and unused\|Reserved. No behavior\|openReview(branch, base, title, body)" skills/ +``` + +Expected: no output, exit code 1. No file still describes the capability as unused or the signature as four-argument. + +Run: + +```bash +grep -rn "—" skills/ docs/plans/2026-08-07-fathom-stacked-reviews-*.md +``` + +Expected: no output, exit code 1. No em dash was introduced. + +Run: + +```bash +grep -rn "TODO\|TBD" skills/ +``` + +Expected: no output, exit code 1. + +- [ ] **Step 5: Read the changed files together** + +Open `skills/execute/SKILL.md`, `skills/fathom-shared/forges.md`, `skills/fathom-shared/conventions.md`, and `skills/fathom-shared/approval.md` side by side and confirm three things by reading, because no tool in this repository checks them: + +- Every place that says "the review" for a stacked issue is unambiguous about whether it means one bundle's review or all of them. +- The bundle cap (3 bundles, 2 sub-issues each, 5 sub-issue threshold) appears with identical numbers everywhere it appears. +- The `stacking` field is described identically in `approval.md` and `execute/SKILL.md`. + +Fix any disagreement in place before committing. + +- [ ] **Step 6: Commit** + +```bash +git add .claude-plugin/plugin.json .claude-plugin/marketplace.json README.md +git commit -m "chore(fathom): release 2.2.0 with stacked reviews" +``` + +--- + +## Self-review record + +**Spec coverage.** Every numbered section of the design document maps to a task: sections 1, 2, 3 and 4 to Tasks 3 and 6; section 5 to Task 6; sections 6 and 7 to Tasks 5 and 6; sections 8 and 9 to Tasks 4 and 7; section 10 to Tasks 1 and 2; sections 11, 12 and 13 to Task 8; section 14 to Task 7; section 15 to Task 8; the `Files touched` list to Tasks 1 through 8; and `Verification` to Task 9. + +**Spec gap found and fixed.** The design's `stackedReviews: none` behavior was unreachable through any bundled adapter, because the only bundled adapter declaring `none` is the one the manual tier runs on, and the manual tier never stacks. Task 1 Steps 1 and 2 amend the design document to scope that row to tier-1 repo-local adapters, and Task 2 Step 3 records the same fact in `generic-git.md`. + +**Naming consistency.** The argument is `dependsOn` in Tasks 1, 2 and 7. The record format is `(bundle k/N)` in Tasks 4, 7 and 8. The plan-document section is `Bundles` in Tasks 4, 5 and 6. The profile field is `stacking` with values `propose` and `never` in Tasks 3 and 6. The branch pattern is the base name with `-` appended in Tasks 6 and 7. From 779c04c3521a9891ca7ba086001cf9cdf12e5cc3 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 17:49:53 -0700 Subject: [PATCH 03/68] docs(fathom): scope the em dash check off the plan file itself --- docs/plans/2026-08-07-fathom-stacked-reviews-plan.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md index 81bb4e49..08e3f9eb 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md @@ -866,11 +866,13 @@ Expected: no output, exit code 1. No file still describes the capability as unus Run: ```bash -grep -rn "—" skills/ docs/plans/2026-08-07-fathom-stacked-reviews-*.md +grep -rn "—" skills/ docs/plans/2026-08-07-fathom-stacked-reviews-design.md ``` Expected: no output, exit code 1. No em dash was introduced. +Do not add the plan file itself to this check. The plan contains this very grep command, so the literal character appears in it by necessity and would always match. + Run: ```bash From 02817ffd8b294a985012a1cebff1ad5f4bf010a7 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 17:53:54 -0700 Subject: [PATCH 04/68] feat(fathom): give stackedReviews behavior in the forge contract --- ...026-08-07-fathom-stacked-reviews-design.md | 5 ++++- skills/fathom-shared/forges.md | 20 +++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-design.md b/docs/plans/2026-08-07-fathom-stacked-reviews-design.md index 69f30dbc..090da1a3 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-design.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-design.md @@ -66,6 +66,9 @@ A tier-3 forge (`forges.md:123-126`) cannot create reviews, so a three-bundle st In tier 3 the agent says the split was not offered and why. Tier 1 and tier 2 both propose. +This makes the `none` behavior in section 10 reachable only through a tier-1 repo-local adapter at `.fathom/forge.md` that creates real reviews but has no stacking model of its own. +No bundled adapter reaches it, because `generic-git.md` is the only bundled adapter declaring `none` and it is exactly what the manual tier runs on. + ### 3. The split proposal stop The stop fires at step 8, after the breakdown exists and before any branch is created. @@ -162,7 +165,7 @@ Adapters key their behavior off their declared `stackedReviews` value: | --- | --- | | `retarget` | Ignore `dependsOn`. The `base` argument does the work, and the forge retargets on upstream merge. | | `declared-dependency` | Pass `dependsOn` to the forge's dependency mechanism and scope the commit range. | -| `none` | Ignore `dependsOn`. The `base` argument gives git-level chaining, and the body's `Depends on` line carries the rest. | +| `none` | Ignore `dependsOn`. The `base` argument gives git-level chaining, and the body's `Depends on` line carries the rest. Reachable only from a tier-1 repo-local adapter, per section 3. | `forges.md:59-60` stops saying the capability is declared and unused. diff --git a/skills/fathom-shared/forges.md b/skills/fathom-shared/forges.md index 150dc3d5..5d851ceb 100644 --- a/skills/fathom-shared/forges.md +++ b/skills/fathom-shared/forges.md @@ -14,7 +14,7 @@ Adapter files implement each one against a specific forge's tools; treat the ope | --- | --- | | `verifyForge()` | Cheap read-only preflight check that the forge is reachable and authenticated; returns verified or unverified and nothing else. | | `resolveBase(branch)` | Confirm the named base branch exists on the remote and is a valid merge target. | -| `openReview(branch, base, title, body)` | Create the review for a branch against a base. Return a stable review id and the review's URL - or, on a forge where no review can be created, the manual-handoff result defined below. | +| `openReview(branch, base, title, body, dependsOn?)` | Create the review for a branch against a base. Return a stable review id and the review's URL - or, on a forge where no review can be created, the manual-handoff result defined below. `dependsOn` is optional and carries the review id this one is stacked on; it is absent for a standalone review and for the first bundle of a stack. | | `publishReview(id)` | Move a draft review to the notified-review state, where the forge distinguishes the two. A no-op everywhere else. | | `getReviewState(id)` | Return one of `open`, `merged`, `closed-unmerged`, or `unknown`, plus a merge timestamp when merged. | @@ -51,13 +51,24 @@ An absent capability means false. | `draftState` | true / false | Whether `publishReview` is meaningful, and when the `inReview` phase is applied. | | `pushesForYou` | true / false | Whether `openReview` owns the push, or the calling skill pushes the branch first. | | `reviewLookup` | `by-id` / `none` | Whether the done-on-merge sweep can run at all. | -| `stackedReviews` | `retarget` / `declared-dependency` / `none` | Reserved. No behavior depends on it yet. | +| `stackedReviews` | `retarget` / `declared-dependency` / `none` | How this adapter expresses that one review is stacked on another, in `openReview`. | Forges differ in kind, not only in command names, which is the same lesson `agents.md:23-31` already records for tracker MCP builds whose tool coverage varies. A capability that is false is a fact to design around, not a gap to work around. -`stackedReviews` is declared and unused. -It is recorded now because the difference is real - `retarget` describes a forge where stacking is branch retargeting with automatic retarget when the upstream merges, and `declared-dependency` describes one where stacking is an explicit dependency plus a manually scoped commit range with no auto-rebase - and because adding a capability key later means revisiting every adapter file. +`stackedReviews` decides what an adapter does with `openReview`'s optional `dependsOn` argument. + +| Value | What `openReview` does with `dependsOn` | +| --- | --- | +| `retarget` | Ignore it. Passing the previous bundle's branch as `base` is the whole mechanism, and the forge retargets the dependent review automatically when its upstream merges. | +| `declared-dependency` | Pass it to the forge's own dependency mechanism, and scope the review's commit range to this bundle's commits only. Nothing is retargeted automatically. | +| `none` | Ignore it. The `base` argument still chains the branches in git, and the calling skill writes the relationship into the review body in prose. | + +A `none` adapter is still stackable in the only sense that matters to a reader: the branches chain, each review shows one bundle's diff, and the body says what it depends on. +What it lacks is any forge-side record of the relationship, so nothing retargets and nothing warns when the stack is merged out of order. + +Only a repo-local adapter reaches the `none` row in practice. +The one bundled adapter that declares `none` is `generic-git.md`, which is what the manual tier runs on, and the manual tier never proposes a stack. ## Adapter resolution @@ -124,6 +135,7 @@ The best outcome is the committed adapter, because it is reviewable by the team No adapter, no candidate, the user declined the tier-2 offer, or the profile records `forge: none`. Push the branch, then print what a human needs in order to open the review by hand: the branch, the base, a suggested title, and a suggested body. `getReviewState` is unavailable, so the done-on-merge sweep does not run. +A stack is never proposed in this tier: with no review object to create, a three-bundle stack would become three separate sets of open-this-by-hand instructions, which is worse for the user than one review. `forge: none` is not a fourth tier. It is the manual tier made permanent, so a repository that will never have an automatable forge stops being offered one on every invocation. From 6c189f6642044ea005447e80dc96450bad4574f2 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 18:17:39 -0700 Subject: [PATCH 05/68] docs(fathom): correct the section ref and grep expectation in task 1 --- docs/plans/2026-08-07-fathom-stacked-reviews-plan.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md index 08e3f9eb..7a334a78 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md @@ -66,7 +66,7 @@ No bundled adapter reaches it, because `generic-git.md` is the only bundled adap In the same file, in section 10, replace the `none` row of the behavior table with this row: ```markdown -| `none` | Ignore `dependsOn`. The `base` argument gives git-level chaining, and the body's `Depends on` line carries the rest. Reachable only from a tier-1 repo-local adapter, per section 3. | +| `none` | Ignore `dependsOn`. The `base` argument gives git-level chaining, and the body's `Depends on` line carries the rest. Reachable only from a tier-1 repo-local adapter, per section 2. | ``` - [ ] **Step 3: Change the `openReview` row in the contract table** @@ -148,7 +148,9 @@ Run: grep -c "dependsOn" skills/fathom-shared/forges.md ``` -Expected: `5` or more. The argument is named in the contract row, the capability table rows, and the surrounding prose. +Expected: `3`. `grep -c` counts matching lines rather than occurrences, and Step 5's prose deliberately says "it" rather than repeating the argument name in each behavior row, so three lines carry it: the contract row, the sentence introducing the behavior table, and the table's own header. + +If this returns anything other than 3, report the number rather than dropping the check. A silently omitted verification is worse than a failed one. - [ ] **Step 8: Run the scanner** From bbc89ed8e6a5ff5b0fea35ca436487a9163d32c6 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 18:18:26 -0700 Subject: [PATCH 06/68] fix(fathom): point the none row at the section that explains it --- docs/plans/2026-08-07-fathom-stacked-reviews-design.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-design.md b/docs/plans/2026-08-07-fathom-stacked-reviews-design.md index 090da1a3..18066d94 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-design.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-design.md @@ -165,7 +165,7 @@ Adapters key their behavior off their declared `stackedReviews` value: | --- | --- | | `retarget` | Ignore `dependsOn`. The `base` argument does the work, and the forge retargets on upstream merge. | | `declared-dependency` | Pass `dependsOn` to the forge's dependency mechanism and scope the commit range. | -| `none` | Ignore `dependsOn`. The `base` argument gives git-level chaining, and the body's `Depends on` line carries the rest. Reachable only from a tier-1 repo-local adapter, per section 3. | +| `none` | Ignore `dependsOn`. The `base` argument gives git-level chaining, and the body's `Depends on` line carries the rest. Reachable only from a tier-1 repo-local adapter, per section 2. | `forges.md:59-60` stops saying the capability is declared and unused. From 02f089d774e4def8d7ecd1039ca604fefe15f648 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 18:21:27 -0700 Subject: [PATCH 07/68] feat(fathom): implement dependsOn in the bundled forge adapters --- skills/fathom-shared/forges/TEMPLATE.md | 6 ++++-- skills/fathom-shared/forges/generic-git.md | 7 ++++++- skills/fathom-shared/forges/github.md | 8 +++++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/skills/fathom-shared/forges/TEMPLATE.md b/skills/fathom-shared/forges/TEMPLATE.md index c5b15364..25349156 100644 --- a/skills/fathom-shared/forges/TEMPLATE.md +++ b/skills/fathom-shared/forges/TEMPLATE.md @@ -37,7 +37,7 @@ Guidance is in `>` blockquotes throughout. Delete the blockquotes as you fill ea > > `reviewLookup` - `by-id` only if you can look up one review's state directly, from any clone, given the id `openReview` returned. If reviews can only be found by listing, or not found at all, this is `none`. > -> `stackedReviews` - declared but currently unused. `retarget` if stacking means retargeting a branch; `declared-dependency` if it means declaring a dependency plus a commit range. +> `stackedReviews` - how your forge expresses that one review is stacked on another, which decides what your `openReview` does with the optional `dependsOn` argument. `retarget` if stacking is just pointing a review at the previous branch, and your forge retargets automatically when the upstream merges. `declared-dependency` if stacking means declaring an explicit dependency and scoping the commit range yourself, with no automatic retarget. `none` if your forge has no stacking model at all, which is a fine answer: the calling skill still chains the branches in git and writes the relationship into the review body. ## Absolute boundary @@ -68,7 +68,7 @@ When it does not verify, report the fix: > `git ls-remote --exit-code --heads origin ` works on most forges and is a fine answer. Use something forge-specific only if your forge has merge targets that are not plain branches. -## `openReview(branch, base, title, body)` +## `openReview(branch, base, title, body, dependsOn?)` @@ -78,6 +78,8 @@ When it does not verify, report the fix: > > **Say how to extract the review id from the command's output**, exactly - which field, which format. This id is written to disk and looked up on later runs from possibly a different clone, so it must be stable. A branch name is not a review id. +> **Say what you do with `dependsOn`, explicitly, even when the answer is nothing.** It arrives holding the review id this one is stacked on, and it is absent for a standalone review and for the first review in a stack. If you declared `retarget` or `none`, write "Ignore `dependsOn`" and say that the `base` argument carries the relationship. If you declared `declared-dependency`, give the exact command that records the dependency, and say how you scope the review to this bundle's commits only - a declared dependency with an unscoped range shows the upstream bundle's changes twice. + Return the review id and the review's URL. diff --git a/skills/fathom-shared/forges/generic-git.md b/skills/fathom-shared/forges/generic-git.md index 1f4af58b..1b489b64 100644 --- a/skills/fathom-shared/forges/generic-git.md +++ b/skills/fathom-shared/forges/generic-git.md @@ -19,6 +19,10 @@ Work still gets committed, pushed, and handed to a human in a usable form; what | `reviewLookup` | `none` | | `stackedReviews` | `none` | +`stackedReviews: none` is never exercised through this adapter. +This adapter is what the manual tier runs on, and `../forges.md` states that the manual tier never proposes a stack, so `openReview` here is only ever called for a standalone review. +The value is declared truthfully rather than left absent, because a repo-local adapter author reading this file as the minimum viable example needs to see every capability filled in. + `reviewLookup: none` is the consequential one. It means the done-on-merge sweep cannot run in this repository, and every skill that would have swept must say so rather than reporting a clean sweep it never performed. @@ -43,7 +47,7 @@ The tier-2 probe already ran and either found nothing or was declined; re-probin Confirm the branch exists on the remote with `git ls-remote --exit-code --heads origin `. -## `openReview(branch, base, title, body)` +## `openReview(branch, base, title, body, dependsOn?)` This operation does not push. `pushesForYou` is false, so the branch has already been pushed by the caller before this runs, exactly as on any other adapter that declares false. @@ -57,6 +61,7 @@ Print what a human needs to open the review by hand: - The suggested body, in full, so it can be pasted rather than reconstructed. Return no review id. +`dependsOn` is ignored here for the same reason the id is absent: there is no review object to attach a dependency to. Say plainly, at this point, all three of these, since a partial statement is what leaves the user guessing: diff --git a/skills/fathom-shared/forges/github.md b/skills/fathom-shared/forges/github.md index 897f8efd..b8c328ff 100644 --- a/skills/fathom-shared/forges/github.md +++ b/skills/fathom-shared/forges/github.md @@ -19,6 +19,9 @@ Shared contracts outside this file say "review"; that difference is deliberate, `ciHooks` is true because GitHub Actions can run a merge-closer workflow in the user's repository; the tracker adapters' merge-closer offers are gated on this. `pushesForYou` is false because `gh pr create` does not push the branch, so the calling skill pushes first. `stackedReviews` is `retarget` because GitHub stacking is branch retargeting, and GitHub retargets a dependent pull request automatically when its upstream merges. +That automatic retarget is real but partial, and the gap matters to the caller. +When the upstream pull request is **squash-merged**, the squash commit is not an ancestor of the dependent branch, so the dependent pull request retargets to the base and then redisplays the upstream bundle's changes as if they were new. +The dependent branch has to be rebased for its diff to be honest again, which is why the calling skill's rebase rule is keyed on commit ancestry rather than on this capability value. ## Absolute boundary @@ -50,7 +53,7 @@ Delivering these instructions is a complete, useful action, not a fallback. Confirm the branch exists on the remote with `git ls-remote --exit-code --heads origin `. A base branch that exists only locally is not a valid merge target, because the pull request is created against the remote. -## `openReview(branch, base, title, body)` +## `openReview(branch, base, title, body, dependsOn?)` Push the branch first; `pushesForYou` is false, so the push is the caller's and this operation does not perform it. @@ -59,6 +62,9 @@ Skip creation when a pull request already exists for the branch, and return the Return the pull request number as the review id, and the pull request URL. The number is what `getReviewState` looks up, and it resolves from any clone without a listing call. +Ignore `dependsOn` when it is supplied. +`stackedReviews` is `retarget`, so passing the previous bundle's branch as `base` is the entire mechanism, and GitHub needs no separate dependency declaration. +Never encode the dependency a second way, such as by adding a label or an extra API call; the base branch already carries it and a second representation can disagree with the first. Two body conventions matter on GitHub specifically, and the calling skill supplies them: From f2a70e46bc45cca4b0115524077863793ad73c4b Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 18:28:47 -0700 Subject: [PATCH 08/68] feat(fathom): classify the bundle-split stop and add the stacking field --- skills/fathom-shared/approval.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/skills/fathom-shared/approval.md b/skills/fathom-shared/approval.md index b2329fe1..3c4c32b6 100644 --- a/skills/fathom-shared/approval.md +++ b/skills/fathom-shared/approval.md @@ -32,6 +32,10 @@ Skipping them changes how much the run interrupts you, not whether it is correct Resolve it by that precedence and report the choice rather than asking. - Any first-run setup question whose answer is unambiguous: one destination available, or tracker state names that match the three phases exactly. Record the answer, and note in the profile that it was auto-accepted rather than confirmed, so a wrong destination is traceable later. +- The bundle-split proposal in `execute`. + Apply the proposed split and report the bundles rather than asking for confirmation first. + This belongs here rather than on the safety list because it fires before any branch, commit, or review exists, so a wrong answer costs nothing and is corrected by re-running with `stacking: never` or a different instruction. + It is skipped only when the profile's `stacking` field permits a split at all; `stacking: never` suppresses the split itself, in both modes, rather than suppressing the question. ## What auto mode never skips @@ -75,5 +79,14 @@ Because the profile is committed, teammates inherit the choice. Editing that field changes it permanently; an invocation phrase changes it for one run. When one skill hands off to the other, carry the resolved mode across so a per-run override is not lost at the boundary; say which mode the handed-off run is using. +A second field, `stacking`, sits alongside `approval` and answers a different question: whether `execute` may split one issue into a stack of dependent reviews at all. +It holds `propose` or `never`, and it defaults to `propose` when the field is absent. + +`propose` means the agent may propose a split when the breakdown crosses the threshold in `execute`, with the `approval` field above deciding whether that proposal is a question or a report. +`never` means this repository always produces one review per issue, in both approval modes, in the same permanent way that `forge: none` makes the manual tier permanent. + +The field deliberately has two values rather than three. +An `ask` or `auto` value here would restate the `approval` field recorded a few lines above it in the same profile, and two fields that can disagree about the same question will eventually disagree. + When auto mode auto-accepted a setup answer rather than having it confirmed, record that alongside the value, for example `default-destination: Prototypes (1209000000000001) # auto-accepted, only option`. A later reader needs to know which answers a human actually gave. From d611b5f67706264478501fc755236c50e362623c Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 18:29:35 -0700 Subject: [PATCH 09/68] docs(fathom): correct the stacking grep expectation in task 3 --- docs/plans/2026-08-07-fathom-stacked-reviews-plan.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md index 7a334a78..9e005210 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md @@ -365,7 +365,9 @@ Run: grep -n "stacking" skills/fathom-shared/approval.md ``` -Expected: at least 4 matching lines, all using only the values `propose` and `never`. +Expected: exactly 3 matching lines, all using only the values `propose` and `never`. + +`grep -n` counts lines rather than occurrences, and the approved text carries the word on three of them: two in the skip-list entry and one in the profile-field paragraph. If you get a different number, report it rather than dropping the check. Run: From 3bfbc43ecbbce19a815737a4d0424d56026be608 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 18:35:15 -0700 Subject: [PATCH 10/68] feat(fathom): add bundle records, per-bundle reconciliation, and stack bodies --- skills/fathom-shared/conventions.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/skills/fathom-shared/conventions.md b/skills/fathom-shared/conventions.md index 533657df..85eba613 100644 --- a/skills/fathom-shared/conventions.md +++ b/skills/fathom-shared/conventions.md @@ -58,6 +58,10 @@ Include these sections: - **Codebase context** - the files, modules, and existing patterns this work touches, with paths. - **Implementation approach** - how the change will be made, including anything deliberately out of scope. - **Tasks** - the planned units of work with their sub-issue links. +- **Bundles** - present only when this issue was split into a stack, and omitted entirely otherwise. + One line per bundle, in stack order, each reading `- Bundle /: - `. + Add a `- Review: ` line beneath a bundle once its review exists. + This section is the durable record a resumed run reads to recover the stack, so write it when the split is confirmed rather than when the first review opens. - **Testing strategy** - which tests will prove the work, and which existing tests could regress. - **Notes** - open questions, risks, and decisions taken during the run. @@ -82,6 +86,12 @@ Compare that count to the number of tasks closed for this issue. Check the recorded hashes as well: every hash recorded at close must name a commit inside that same range, and each closed task's hash must be distinct, which catches a mismatch that subject-line counting can misclassify. When the counts disagree, stop and report the discrepancy rather than opening a review: either a commit is missing, or tasks were combined into one commit, and both contradict the one-commit-per-task rule. +When the issue was split into a stack, reconcile once per bundle rather than once per issue, and do it before that bundle's review opens rather than at the end of the run. +Count over the range from that bundle's own base to that bundle's head: the resolved base branch for bundle 1, and branch k-1 for bundle k. +Compare that count to the number of tasks closed for that bundle only. +A stack-wide count over the whole range would pass even when one bundle carried another bundle's commits, which is exactly the mistake the check exists to catch. +Stop on a mismatch the same way, and do not open that bundle's review. + This check guards a hazard that is universal across forges rather than specific to any one of them: every forge reviews committed work only, so anything left staged or uncommitted is silently absent from the review, with no error raised anywhere. ## Review test plan @@ -100,3 +110,18 @@ When the project cannot run tests at all, say that plainly here rather than leav After each task closes, print one line so a long autonomous run stays legible: the task position in the queue, its id, the commit subject, the test result, and how many tasks remain. Report the resolved tracker and memory backend once at the start of the run, and state the backend explicitly whenever it differs from what other open issues in this repository are using. + +## Review bodies in a stack + +When one issue produced a stack of reviews, the issue-closing reference goes in the last bundle's review body only. + +`execute` puts `Closes ` in the body for a Linear issue, or the task's URL for an Asana task, and both are read by the forge's tracker integration on merge. +Repeating either in every bundle means the first bundle's merge closes the issue while most of the work is still open and unreviewed. + +Every bundle's body carries two additional lines instead: + +- `Part of ` so a reviewer knows this diff is a slice rather than the whole change. +- `Depends on `, omitted for bundle 1, which depends on nothing. + +Earlier bundles still name the issue for context, as a plain link with no closing keyword. +The distinction is between referencing an issue and instructing the forge to close it, and only the last bundle does the second one. From 90750b7226539b1f9c040041dfee5a43a79f9e11 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 18:39:49 -0700 Subject: [PATCH 11/68] docs(fathom): add the bundle suffix and shorten the task 4 subject --- docs/plans/2026-08-07-fathom-stacked-reviews-plan.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md index 9e005210..7cb583be 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md @@ -415,7 +415,8 @@ In `skills/fathom-shared/conventions.md`, in the bullet list of plan document se ```markdown - **Bundles** - present only when this issue was split into a stack, and omitted entirely otherwise. One line per bundle, in stack order, each reading `- Bundle /: - `. - Add a `- Review: ` line beneath a bundle once its review exists. + Add a `- Review: (bundle k/N)` line beneath a bundle once its review exists. + The suffix is redundant with the nesting on purpose: the sweep reads these lines individually, and a self-describing record survives being read out of its surrounding context. This section is the durable record a resumed run reads to recover the stack, so write it when the split is confirmed rather than when the first review opens. ``` @@ -484,7 +485,7 @@ Expected: exit code 0. ```bash git add skills/fathom-shared/conventions.md -git commit -m "feat(fathom): add bundle records, per-bundle reconciliation, and stack bodies" +git commit -m "feat(fathom): add bundle records, reconciliation, and stack bodies" ``` --- From ee7daa8b9615c4e41b87a5444916fe90eda7041c Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 18:40:54 -0700 Subject: [PATCH 12/68] fix(fathom): give the bundle review record a self-describing suffix --- skills/fathom-shared/conventions.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/skills/fathom-shared/conventions.md b/skills/fathom-shared/conventions.md index 85eba613..f5d1ab88 100644 --- a/skills/fathom-shared/conventions.md +++ b/skills/fathom-shared/conventions.md @@ -60,7 +60,8 @@ Include these sections: - **Tasks** - the planned units of work with their sub-issue links. - **Bundles** - present only when this issue was split into a stack, and omitted entirely otherwise. One line per bundle, in stack order, each reading `- Bundle /: - `. - Add a `- Review: ` line beneath a bundle once its review exists. + Add a `- Review: (bundle k/N)` line beneath a bundle once its review exists. + The suffix is redundant with the nesting on purpose: the sweep reads these lines individually, and a self-describing record survives being read out of its surrounding context. This section is the durable record a resumed run reads to recover the stack, so write it when the split is confirmed rather than when the first review opens. - **Testing strategy** - which tests will prove the work, and which existing tests could regress. - **Notes** - open questions, risks, and decisions taken during the run. From 032bea55865d89a888fb2b9eeb65d8b5e6c465b5 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 18:43:57 -0700 Subject: [PATCH 13/68] feat(fathom): record stack structure and cross-bundle task deps --- skills/fathom-shared/memory.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/skills/fathom-shared/memory.md b/skills/fathom-shared/memory.md index 5363e470..5ffdefd9 100644 --- a/skills/fathom-shared/memory.md +++ b/skills/fathom-shared/memory.md @@ -11,7 +11,7 @@ Adapter files implement each one against a specific backend; treat the operation | Operation | Purpose | | --- | --- | | `init(issueRef)` | Prepare the backend for this issue's task set. | -| `createTask(title, description, subIssueRef, deps)` | Create a task, tag it with the issue ref so all tasks for one issue can be listed directly, record `subIssueRef` on the task, and return its task id. | +| `createTask(title, description, subIssueRef, deps)` | Create a task, tag it with the issue ref so all tasks for one issue can be listed directly, record `subIssueRef` on the task, and return its task id. When the issue was split into a stack, the first task of each bundle after the first also takes a dep on the last task of the previous bundle, so the backend itself enforces bundle order and `claimNext` cannot hand out a later bundle's task while an earlier bundle is still open. | | `claimNext()` | Return and mark in-progress this issue's first open task whose deps are all closed; null when none remain. Scope every call to the issue being worked: a backend able to see other issues' tasks must filter to this one, or the loop will implement another issue's work on this branch and close the wrong sub-issue. When an interrupted run left one of this issue's tasks in progress, return that task to be resumed rather than claiming a new one. | | `close(taskId)` | Mark a task done. | | `status()` | Return this issue's open and done counts and its current in-progress task, scoped to the issue exactly as `claimNext` is. | @@ -63,3 +63,6 @@ The human-readable plan always lives in the plan document at `.fathom/plans/.md` holds the checkbox statuses for that issue, and the plan still lives in the plan document. Whichever backend is active, at least one file under `.fathom/` must record the issue's branch, its review id once one exists, and its tracker URL, because the merge sweep finds an issue by searching that directory, and a merge-closer running on the forge's own CI finds one the same way. +A stacked issue has more than one branch and more than one review id, so it records one of each per bundle, in stack order, in the plan document's `Bundles` section described in `conventions.md`. +The single `Branch` line at the top of the plan document keeps naming bundle 1's branch and is never removed, because the merge-closer Action matches that exact label and knows nothing about stacks. +This is a record of structure rather than of status, so it does not violate the no-dual-truth rule above: task status still lives only in the resolved backend, and the sweep reads review ids from these lines the same way it reads the single-review one. From a4ea74bdb6a9ab34b6829bab71a9a34aabf9db26 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 22:46:01 -0700 Subject: [PATCH 14/68] fix(fathom): require a full task chain to guarantee stack order --- .../2026-08-07-fathom-stacked-reviews-design.md | 17 +++++++++++------ .../2026-08-07-fathom-stacked-reviews-plan.md | 8 +++++--- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-design.md b/docs/plans/2026-08-07-fathom-stacked-reviews-design.md index 18066d94..00e1eb10 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-design.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-design.md @@ -100,13 +100,18 @@ The pattern is predictable and matchable, which is what lets a resumed run find ### 6. Ordering is enforced in data -When a split is confirmed, add a dependency edge from the first task of bundle k+1 to the last task of bundle k. +When a split is confirmed, every task takes a dependency on its predecessor, so the whole issue becomes one sequential chain across bundles as well as within them. -`claimNext` then structurally cannot hand out a bundle-2 task while a bundle-1 task is still open, and the implementation loop needs no bundle-ordering logic of its own. +`claimNext` returns the first open task whose deps are all closed, so a single chain means it structurally cannot hand out a later bundle's task while any earlier task is still open. +The implementation loop therefore needs no bundle-ordering logic of its own. -This edge is necessary rather than decorative. -`execute/SKILL.md:76` sets `deps` so tasks chain sequentially "whenever order matters", which leaves parallel-claimable tasks legal. -Without the boundary edge a stack could be built out of order. +A boundary-only edge, from the first task of bundle k+1 to the last task of bundle k, is not sufficient and was rejected for that reason. +`execute/SKILL.md:76` sets `deps` so tasks chain sequentially "whenever order matters", which leaves tasks with no deps at all legal. +Such a task sitting anywhere in bundle k+1 other than its first position has all of its deps trivially closed, so `claimNext` would hand it out while bundle k was still open, and the branch chain would then be built on unfinished work. + +Requiring the full chain is not a patch on that hole. +It makes the design's own premise explicit: section 1 defines a bundle as a contiguous run of the dependency chain, and if tasks are parallel-claimable there is no chain to cut into contiguous runs in the first place. +Full sequential chaining applies only when a split is confirmed; an ordinary single-review run keeps today's conditional chaining unchanged. ### 7. Durable record @@ -246,7 +251,7 @@ Internal consistency is checked by reading the changed files together: every `ex | Skip-list stop | Never-skip stop | It fires before any branch, commit, or review exists, so being wrong costs nothing. | | `stacking` with two values | `stacking` with `ask`, `auto`, and `never` | Three values would duplicate the `approval` field in the same profile and could disagree with it. | | Incremental review opening | All reviews at the end | Opening at the end requires cherry-picking commit ranges onto a chain of branches after the fact. | -| Ordering via dependency edge | Ordering logic in the loop | Encoding it in the task graph means `claimNext` cannot violate it, so the loop needs no new branch. | +| Full sequential chain when stacked | A single edge at each bundle boundary | A boundary edge leaves a dep-free task inside a later bundle claimable while an earlier bundle is open, so it does not deliver the ordering it claims. | | Ancestry check for rebase | Rebase keyed on `stackedReviews` | A squash-merge on a `retarget` forge has the same problem as a merge on a `none` forge, and one rule covers both. | | All bundles merged closes the issue | Top of stack merged closes it | Cheaper, but wrong when someone merges out of order or squashes the stack by hand. | | No stacks in tier 3 | Stacks with N manual handoffs | Three sets of hand-open-this instructions is worse than one review. | diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md index 7cb583be..71d348d0 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md @@ -507,7 +507,7 @@ No new memory operation is added. `createTask` already accepts `deps`, which is In `skills/fathom-shared/memory.md`, append this sentence to the end of the `createTask` row's cell in the contract table, keeping it on the same table line: ``` -When the issue was split into a stack, the first task of each bundle after the first also takes a dep on the last task of the previous bundle, so the backend itself enforces bundle order and `claimNext` cannot hand out a later bundle's task while an earlier bundle is still open. +When the issue was split into a stack, every task takes a dep on its predecessor so the whole issue forms one sequential chain across bundles as well as within them, which is what lets the backend itself enforce bundle order: a later bundle's task is never claimable while any earlier task is still open. A single edge at each bundle boundary would not achieve this, because a task carrying no deps at all has them trivially closed and stays claimable out of order. ``` - [ ] **Step 2: Update the record requirement for stacks** @@ -601,8 +601,10 @@ In the same file, insert these bullets into step 8, directly after the bullet be Exceed the cap only when the user asked for a specific larger split; never exceed it on the heuristic's own judgment. - Present the proposed split before creating anything: the bundles, which sub-issues fall in each, and the resolved forge's `stackedReviews` value with what it means for this run. This is a skip-list stop per `../fathom-shared/approval.md`, so `ask` mode waits for an answer and `auto` mode applies the split and reports it. - - When a split is confirmed, add a dependency edge from the first task of each bundle after the first to the last task of the previous bundle, alongside the edges the steps above already add. - This is what makes `claimNext` structurally unable to hand out a later bundle's task while an earlier bundle is open, so the implementation loop needs no bundle-ordering logic of its own. + - When a split is confirmed, chain every task in the issue sequentially, so each task deps on its predecessor across bundle boundaries as well as within them, rather than only where order matters. + This is what makes `claimNext` structurally unable to hand out a later bundle's task while any earlier task is open, so the implementation loop needs no bundle-ordering logic of its own. + A single edge at each bundle boundary is not enough: a task carrying no deps has them trivially closed, so it stays claimable out of order and the branch chain would be built on unfinished work. + Apply full chaining only when a split is confirmed; a single-review run keeps the conditional chaining described above. Then write the `Bundles` section of the plan document described in `conventions.md`, and commit it with the breakdown. ``` From d1a153b6f0a82c9e06ccec87f370716d9d4187c1 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 22:47:03 -0700 Subject: [PATCH 15/68] fix(fathom): require a full task chain for stack ordering --- skills/fathom-shared/memory.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/skills/fathom-shared/memory.md b/skills/fathom-shared/memory.md index 5ffdefd9..2e39fe0d 100644 --- a/skills/fathom-shared/memory.md +++ b/skills/fathom-shared/memory.md @@ -11,7 +11,7 @@ Adapter files implement each one against a specific backend; treat the operation | Operation | Purpose | | --- | --- | | `init(issueRef)` | Prepare the backend for this issue's task set. | -| `createTask(title, description, subIssueRef, deps)` | Create a task, tag it with the issue ref so all tasks for one issue can be listed directly, record `subIssueRef` on the task, and return its task id. When the issue was split into a stack, the first task of each bundle after the first also takes a dep on the last task of the previous bundle, so the backend itself enforces bundle order and `claimNext` cannot hand out a later bundle's task while an earlier bundle is still open. | +| `createTask(title, description, subIssueRef, deps)` | Create a task, tag it with the issue ref so all tasks for one issue can be listed directly, record `subIssueRef` on the task, and return its task id. When the issue was split into a stack, every task takes a dep on its predecessor so the whole issue forms one sequential chain across bundles as well as within them, which is what lets the backend itself enforce bundle order: a later bundle's task is never claimable while any earlier task is still open. A single edge at each bundle boundary would not achieve this, because a task carrying no deps at all has them trivially closed and stays claimable out of order. | | `claimNext()` | Return and mark in-progress this issue's first open task whose deps are all closed; null when none remain. Scope every call to the issue being worked: a backend able to see other issues' tasks must filter to this one, or the loop will implement another issue's work on this branch and close the wrong sub-issue. When an interrupted run left one of this issue's tasks in progress, return that task to be resumed rather than claiming a new one. | | `close(taskId)` | Mark a task done. | | `status()` | Return this issue's open and done counts and its current in-progress task, scoped to the issue exactly as `claimNext` is. | @@ -63,6 +63,6 @@ The human-readable plan always lives in the plan document at `.fathom/plans/.md` holds the checkbox statuses for that issue, and the plan still lives in the plan document. Whichever backend is active, at least one file under `.fathom/` must record the issue's branch, its review id once one exists, and its tracker URL, because the merge sweep finds an issue by searching that directory, and a merge-closer running on the forge's own CI finds one the same way. -A stacked issue has more than one branch and more than one review id, so it records one of each per bundle, in stack order, in the plan document's `Bundles` section described in `conventions.md`. +A stacked issue has more than one branch and more than one review id, so it records one branch per bundle at breakdown time and adds each review id once that bundle's review exists, in stack order, in the plan document's `Bundles` section described in `conventions.md`. The single `Branch` line at the top of the plan document keeps naming bundle 1's branch and is never removed, because the merge-closer Action matches that exact label and knows nothing about stacks. This is a record of structure rather than of status, so it does not violate the no-dual-truth rule above: task status still lives only in the resolved backend, and the sweep reads review ids from these lines the same way it reads the single-review one. From 4f947d236310f89b1652a8a0ef6d5bf3d81ab7e2 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 22:50:33 -0700 Subject: [PATCH 16/68] feat(fathom): propose a bundle split during breakdown --- skills/execute/SKILL.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index 9e6b5a20..89b1c229 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -70,11 +70,30 @@ If any of these files cannot be found and read, stop immediately and report whic Resolve the base branch per the base-branch rules in `../fathom-shared/forges.md`, then fetch it and create the new branch from the fetched remote copy rather than from a local copy that may be behind, since branching from a stale local copy is the usual cause of conflicts at merge time. When the branch already exists and the base branch has moved on since, bring it up to date before implementing, and report that you did. When that update conflicts, stop and hold exactly as an unfixable test failure would: keep the work, leave the task in progress, report which files conflict, and let the user decide how to resolve them; never resolve a conflict by discarding either side's changes. + These rules describe bundle 1's branch, which is the only branch a single-review run has. + When step 8 confirms a stack, later bundles take the same name with their index appended, so bundle 2 of `feat/ONC-5-add-webhooks` is `feat/ONC-5-add-webhooks-2`. + Create each of those from the previous bundle's branch at the moment that bundle starts, not up front: creating them all at breakdown time would leave empty branches behind whenever a run stops early. 8. Ensure the breakdown exists. - Skip the rest of this step when a breakdown already exists for this issue. - Call `init` for the issue, then call `parentTask` for it. - When the issue has no existing children, plan three to seven units of work, each sized so it can be implemented and verified on its own; for each one, call `createSubIssue` first, then call `createTask` with the newly created sub-issue's ref as `subIssueRef`, then write the returned task id back onto that sub-issue so the link reads both ways, since the task id does not exist until `createTask` returns, setting `deps` to the id of the task it builds on so tasks chain sequentially by default whenever order matters. - When the issue already has children, call `listSubIssues` to adopt them instead of inventing a new breakdown; for each adopted sub-issue, still call `createTask`, passing that sub-issue's existing ref as `subIssueRef` and skipping `createSubIssue` since the sub-issue already exists, then write the returned task id back onto that sub-issue the same way, and setting `deps` the same way. + - Decide whether this issue produces one review or a stack, once the child tasks exist and before any dependency edge is added. + Read the profile's `stacking` field per `../fathom-shared/approval.md`; treat an absent field as `propose`, and stop considering a split immediately when it reads `never`. + Do not consider a split when the resolved forge tier is the manual tier, and say once that the split was not offered because the tier cannot create reviews. + Otherwise propose a split only when both conditions hold: the breakdown has five or more sub-issues, and at least one valid cut point exists. + A cut point is valid only where the work up to it is independently mergeable, meaning the repository builds, that bundle's tests pass, and merging it alone would not break the base branch. + When no valid cut point exists, proceed as a single review and say so rather than forcing a boundary. + - Shape the bundles as contiguous runs of the sub-issue dependency chain, so bundles inherit its order rather than inventing one. + Produce at most three bundles, each holding at least two sub-issues; those two limits together mean five sub-issues yield at most two bundles, and six is the smallest breakdown that can yield three. + Exceed the cap only when the user asked for a specific larger split; never exceed it on the heuristic's own judgment. + - Present the proposed split before creating anything: the bundles, which sub-issues fall in each, and the resolved forge's `stackedReviews` value with what it means for this run. + This is a skip-list stop per `../fathom-shared/approval.md`, so `ask` mode waits for an answer and `auto` mode applies the split and reports it. + - When a split is confirmed, chain every task in the issue sequentially, so each task deps on its predecessor across bundle boundaries as well as within them, rather than only where order matters. + This is what makes `claimNext` structurally unable to hand out a later bundle's task while any earlier task is open, so the implementation loop needs no bundle-ordering logic of its own. + A single edge at each bundle boundary is not enough: a task carrying no deps has them trivially closed, so it stays claimable out of order and the branch chain would be built on unfinished work. + Apply full chaining only when a split is confirmed; a single-review run keeps the conditional chaining described above. + Then write the `Bundles` section of the plan document described in `conventions.md`, and commit it with the breakdown. - After every child task exists, add the parent's dependency edge on each child, so the parent cannot close before its children and "no open children" becomes a real signal rather than an assumption. - Either way, write the plan document described in `conventions.md` and commit it with the breakdown. - Write `.fathom/tasks/.md` only when the resolved backend is the checklist adapter, since that file holds checkbox statuses; with beads active the statuses live in beads and no file belongs there, as `memory.md` states. From fd03e045a6d5ad61ce0aed8c7293b1d178760fc4 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 22:51:37 -0700 Subject: [PATCH 17/68] docs(fathom): fix the step-numbering grep for bsd grep --- docs/plans/2026-08-07-fathom-stacked-reviews-plan.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md index 71d348d0..271d0b26 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md @@ -613,11 +613,13 @@ In the same file, insert these bullets into step 8, directly after the bullet be Run: ```bash -grep -n "^1\?[0-9]\. " skills/execute/SKILL.md | head -20 +grep -nE "^[0-9]+\. " skills/execute/SKILL.md ``` Expected: steps numbered 1 through 12 with no gaps and no duplicates, exactly as before your edits. +Use `grep -E` here, not plain `grep`. macOS ships BSD grep, whose basic regex does not honor `\?`, so a pattern written that way matches nothing at all and the check silently passes while proving nothing. + Run: ```bash @@ -714,10 +716,12 @@ Expected: at least one line from each file, both using the identical `(bundle k/ Run: ```bash -grep -n "^1\?[0-9]\. " skills/execute/SKILL.md | tail -5 +grep -nE "^[0-9]+\. " skills/execute/SKILL.md ``` -Expected: steps 9 through 12 still present, in order, unrenumbered. +Expected: steps 1 through 12 still present, in order, unrenumbered, with steps 9 through 12 at the end. + +Use `grep -E` here, not plain `grep`. macOS ships BSD grep, whose basic regex does not honor `\?`, so a pattern written that way matches nothing and the check silently passes while proving nothing. - [ ] **Step 6: Run the scanner** From beb29e74d3d8e2d01f1aec89b5f6f1cffea7e493 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 22:58:06 -0700 Subject: [PATCH 18/68] feat(fathom): open one review per bundle as each bundle completes --- skills/execute/SKILL.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index 89b1c229..6cd61158 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -112,7 +112,10 @@ If any of these files cannot be found and read, stop immediately and report whic - Close the task in the memory backend and move its sub-issue to `done`, again per the adapter's sub-issue rules, recording the close as it happens rather than summarizing at the end of the loop. A task is not closed until both its memory record and its sub-issue are closed; closing only the sub-issue leaves it claimable and `claimNext` will hand you the same task again. - Print the per-task progress line from `conventions.md`. + - When this issue was split into a stack and the closed task was the last one in its bundle, run the per-bundle finish routine in step 11 for that bundle before claiming again, then create the next bundle's branch from this one and continue the loop on it. + Do not wait until the loop drains to open any review: building each bundle on the correct branch from the start is what avoids having to cherry-pick commit ranges onto a chain of branches afterwards. - On a failure that cannot be fixed, stop and hold: keep the change, leave the task in progress, report the failure, and exit without continuing the loop. + On a stacked issue, also name which bundles already have open reviews and which were never built, since some of the work is already in front of reviewers and the user needs to know which part held. One commit per task, always, even when two tasks touch the same file. 11. Once `claimNext` returns none remaining, finish the issue. @@ -132,8 +135,22 @@ If any of these files cannot be found and read, stop immediately and report whic When `openReview` returns the manual-handoff result instead of an id, there is no review object: skip `publishReview`, record no review id, print the handoff. Still apply `inReview`, and say plainly that no later run will move this issue to `done` on its own because the forge cannot be observed, so closing it is now a manual step. + When this issue was split into a stack, the review-opening portion above is a per-bundle routine rather than a single closing action, and step 10 invokes it once per bundle as that bundle's last task closes. + For bundle k of N: + - Reconcile bundle k's closed tasks against the commits on its branch, over that bundle's own range, per the per-bundle rule in `conventions.md`; stop and do not open this bundle's review when they disagree. + - Call `resolveBase` on bundle 1's base, which is the resolved base branch, or on branch k-1 for every later bundle. + - Push branch k, unless the adapter declares `pushesForYou`, exactly as the single-review path does. + - Call `openReview` with branch k, that base, a title naming the bundle, and a body built per the stack rules in `conventions.md`: the closing reference only in bundle N, plus `Part k of N`, plus `Depends on` the previous bundle's review URL for every bundle after the first. + Pass the previous bundle's review id as `dependsOn` for every bundle after the first, and omit it for bundle 1. + - Call `publishReview` with the returned id. + - Record `- Review: (bundle k/N)` beneath that bundle's line in the plan document's `Bundles` section, since the sweep looks reviews up by id and needs every one of them. + - Apply `inReview` when bundle 1's review publishes, and never again for the later bundles; the issue is genuinely in review from that moment and re-applying a phase it already holds reports progress that did not happen. + Skip a bundle whose review already exists and reuse it, the same way the single-review path does, so a resumed run never opens a second review for a bundle that has one. + After bundle N's routine completes, continue into the closing actions below, which run once for the issue rather than once per bundle. + Finally, post a completion comment on the issue, including the done-on-merge note from `asana.md` when the tracker is Asana, and commit and push the task-state files this run changed as a final closing commit so the branch carries the completed state, staging them by explicit path per the staging rules in `conventions.md`: the beads JSONL export and `metadata.json` when beads is the backend, and this issue's files under `.fathom/`; never sweep `.beads/` or `.fathom/` as directories, since the beads database and runtime files are intentionally ignored and must not ride into the review. Push this closing commit with an ordinary `git push` of the branch even when the adapter declares `pushesForYou`, since that capability governs only the push that opens the review, as `../fathom-shared/forges.md` states; skipping it here would leave the completed task state in the local clone while the review reads as finished. + On a stacked issue this closing commit goes on branch N, the stack tip, because that branch contains every bundle's history and is the only one whose review shows the completed task state. 12. Report a final summary: the issue, the review URL when one was opened or the resolved tier when one was not, the tracker's current phase, and the task counts from `status()`. ## Display overlay From 09c6c8386f1e3593c1f00b34dd277b04eea1003b Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 23:05:00 -0700 Subject: [PATCH 19/68] fix(fathom): make the two step 11 paths mutually exclusive --- .../2026-08-07-fathom-stacked-reviews-plan.md | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md index 271d0b26..c1f703c2 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md @@ -664,7 +664,7 @@ Step 11 keeps its number and its single-review text. The stack behavior is added In `skills/execute/SKILL.md`, append this bullet to step 10's inner bullet list, directly after the bullet beginning "- Print the per-task progress line": ```markdown - - When this issue was split into a stack and the closed task was the last one in its bundle, run the per-bundle finish routine in step 11 for that bundle before claiming again, then create the next bundle's branch from this one and continue the loop on it. + - When this issue was split into a stack and the closed task was the last one in its bundle, run the per-bundle finish routine in step 11 for that bundle before claiming again, then, when a later bundle remains, create the next bundle's branch from this one and continue the loop on it. Do not wait until the loop drains to open any review: building each bundle on the correct branch from the start is what avoids having to cherry-pick commit ranges onto a chain of branches afterwards. ``` @@ -684,7 +684,29 @@ In the same file, insert this block into step 11, directly before the paragraph - Record `- Review: (bundle k/N)` beneath that bundle's line in the plan document's `Bundles` section, since the sweep looks reviews up by id and needs every one of them. - Apply `inReview` when bundle 1's review publishes, and never again for the later bundles; the issue is genuinely in review from that moment and re-applying a phase it already holds reports progress that did not happen. Skip a bundle whose review already exists and reuse it, the same way the single-review path does, so a resumed run never opens a second review for a bundle that has one. - After bundle N's routine completes, continue into the closing actions below, which run once for the issue rather than once per bundle. + After bundle N's routine completes, skip the single-review path above entirely and continue into the closing actions below, which run once for the issue rather than once per bundle. +``` + +- [ ] **Step 2b: Scope the existing single-review path so a stacked run cannot fall into it** + +This is the other half of Step 2, and without it the two paths are not mutually exclusive. A stacked run reaches `claimNext` returning none after its last bundle's routine has already opened that bundle's review, and then executes the original text as well. + +In the same file, replace this line: + +```markdown +11. Once `claimNext` returns none remaining, finish the issue. +``` + +with: + +```markdown +11. Once `claimNext` returns none remaining, finish the issue. + This step has two mutually exclusive paths, and exactly one of them runs. + A single-review issue follows the single-review path immediately below, then the closing actions at the end of this step. + A stacked issue skips that path entirely and goes straight to the closing actions, because step 10 already opened every one of its reviews through the per-bundle routine further down. + Running the single-review path on a stacked issue would reconcile the whole issue against a single bundle's commit range, write a second review record in a format the sweep does not read, and move the issue to `inReview` a second time. + + The single-review path, for an issue that was not split into a stack: ``` - [ ] **Step 3: Point the closing commit at the stack tip** From c7f3da5ac8fd9e3ce43c9a298e20811054f59f73 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 23:06:20 -0700 Subject: [PATCH 20/68] fix(fathom): make the two step 11 paths mutually exclusive --- skills/execute/SKILL.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index 6cd61158..1eb5f5f3 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -112,13 +112,20 @@ If any of these files cannot be found and read, stop immediately and report whic - Close the task in the memory backend and move its sub-issue to `done`, again per the adapter's sub-issue rules, recording the close as it happens rather than summarizing at the end of the loop. A task is not closed until both its memory record and its sub-issue are closed; closing only the sub-issue leaves it claimable and `claimNext` will hand you the same task again. - Print the per-task progress line from `conventions.md`. - - When this issue was split into a stack and the closed task was the last one in its bundle, run the per-bundle finish routine in step 11 for that bundle before claiming again, then create the next bundle's branch from this one and continue the loop on it. + - When this issue was split into a stack and the closed task was the last one in its bundle, run the per-bundle finish routine in step 11 for that bundle before claiming again, then, when a later bundle remains, create the next bundle's branch from this one and continue the loop on it. Do not wait until the loop drains to open any review: building each bundle on the correct branch from the start is what avoids having to cherry-pick commit ranges onto a chain of branches afterwards. - On a failure that cannot be fixed, stop and hold: keep the change, leave the task in progress, report the failure, and exit without continuing the loop. On a stacked issue, also name which bundles already have open reviews and which were never built, since some of the work is already in front of reviewers and the user needs to know which part held. One commit per task, always, even when two tasks touch the same file. 11. Once `claimNext` returns none remaining, finish the issue. + This step has two mutually exclusive paths, and exactly one of them runs. + A single-review issue follows the single-review path immediately below, then the closing actions at the end of this step. + A stacked issue skips that path entirely and goes straight to the closing actions, because step 10 already opened every one of its reviews through the per-bundle routine further down. + Running the single-review path on a stacked issue would reconcile the whole issue against a single bundle's commit range, write a second review record in a format the sweep does not read, and move the issue to `inReview` a second time. + + The single-review path, for an issue that was not split into a stack: + Run the commit reconciliation from `conventions.md` and stop if the task and commit counts disagree. Commit any leftover uncommitted change that belongs to this issue's tasks, leaving unrelated working-tree edits alone rather than sweeping them into the review. Close the parent task in the memory backend (a no-op for the checklist adapter, whose file is the parent record). @@ -146,7 +153,7 @@ If any of these files cannot be found and read, stop immediately and report whic - Record `- Review: (bundle k/N)` beneath that bundle's line in the plan document's `Bundles` section, since the sweep looks reviews up by id and needs every one of them. - Apply `inReview` when bundle 1's review publishes, and never again for the later bundles; the issue is genuinely in review from that moment and re-applying a phase it already holds reports progress that did not happen. Skip a bundle whose review already exists and reuse it, the same way the single-review path does, so a resumed run never opens a second review for a bundle that has one. - After bundle N's routine completes, continue into the closing actions below, which run once for the issue rather than once per bundle. + After bundle N's routine completes, skip the single-review path above entirely and continue into the closing actions below, which run once for the issue rather than once per bundle. Finally, post a completion comment on the issue, including the done-on-merge note from `asana.md` when the tracker is Asana, and commit and push the task-state files this run changed as a final closing commit so the branch carries the completed state, staging them by explicit path per the staging rules in `conventions.md`: the beads JSONL export and `metadata.json` when beads is the backend, and this issue's files under `.fathom/`; never sweep `.beads/` or `.fathom/` as directories, since the beads database and runtime files are intentionally ignored and must not ride into the review. Push this closing commit with an ordinary `git push` of the branch even when the adapter declares `pushesForYou`, since that capability governs only the push that opens the review, as `../fathom-shared/forges.md` states; skipping it here would leave the completed task state in the local clone while the review reads as finished. From f811d68b1c68a87dc39ee1f2fcc333fd28bdd80d Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 23:13:35 -0700 Subject: [PATCH 21/68] fix(fathom): state that a stacked issue never re-enters step 11 --- docs/plans/2026-08-07-fathom-stacked-reviews-plan.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md index c1f703c2..d5cee13f 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md @@ -705,6 +705,8 @@ with: A single-review issue follows the single-review path immediately below, then the closing actions at the end of this step. A stacked issue skips that path entirely and goes straight to the closing actions, because step 10 already opened every one of its reviews through the per-bundle routine further down. Running the single-review path on a stacked issue would reconcile the whole issue against a single bundle's commit range, write a second review record in a format the sweep does not read, and move the issue to `inReview` a second time. + A stacked issue also never enters this step on its own: step 10 invokes the per-bundle routine directly, and bundle N's routine runs the closing actions once as it finishes. + So when the loop afterwards drains and `claimNext` returns none, this step has already completed for that issue, and nothing in it runs a second time. The single-review path, for an issue that was not split into a stack: ``` From 15778e5978a3f72d4de65c3e57dc8fef7486e42d Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 23:14:19 -0700 Subject: [PATCH 22/68] fix(fathom): state that a stacked issue never re-enters step 11 --- skills/execute/SKILL.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index 1eb5f5f3..e6a0c447 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -123,6 +123,8 @@ If any of these files cannot be found and read, stop immediately and report whic A single-review issue follows the single-review path immediately below, then the closing actions at the end of this step. A stacked issue skips that path entirely and goes straight to the closing actions, because step 10 already opened every one of its reviews through the per-bundle routine further down. Running the single-review path on a stacked issue would reconcile the whole issue against a single bundle's commit range, write a second review record in a format the sweep does not read, and move the issue to `inReview` a second time. + A stacked issue also never enters this step on its own: step 10 invokes the per-bundle routine directly, and bundle N's routine runs the closing actions once as it finishes. + So when the loop afterwards drains and `claimNext` returns none, this step has already completed for that issue, and nothing in it runs a second time. The single-review path, for an issue that was not split into a stack: From 9f2df88c87a7f9d08195dc47ebe6f2fbf65c6d48 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 23:18:46 -0700 Subject: [PATCH 23/68] feat(fathom): sweep every bundle and restack on ancestry --- skills/execute/SKILL.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index e6a0c447..6ca22ed2 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -53,12 +53,26 @@ If any of these files cannot be found and read, stop immediately and report whic This keeps preflight, the sweep, and the run itself on one tracker; verifying whatever the profile names while the invocation clearly targets the other tracker would sweep and verify the wrong one. Stop here, following that section's instructions, when the tracker's MCP does not verify. A forge that does not verify is not a stop: it selects a capability tier per `../fathom-shared/forges.md`. State the resolved tier before continuing, so the user knows up front whether this run will end in an opened review or a manual handoff. + When a resumed run resolves the manual tier on an issue whose earlier bundles already have open reviews, leave those reviews alone and hand the remaining bundles off manually, saying that the tier changed between runs so the stack is now half automated and half manual. 2. Run the done-on-merge sweep for the resolved tracker; the mechanics are described in `../fathom-shared/trackers.md` and are tracker-agnostic, with each adapter file defining only its own closure action for the merged path. This sweep is itself tracker work, so it only runs once preflight has verified the MCP. When the invocation itself was a cleanup phrase, run only this sweep, report what it found, then stop; do not continue into the rest of this procedure. Treat any claim about a review's fate as a cleanup phrase, whether it says merged, closed, abandoned, landed, or shipped, and whether it names an issue or asks to clean up whatever is outstanding. Never act on the claim itself: confirm each referenced review's real state through `getReviewState` first, then apply the merged path or the closed-without-merging path accordingly, and say plainly when the confirmed state differs from what the user described. When the resolved forge declares `reviewLookup: none`, the claim cannot be confirmed at all. Say that plainly and act on nothing; do not close an issue on the strength of an unverifiable claim, since a wrong close is exactly what the confirmation step exists to prevent. + An issue split into a stack has one recorded review per bundle rather than one in total, so call `getReviewState` on every recorded id before deciding anything about the issue. + Move the issue to `done` only when every bundle reports `merged`. + When some bundles are merged and others are still open, close nothing: report the partial progress, naming which bundles merged, then run the restack check below. + When any bundle reports `closed-unmerged`, apply the closed-without-merging path for that bundle, name which bundles above it in the stack are now orphaned by it, and neither close the issue nor restack anything; whether to retry, rescope, or drop the orphaned work is the user's judgment call. + When the adapter declares `reviewLookup: none` the whole sweep is unavailable here as it already is for single reviews, so say so once and act on nothing. + + The restack check asks one forge-agnostic question: is the merged bundle's content an ancestor of each remaining stack branch? + Rebase a remaining branch onto its updated base only when the answer is no, and leave it alone when the answer is yes. + Ancestry is the right test rather than the adapter's `stackedReviews` value, because a squash-merge on a `retarget` forge leaves a dependent review redisplaying the merged bundle's changes exactly as an unretargeted `none` forge would, and one check covers both. + Rebase the remaining branches bottom-up, so each one lands on a base that is already correct. + Push a rebased branch with `--force-with-lease` and never with a bare force push. + When the lease is rejected, stop and hold: another commit reached that branch, and overwriting it discards someone's work, which is the hazard `../fathom-shared/approval.md` already refuses to take unattended. + When the rebase conflicts, stop and hold naming the conflicting files, exactly as a base-branch update conflict does in step 7. 3. Resolve which tracker owns this issue and which memory backend owns its task state, following `trackers.md` and `memory.md`. When the repo already contains beads state but the beads tooling is unavailable on this machine, stop and say so as memory.md directs; never substitute a different backend for a repo whose state lives in another one. Load the existing `.fathom/config.md` tracker profile, or run first-run setup when none exists; either way, run the tracker adapter's profile-load checks and honor any one-time offers they define. From c4a101dd2fb64faecff7c95914440e13129930b1 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 23:19:33 -0700 Subject: [PATCH 24/68] docs(fathom): correct the force-with-lease grep expectation --- docs/plans/2026-08-07-fathom-stacked-reviews-plan.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md index d5cee13f..8ecbeb8d 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md @@ -811,7 +811,9 @@ Run: grep -n "force-with-lease" skills/execute/SKILL.md ``` -Expected: exactly 2 lines, one requiring the flag and one handling its rejection. There must be no line permitting a bare `--force`. +Expected: exactly 1 line, the one requiring the flag and forbidding a bare force push. The sentence handling a rejected lease follows it and says "the lease is rejected" without repeating the flag name, so it does not match this pattern. There must be no line permitting a bare `--force`. + +Also confirm by reading that the sentence immediately after it stops and holds when the lease is rejected. That behavior is the point of the check, and a grep count alone cannot prove it. Run: From df65511d7c941898c10c2626d3ec18f3627944d8 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 23:25:35 -0700 Subject: [PATCH 25/68] fix(fathom): make the abandoned-bundle sweep case terminal --- .../2026-08-07-fathom-stacked-reviews-plan.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md index 8ecbeb8d..e2a1a339 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md @@ -781,9 +781,12 @@ In `skills/execute/SKILL.md`, append these lines to the end of step 2: ```markdown An issue split into a stack has one recorded review per bundle rather than one in total, so call `getReviewState` on every recorded id before deciding anything about the issue. - Move the issue to `done` only when every bundle reports `merged`. - When some bundles are merged and others are still open, close nothing: report the partial progress, naming which bundles merged, then run the restack check below. + A stack can satisfy more than one of the cases below at once, so check them in the order written and let the first one that applies decide the whole sweep. + In particular a stack can hold a merged bundle, an open bundle, and an abandoned one simultaneously, and the abandoned bundle wins: restacking the bundles above it would force-push a rebase onto work the user may be about to discard, which is exactly the unattended destruction that stop exists to prevent. When any bundle reports `closed-unmerged`, apply the closed-without-merging path for that bundle, name which bundles above it in the stack are now orphaned by it, and neither close the issue nor restack anything; whether to retry, rescope, or drop the orphaned work is the user's judgment call. + This case is checked first and is terminal: no later case runs after it, however many other bundles merged or stayed open. + Otherwise move the issue to `done` when every bundle reports `merged`. + Otherwise, with some bundles merged and others still open, close nothing: report the partial progress, naming which bundles merged, then run the restack check below. When the adapter declares `reviewLookup: none` the whole sweep is unavailable here as it already is for single reviews, so say so once and act on nothing. The restack check asks one forge-agnostic question: is the merged bundle's content an ancestor of each remaining stack branch? @@ -811,9 +814,12 @@ Run: grep -n "force-with-lease" skills/execute/SKILL.md ``` -Expected: exactly 1 line, the one requiring the flag and forbidding a bare force push. The sentence handling a rejected lease follows it and says "the lease is rejected" without repeating the flag name, so it does not match this pattern. There must be no line permitting a bare `--force`. +Expected: exactly 1 line, the one requiring the flag and forbidding a bare force push. +The sentence handling a rejected lease follows it and says "the lease is rejected" without repeating the flag name, so it does not match this pattern. +There must be no line permitting a bare `--force`. -Also confirm by reading that the sentence immediately after it stops and holds when the lease is rejected. That behavior is the point of the check, and a grep count alone cannot prove it. +Also confirm by reading that the sentence immediately after it stops and holds when the lease is rejected. +That behavior is the point of the check, and a grep count alone cannot prove it. Run: From 29c62859216c8fade242f743cf009e1d6513ac78 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 23:26:34 -0700 Subject: [PATCH 26/68] fix(fathom): make the abandoned-bundle sweep case terminal --- skills/execute/SKILL.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index 6ca22ed2..150df07e 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -61,9 +61,12 @@ If any of these files cannot be found and read, stop immediately and report whic Never act on the claim itself: confirm each referenced review's real state through `getReviewState` first, then apply the merged path or the closed-without-merging path accordingly, and say plainly when the confirmed state differs from what the user described. When the resolved forge declares `reviewLookup: none`, the claim cannot be confirmed at all. Say that plainly and act on nothing; do not close an issue on the strength of an unverifiable claim, since a wrong close is exactly what the confirmation step exists to prevent. An issue split into a stack has one recorded review per bundle rather than one in total, so call `getReviewState` on every recorded id before deciding anything about the issue. - Move the issue to `done` only when every bundle reports `merged`. - When some bundles are merged and others are still open, close nothing: report the partial progress, naming which bundles merged, then run the restack check below. + A stack can satisfy more than one of the cases below at once, so check them in the order written and let the first one that applies decide the whole sweep. + In particular a stack can hold a merged bundle, an open bundle, and an abandoned one simultaneously, and the abandoned bundle wins: restacking the bundles above it would force-push a rebase onto work the user may be about to discard, which is exactly the unattended destruction that stop exists to prevent. When any bundle reports `closed-unmerged`, apply the closed-without-merging path for that bundle, name which bundles above it in the stack are now orphaned by it, and neither close the issue nor restack anything; whether to retry, rescope, or drop the orphaned work is the user's judgment call. + This case is checked first and is terminal: no later case runs after it, however many other bundles merged or stayed open. + Otherwise move the issue to `done` when every bundle reports `merged`. + Otherwise, with some bundles merged and others still open, close nothing: report the partial progress, naming which bundles merged, then run the restack check below. When the adapter declares `reviewLookup: none` the whole sweep is unavailable here as it already is for single reviews, so say so once and act on nothing. The restack check asks one forge-agnostic question: is the merged bundle's content an ancestor of each remaining stack branch? From 3130e27965ee07e646e8202e69833950028f0465 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 23:33:08 -0700 Subject: [PATCH 27/68] chore(fathom): release 2.2.0 with stacked reviews Bump plugin.json to 2.2.0 and propagate it into marketplace.json and README.md via bin/sync-versions.sh. Fix a cross-file gap found during Step 5's side-by-side reading: execute/SKILL.md step 12's final summary said "the review URL" without accounting for a stacked issue, where multiple bundle reviews exist. It now reports every bundle's review URL in order when the issue was split into a stack. --- .claude-plugin/marketplace.json | 2 +- .claude-plugin/plugin.json | 2 +- README.md | 2 +- skills/execute/SKILL.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index bc23de80..1cd4377a 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -12,7 +12,7 @@ "name": "fathom", "source": "./", "description": "Two agent skills, scaffold and execute, that carry a tracker issue from requirements to an open code review, on GitHub or any other forge with an adapter. Works with Asana or Linear, runs on Claude Code and Kiro, tracks tasks in beads or a committed markdown checklist, and resumes from repository state.", - "version": "2.1.0", + "version": "2.2.0", "author": { "name": "crod951" }, diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index 7813b6c4..83906470 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "fathom", - "version": "2.1.0", + "version": "2.2.0", "description": "Fathom provides the execute and scaffold skills for driving Asana or Linear tracker issues from requirements to an open code review, on GitHub or any other forge with an adapter. Agent-portable skills for Claude Code and Kiro with resumable, task-tracked implementation runs.", "author": { "name": "crod951", diff --git a/README.md b/README.md index a9665c47..90bb04a1 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ When the installer asks which skills to take, take all of them; `fathom-shared` ## Available Plugins -### fathom (v2.1.0) +### fathom (v2.2.0) Fathom provides two agent skills, execute and scaffold, that carry a tracker issue from requirements to an open code review, on GitHub or any other forge with an adapter. It works with Asana or Linear as your issue tracker, and both skills run unchanged on Claude Code and Kiro. diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index 150df07e..065dfa9e 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -177,7 +177,7 @@ If any of these files cannot be found and read, stop immediately and report whic Finally, post a completion comment on the issue, including the done-on-merge note from `asana.md` when the tracker is Asana, and commit and push the task-state files this run changed as a final closing commit so the branch carries the completed state, staging them by explicit path per the staging rules in `conventions.md`: the beads JSONL export and `metadata.json` when beads is the backend, and this issue's files under `.fathom/`; never sweep `.beads/` or `.fathom/` as directories, since the beads database and runtime files are intentionally ignored and must not ride into the review. Push this closing commit with an ordinary `git push` of the branch even when the adapter declares `pushesForYou`, since that capability governs only the push that opens the review, as `../fathom-shared/forges.md` states; skipping it here would leave the completed task state in the local clone while the review reads as finished. On a stacked issue this closing commit goes on branch N, the stack tip, because that branch contains every bundle's history and is the only one whose review shows the completed task state. -12. Report a final summary: the issue, the review URL when one was opened or the resolved tier when one was not, the tracker's current phase, and the task counts from `status()`. +12. Report a final summary: the issue, the review URL when one was opened, every bundle's review URL in order when the issue was split into a stack, or the resolved tier when no review was opened, the tracker's current phase, and the task counts from `status()`. ## Display overlay From 7278886a9fe7a01000c702ad400b4c14b06787ca Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 23:47:49 -0700 Subject: [PATCH 28/68] fix(fathom): suppress the merge-closer and order the split before tasks --- .../2026-08-07-fathom-stacked-reviews-design.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-design.md b/docs/plans/2026-08-07-fathom-stacked-reviews-design.md index 00e1eb10..30f860a0 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-design.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-design.md @@ -100,6 +100,13 @@ The pattern is predictable and matchable, which is what lets a resumed run find ### 6. Ordering is enforced in data +The split is decided before any task is created, not after. +The bundling proposal and its confirmation happen once the sub-issues are planned and before the `createTask` calls, so every task is created with its final deps in a single pass. + +This ordering is load-bearing rather than tidy. +`createTask` takes `deps` at creation, and the memory contract has exactly six operations with no way to add a dependency to a task that already exists. +Deciding the split after the tasks exist would leave the chain unbuildable, which would silently reinstate the out-of-order hazard this section exists to close. + When a split is confirmed, every task takes a dependency on its predecessor, so the whole issue becomes one sequential chain across bundles as well as within them. `claimNext` returns the first open task whose deps are all closed, so a single chain means it structurally cannot hand out a later bundle's task while any earlier task is still open. @@ -159,6 +166,16 @@ Earlier bundles reference the issue without a closing keyword and carry two addi Without this rule the first bundle's merge closes the issue while most of the work is still open. +That rule alone is not sufficient, because it only governs the forge's own keyword integration. +The merge-closer GitHub Action closes an issue by matching the merged branch name against records under `.fathom/`, so it never reads the keyword at all, and every bundle's branch is recorded there. +Under it, merging any bundle in any order closes the issue, and the next sweep then reads that issue as already complete and does nothing, making the early close permanent and silent. + +So a stacked issue suppresses the merge-closer entirely and leaves closure to the sweep, which already waits for every bundle to report `merged`. +The run records a marker on the issue that tells the Action to take no action for it. + +One mechanism closes a stacked issue, not two that disagree. +The cost is real and is stated at handoff: on a repository that relies on the Action for closure, a stacked issue now needs a later sweep run to reach `done`, where a single-review issue still closes on merge without one. + ### 10. Forge contract change `openReview` gains one optional fifth argument, `dependsOn`, holding the previous bundle's review id. From 4692594cb504b0d020a15ee656631df73dfd677f Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 23:53:33 -0700 Subject: [PATCH 29/68] fix(fathom): settle the split before any createTask call Reorders step 8 so the sub-issues are planned, the split decided, and the bundling proposal confirmed before any task is created, then creates every task with its final deps in one pass. Guards the bundle-shaping and proposal bullets so a single-review run never reaches them, and only explains a missing split in the manual tier when the breakdown would otherwise have crossed the threshold. --- skills/execute/SKILL.md | 26 ++++++++++++++++---------- skills/fathom-shared/memory.md | 2 +- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index 065dfa9e..99f76074 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -93,26 +93,32 @@ If any of these files cannot be found and read, stop immediately and report whic 8. Ensure the breakdown exists. - Skip the rest of this step when a breakdown already exists for this issue. - Call `init` for the issue, then call `parentTask` for it. - - When the issue has no existing children, plan three to seven units of work, each sized so it can be implemented and verified on its own; for each one, call `createSubIssue` first, then call `createTask` with the newly created sub-issue's ref as `subIssueRef`, then write the returned task id back onto that sub-issue so the link reads both ways, since the task id does not exist until `createTask` returns, setting `deps` to the id of the task it builds on so tasks chain sequentially by default whenever order matters. - - When the issue already has children, call `listSubIssues` to adopt them instead of inventing a new breakdown; for each adopted sub-issue, still call `createTask`, passing that sub-issue's existing ref as `subIssueRef` and skipping `createSubIssue` since the sub-issue already exists, then write the returned task id back onto that sub-issue the same way, and setting `deps` the same way. - - Decide whether this issue produces one review or a stack, once the child tasks exist and before any dependency edge is added. + - Establish the set of sub-issues before creating any task. + When the issue has no existing children, plan three to seven units of work, each sized so it can be implemented and verified on its own, and call `createSubIssue` for each one in order. + When the issue already has children, call `listSubIssues` to adopt them instead of inventing a new breakdown, and skip `createSubIssue` since those sub-issues already exist. + Either way the set is ordered, each unit building on the one before it, and that order is what the `deps` below and any bundle boundary follow. + - Decide whether this issue produces one review or a stack, now that the sub-issues are known and before any task is created. Read the profile's `stacking` field per `../fathom-shared/approval.md`; treat an absent field as `propose`, and stop considering a split immediately when it reads `never`. - Do not consider a split when the resolved forge tier is the manual tier, and say once that the split was not offered because the tier cannot create reviews. Otherwise propose a split only when both conditions hold: the breakdown has five or more sub-issues, and at least one valid cut point exists. A cut point is valid only where the work up to it is independently mergeable, meaning the repository builds, that bundle's tests pass, and merging it alone would not break the base branch. When no valid cut point exists, proceed as a single review and say so rather than forcing a boundary. - - Shape the bundles as contiguous runs of the sub-issue dependency chain, so bundles inherit its order rather than inventing one. + Never consider a split when the resolved forge tier is the manual tier, whatever the breakdown looks like. + Say that the split was not offered because the tier cannot create reviews only when the breakdown would otherwise have crossed the five sub-issue threshold above; below that threshold no split was available in any tier, so explaining its absence would report a decision that was never live. + - When both of those conditions hold, shape the bundles as contiguous runs of the sub-issue order established above, so bundles inherit that order rather than inventing one. Produce at most three bundles, each holding at least two sub-issues; those two limits together mean five sub-issues yield at most two bundles, and six is the smallest breakdown that can yield three. Exceed the cap only when the user asked for a specific larger split; never exceed it on the heuristic's own judgment. - - Present the proposed split before creating anything: the bundles, which sub-issues fall in each, and the resolved forge's `stackedReviews` value with what it means for this run. + - When both of those conditions hold, present the proposed split before creating any task: the bundles, which sub-issues fall in each, and the resolved forge's `stackedReviews` value with what it means for this run. This is a skip-list stop per `../fathom-shared/approval.md`, so `ask` mode waits for an answer and `auto` mode applies the split and reports it. - - When a split is confirmed, chain every task in the issue sequentially, so each task deps on its predecessor across bundle boundaries as well as within them, rather than only where order matters. + - Create the tasks once the split question is settled, in one pass over the sub-issues in order. + For each one, call `createTask` with that sub-issue's ref as `subIssueRef`, then write the returned task id back onto that sub-issue so the link reads both ways, since the task id does not exist until `createTask` returns. + Pass each task's final `deps` in that same call: `createTask` is the only operation in `../fathom-shared/memory.md` that takes `deps`, so a chain the split needs has to be built as the tasks are created rather than added to them afterwards, which is why the split is settled first. + When no split was confirmed, set `deps` to the id of the task it builds on so tasks chain sequentially by default whenever order matters, which is the single-review behavior unchanged. + When a split was confirmed, chain every task in the issue sequentially instead, so each task deps on its predecessor across bundle boundaries as well as within them, rather than only where order matters. This is what makes `claimNext` structurally unable to hand out a later bundle's task while any earlier task is open, so the implementation loop needs no bundle-ordering logic of its own. A single edge at each bundle boundary is not enough: a task carrying no deps has them trivially closed, so it stays claimable out of order and the branch chain would be built on unfinished work. - Apply full chaining only when a split is confirmed; a single-review run keeps the conditional chaining described above. - Then write the `Bundles` section of the plan document described in `conventions.md`, and commit it with the breakdown. - After every child task exists, add the parent's dependency edge on each child, so the parent cannot close before its children and "no open children" becomes a real signal rather than an assumption. - - Either way, write the plan document described in `conventions.md` and commit it with the breakdown. + - Whether the sub-issues were newly created or adopted, write the plan document described in `conventions.md` and commit it with the breakdown. + When a split was confirmed, that same document also carries the `Bundles` section recording each bundle's index, branch, and sub-issue refs, so write it now rather than when the first review opens, since it is what a resumed run reads to recover the stack. - Write `.fathom/tasks/.md` only when the resolved backend is the checklist adapter, since that file holds checkbox statuses; with beads active the statuses live in beads and no file belongs there, as `memory.md` states. 9. Call `updateState` to move the issue to the `inProgress` phase. 10. Run the implementation loop until `claimNext` reports nothing claimable. diff --git a/skills/fathom-shared/memory.md b/skills/fathom-shared/memory.md index 2e39fe0d..6a918813 100644 --- a/skills/fathom-shared/memory.md +++ b/skills/fathom-shared/memory.md @@ -11,7 +11,7 @@ Adapter files implement each one against a specific backend; treat the operation | Operation | Purpose | | --- | --- | | `init(issueRef)` | Prepare the backend for this issue's task set. | -| `createTask(title, description, subIssueRef, deps)` | Create a task, tag it with the issue ref so all tasks for one issue can be listed directly, record `subIssueRef` on the task, and return its task id. When the issue was split into a stack, every task takes a dep on its predecessor so the whole issue forms one sequential chain across bundles as well as within them, which is what lets the backend itself enforce bundle order: a later bundle's task is never claimable while any earlier task is still open. A single edge at each bundle boundary would not achieve this, because a task carrying no deps at all has them trivially closed and stays claimable out of order. | +| `createTask(title, description, subIssueRef, deps)` | Create a task, tag it with the issue ref so all tasks for one issue can be listed directly, record `subIssueRef` on the task, and return its task id. This is the only operation here that takes `deps`, so a task's dependencies are settled at creation and every task is created with its final ones in a single pass. When the issue was split into a stack, every task takes a dep on its predecessor so the whole issue forms one sequential chain across bundles as well as within them, which is what lets the backend itself enforce bundle order: a later bundle's task is never claimable while any earlier task is still open. A single edge at each bundle boundary would not achieve this, because a task carrying no deps at all has them trivially closed and stays claimable out of order. Whether the issue is split is therefore decided before the first `createTask` call, since a chain this contract cannot add afterwards has to be built as the tasks are created. | | `claimNext()` | Return and mark in-progress this issue's first open task whose deps are all closed; null when none remain. Scope every call to the issue being worked: a backend able to see other issues' tasks must filter to this one, or the loop will implement another issue's work on this branch and close the wrong sub-issue. When an interrupted run left one of this issue's tasks in progress, return that task to be resumed rather than claiming a new one. | | `close(taskId)` | Mark a task done. | | `status()` | Return this issue's open and done counts and its current in-progress task, scoped to the issue exactly as `claimNext` is. | From 5154ec37d6fb8dd87cda66e29a9cbabbd3da430f Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 23:54:44 -0700 Subject: [PATCH 30/68] fix(fathom): suppress the merge-closer for a stacked issue A stacked issue records every bundle's branch under .fathom/, so the merge-closer Action would close the whole issue on whichever bundle merged first, and the next sweep would read it as complete. A split now writes a Merge-closer: suppressed marker into the plan document, both Action templates skip an issue carrying it, and closure is left to the sweep. The cost is stated at handoff. --- skills/execute/SKILL.md | 4 ++++ skills/fathom-shared/conventions.md | 6 ++++++ skills/fathom-shared/trackers.md | 2 ++ skills/fathom-shared/trackers/asana.md | 18 ++++++++++++++++++ skills/fathom-shared/trackers/linear.md | 18 ++++++++++++++++++ 5 files changed, 48 insertions(+) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index 99f76074..bfdb31dc 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -119,6 +119,7 @@ If any of these files cannot be found and read, stop immediately and report whic - After every child task exists, add the parent's dependency edge on each child, so the parent cannot close before its children and "no open children" becomes a real signal rather than an assumption. - Whether the sub-issues were newly created or adopted, write the plan document described in `conventions.md` and commit it with the breakdown. When a split was confirmed, that same document also carries the `Bundles` section recording each bundle's index, branch, and sub-issue refs, so write it now rather than when the first review opens, since it is what a resumed run reads to recover the stack. + Write the `- Merge-closer: suppressed` line described in `conventions.md` with it, since a stacked issue records every bundle's branch and the merge-closer Action would otherwise close the whole issue on whichever bundle merged first. - Write `.fathom/tasks/.md` only when the resolved backend is the checklist adapter, since that file holds checkbox statuses; with beads active the statuses live in beads and no file belongs there, as `memory.md` states. 9. Call `updateState` to move the issue to the `inProgress` phase. 10. Run the implementation loop until `claimNext` reports nothing claimable. @@ -183,6 +184,9 @@ If any of these files cannot be found and read, stop immediately and report whic Finally, post a completion comment on the issue, including the done-on-merge note from `asana.md` when the tracker is Asana, and commit and push the task-state files this run changed as a final closing commit so the branch carries the completed state, staging them by explicit path per the staging rules in `conventions.md`: the beads JSONL export and `metadata.json` when beads is the backend, and this issue's files under `.fathom/`; never sweep `.beads/` or `.fathom/` as directories, since the beads database and runtime files are intentionally ignored and must not ride into the review. Push this closing commit with an ordinary `git push` of the branch even when the adapter declares `pushesForYou`, since that capability governs only the push that opens the review, as `../fathom-shared/forges.md` states; skipping it here would leave the completed task state in the local clone while the review reads as finished. On a stacked issue this closing commit goes on branch N, the stack tip, because that branch contains every bundle's history and is the only one whose review shows the completed task state. + Say plainly at handoff, when the issue was split, that its record carries `- Merge-closer: suppressed`, so the merge-closer Action will take no action for it however its bundles merge. + On a repository that relies on that Action for closure this is a real change: a stacked issue reaches `done` only when a later run's done-on-merge sweep sees every bundle merged, where a single-review issue still closes on merge without one. + The alternative is worse, since the Action matches branch names and every bundle records one, so the first bundle to merge would close the whole issue and the sweep would then read it as complete and never correct it. 12. Report a final summary: the issue, the review URL when one was opened, every bundle's review URL in order when the issue was split into a stack, or the resolved tier when no review was opened, the tracker's current phase, and the task counts from `status()`. ## Display overlay diff --git a/skills/fathom-shared/conventions.md b/skills/fathom-shared/conventions.md index f5d1ab88..e4448728 100644 --- a/skills/fathom-shared/conventions.md +++ b/skills/fathom-shared/conventions.md @@ -63,6 +63,12 @@ Include these sections: Add a `- Review: (bundle k/N)` line beneath a bundle once its review exists. The suffix is redundant with the nesting on purpose: the sweep reads these lines individually, and a self-describing record survives being read out of its surrounding context. This section is the durable record a resumed run reads to recover the stack, so write it when the split is confirmed rather than when the first review opens. +- **Merge-closer** - present only when this issue was split into a stack, and omitted entirely otherwise. + One line reading `- Merge-closer: suppressed`, written when the split is confirmed, alongside the `Bundles` section. + The merge-closer Action matches a merged branch against the records under `.fathom/` and knows nothing about stacks, and every bundle's branch is recorded there, so without this line the first bundle to merge closes the whole issue while most of the work is still open and unreviewed. + That close is also permanent and silent, because the next sweep reads the issue as already complete and does nothing. + The Action reads this line and takes no action for the issue, which leaves closure to the sweep, and the sweep already waits for every bundle to report merged. + One mechanism closes a stacked issue rather than two that disagree. - **Testing strategy** - which tests will prove the work, and which existing tests could regress. - **Notes** - open questions, risks, and decisions taken during the run. diff --git a/skills/fathom-shared/trackers.md b/skills/fathom-shared/trackers.md index 121072e4..42ca2fdf 100644 --- a/skills/fathom-shared/trackers.md +++ b/skills/fathom-shared/trackers.md @@ -98,6 +98,8 @@ When the resolved adapter does not implement that operation, the record cannot b When `getReviewState` returns `merged`, read the issue's current state before writing to the tracker. When the issue is already complete, for example because a merge-closer Action or a native integration already closed it, do nothing further for that issue. Otherwise apply the mapped `done` state through `updateState`, plus any closure action the adapter defines for the merged path, before proceeding with the rest of the run. +An issue whose record carries `- Merge-closer: suppressed`, which is how a stacked issue is recorded per `conventions.md`, was deliberately left for this sweep to close: the Action takes no action for it, so the sweep is its only closure mechanism and reaching `done` requires a run of this sweep. +The state read above still applies to it unchanged, since a user may have closed such an issue by hand. That state read is the whole idempotency mechanism for the merged path. An issue that is already `done` produces no write on any later run, so nothing needs to be recorded anywhere and nothing needs to be pushed. diff --git a/skills/fathom-shared/trackers/asana.md b/skills/fathom-shared/trackers/asana.md index 8d1958e5..a912e5ad 100644 --- a/skills/fathom-shared/trackers/asana.md +++ b/skills/fathom-shared/trackers/asana.md @@ -179,6 +179,24 @@ jobs: exit 1 fi + # A stacked issue records one branch per bundle, so any one bundle's + # merge reaches this Action while the rest of the work is still open. + # Such an issue records a suppression marker and is closed by fathom's + # own sweep once every bundle reports merged. Check every matching + # record rather than the one selected below: in checklist mode the + # marker lives in the plan document while the task file is preferred. + SUPPRESSED='' + for RECORD in $MATCHES; do + if grep -qE '^[[:space:]]*[-*]?[[:space:]]*(\*\*)?[Mm]erge-closer(\*\*)?[[:space:]]*[:-][[:space:]]*(\*\*)?[Ss]uppressed' "$RECORD"; then + SUPPRESSED=$RECORD + break + fi + done + if [ -n "$SUPPRESSED" ]; then + echo "$SUPPRESSED records merge-closer: suppressed, so this issue is a stack that closes only once every bundle merges. Taking no action for $BRANCH." + exit 0 + fi + # Prefer the task file when both exist; it also carries the review id. # Anchor the prefix rather than matching /tasks/ anywhere: grep -r # descends into dot-directories, so a repo left holding a nested diff --git a/skills/fathom-shared/trackers/linear.md b/skills/fathom-shared/trackers/linear.md index 7d46359b..3402a0df 100644 --- a/skills/fathom-shared/trackers/linear.md +++ b/skills/fathom-shared/trackers/linear.md @@ -168,6 +168,24 @@ jobs: exit 1 fi + # A stacked issue records one branch per bundle, so any one bundle's + # merge reaches this Action while the rest of the work is still open. + # Such an issue records a suppression marker and is closed by fathom's + # own sweep once every bundle reports merged. Check every matching + # record rather than the one selected below: in checklist mode the + # marker lives in the plan document while the task file is preferred. + SUPPRESSED='' + for RECORD in $MATCHES; do + if grep -qE '^[[:space:]]*[-*]?[[:space:]]*(\*\*)?[Mm]erge-closer(\*\*)?[[:space:]]*[:-][[:space:]]*(\*\*)?[Ss]uppressed' "$RECORD"; then + SUPPRESSED=$RECORD + break + fi + done + if [ -n "$SUPPRESSED" ]; then + echo "$SUPPRESSED records merge-closer: suppressed, so this issue is a stack that closes only once every bundle merges. Taking no action for $BRANCH." + exit 0 + fi + # Prefer the task file when both exist; it also carries the review id. # Anchor the prefix rather than matching /tasks/ anywhere: grep -r # descends into dot-directories, so a repo left holding a nested From 41a2f603781ceff847b7210b31cf045c3a773dd2 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 23:55:28 -0700 Subject: [PATCH 31/68] fix(fathom): recover the stack before a resumed run implements Step 8's skip line bypassed every stack bullet, so a resumed run continued on bundle 1's branch and would have landed bundle 2's commits in a review that was already published. Step 7 now reads the plan document's Bundles section first, identifies the in-progress bundle as the first with no recorded review, and continues on that bundle's branch. Bundle branch creation gets the same already-exists guard bundle 1 has. --- skills/execute/SKILL.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index bfdb31dc..f145995b 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -90,8 +90,17 @@ If any of these files cannot be found and read, stop immediately and report whic These rules describe bundle 1's branch, which is the only branch a single-review run has. When step 8 confirms a stack, later bundles take the same name with their index appended, so bundle 2 of `feat/ONC-5-add-webhooks` is `feat/ONC-5-add-webhooks-2`. Create each of those from the previous bundle's branch at the moment that bundle starts, not up front: creating them all at breakdown time would leave empty branches behind whenever a run stops early. + Give every one of them the same already-exists guard bundle 1 has: check out a bundle branch that already exists rather than creating it, and create it only when it is genuinely absent, since creating a branch name that already carries that bundle's commits either fails outright or resets the branch and discards them. + + Before deciding which branch this run continues on, read this issue's plan document when one already exists, since a resumed run recovers the stack from durable state and never from memory of an earlier run. + When that document carries a `Bundles` section, this issue was already split: recover every bundle's index, branch, sub-issue refs, and recorded review id from it, and carry that recovered stack through the rest of this run, including step 10's loop and step 11's per-bundle routine. + The bundle in progress is the first one with no recorded review, because a bundle's review is recorded as its last task closes; continue on that bundle's branch rather than on bundle 1's. + Continuing on bundle 1's branch instead would land a later bundle's commits in a review that is already open and published, which is the failure this recovery exists to prevent. + Fall back to bundle 1's branch only when no plan document exists yet, which is a first run rather than a resumed one. 8. Ensure the breakdown exists. - - Skip the rest of this step when a breakdown already exists for this issue. + - Skip the rest of this step when a breakdown already exists for this issue, and let the stack recovered in step 7 govern the rest of this run. + Every decision below is made once, at breakdown time, so a resumed run reads the split, the bundles, and their branches out of the plan document instead of deciding any of them again. + Reaching this step without having recovered them is the defect: go back to step 7 and recover them before implementing anything. - Call `init` for the issue, then call `parentTask` for it. - Establish the set of sub-issues before creating any task. When the issue has no existing children, plan three to seven units of work, each sized so it can be implemented and verified on its own, and call `createSubIssue` for each one in order. @@ -136,7 +145,7 @@ If any of these files cannot be found and read, stop immediately and report whic - Close the task in the memory backend and move its sub-issue to `done`, again per the adapter's sub-issue rules, recording the close as it happens rather than summarizing at the end of the loop. A task is not closed until both its memory record and its sub-issue are closed; closing only the sub-issue leaves it claimable and `claimNext` will hand you the same task again. - Print the per-task progress line from `conventions.md`. - - When this issue was split into a stack and the closed task was the last one in its bundle, run the per-bundle finish routine in step 11 for that bundle before claiming again, then, when a later bundle remains, create the next bundle's branch from this one and continue the loop on it. + - When this issue was split into a stack and the closed task was the last one in its bundle, run the per-bundle finish routine in step 11 for that bundle before claiming again, then, when a later bundle remains, move onto the next bundle's branch under the already-exists guard in step 7, creating it from this one only when it is absent and checking it out when it is not, and continue the loop on it. Do not wait until the loop drains to open any review: building each bundle on the correct branch from the start is what avoids having to cherry-pick commit ranges onto a chain of branches afterwards. - On a failure that cannot be fixed, stop and hold: keep the change, leave the task in progress, report the failure, and exit without continuing the loop. On a stacked issue, also name which bundles already have open reviews and which were never built, since some of the work is already in front of reviewers and the user needs to know which part held. From afb6b4091908cf7fa6f7feb3bf63cfa7476c9d18 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 23:56:32 -0700 Subject: [PATCH 32/68] fix(fathom): sweep every recorded review, in one documented order trackers.md still described a single getReviewState call and applied done on a merged result, which closed a stacked issue on bundle 1 and contradicted the multi-review sweep in execute. Its mechanics now read every recorded review and apply four ordered cases, with the abandoned case first and terminal and a case for a stack that is still entirely open. The reviewLookup: none gate moves ahead of those cases in execute, and the profile format block gains the stacking line. --- skills/execute/SKILL.md | 3 ++- skills/fathom-shared/trackers.md | 28 ++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index f145995b..5d9a5646 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -60,6 +60,7 @@ If any of these files cannot be found and read, stop immediately and report whic Treat any claim about a review's fate as a cleanup phrase, whether it says merged, closed, abandoned, landed, or shipped, and whether it names an issue or asks to clean up whatever is outstanding. Never act on the claim itself: confirm each referenced review's real state through `getReviewState` first, then apply the merged path or the closed-without-merging path accordingly, and say plainly when the confirmed state differs from what the user described. When the resolved forge declares `reviewLookup: none`, the claim cannot be confirmed at all. Say that plainly and act on nothing; do not close an issue on the strength of an unverifiable claim, since a wrong close is exactly what the confirmation step exists to prevent. + When the adapter declares `reviewLookup: none` the whole sweep is unavailable, exactly as it already is for single reviews, so say so once and act on nothing; this is checked before the cases below because it decides whether `getReviewState` can be called at all. An issue split into a stack has one recorded review per bundle rather than one in total, so call `getReviewState` on every recorded id before deciding anything about the issue. A stack can satisfy more than one of the cases below at once, so check them in the order written and let the first one that applies decide the whole sweep. In particular a stack can hold a merged bundle, an open bundle, and an abandoned one simultaneously, and the abandoned bundle wins: restacking the bundles above it would force-push a rebase onto work the user may be about to discard, which is exactly the unattended destruction that stop exists to prevent. @@ -67,7 +68,7 @@ If any of these files cannot be found and read, stop immediately and report whic This case is checked first and is terminal: no later case runs after it, however many other bundles merged or stayed open. Otherwise move the issue to `done` when every bundle reports `merged`. Otherwise, with some bundles merged and others still open, close nothing: report the partial progress, naming which bundles merged, then run the restack check below. - When the adapter declares `reviewLookup: none` the whole sweep is unavailable here as it already is for single reviews, so say so once and act on nothing. + Otherwise every bundle is still open with none merged and none abandoned, so the stack is simply still in review: say that, close nothing, and restack nothing, since no merge has moved any base. The restack check asks one forge-agnostic question: is the merged bundle's content an ancestor of each remaining stack branch? Rebase a remaining branch onto its updated base only when the answer is no, and leave it alone when the answer is yes. diff --git a/skills/fathom-shared/trackers.md b/skills/fathom-shared/trackers.md index 42ca2fdf..91590178 100644 --- a/skills/fathom-shared/trackers.md +++ b/skills/fathom-shared/trackers.md @@ -87,7 +87,9 @@ When it declares `none`, there is no way to observe what happened to a review, s Find the outstanding issues by searching `.fathom/` for recorded reviews. Search the whole directory rather than only `tasks/`: depending on the resolved memory backend the per-issue record may be a plan document under `plans/` with no checklist file at all, and narrowing the search to `tasks/` silently skips those issues. -For each issue the search finds, call `getReviewState` once with that issue's recorded review id and act on what it returns. +For each issue the search finds, read every review id recorded for it and call `getReviewState` on each one before deciding anything about that issue. +A single-review issue records one id; an issue split into a stack records one per bundle, in the plan document's `Bundles` section described in `conventions.md`. +Read the records rather than assuming a count: acting on the first id found would decide a stacked issue's fate from one bundle's result while the rest of its work was still open, which is the early close the `Merge-closer: suppressed` marker exists to prevent. Look each id up directly; never list a forge's reviews and match them locally. A listing has to be bounded, and any bound silently drops the oldest records once a repository has more reviews than the bound allows, which is a defect that grows quietly with the repository's age. @@ -95,7 +97,25 @@ Records written before review ids were recorded carry a branch name and no id. For those, fall back to the optional `findReviewByBranch` operation defined in `forges.md`, and rewrite the record with the id once one is known, so the fallback path drains over time rather than becoming permanent. When the resolved adapter does not implement that operation, the record cannot be swept: report that once, naming the record, rather than guessing or treating a branch name as a review id. -When `getReviewState` returns `merged`, read the issue's current state before writing to the tracker. +Judge each issue on all of its results together, in the order below, letting the first case that applies decide that issue. +An issue can satisfy more than one case at once, and a stack holding a merged bundle, an open bundle, and an abandoned one routinely does. + +1. Any recorded review reports `closed-unmerged`. + Apply the closed-without-merging path below for that review, and, when the issue is a stack, name which bundles above it are now orphaned by it. + Close nothing for that issue, and do not read its merged reviews as progress toward closure. + This case is checked first and is terminal, however many of the issue's other reviews merged or stayed open, because whether to retry, rescope, or drop the orphaned work is the user's decision and nothing should be built on top of work that may be about to be discarded. +2. Every recorded review reports `merged`. + Apply the merged path below. + For a single-review issue that is its one review, and for a stack it is every bundle, which is what keeps a stack from being closed by its first merge. +3. Some reviews merged and others still open. + Close nothing, and report the partial progress, naming which bundles merged. +4. None merged and none closed without merging. + The work is still entirely in review, so close nothing and say so plainly rather than reporting nothing at all. + +Cases 3 and 4 leave the issue's phase exactly where it is. +The branches a partially merged stack leaves behind may still need restacking, but that is git and forge work rather than tracker work, so it belongs to the skill running the sweep; this section decides only what is written to the tracker. + +On the merged path, read the issue's current state before writing to the tracker. When the issue is already complete, for example because a merge-closer Action or a native integration already closed it, do nothing further for that issue. Otherwise apply the mapped `done` state through `updateState`, plus any closure action the adapter defines for the merged path, before proceeding with the rest of the run. An issue whose record carries `- Merge-closer: suppressed`, which is how a stacked issue is recorded per `conventions.md`, was deliberately left for this sweep to close: the Action takes no action for it, so the sweep is its only closure mechanism and reaching `done` requires a run of this sweep. @@ -220,6 +240,7 @@ forge: github # a bundled adapter name, "local" for .fathom/forge.md, o default-destination: Prototypes (1209000000000001) # add "# auto-accepted" when auto mode chose it base-branch: main approval: ask +stacking: propose # or "never" to keep this repository on one review per issue; absent means propose merge-closer: native # "none (forge has no hooks)" when the forge declares no ciHooks state-mapping: inProgress: section "In Progress" @@ -227,6 +248,9 @@ state-mapping: done: section "Done" + completed ``` +The `stacking` line is optional and is not one of the six setup questions above, so first-run setup neither asks for it nor writes it. +Write it only when the user asks for a repository-wide answer, and treat its absence as `propose` exactly as `approval.md` states. + On every subsequent run, read the existing profile silently and use it without re-prompting. Re-run setup when a mapped state no longer exists in the tracker, or when the user explicitly asks to redo it. Re-run setup to resolve merge conflicts in `.fathom/config.md`; do not attempt to hand-merge the conflicting mapping. From 8ee9a06372f842a676839840b443bc9b0aa0afd7 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 23:57:05 -0700 Subject: [PATCH 33/68] fix(fathom): close the parent task on a stacked issue too The parent-task close and the leftover-change commit sat only in the single-review path, which a stacked issue skips entirely, so a stack left its parent task open. Bundle N now closes the parent once, and each bundle routine commits its own leftovers before pushing. Also resolves the plan document's status-versus-structure contradiction and states the manual closure consequence when the tier drops mid-stack. --- skills/execute/SKILL.md | 7 ++++++- skills/fathom-shared/conventions.md | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index 5d9a5646..ca5648df 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -54,6 +54,7 @@ If any of these files cannot be found and read, stop immediately and report whic Stop here, following that section's instructions, when the tracker's MCP does not verify. A forge that does not verify is not a stop: it selects a capability tier per `../fathom-shared/forges.md`. State the resolved tier before continuing, so the user knows up front whether this run will end in an opened review or a manual handoff. When a resumed run resolves the manual tier on an issue whose earlier bundles already have open reviews, leave those reviews alone and hand the remaining bundles off manually, saying that the tier changed between runs so the stack is now half automated and half manual. + Say with it that no later run will move this issue to `done` on its own, because the manual tier cannot observe what happened to a review, so closing the issue is now a manual step. 2. Run the done-on-merge sweep for the resolved tracker; the mechanics are described in `../fathom-shared/trackers.md` and are tracker-agnostic, with each adapter file defining only its own closure action for the merged path. This sweep is itself tracker work, so it only runs once preflight has verified the MCP. When the invocation itself was a cleanup phrase, run only this sweep, report what it found, then stop; do not continue into the rest of this procedure. @@ -181,6 +182,8 @@ If any of these files cannot be found and read, stop immediately and report whic When this issue was split into a stack, the review-opening portion above is a per-bundle routine rather than a single closing action, and step 10 invokes it once per bundle as that bundle's last task closes. For bundle k of N: - Reconcile bundle k's closed tasks against the commits on its branch, over that bundle's own range, per the per-bundle rule in `conventions.md`; stop and do not open this bundle's review when they disagree. + - Commit any leftover uncommitted change that belongs to this bundle's tasks, leaving unrelated working-tree edits alone rather than sweeping them into the review, exactly as the single-review path does before it opens its one review. + A change left uncommitted here is absent from bundle k's review and lands in bundle k+1's instead, which is worse than the single-review case rather than merely equivalent to it. - Call `resolveBase` on bundle 1's base, which is the resolved base branch, or on branch k-1 for every later bundle. - Push branch k, unless the adapter declares `pushesForYou`, exactly as the single-review path does. - Call `openReview` with branch k, that base, a title naming the bundle, and a body built per the stack rules in `conventions.md`: the closing reference only in bundle N, plus `Part k of N`, plus `Depends on` the previous bundle's review URL for every bundle after the first. @@ -189,7 +192,9 @@ If any of these files cannot be found and read, stop immediately and report whic - Record `- Review: (bundle k/N)` beneath that bundle's line in the plan document's `Bundles` section, since the sweep looks reviews up by id and needs every one of them. - Apply `inReview` when bundle 1's review publishes, and never again for the later bundles; the issue is genuinely in review from that moment and re-applying a phase it already holds reports progress that did not happen. Skip a bundle whose review already exists and reuse it, the same way the single-review path does, so a resumed run never opens a second review for a bundle that has one. - After bundle N's routine completes, skip the single-review path above entirely and continue into the closing actions below, which run once for the issue rather than once per bundle. + After bundle N's routine completes, close the parent task in the memory backend (a no-op for the checklist adapter, whose file is the parent record), which is the one action the single-review path takes that no bundle routine has taken yet. + Then skip the single-review path above entirely and continue into the closing actions below, which run once for the issue rather than once per bundle. + The parent task is closed exactly once either way: the single-review path closes it before opening its review, and a stacked issue closes it here, after the last bundle's review and before the issue's completion comment. Finally, post a completion comment on the issue, including the done-on-merge note from `asana.md` when the tracker is Asana, and commit and push the task-state files this run changed as a final closing commit so the branch carries the completed state, staging them by explicit path per the staging rules in `conventions.md`: the beads JSONL export and `metadata.json` when beads is the backend, and this issue's files under `.fathom/`; never sweep `.beads/` or `.fathom/` as directories, since the beads database and runtime files are intentionally ignored and must not ride into the review. Push this closing commit with an ordinary `git push` of the branch even when the adapter declares `pushesForYou`, since that capability governs only the push that opens the review, as `../fathom-shared/forges.md` states; skipping it here would leave the completed task state in the local clone while the review reads as finished. diff --git a/skills/fathom-shared/conventions.md b/skills/fathom-shared/conventions.md index e4448728..de57edc8 100644 --- a/skills/fathom-shared/conventions.md +++ b/skills/fathom-shared/conventions.md @@ -44,7 +44,9 @@ Name the task in the body so the commit ties back to task memory. ## The plan document During breakdown, write a human-readable plan for the issue at `.fathom/plans/.md`, and commit it with the breakdown. -This document is a reference artifact for people, never resume state; task status always lives in the resolved memory backend. +This document is a reference artifact for people, and it never carries task status; status always lives in the resolved memory backend, so nothing here is ever consulted to learn what is done. +It does carry structure, which is a different thing: the branch, the review ids, and the bundles of a stacked issue are recorded here, and a resumed run reads them back rather than remembering them from a previous invocation. +`memory.md` draws the same line, and it is what keeps this from being dual truth: structure is decided once and does not change as the work proceeds, while status changes with every task and lives in exactly one place. Include these sections: From d23b4e84f61530219bda760dfee432a73b7adbd8 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Fri, 7 Aug 2026 23:59:08 -0700 Subject: [PATCH 34/68] fix(fathom): decide the branch before step 7 creates one The stack recovery sat below step 7's creation rules, so an agent reading the step in order would create or check out bundle 1's branch before ever reaching it. The recovery now runs first and the creation mechanics follow the branch it names. --- skills/execute/SKILL.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index ca5648df..97ba9d96 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -61,7 +61,8 @@ If any of these files cannot be found and read, stop immediately and report whic Treat any claim about a review's fate as a cleanup phrase, whether it says merged, closed, abandoned, landed, or shipped, and whether it names an issue or asks to clean up whatever is outstanding. Never act on the claim itself: confirm each referenced review's real state through `getReviewState` first, then apply the merged path or the closed-without-merging path accordingly, and say plainly when the confirmed state differs from what the user described. When the resolved forge declares `reviewLookup: none`, the claim cannot be confirmed at all. Say that plainly and act on nothing; do not close an issue on the strength of an unverifiable claim, since a wrong close is exactly what the confirmation step exists to prevent. - When the adapter declares `reviewLookup: none` the whole sweep is unavailable, exactly as it already is for single reviews, so say so once and act on nothing; this is checked before the cases below because it decides whether `getReviewState` can be called at all. + That same `reviewLookup: none` declaration makes the whole sweep unavailable, exactly as it already is for single reviews, so say so once and act on nothing. + Check it before the cases below rather than after them, since it decides whether `getReviewState` can be called at all. An issue split into a stack has one recorded review per bundle rather than one in total, so call `getReviewState` on every recorded id before deciding anything about the issue. A stack can satisfy more than one of the cases below at once, so check them in the order written and let the first one that applies decide the whole sweep. In particular a stack can hold a merged bundle, an open bundle, and an abandoned one simultaneously, and the abandoned bundle wins: restacking the bundles above it would force-push a rebase onto work the user may be about to discard, which is exactly the unattended destruction that stop exists to prevent. @@ -85,7 +86,14 @@ If any of these files cannot be found and read, stop immediately and report whic 5. Call `getIssue` for that ref and save its title, description, type, URL, and existing children for the rest of this run. When the issue is already in the `done` phase or marked complete, do not start work: say so, report what the sweep found for it, and ask whether to reopen it or pick a different issue. 6. Search the codebase and read the files that look relevant to this issue, noting existing patterns to follow during implementation. -7. Ensure a feature branch exists for this issue; when one must be created, prefix its name from the issue type (`feat/` for a feature, `fix/` for a bug, `chore/` for a chore, `docs/` for docs, `feat/` by default) followed by the issue ref and a short title slug; skip creation when a matching branch already exists. +7. Ensure the branch this run implements on exists, and continue on that one branch until step 10 says to move to the next bundle. + Decide which branch that is before creating anything: read this issue's plan document when one already exists, since a resumed run recovers the stack from durable state and never from memory of an earlier run. + When that document carries a `Bundles` section, this issue was already split: recover every bundle's index, branch, sub-issue refs, and recorded review id from it, and carry that recovered stack through the rest of this run, including step 10's loop and step 11's per-bundle routine. + The bundle in progress is the first one with no recorded review, because a bundle's review is recorded as its last task closes, so this run continues on that bundle's branch rather than on bundle 1's. + Continuing on bundle 1's branch instead would land a later bundle's commits in a review that is already open and published, which is the failure this recovery exists to prevent. + The branch is bundle 1's whenever no plan document exists yet, which is a first run rather than a resumed one, and whenever the plan document carries no `Bundles` section, which is a single-review issue. + + Name a branch that must be created from the issue type (`feat/` for a feature, `fix/` for a bug, `chore/` for a chore, `docs/` for docs, `feat/` by default) followed by the issue ref and a short title slug; skip creation when a matching branch already exists. Resolve the base branch per the base-branch rules in `../fathom-shared/forges.md`, then fetch it and create the new branch from the fetched remote copy rather than from a local copy that may be behind, since branching from a stale local copy is the usual cause of conflicts at merge time. When the branch already exists and the base branch has moved on since, bring it up to date before implementing, and report that you did. When that update conflicts, stop and hold exactly as an unfixable test failure would: keep the work, leave the task in progress, report which files conflict, and let the user decide how to resolve them; never resolve a conflict by discarding either side's changes. @@ -93,12 +101,6 @@ If any of these files cannot be found and read, stop immediately and report whic When step 8 confirms a stack, later bundles take the same name with their index appended, so bundle 2 of `feat/ONC-5-add-webhooks` is `feat/ONC-5-add-webhooks-2`. Create each of those from the previous bundle's branch at the moment that bundle starts, not up front: creating them all at breakdown time would leave empty branches behind whenever a run stops early. Give every one of them the same already-exists guard bundle 1 has: check out a bundle branch that already exists rather than creating it, and create it only when it is genuinely absent, since creating a branch name that already carries that bundle's commits either fails outright or resets the branch and discards them. - - Before deciding which branch this run continues on, read this issue's plan document when one already exists, since a resumed run recovers the stack from durable state and never from memory of an earlier run. - When that document carries a `Bundles` section, this issue was already split: recover every bundle's index, branch, sub-issue refs, and recorded review id from it, and carry that recovered stack through the rest of this run, including step 10's loop and step 11's per-bundle routine. - The bundle in progress is the first one with no recorded review, because a bundle's review is recorded as its last task closes; continue on that bundle's branch rather than on bundle 1's. - Continuing on bundle 1's branch instead would land a later bundle's commits in a review that is already open and published, which is the failure this recovery exists to prevent. - Fall back to bundle 1's branch only when no plan document exists yet, which is a first run rather than a resumed one. 8. Ensure the breakdown exists. - Skip the rest of this step when a breakdown already exists for this issue, and let the stack recovered in step 7 govern the rest of this run. Every decision below is made once, at breakdown time, so a resumed run reads the split, the bundles, and their branches out of the plan document instead of deciding any of them again. From adade93389d46bf744b142273af641aaea037f4a Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 00:21:21 -0700 Subject: [PATCH 35/68] fix(fathom): decide the split before any tracker write Both split conditions are properties of the planned units rather than of tracker refs, so the decision and its proposal stop now run before the first createSubIssue. A no-split run creates one sub-issue and its task at a time, exactly as the pre-feature file did, and an abandoned proposal leaves no sub-issue on the tracker and no task in memory. The confirmed-split path creates in whatever order the bundle refs need, and still passes every task's final deps to createTask in one pass. Scopes the resume sentence to an issue that actually has a stack record, and moves the manual-tier guard above the condition it governs. --- skills/execute/SKILL.md | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index 97ba9d96..3d89e949 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -102,31 +102,35 @@ If any of these files cannot be found and read, stop immediately and report whic Create each of those from the previous bundle's branch at the moment that bundle starts, not up front: creating them all at breakdown time would leave empty branches behind whenever a run stops early. Give every one of them the same already-exists guard bundle 1 has: check out a bundle branch that already exists rather than creating it, and create it only when it is genuinely absent, since creating a branch name that already carries that bundle's commits either fails outright or resets the branch and discards them. 8. Ensure the breakdown exists. - - Skip the rest of this step when a breakdown already exists for this issue, and let the stack recovered in step 7 govern the rest of this run. + - Skip the rest of this step when a breakdown already exists for this issue. Every decision below is made once, at breakdown time, so a resumed run reads the split, the bundles, and their branches out of the plan document instead of deciding any of them again. - Reaching this step without having recovered them is the defect: go back to step 7 and recover them before implementing anything. + When that plan document carries a `Bundles` section, the stack step 7 recovered from it governs the rest of this run, and arriving here with such a section on disk but no recovered stack is the defect: go back to step 7 and recover it before implementing anything. + A resumed single-review issue has no `Bundles` section and so has nothing to recover; step 7 has already put it on its one branch. - Call `init` for the issue, then call `parentTask` for it. - - Establish the set of sub-issues before creating any task. - When the issue has no existing children, plan three to seven units of work, each sized so it can be implemented and verified on its own, and call `createSubIssue` for each one in order. - When the issue already has children, call `listSubIssues` to adopt them instead of inventing a new breakdown, and skip `createSubIssue` since those sub-issues already exist. - Either way the set is ordered, each unit building on the one before it, and that order is what the `deps` below and any bundle boundary follow. - - Decide whether this issue produces one review or a stack, now that the sub-issues are known and before any task is created. + - Plan the units of work before writing anything to the tracker. + When the issue has no existing children, plan three to seven units of work, each sized so it can be implemented and verified on its own, and hold that plan rather than creating anything from it yet. + When the issue already has children, call `listSubIssues` to adopt them instead of inventing a new breakdown, which reads the tracker without writing to it. + Either way the units are ordered, each building on the one before it, and that order is what the `deps` below and any bundle boundary follow. + - Decide whether this issue produces one review or a stack, from those planned units and before anything is written to the tracker. + Never consider a split when the resolved forge tier is the manual tier, whatever the breakdown looks like, since that tier cannot create a review at all. Read the profile's `stacking` field per `../fathom-shared/approval.md`; treat an absent field as `propose`, and stop considering a split immediately when it reads `never`. - Otherwise propose a split only when both conditions hold: the breakdown has five or more sub-issues, and at least one valid cut point exists. + Otherwise propose a split only when both conditions hold: the breakdown has five or more units of work, and at least one valid cut point exists. A cut point is valid only where the work up to it is independently mergeable, meaning the repository builds, that bundle's tests pass, and merging it alone would not break the base branch. When no valid cut point exists, proceed as a single review and say so rather than forcing a boundary. - Never consider a split when the resolved forge tier is the manual tier, whatever the breakdown looks like. - Say that the split was not offered because the tier cannot create reviews only when the breakdown would otherwise have crossed the five sub-issue threshold above; below that threshold no split was available in any tier, so explaining its absence would report a decision that was never live. - - When both of those conditions hold, shape the bundles as contiguous runs of the sub-issue order established above, so bundles inherit that order rather than inventing one. - Produce at most three bundles, each holding at least two sub-issues; those two limits together mean five sub-issues yield at most two bundles, and six is the smallest breakdown that can yield three. + Both conditions are properties of the planned units rather than of anything on the tracker: the count comes from the plan, and a cut point's validity is a property of the work itself, which is what lets this whole decision run before a single sub-issue exists. + When the manual-tier guard above fired, say the split was not offered because the tier cannot create reviews only if the breakdown would otherwise have crossed the five-unit threshold; below that threshold no split was available in any tier, so explaining its absence would report a decision that was never live. + - When both of those conditions hold, shape the bundles as contiguous runs of the planned order established above, so bundles inherit that order rather than inventing one. + Produce at most three bundles, each holding at least two units; those two limits together mean five units yield at most two bundles, and six is the smallest breakdown that can yield three. Exceed the cap only when the user asked for a specific larger split; never exceed it on the heuristic's own judgment. - - When both of those conditions hold, present the proposed split before creating any task: the bundles, which sub-issues fall in each, and the resolved forge's `stackedReviews` value with what it means for this run. + - When both of those conditions hold, present the proposed split before anything is written to the tracker: the bundles, which units fall in each, and the resolved forge's `stackedReviews` value with what it means for this run. This is a skip-list stop per `../fathom-shared/approval.md`, so `ask` mode waits for an answer and `auto` mode applies the split and reports it. - - Create the tasks once the split question is settled, in one pass over the sub-issues in order. - For each one, call `createTask` with that sub-issue's ref as `subIssueRef`, then write the returned task id back onto that sub-issue so the link reads both ways, since the task id does not exist until `createTask` returns. - Pass each task's final `deps` in that same call: `createTask` is the only operation in `../fathom-shared/memory.md` that takes `deps`, so a chain the split needs has to be built as the tasks are created rather than added to them afterwards, which is why the split is settled first. - When no split was confirmed, set `deps` to the id of the task it builds on so tasks chain sequentially by default whenever order matters, which is the single-review behavior unchanged. - When a split was confirmed, chain every task in the issue sequentially instead, so each task deps on its predecessor across bundle boundaries as well as within them, rather than only where order matters. + Placing it ahead of every write is what makes it safe to abandon: a user who walks away from the question, or declines outright, leaves no sub-issue on the tracker and no task in memory, so there is nothing half-built to reconcile. + - Create the sub-issues and their tasks once the split question is settled, passing each task's final `deps` to `createTask` itself, since that is the only operation in `../fathom-shared/memory.md` that takes `deps` and a chain cannot be added to tasks that already exist. + When no split was confirmed and the issue has no existing children, for each planned unit call `createSubIssue` first, then call `createTask` with the newly created sub-issue's ref as `subIssueRef`, then write the returned task id back onto that sub-issue so the link reads both ways, since the task id does not exist until `createTask` returns, setting `deps` to the id of the task it builds on so tasks chain sequentially by default whenever order matters. + When no split was confirmed and the issue already had children, for each adopted sub-issue still call `createTask`, passing that sub-issue's existing ref as `subIssueRef` and skipping `createSubIssue` since the sub-issue already exists, then write the returned task id back onto that sub-issue the same way, and setting `deps` the same way. + Those two are the single-review behavior exactly as it has always run, one sub-issue and its task at a time, so nothing watching the tracker sees a different sequence than before. + When a split was confirmed, create the sub-issues and tasks in whatever order the bundle records require, since a bundle names its sub-issues by ref and those refs must exist before the `Bundles` section can be written; this path is new behavior with no earlier sequence to preserve. + Chain every task in the issue sequentially on that path, so each task deps on its predecessor across bundle boundaries as well as within them, rather than only where order matters. This is what makes `claimNext` structurally unable to hand out a later bundle's task while any earlier task is open, so the implementation loop needs no bundle-ordering logic of its own. A single edge at each bundle boundary is not enough: a task carrying no deps has them trivially closed, so it stays claimable out of order and the branch chain would be built on unfinished work. - After every child task exists, add the parent's dependency edge on each child, so the parent cannot close before its children and "no open children" becomes a real signal rather than an assumption. From 120b189760fa8bff210dac5c284ef323e9ee2d36 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 00:22:12 -0700 Subject: [PATCH 36/68] fix(fathom): quote the suppression-marker scan in both templates The unquoted for loop word-split and glob-expanded each record path, so a record named with a space or a bracket made grep read a nonexistent path, the marker be missed, and the Action close a stacked issue on one bundle's merge. Reads the list through printf and a quoted read, matching the rest of the discovery block. Verified against a path containing both a space and a bracket: the old loop misses the marker, the new one finds it. --- skills/fathom-shared/trackers/asana.md | 12 ++++++++---- skills/fathom-shared/trackers/linear.md | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/skills/fathom-shared/trackers/asana.md b/skills/fathom-shared/trackers/asana.md index a912e5ad..189c020c 100644 --- a/skills/fathom-shared/trackers/asana.md +++ b/skills/fathom-shared/trackers/asana.md @@ -185,13 +185,17 @@ jobs: # own sweep once every bundle reports merged. Check every matching # record rather than the one selected below: in checklist mode the # marker lives in the plan document while the task file is preferred. - SUPPRESSED='' - for RECORD in $MATCHES; do + # Read the list the same way everything above does, through + # printf and a quoted read: an unquoted for loop word-splits and + # glob-expands the path, so one record named with a space or a + # bracket would silently fail the grep and close a stacked issue. + SUPPRESSED=$(printf '%s\n' "$MATCHES" | while IFS= read -r RECORD; do + [ -n "$RECORD" ] || continue if grep -qE '^[[:space:]]*[-*]?[[:space:]]*(\*\*)?[Mm]erge-closer(\*\*)?[[:space:]]*[:-][[:space:]]*(\*\*)?[Ss]uppressed' "$RECORD"; then - SUPPRESSED=$RECORD + printf '%s\n' "$RECORD" break fi - done + done) || true if [ -n "$SUPPRESSED" ]; then echo "$SUPPRESSED records merge-closer: suppressed, so this issue is a stack that closes only once every bundle merges. Taking no action for $BRANCH." exit 0 diff --git a/skills/fathom-shared/trackers/linear.md b/skills/fathom-shared/trackers/linear.md index 3402a0df..abd78645 100644 --- a/skills/fathom-shared/trackers/linear.md +++ b/skills/fathom-shared/trackers/linear.md @@ -174,13 +174,17 @@ jobs: # own sweep once every bundle reports merged. Check every matching # record rather than the one selected below: in checklist mode the # marker lives in the plan document while the task file is preferred. - SUPPRESSED='' - for RECORD in $MATCHES; do + # Read the list the same way everything above does, through + # printf and a quoted read: an unquoted for loop word-splits and + # glob-expands the path, so one record named with a space or a + # bracket would silently fail the grep and close a stacked issue. + SUPPRESSED=$(printf '%s\n' "$MATCHES" | while IFS= read -r RECORD; do + [ -n "$RECORD" ] || continue if grep -qE '^[[:space:]]*[-*]?[[:space:]]*(\*\*)?[Mm]erge-closer(\*\*)?[[:space:]]*[:-][[:space:]]*(\*\*)?[Ss]uppressed' "$RECORD"; then - SUPPRESSED=$RECORD + printf '%s\n' "$RECORD" break fi - done + done) || true if [ -n "$SUPPRESSED" ]; then echo "$SUPPRESSED records merge-closer: suppressed, so this issue is a stack that closes only once every bundle merges. Taking no action for $BRANCH." exit 0 From b5933796c320382303f0417d2f59987ca2cab4c8 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 00:23:18 -0700 Subject: [PATCH 37/68] fix(fathom): move init and parentTask below the proposal stop They were the only writes still sitting above the stop, so abandoning the proposal left a parent task in memory and, on the checklist adapter, a task file on disk. Nothing between the plan and that point reads either one, and the single-review write order is unchanged: init, parentTask, then one sub-issue and its task at a time. --- skills/execute/SKILL.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index 3d89e949..483d2579 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -106,8 +106,7 @@ If any of these files cannot be found and read, stop immediately and report whic Every decision below is made once, at breakdown time, so a resumed run reads the split, the bundles, and their branches out of the plan document instead of deciding any of them again. When that plan document carries a `Bundles` section, the stack step 7 recovered from it governs the rest of this run, and arriving here with such a section on disk but no recovered stack is the defect: go back to step 7 and recover it before implementing anything. A resumed single-review issue has no `Bundles` section and so has nothing to recover; step 7 has already put it on its one branch. - - Call `init` for the issue, then call `parentTask` for it. - - Plan the units of work before writing anything to the tracker. + - Plan the units of work before writing anything to the tracker or the memory backend. When the issue has no existing children, plan three to seven units of work, each sized so it can be implemented and verified on its own, and hold that plan rather than creating anything from it yet. When the issue already has children, call `listSubIssues` to adopt them instead of inventing a new breakdown, which reads the tracker without writing to it. Either way the units are ordered, each building on the one before it, and that order is what the `deps` below and any bundle boundary follow. @@ -124,8 +123,10 @@ If any of these files cannot be found and read, stop immediately and report whic Exceed the cap only when the user asked for a specific larger split; never exceed it on the heuristic's own judgment. - When both of those conditions hold, present the proposed split before anything is written to the tracker: the bundles, which units fall in each, and the resolved forge's `stackedReviews` value with what it means for this run. This is a skip-list stop per `../fathom-shared/approval.md`, so `ask` mode waits for an answer and `auto` mode applies the split and reports it. - Placing it ahead of every write is what makes it safe to abandon: a user who walks away from the question, or declines outright, leaves no sub-issue on the tracker and no task in memory, so there is nothing half-built to reconcile. - - Create the sub-issues and their tasks once the split question is settled, passing each task's final `deps` to `createTask` itself, since that is the only operation in `../fathom-shared/memory.md` that takes `deps` and a chain cannot be added to tasks that already exist. + Placing it ahead of every write is what makes it safe to abandon: a user who walks away from the question, or declines outright, leaves no sub-issue on the tracker, no task in memory, and no task file on disk, so there is nothing half-built to reconcile. + - Call `init` for the issue, then call `parentTask` for it, once the split question is settled. + These are the first writes this step makes, which is why they sit below the proposal stop rather than above it; nothing between the plan and this point reads either of them. + - Create the sub-issues and their tasks next, passing each task's final `deps` to `createTask` itself, since that is the only operation in `../fathom-shared/memory.md` that takes `deps` and a chain cannot be added to tasks that already exist. When no split was confirmed and the issue has no existing children, for each planned unit call `createSubIssue` first, then call `createTask` with the newly created sub-issue's ref as `subIssueRef`, then write the returned task id back onto that sub-issue so the link reads both ways, since the task id does not exist until `createTask` returns, setting `deps` to the id of the task it builds on so tasks chain sequentially by default whenever order matters. When no split was confirmed and the issue already had children, for each adopted sub-issue still call `createTask`, passing that sub-issue's existing ref as `subIssueRef` and skipping `createSubIssue` since the sub-issue already exists, then write the returned task id back onto that sub-issue the same way, and setting `deps` the same way. Those two are the single-review behavior exactly as it has always run, one sub-issue and its task at a time, so nothing watching the tracker sees a different sequence than before. From e7249e16d855900d0bcfaa769516a3d2a6657b31 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 01:44:31 -0700 Subject: [PATCH 38/68] fix(fathom): default absent stacking field to never --- docs/plans/2026-08-07-fathom-stacked-reviews-design.md | 8 ++++++-- skills/execute/SKILL.md | 2 +- skills/fathom-shared/approval.md | 8 ++++++-- skills/fathom-shared/trackers.md | 5 +++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-design.md b/docs/plans/2026-08-07-fathom-stacked-reviews-design.md index 30f860a0..9d1ddcac 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-design.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-design.md @@ -22,7 +22,7 @@ On a `none` forge there is no forge-level stacking at all, but chaining the bran ## Goals Let one issue produce a short stack of dependent reviews when the work is large enough to warrant it. -Keep the existing single-review behavior as the default for every repository, forge, and issue that does not opt in. +Keep the existing single-review behavior as the default for every repository, forge, and issue that does not opt in, where opting in means writing `stacking: propose` into the repository's profile. Make the split a decision the user can see, override, and pin, rather than something the agent does silently. ## Non-goals @@ -85,9 +85,13 @@ In `ask` mode the run waits for an answer; in `auto` mode it applies the split a `.fathom/config.md` gains `stacking`, with two values. -`propose` is the default and means the agent may propose a split, with the approval mode deciding whether that is a question or a report. +`propose` means the agent may propose a split, with the approval mode deciding whether that is a question or a report. `never` makes single-review behavior permanent for the repository, in the same spirit as `forge: none`. +`never` is the default, so an absent field means the repository never splits an issue and a repository opts in by writing `stacking: propose`. +A `propose` default would silently change behavior for every existing repository, most sharply for one running `approval: auto`, where the split is applied and reported rather than asked about, so its next large issue would arrive as a stack without anyone having asked for stacking. +An opt-in feature must not do that, which is what makes `never` the only default consistent with the goal above of preserving single-review behavior for every repository that does not opt in. + The field has two values rather than three on purpose. An `ask` or `auto` value here would duplicate the `approval` field two lines above it in the same file, and two fields that can disagree about the same question is a defect waiting to be filed. diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index 483d2579..806f45a5 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -112,7 +112,7 @@ If any of these files cannot be found and read, stop immediately and report whic Either way the units are ordered, each building on the one before it, and that order is what the `deps` below and any bundle boundary follow. - Decide whether this issue produces one review or a stack, from those planned units and before anything is written to the tracker. Never consider a split when the resolved forge tier is the manual tier, whatever the breakdown looks like, since that tier cannot create a review at all. - Read the profile's `stacking` field per `../fathom-shared/approval.md`; treat an absent field as `propose`, and stop considering a split immediately when it reads `never`. + Read the profile's `stacking` field per `../fathom-shared/approval.md`; treat an absent field as `never`, and stop considering a split immediately when it reads `never`, whether it was written or absent. Otherwise propose a split only when both conditions hold: the breakdown has five or more units of work, and at least one valid cut point exists. A cut point is valid only where the work up to it is independently mergeable, meaning the repository builds, that bundle's tests pass, and merging it alone would not break the base branch. When no valid cut point exists, proceed as a single review and say so rather than forcing a boundary. diff --git a/skills/fathom-shared/approval.md b/skills/fathom-shared/approval.md index 3c4c32b6..89f5b4b3 100644 --- a/skills/fathom-shared/approval.md +++ b/skills/fathom-shared/approval.md @@ -35,7 +35,7 @@ Skipping them changes how much the run interrupts you, not whether it is correct - The bundle-split proposal in `execute`. Apply the proposed split and report the bundles rather than asking for confirmation first. This belongs here rather than on the safety list because it fires before any branch, commit, or review exists, so a wrong answer costs nothing and is corrected by re-running with `stacking: never` or a different instruction. - It is skipped only when the profile's `stacking` field permits a split at all; `stacking: never` suppresses the split itself, in both modes, rather than suppressing the question. + It is skipped only when the profile's `stacking` field permits a split at all; `stacking: never`, and an absent field which means the same thing, suppress the split itself, in both modes, rather than suppressing the question. ## What auto mode never skips @@ -80,11 +80,15 @@ Editing that field changes it permanently; an invocation phrase changes it for o When one skill hands off to the other, carry the resolved mode across so a per-run override is not lost at the boundary; say which mode the handed-off run is using. A second field, `stacking`, sits alongside `approval` and answers a different question: whether `execute` may split one issue into a stack of dependent reviews at all. -It holds `propose` or `never`, and it defaults to `propose` when the field is absent. +It holds `propose` or `never`, and it defaults to `never` when the field is absent. `propose` means the agent may propose a split when the breakdown crosses the threshold in `execute`, with the `approval` field above deciding whether that proposal is a question or a report. `never` means this repository always produces one review per issue, in both approval modes, in the same permanent way that `forge: none` makes the manual tier permanent. +The default is `never` because stacking is opt-in, and a default of `propose` would not be. +An existing repository running in `auto` mode has a profile written before this field existed and has never asked for stacking, yet under a `propose` default its next large issue would be split into a stack and reported rather than asked about, changing that repository's behavior without anyone opting in. +A repository gets stacking only by writing `stacking: propose` into its profile, so every repository that has not written it keeps producing exactly one review per issue. + The field deliberately has two values rather than three. An `ask` or `auto` value here would restate the `approval` field recorded a few lines above it in the same profile, and two fields that can disagree about the same question will eventually disagree. diff --git a/skills/fathom-shared/trackers.md b/skills/fathom-shared/trackers.md index 91590178..363a9f75 100644 --- a/skills/fathom-shared/trackers.md +++ b/skills/fathom-shared/trackers.md @@ -240,7 +240,7 @@ forge: github # a bundled adapter name, "local" for .fathom/forge.md, o default-destination: Prototypes (1209000000000001) # add "# auto-accepted" when auto mode chose it base-branch: main approval: ask -stacking: propose # or "never" to keep this repository on one review per issue; absent means propose +stacking: propose # write this to let the repository split an issue into a stack; "never" or absent keeps it on one review per issue merge-closer: native # "none (forge has no hooks)" when the forge declares no ciHooks state-mapping: inProgress: section "In Progress" @@ -249,7 +249,8 @@ state-mapping: ``` The `stacking` line is optional and is not one of the six setup questions above, so first-run setup neither asks for it nor writes it. -Write it only when the user asks for a repository-wide answer, and treat its absence as `propose` exactly as `approval.md` states. +Write it only when the user asks for a repository-wide answer, and treat its absence as `never` exactly as `approval.md` states. +Leaving it out of setup therefore means a freshly set up repository produces one review per issue and never proposes a split, which is the opt-in behavior stacking is meant to have; a repository that wants stacking adds the line itself. On every subsequent run, read the existing profile silently and use it without re-prompting. Re-run setup when a mapped state no longer exists in the tracker, or when the user explicitly asks to redo it. From 4a128714856643bf3c625385ec276d5a60275b37 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 01:45:27 -0700 Subject: [PATCH 39/68] fix(fathom): handle an unknown review state in the sweep --- skills/execute/SKILL.md | 5 ++++- skills/fathom-shared/trackers.md | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index 806f45a5..c1fb93fa 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -68,9 +68,12 @@ If any of these files cannot be found and read, stop immediately and report whic In particular a stack can hold a merged bundle, an open bundle, and an abandoned one simultaneously, and the abandoned bundle wins: restacking the bundles above it would force-push a rebase onto work the user may be about to discard, which is exactly the unattended destruction that stop exists to prevent. When any bundle reports `closed-unmerged`, apply the closed-without-merging path for that bundle, name which bundles above it in the stack are now orphaned by it, and neither close the issue nor restack anything; whether to retry, rescope, or drop the orphaned work is the user's judgment call. This case is checked first and is terminal: no later case runs after it, however many other bundles merged or stayed open. + Otherwise, when any bundle reports `unknown`, change nothing about the issue and leave it for a later sweep: name the review ids that came back `unknown`, close nothing, restack nothing, and report no progress for the issue. + `unknown` means the sweep did not learn that review's fate, not that the review is open or merged, so calling it any of those states is a claim about work that was never observed. + This case sits below the `closed-unmerged` case, which closes nothing and restacks nothing whatever the undetermined bundles turn out to be, and above the three cases below, each of which judges the whole stack on all of its bundles at once and cannot do that with an undetermined bundle among them. Otherwise move the issue to `done` when every bundle reports `merged`. Otherwise, with some bundles merged and others still open, close nothing: report the partial progress, naming which bundles merged, then run the restack check below. - Otherwise every bundle is still open with none merged and none abandoned, so the stack is simply still in review: say that, close nothing, and restack nothing, since no merge has moved any base. + Otherwise every bundle is still open, with none merged, none abandoned, and none undetermined, so the stack is simply still in review: say that, close nothing, and restack nothing, since no merge has moved any base. The restack check asks one forge-agnostic question: is the merged bundle's content an ancestor of each remaining stack branch? Rebase a remaining branch onto its updated base only when the answer is no, and leave it alone when the answer is yes. diff --git a/skills/fathom-shared/trackers.md b/skills/fathom-shared/trackers.md index 363a9f75..5845ea3a 100644 --- a/skills/fathom-shared/trackers.md +++ b/skills/fathom-shared/trackers.md @@ -104,15 +104,23 @@ An issue can satisfy more than one case at once, and a stack holding a merged bu Apply the closed-without-merging path below for that review, and, when the issue is a stack, name which bundles above it are now orphaned by it. Close nothing for that issue, and do not read its merged reviews as progress toward closure. This case is checked first and is terminal, however many of the issue's other reviews merged or stayed open, because whether to retry, rescope, or drop the orphaned work is the user's decision and nothing should be built on top of work that may be about to be discarded. -2. Every recorded review reports `merged`. +2. Any recorded review reports `unknown`, and none reported `closed-unmerged`. + `getReviewState` returns `unknown` when it could not determine the review's fate, which is not a state the review is in but an answer the sweep did not get. + Change nothing about the issue: close nothing, report nothing about its progress, and leave it exactly as it stands for a later sweep to decide. + Name the review ids that came back `unknown`, and say that this issue was left undecided because of them. + Never fold an `unknown` result into `merged`, `open`, or "still entirely in review": each of those is a specific claim about work the sweep cannot actually see, and the later cases would otherwise absorb it and make that claim anyway. + This case sits below case 1 because a `closed-unmerged` result is a fact the sweep did observe, and its outcome does not depend on the undetermined ones: it closes nothing, restacks nothing, and hands the decision to the user, which is already the safest thing an undetermined result could ask for. + It sits above every case below because those judge the issue on all of its results at once, and an undetermined result cannot carry its share of such a judgment. +3. Every recorded review reports `merged`. Apply the merged path below. For a single-review issue that is its one review, and for a stack it is every bundle, which is what keeps a stack from being closed by its first merge. -3. Some reviews merged and others still open. +4. Some reviews merged and others still open. Close nothing, and report the partial progress, naming which bundles merged. -4. None merged and none closed without merging. +5. None merged and none closed without merging. The work is still entirely in review, so close nothing and say so plainly rather than reporting nothing at all. + Every result reaching this case is `open`, since an `unknown` one was already decided by case 2. -Cases 3 and 4 leave the issue's phase exactly where it is. +Cases 2, 4, and 5 leave the issue's phase exactly where it is. The branches a partially merged stack leaves behind may still need restacking, but that is git and forge work rather than tracker work, so it belongs to the skill running the sweep; this section decides only what is written to the tracker. On the merged path, read the issue's current state before writing to the tracker. From c6b77f185fa0cd71d57e7ef114111b092fc93ead Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 01:46:16 -0700 Subject: [PATCH 40/68] fix(fathom): commit each bundle review id as it is recorded --- skills/execute/SKILL.md | 4 ++++ skills/fathom-shared/conventions.md | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index c1fb93fa..1840f1fe 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -200,6 +200,10 @@ If any of these files cannot be found and read, stop immediately and report whic Pass the previous bundle's review id as `dependsOn` for every bundle after the first, and omit it for bundle 1. - Call `publishReview` with the returned id. - Record `- Review: (bundle k/N)` beneath that bundle's line in the plan document's `Bundles` section, since the sweep looks reviews up by id and needs every one of them. + - Commit and push that recorded line immediately, on branch k, before moving to bundle k+1's branch or doing anything else. + Stage only the plan document, by explicit path, per the staging rules in `conventions.md`, and word it as bookkeeping rather than as a task: `chore(): record bundle k review id`, naming no task in the body. + `conventions.md` excludes plan document and bookkeeping commits from task and commit reconciliation, and a commit shaped this way is one of them, so it cannot be miscounted as the commit that implemented a task. + Waiting for the run's final closing commit instead would leave bundle 1's review id uncommitted through bundles 2 and 3, where a sweep run from another clone cannot see it and an interrupted run leaves it on one machine's disk only. - Apply `inReview` when bundle 1's review publishes, and never again for the later bundles; the issue is genuinely in review from that moment and re-applying a phase it already holds reports progress that did not happen. Skip a bundle whose review already exists and reuse it, the same way the single-review path does, so a resumed run never opens a second review for a bundle that has one. After bundle N's routine completes, close the parent task in the memory backend (a no-op for the checklist adapter, whose file is the parent record), which is the one action the single-review path takes that no bundle routine has taken yet. diff --git a/skills/fathom-shared/conventions.md b/skills/fathom-shared/conventions.md index de57edc8..c7eb2268 100644 --- a/skills/fathom-shared/conventions.md +++ b/skills/fathom-shared/conventions.md @@ -64,6 +64,7 @@ Include these sections: One line per bundle, in stack order, each reading `- Bundle /: - `. Add a `- Review: (bundle k/N)` line beneath a bundle once its review exists. The suffix is redundant with the nesting on purpose: the sweep reads these lines individually, and a self-describing record survives being read out of its surrounding context. + Each of those lines is committed and pushed as soon as it is written rather than riding the run's final closing commit, so that every review id is durable and visible from another clone the moment its review is published; `execute` describes exactly where in its per-bundle routine that happens. This section is the durable record a resumed run reads to recover the stack, so write it when the split is confirmed rather than when the first review opens. - **Merge-closer** - present only when this issue was split into a stack, and omitted entirely otherwise. One line reading `- Merge-closer: suppressed`, written when the split is confirmed, alongside the `Bundles` section. @@ -89,7 +90,8 @@ Recording a real hash is impossible when no commit was made, so this converts a A progress line describes repository state, so never name a commit that does not exist in the log. Reconcile before finishing. -A task commit is one whose subject is scoped to this issue's ref and which implements a task; the breakdown commit, the plan document commit, and any task-state bookkeeping commit are not task commits. +A task commit is one whose subject is scoped to this issue's ref and which implements a task; the breakdown commit, every plan document commit including the per-bundle one that records a bundle's review id, and any task-state bookkeeping commit are not task commits. +Those bookkeeping commits are recognizable rather than a matter of judgment: each is typed `chore`, touches only records under `.fathom/`, and names no task, so none of them can be counted as the commit that implemented one. Count them over the range from the resolved base branch to the current head, not over all history, since a branch inherits its base's commits. Compare that count to the number of tasks closed for this issue. Check the recorded hashes as well: every hash recorded at close must name a commit inside that same range, and each closed task's hash must be distinct, which catches a mismatch that subject-line counting can misclassify. From a0c2f3eed172b3d6fa6abb0a2b974c9a39e53816 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 01:48:08 -0700 Subject: [PATCH 41/68] fix(fathom): resume a stacked run whose finalization was cut short --- skills/execute/SKILL.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index 1840f1fe..613f2261 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -94,6 +94,8 @@ If any of these files cannot be found and read, stop immediately and report whic When that document carries a `Bundles` section, this issue was already split: recover every bundle's index, branch, sub-issue refs, and recorded review id from it, and carry that recovered stack through the rest of this run, including step 10's loop and step 11's per-bundle routine. The bundle in progress is the first one with no recorded review, because a bundle's review is recorded as its last task closes, so this run continues on that bundle's branch rather than on bundle 1's. Continuing on bundle 1's branch instead would land a later bundle's commits in a review that is already open and published, which is the failure this recovery exists to prevent. + When every bundle already carries a recorded review, no bundle is in progress and the branch is bundle N's, the stack tip: every bundle's work is committed and reviewed, so all that can remain is the issue-level finalization, which step 11 puts on the tip branch anyway. + Do not create another branch and do not go back to an earlier bundle's branch in that case; this run is finishing the stack rather than building it. The branch is bundle 1's whenever no plan document exists yet, which is a first run rather than a resumed one, and whenever the plan document carries no `Bundles` section, which is a single-review issue. Name a branch that must be created from the issue type (`feat/` for a feature, `fix/` for a bug, `chore/` for a chore, `docs/` for docs, `feat/` by default) followed by the issue ref and a short title slug; skip creation when a matching branch already exists. @@ -144,6 +146,11 @@ If any of these files cannot be found and read, stop immediately and report whic - Write `.fathom/tasks/.md` only when the resolved backend is the checklist adapter, since that file holds checkbox statuses; with beads active the statuses live in beads and no file belongs there, as `memory.md` states. 9. Call `updateState` to move the issue to the `inProgress` phase. 10. Run the implementation loop until `claimNext` reports nothing claimable. + Before the first pass, when this issue was split into a stack, check the bundle step 7 recovered: when every task in that bundle is already closed and it still carries no recorded review, its per-bundle finish routine was interrupted, so run that routine from step 11 for that bundle now, and then, when a later bundle remains, move onto its branch under the already-exists guard in step 7, exactly as the end of a pass would. + Decide that from the durable record rather than from what is claimable: the closed tasks live in the memory backend and the recorded reviews live in the plan document, and both outlive the run that was interrupted. + Claiming without this check would hand out the next bundle's first task, since an interrupted routine leaves this bundle's tasks all closed while the next bundle's are still open, and that task would then be implemented on this bundle's branch and land in the wrong review. + A run interrupted later still, after every bundle's routine finished but before the issue's closing actions did, leaves nothing claimable at all and so makes no pass here; step 11 recovers that one. + Each pass through the loop does the following, in order. - Call `claimNext`, and record the claim in the memory backend's own format at claim time. - Move the claimed task's linked sub-issue to the `inProgress` phase, subject to the adapter's own rules for sub-issues; the Asana adapter degrades this to a no-op on subtasks, so read its subtask section rather than assuming a state change happens. @@ -168,9 +175,18 @@ If any of these files cannot be found and read, stop immediately and report whic A single-review issue follows the single-review path immediately below, then the closing actions at the end of this step. A stacked issue skips that path entirely and goes straight to the closing actions, because step 10 already opened every one of its reviews through the per-bundle routine further down. Running the single-review path on a stacked issue would reconcile the whole issue against a single bundle's commit range, write a second review record in a format the sweep does not read, and move the issue to `inReview` a second time. - A stacked issue also never enters this step on its own: step 10 invokes the per-bundle routine directly, and bundle N's routine runs the closing actions once as it finishes. + A stacked issue also never enters this step on its own on a run that completes: step 10 invokes the per-bundle routine directly, and bundle N's routine runs the closing actions once as it finishes. So when the loop afterwards drains and `claimNext` returns none, this step has already completed for that issue, and nothing in it runs a second time. + A run that was interrupted is the one exception, and recovering it is the only reason a stacked issue ever arrives here with nothing claimable. + Every task can be closed while the finalization that follows the last one is unfinished, and in that state nothing is claimable precisely when there is most left to do, so decide what remains from the durable record instead: the plan document's `Bundles` section says which bundles carry a recorded review, the memory backend says whether the parent task is still open, the tracker says the issue's phase and whether the completion comment is already on it, and branch N says whether the final closing commit exists and is pushed. + Then do only what that record shows is missing, and skip whatever it shows is already done, which is what makes arriving here twice produce the same result as arriving once. + Never call `openReview` for a bundle that already carries a recorded review; reuse it, exactly as the per-bundle routine's own guard says. + A bundle whose tasks are all closed and whose review is missing is recovered in step 10 rather than here, before any claiming, so by the time this step runs every bundle has its review. + Close the parent task only when the backend shows it open, apply `inReview` only when the tracker shows the issue in an earlier phase, post the completion comment only when `listComments` shows the issue does not already carry one, and make and push the final closing commit only when branch N does not already carry the completed task state. + When the resolved tracker cannot list comments, post the comment and say that it may be a duplicate, since a second completion comment is a cosmetic cost and a missing one loses the handoff entirely. + When the record shows all of that already done, say so and change nothing, since the previous run finished the issue and only the report was lost. + The single-review path, for an issue that was not split into a stack: Run the commit reconciliation from `conventions.md` and stop if the task and commit counts disagree. From 0ec76fd0ec76b89d2f055347ac392929c8f927c9 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 01:49:36 -0700 Subject: [PATCH 42/68] docs(fathom): align the plan with the never default --- docs/plans/2026-08-07-fathom-stacked-reviews-plan.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md index e2a1a339..9877c414 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md @@ -591,7 +591,7 @@ In the same file, insert these bullets into step 8, directly after the bullet be ```markdown - Decide whether this issue produces one review or a stack, once the child tasks exist and before any dependency edge is added. - Read the profile's `stacking` field per `../fathom-shared/approval.md`; treat an absent field as `propose`, and stop considering a split immediately when it reads `never`. + Read the profile's `stacking` field per `../fathom-shared/approval.md`; treat an absent field as `never`, and stop considering a split immediately when it reads `never`. Do not consider a split when the resolved forge tier is the manual tier, and say once that the split was not offered because the tier cannot create reviews. Otherwise propose a split only when both conditions hold: the breakdown has five or more sub-issues, and at least one valid cut point exists. A cut point is valid only where the work up to it is independently mergeable, meaning the repository builds, that bundle's tests pass, and merging it alone would not break the base branch. From c7ff6dd936bc91fa1a6617b0b3d7db5099f4a005 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 01:49:57 -0700 Subject: [PATCH 43/68] docs(fathom): fix the last stale stacking default in the plan --- docs/plans/2026-08-07-fathom-stacked-reviews-plan.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md index 9877c414..b3596e38 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md @@ -348,7 +348,7 @@ In the same file, in the `Recording it` section, append these lines after the pa ```markdown A second field, `stacking`, sits alongside `approval` and answers a different question: whether `execute` may split one issue into a stack of dependent reviews at all. -It holds `propose` or `never`, and it defaults to `propose` when the field is absent. +It holds `propose` or `never`, and an absent field means `never`, so a repository opts into stacking by writing `stacking: propose`. `propose` means the agent may propose a split when the breakdown crosses the threshold in `execute`, with the `approval` field above deciding whether that proposal is a question or a report. `never` means this repository always produces one review per issue, in both approval modes, in the same permanent way that `forge: none` makes the manual tier permanent. From 916a0da88411978ebc68388d989aded5d0851338 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 02:10:24 -0700 Subject: [PATCH 44/68] fix(fathom): make the cut-point criterion decidable at plan time --- .../2026-08-07-fathom-stacked-reviews-design.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-design.md b/docs/plans/2026-08-07-fathom-stacked-reviews-design.md index 9d1ddcac..2bd94068 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-design.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-design.md @@ -44,10 +44,18 @@ A bundle is a contiguous run of the sub-issue dependency chain that `execute/SKI Bundles inherit the chain's ordering rather than inventing an ordering of their own. Each bundle maps to one branch and one review. -A bundle boundary may fall only at a point where the work up to that point is independently mergeable. -That means the repository builds, that bundle's tests pass, and merging the bundle alone would not break the base branch. +A bundle boundary may fall only where the planned units up to that point form a self-contained change: the units after the boundary build on the units before it and not the reverse, and the earlier units together deliver something that stands on its own rather than half of one thing. When no such point exists there is no valid split, and the run proceeds as a single review. +This criterion is deliberately about the plan rather than about the repository. +The decision happens at breakdown time, before any of the work is written, so the agent cannot build the repository at a candidate boundary or run that bundle's tests: neither exists yet. +An earlier version of this design asked for exactly that, and it was undecidable at the only moment it could be applied. + +So the agent is predicting reviewability, not verifying it, and two things catch a wrong prediction. +The confirmation stop shows the proposed boundaries to the user before anything is built, which is the cheap correction. +The per-bundle finish routine then reconciles and runs that bundle's tests for real, and its existing stop-and-hold fires when they fail, which is the expensive one. +A boundary that looked self-contained in the plan and turns out not to be is therefore caught before its review opens, rather than silently shipped. + ### 2. When a split is proposed Both conditions must hold before the agent proposes a split at all: @@ -75,7 +83,8 @@ The stop fires at step 8, after the breakdown exists and before any branch is cr It shows the proposed bundles, which sub-issues fall in each, and the resolved forge's stacking behavior. It goes on the skip list in `approval.md`, not the never-skip list. -It fires before any branch, commit, or review exists, so being wrong costs nothing and is trivially corrected. +It fires before any commit or review exists, so being wrong costs nothing and is trivially corrected. +Bundle 1's branch does exist by then, because step 7 creates it before step 8 runs, but that branch is the one a single-review run needs anyway, so declining the split wastes nothing and leaves nothing to clean up. That is the shape of every existing skip-list item, and unlike every never-skip item it destroys nothing and misdirects nothing. In `ask` mode the run waits for an answer; in `auto` mode it applies the split and reports it. From 865827087758cd4dcd1871098d97ed0f01f416fd Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 02:13:56 -0700 Subject: [PATCH 45/68] fix(fathom): make the skill's cut-point criterion plan-decidable --- skills/execute/SKILL.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index 613f2261..df1f6786 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -119,7 +119,12 @@ If any of these files cannot be found and read, stop immediately and report whic Never consider a split when the resolved forge tier is the manual tier, whatever the breakdown looks like, since that tier cannot create a review at all. Read the profile's `stacking` field per `../fathom-shared/approval.md`; treat an absent field as `never`, and stop considering a split immediately when it reads `never`, whether it was written or absent. Otherwise propose a split only when both conditions hold: the breakdown has five or more units of work, and at least one valid cut point exists. - A cut point is valid only where the work up to it is independently mergeable, meaning the repository builds, that bundle's tests pass, and merging it alone would not break the base branch. + A cut point is valid only where the planned units up to it form a self-contained change: the units after it build on the units before it and not the reverse, and the earlier units together deliver something that stands on its own rather than half of one thing. + Judge that from the plan alone, because the plan is all there is to judge from at this moment: the decision is made at breakdown time, before any of the work is written, so there is no build to run and no tests to pass at a candidate boundary. + This is therefore a prediction about reviewability rather than a verified property of the repository, and two later steps catch a wrong prediction. + The confirmation stop below shows the proposed boundaries to the user before anything is built, which is the cheap correction. + The per-bundle finish routine in step 11 then reconciles that bundle and runs its tests for real, and its stop-and-hold fires when either disagrees, which is the expensive one. + A boundary that looked self-contained in the plan and turns out not to be is caught before that bundle's review opens rather than after it ships. When no valid cut point exists, proceed as a single review and say so rather than forcing a boundary. Both conditions are properties of the planned units rather than of anything on the tracker: the count comes from the plan, and a cut point's validity is a property of the work itself, which is what lets this whole decision run before a single sub-issue exists. When the manual-tier guard above fired, say the split was not offered because the tier cannot create reviews only if the breakdown would otherwise have crossed the five-unit threshold; below that threshold no split was available in any tier, so explaining its absence would report a decision that was never live. From fc1b8972fc1fbf4d3b7798e6dc06378c4e2c5b00 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 02:14:33 -0700 Subject: [PATCH 46/68] fix(fathom): make every bundle review record visible to the sweep --- skills/execute/SKILL.md | 5 ++++- skills/fathom-shared/conventions.md | 5 +++++ skills/fathom-shared/trackers.md | 10 ++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index df1f6786..a13c7f70 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -63,7 +63,10 @@ If any of these files cannot be found and read, stop immediately and report whic When the resolved forge declares `reviewLookup: none`, the claim cannot be confirmed at all. Say that plainly and act on nothing; do not close an issue on the strength of an unverifiable claim, since a wrong close is exactly what the confirmation step exists to prevent. That same `reviewLookup: none` declaration makes the whole sweep unavailable, exactly as it already is for single reviews, so say so once and act on nothing. Check it before the cases below rather than after them, since it decides whether `getReviewState` can be called at all. - An issue split into a stack has one recorded review per bundle rather than one in total, so call `getReviewState` on every recorded id before deciding anything about the issue. + An issue split into a stack has one recorded review per bundle rather than one in total, so collect every bundle's record first, then call `getReviewState` on every id collected before deciding anything about the issue. + Those records are not all reachable from the checkout this sweep runs in: each bundle's `- Review:` line is committed on that bundle's own branch, so a sweep running from the base branch checkout sees the records of the bundles that have merged and none of the records above them. + Collect the rest by fetching, per the collection rule in `../fathom-shared/trackers.md`: read the branch names from the plan document's `Bundles` section, fetch each of those branches, and read each fetched branch's own copy of the plan document for that bundle's `- Review:` line. + This is read-only git work that writes nothing, which is why the ids stay in the plan document rather than being mirrored into a second store the base branch could read directly; one record of a fact cannot disagree with itself. A stack can satisfy more than one of the cases below at once, so check them in the order written and let the first one that applies decide the whole sweep. In particular a stack can hold a merged bundle, an open bundle, and an abandoned one simultaneously, and the abandoned bundle wins: restacking the bundles above it would force-push a rebase onto work the user may be about to discard, which is exactly the unattended destruction that stop exists to prevent. When any bundle reports `closed-unmerged`, apply the closed-without-merging path for that bundle, name which bundles above it in the stack are now orphaned by it, and neither close the issue nor restack anything; whether to retry, rescope, or drop the orphaned work is the user's judgment call. diff --git a/skills/fathom-shared/conventions.md b/skills/fathom-shared/conventions.md index c7eb2268..51a62abf 100644 --- a/skills/fathom-shared/conventions.md +++ b/skills/fathom-shared/conventions.md @@ -65,6 +65,11 @@ Include these sections: Add a `- Review: (bundle k/N)` line beneath a bundle once its review exists. The suffix is redundant with the nesting on purpose: the sweep reads these lines individually, and a self-describing record survives being read out of its surrounding context. Each of those lines is committed and pushed as soon as it is written rather than riding the run's final closing commit, so that every review id is durable and visible from another clone the moment its review is published; `execute` describes exactly where in its per-bundle routine that happens. + Each one lands on its own bundle's branch, though, because that is the branch the run is on when it writes the line. + So a checkout of the base branch carries the records of the bundles that have already merged into it and none of the records above them, and reading only what that checkout holds would judge a three-bundle stack on one bundle's record. + The branch name on each `- Bundle` line is what makes the rest reachable: the done-on-merge sweep fetches every branch named in this section and reads that branch's own copy of this document to collect the `- Review:` lines it cannot see locally, as `trackers.md` describes. + Those branch names are therefore load-bearing for the sweep as well as for a resumed run, and a bundle line without one leaves that bundle's record unreachable. + Collecting the records this way is what keeps them in one place: the alternative is mirroring every review id into a second store that the sweep can read directly, and two records of the same fact can disagree, while a fetch is read-only git work that needs no write anywhere. This section is the durable record a resumed run reads to recover the stack, so write it when the split is confirmed rather than when the first review opens. - **Merge-closer** - present only when this issue was split into a stack, and omitted entirely otherwise. One line reading `- Merge-closer: suppressed`, written when the split is confirmed, alongside the `Bundles` section. diff --git a/skills/fathom-shared/trackers.md b/skills/fathom-shared/trackers.md index 5845ea3a..29f65f7c 100644 --- a/skills/fathom-shared/trackers.md +++ b/skills/fathom-shared/trackers.md @@ -90,6 +90,16 @@ Search the whole directory rather than only `tasks/`: depending on the resolved For each issue the search finds, read every review id recorded for it and call `getReviewState` on each one before deciding anything about that issue. A single-review issue records one id; an issue split into a stack records one per bundle, in the plan document's `Bundles` section described in `conventions.md`. Read the records rather than assuming a count: acting on the first id found would decide a stacked issue's fate from one bundle's result while the rest of its work was still open, which is the early close the `Merge-closer: suppressed` marker exists to prevent. +A stack's records are spread across its bundle branches rather than gathered in one place. +Each bundle's `- Review:` line is committed on that bundle's own branch as that bundle's review publishes, so a checkout of the base branch carries the records of the bundles that have merged into it and none of the records above them. +Collect the missing ones before judging anything: read the branch names from the plan document's `Bundles` section, fetch each of those branches, and read each fetched branch's own copy of the plan document for that bundle's `- Review:` line. +A bundle branch is created from the branch below it, so the highest one that still exists carries every record beneath it, and fetching all of them costs nothing beyond that. +Prefer this to mirroring the ids into a store the base branch can read directly, such as a tracker comment or a second file: fetching is read-only git work that needs no write anywhere and cannot drift, whereas a second record of the same fact is a second thing that can disagree with the plan document. +When a bundle's branch is absent from the remote and its record is not on the current branch either, that bundle simply has no record, and case 2 below decides what happens then. + +An issue none of whose bundles have merged has no record on the base branch at all, since the plan document itself is committed on bundle 1's branch, so from a base checkout that issue is not found by the search above. +That is exactly how an unmerged single-review issue behaves, and it is correct: nothing has merged, so there is nothing to close. + Look each id up directly; never list a forge's reviews and match them locally. A listing has to be bounded, and any bound silently drops the oldest records once a repository has more reviews than the bound allows, which is a defect that grows quietly with the repository's age. From 156f3db49fe7cce7eb7f96712956eb3c1ac1c991 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 02:14:51 -0700 Subject: [PATCH 47/68] fix(fathom): backfill a reused bundle review into the plan record --- skills/execute/SKILL.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index a13c7f70..e522d7f0 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -229,7 +229,13 @@ If any of these files cannot be found and read, stop immediately and report whic `conventions.md` excludes plan document and bookkeeping commits from task and commit reconciliation, and a commit shaped this way is one of them, so it cannot be miscounted as the commit that implemented a task. Waiting for the run's final closing commit instead would leave bundle 1's review id uncommitted through bundles 2 and 3, where a sweep run from another clone cannot see it and an interrupted run leaves it on one machine's disk only. - Apply `inReview` when bundle 1's review publishes, and never again for the later bundles; the issue is genuinely in review from that moment and re-applying a phase it already holds reports progress that did not happen. - Skip a bundle whose review already exists and reuse it, the same way the single-review path does, so a resumed run never opens a second review for a bundle that has one. + Skip the `openReview` call for a bundle whose review already exists and reuse that review, the same way the single-review path does, so a resumed run never opens a second review for a bundle that has one. + Reusing a review does not skip the two recording steps above it, and this is where a resumed run otherwise loses a bundle. + Read that bundle's entry in the `Bundles` section, and when it carries no `- Review:` line, backfill one now from the existing review's own id and URL, in the same `- Review: (bundle k/N)` form, then commit it exactly as the recording step above does: stage only the plan document, by explicit path, and word it as the same bookkeeping commit. + Push it on branch k before continuing, then carry on with the rest of this routine for that bundle. + Without that backfill the review exists on the forge and nothing in the repository names it, so the sweep never learns its id, step 7 keeps reading that bundle as the one in progress, and the completeness rule in step 2 leaves the whole issue undecided forever. + When the entry already carries its `- Review:` line, the record is already durable: change nothing, make no commit, and continue. + A bundle with no reusable review is unaffected by any of this and runs the routine above unchanged. After bundle N's routine completes, close the parent task in the memory backend (a no-op for the checklist adapter, whose file is the parent record), which is the one action the single-review path takes that no bundle routine has taken yet. Then skip the single-review path above entirely and continue into the closing actions below, which run once for the issue rather than once per bundle. The parent task is closed exactly once either way: the single-review path closes it before opening its review, and a stacked issue closes it here, after the last bundle's review and before the issue's completion comment. From cbdd1b85571f607941fc0db9c4fb552c2dc0d932 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 02:15:24 -0700 Subject: [PATCH 48/68] fix(fathom): require a record for every bundle before sweeping --- skills/execute/SKILL.md | 7 +++++-- skills/fathom-shared/trackers.md | 13 ++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index e522d7f0..e538c50e 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -71,9 +71,12 @@ If any of these files cannot be found and read, stop immediately and report whic In particular a stack can hold a merged bundle, an open bundle, and an abandoned one simultaneously, and the abandoned bundle wins: restacking the bundles above it would force-push a rebase onto work the user may be about to discard, which is exactly the unattended destruction that stop exists to prevent. When any bundle reports `closed-unmerged`, apply the closed-without-merging path for that bundle, name which bundles above it in the stack are now orphaned by it, and neither close the issue nor restack anything; whether to retry, rescope, or drop the orphaned work is the user's judgment call. This case is checked first and is terminal: no later case runs after it, however many other bundles merged or stayed open. - Otherwise, when any bundle reports `unknown`, change nothing about the issue and leave it for a later sweep: name the review ids that came back `unknown`, close nothing, restack nothing, and report no progress for the issue. + Otherwise, when any bundle reports `unknown`, or the collection above found no `- Review:` record for some bundle between 1 and N, change nothing about the issue and leave it for a later sweep: name the review ids that came back `unknown` and the bundles whose records are missing, close nothing, restack nothing, and report no progress for the issue. `unknown` means the sweep did not learn that review's fate, not that the review is open or merged, so calling it any of those states is a claim about work that was never observed. - This case sits below the `closed-unmerged` case, which closes nothing and restacks nothing whatever the undetermined bundles turn out to be, and above the three cases below, each of which judges the whole stack on all of its bundles at once and cannot do that with an undetermined bundle among them. + A missing record is the same kind of gap and is treated identically: the `Bundles` section says how many bundles this issue has, so N is known even when a record is not, and a stack judged on fewer records than N is judged on an incomplete set. + With N of 3 and only two records collected, every case below would read a partly recorded three-bundle stack as a complete two-bundle one, and the first of them would move a half-merged issue to `done`. + So require a record for every bundle from 1 to N before evaluating any of the aggregate cases below, and take this case whenever that requirement is unmet. + This case sits below the `closed-unmerged` case, which closes nothing and restacks nothing whatever the undetermined or unrecorded bundles turn out to be, and above the three cases below, each of which judges the whole stack on all of its bundles at once and cannot do that with an undetermined or missing bundle among them. Otherwise move the issue to `done` when every bundle reports `merged`. Otherwise, with some bundles merged and others still open, close nothing: report the partial progress, naming which bundles merged, then run the restack check below. Otherwise every bundle is still open, with none merged, none abandoned, and none undetermined, so the stack is simply still in review: say that, close nothing, and restack nothing, since no merge has moved any base. diff --git a/skills/fathom-shared/trackers.md b/skills/fathom-shared/trackers.md index 29f65f7c..7993c35d 100644 --- a/skills/fathom-shared/trackers.md +++ b/skills/fathom-shared/trackers.md @@ -114,13 +114,16 @@ An issue can satisfy more than one case at once, and a stack holding a merged bu Apply the closed-without-merging path below for that review, and, when the issue is a stack, name which bundles above it are now orphaned by it. Close nothing for that issue, and do not read its merged reviews as progress toward closure. This case is checked first and is terminal, however many of the issue's other reviews merged or stayed open, because whether to retry, rescope, or drop the orphaned work is the user's decision and nothing should be built on top of work that may be about to be discarded. -2. Any recorded review reports `unknown`, and none reported `closed-unmerged`. +2. Any recorded review reports `unknown`, or some bundle between 1 and N has no `- Review:` record at all, and none reported `closed-unmerged`. `getReviewState` returns `unknown` when it could not determine the review's fate, which is not a state the review is in but an answer the sweep did not get. + A missing record is the same kind of gap: the `Bundles` section says how many bundles the issue has, so N is known even when a record is not, and an issue judged on fewer records than N is judged on an incomplete set. + With N of 3 and only two records collected, the cases below would read a partly recorded three-bundle stack as a complete two-bundle one, and case 3 would then close a half-merged issue. + So require a record for every bundle from 1 to N before evaluating cases 3, 4, and 5 at all, and take this case whenever that requirement is unmet. Change nothing about the issue: close nothing, report nothing about its progress, and leave it exactly as it stands for a later sweep to decide. - Name the review ids that came back `unknown`, and say that this issue was left undecided because of them. - Never fold an `unknown` result into `merged`, `open`, or "still entirely in review": each of those is a specific claim about work the sweep cannot actually see, and the later cases would otherwise absorb it and make that claim anyway. - This case sits below case 1 because a `closed-unmerged` result is a fact the sweep did observe, and its outcome does not depend on the undetermined ones: it closes nothing, restacks nothing, and hands the decision to the user, which is already the safest thing an undetermined result could ask for. - It sits above every case below because those judge the issue on all of its results at once, and an undetermined result cannot carry its share of such a judgment. + Name the review ids that came back `unknown` and the bundles whose records are missing, and say that this issue was left undecided because of them. + Never fold an `unknown` result or a missing record into `merged`, `open`, or "still entirely in review": each of those is a specific claim about work the sweep cannot actually see, and the later cases would otherwise absorb it and make that claim anyway. + This case sits below case 1 because a `closed-unmerged` result is a fact the sweep did observe, and its outcome does not depend on the undetermined or unrecorded ones: it closes nothing, restacks nothing, and hands the decision to the user, which is already the safest thing an incomplete picture could ask for. + It sits above every case below because those judge the issue on all of its results at once, and neither an undetermined result nor a missing one can carry its share of such a judgment. 3. Every recorded review reports `merged`. Apply the merged path below. For a single-review issue that is its one review, and for a stack it is every bundle, which is what keeps a stack from being closed by its first merge. From 2394e9938a9697232442eb928beae631262022be Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 02:16:24 -0700 Subject: [PATCH 49/68] fix(fathom): record finalization once and consult it before closing --- skills/execute/SKILL.md | 20 +++++++++++++++----- skills/fathom-shared/conventions.md | 6 ++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index e538c50e..76a90c9a 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -182,21 +182,29 @@ If any of these files cannot be found and read, stop immediately and report whic One commit per task, always, even when two tasks touch the same file. 11. Once `claimNext` returns none remaining, finish the issue. + Read this issue's plan document before anything else in this step and look for the `- Finalization: complete` line described in `conventions.md`. + That line is this issue's one durable record that its closing actions have run, the closing actions themselves are the only thing that writes it, and it is written by the last of them. + When it is present, this issue is already finished: say so, change nothing else in this step, and go to step 12. + The one exception is a line sitting on a commit that was never pushed; push that commit before reporting, since that push is itself the last of the closing actions and the only one that can still be missing while the line exists. + When the line is absent, run the rest of this step. + One recorded fact deciding this is what keeps a stacked issue from finalizing twice, in place of reasoning about which path invoked which routine. + This step has two mutually exclusive paths, and exactly one of them runs. A single-review issue follows the single-review path immediately below, then the closing actions at the end of this step. A stacked issue skips that path entirely and goes straight to the closing actions, because step 10 already opened every one of its reviews through the per-bundle routine further down. Running the single-review path on a stacked issue would reconcile the whole issue against a single bundle's commit range, write a second review record in a format the sweep does not read, and move the issue to `inReview` a second time. - A stacked issue also never enters this step on its own on a run that completes: step 10 invokes the per-bundle routine directly, and bundle N's routine runs the closing actions once as it finishes. - So when the loop afterwards drains and `claimNext` returns none, this step has already completed for that issue, and nothing in it runs a second time. + On a stacked run that completes, step 10 invokes the per-bundle routine directly and bundle N's routine runs the closing actions as it finishes, so the finalization line is already written and pushed by the time the loop drains. + Re-entering this step then reads that line and stops at the check above, having changed nothing, so the closing actions run exactly once however the run reached them. - A run that was interrupted is the one exception, and recovering it is the only reason a stacked issue ever arrives here with nothing claimable. + A run interrupted before that line was written arrives here with it absent, and recovering such a run is the only reason a stacked issue ever runs this step's body. Every task can be closed while the finalization that follows the last one is unfinished, and in that state nothing is claimable precisely when there is most left to do, so decide what remains from the durable record instead: the plan document's `Bundles` section says which bundles carry a recorded review, the memory backend says whether the parent task is still open, the tracker says the issue's phase and whether the completion comment is already on it, and branch N says whether the final closing commit exists and is pushed. Then do only what that record shows is missing, and skip whatever it shows is already done, which is what makes arriving here twice produce the same result as arriving once. Never call `openReview` for a bundle that already carries a recorded review; reuse it, exactly as the per-bundle routine's own guard says. A bundle whose tasks are all closed and whose review is missing is recovered in step 10 rather than here, before any claiming, so by the time this step runs every bundle has its review. Close the parent task only when the backend shows it open, apply `inReview` only when the tracker shows the issue in an earlier phase, post the completion comment only when `listComments` shows the issue does not already carry one, and make and push the final closing commit only when branch N does not already carry the completed task state. When the resolved tracker cannot list comments, post the comment and say that it may be a duplicate, since a second completion comment is a cosmetic cost and a missing one loses the handoff entirely. - When the record shows all of that already done, say so and change nothing, since the previous run finished the issue and only the report was lost. + When the record shows every one of those already done, the previous run got all the way to the last closing action without recording it, so write the finalization line described below, commit and push it as bookkeeping, and say that the issue was already finished and only its record was missing. + That is the one thing such a run still owes: leaving the line unwritten would make every later run walk this recovery again. The single-review path, for an issue that was not split into a stack: @@ -243,7 +251,9 @@ If any of these files cannot be found and read, stop immediately and report whic Then skip the single-review path above entirely and continue into the closing actions below, which run once for the issue rather than once per bundle. The parent task is closed exactly once either way: the single-review path closes it before opening its review, and a stacked issue closes it here, after the last bundle's review and before the issue's completion comment. - Finally, post a completion comment on the issue, including the done-on-merge note from `asana.md` when the tracker is Asana, and commit and push the task-state files this run changed as a final closing commit so the branch carries the completed state, staging them by explicit path per the staging rules in `conventions.md`: the beads JSONL export and `metadata.json` when beads is the backend, and this issue's files under `.fathom/`; never sweep `.beads/` or `.fathom/` as directories, since the beads database and runtime files are intentionally ignored and must not ride into the review. + Finally, post a completion comment on the issue, including the done-on-merge note from `asana.md` when the tracker is Asana, then write `- Finalization: complete` into this issue's plan document per `conventions.md`, and commit and push the task-state files this run changed as a final closing commit so the branch carries the completed state, staging them by explicit path per the staging rules in `conventions.md`: the beads JSONL export and `metadata.json` when beads is the backend, and this issue's files under `.fathom/`; never sweep `.beads/` or `.fathom/` as directories, since the beads database and runtime files are intentionally ignored and must not ride into the review. + Write that line last, after every other closing action has been taken, since it records that they were: a line written earlier would claim a finalization that had not happened and the check at the top of this step would then skip the rest of it forever. + It rides this same closing commit, so it becomes durable at the moment the completed task state does, and this commit is the only one that carries it on a run that reaches here normally. Push this closing commit with an ordinary `git push` of the branch even when the adapter declares `pushesForYou`, since that capability governs only the push that opens the review, as `../fathom-shared/forges.md` states; skipping it here would leave the completed task state in the local clone while the review reads as finished. On a stacked issue this closing commit goes on branch N, the stack tip, because that branch contains every bundle's history and is the only one whose review shows the completed task state. Say plainly at handoff, when the issue was split, that its record carries `- Merge-closer: suppressed`, so the merge-closer Action will take no action for it however its bundles merge. diff --git a/skills/fathom-shared/conventions.md b/skills/fathom-shared/conventions.md index 51a62abf..fdc9dd73 100644 --- a/skills/fathom-shared/conventions.md +++ b/skills/fathom-shared/conventions.md @@ -77,6 +77,12 @@ Include these sections: That close is also permanent and silent, because the next sweep reads the issue as already complete and does nothing. The Action reads this line and takes no action for the issue, which leaves closure to the sweep, and the sweep already waits for every bundle to report merged. One mechanism closes a stacked issue rather than two that disagree. +- **Finalization** - one line reading `- Finalization: complete`, absent until every one of the issue's closing actions has run. + The last of those actions writes it, so it rides the run's final closing commit and becomes durable at the same moment the completed task state does. + This is the one durable record that an issue's one-time closing actions have happened, and `execute` consults it before finalizing and stops immediately when it is present. + A stacked issue needs that: its last bundle finalizes the issue directly as it finishes, and the implementation loop then drains and reaches the finalizing step again, so without one recorded fact to consult the closing actions can run twice. + This is not task status and does not belong in the memory backend, which knows which tasks are closed and nothing about whether the completion comment was posted or the closing commit pushed. + It is the same kind of line as `Merge-closer` above: a fact about this issue that another mechanism reads later. - **Testing strategy** - which tests will prove the work, and which existing tests could regress. - **Notes** - open questions, risks, and decisions taken during the run. From e2de7ff6bb57f2a0fda8cebf7c4fbe97c3294949 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 02:31:03 -0700 Subject: [PATCH 50/68] docs(fathom): mark the stacked-reviews plan as a historical record --- docs/plans/2026-08-07-fathom-stacked-reviews-plan.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md index b3596e38..aac68684 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-plan.md @@ -1,5 +1,17 @@ # Fathom stacked reviews implementation plan +## Status: completed historical record + +This document is a historical execution record of how the stacked-reviews change was implemented. +Every task in it has been completed. +It is a point-in-time record rather than current guidance, and it is deliberately left as it was written rather than rewritten to track later corrections. + +The skill files under `skills/` are authoritative wherever this document disagrees with them. +Several skill files have been corrected past what this plan describes, so a difference between the two means the skill file is right and this record is simply older. + +The current specification is `docs/plans/2026-08-07-fathom-stacked-reviews-design.md`. +Read that document, and the skill files themselves, for how the feature behaves today. + > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. **Goal:** Give the reserved `stackedReviews` forge capability real behavior, so one tracker issue can produce a short stack of dependent code reviews when its breakdown is large enough, with the split proposed at breakdown time. From e97c2b0247a1b2a0054e86b6fe93c734448645af Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 02:31:29 -0700 Subject: [PATCH 51/68] fix(fathom): scope the createTask dep guarantee to child tasks --- skills/fathom-shared/memory.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skills/fathom-shared/memory.md b/skills/fathom-shared/memory.md index 6a918813..324ff791 100644 --- a/skills/fathom-shared/memory.md +++ b/skills/fathom-shared/memory.md @@ -11,7 +11,7 @@ Adapter files implement each one against a specific backend; treat the operation | Operation | Purpose | | --- | --- | | `init(issueRef)` | Prepare the backend for this issue's task set. | -| `createTask(title, description, subIssueRef, deps)` | Create a task, tag it with the issue ref so all tasks for one issue can be listed directly, record `subIssueRef` on the task, and return its task id. This is the only operation here that takes `deps`, so a task's dependencies are settled at creation and every task is created with its final ones in a single pass. When the issue was split into a stack, every task takes a dep on its predecessor so the whole issue forms one sequential chain across bundles as well as within them, which is what lets the backend itself enforce bundle order: a later bundle's task is never claimable while any earlier task is still open. A single edge at each bundle boundary would not achieve this, because a task carrying no deps at all has them trivially closed and stays claimable out of order. Whether the issue is split is therefore decided before the first `createTask` call, since a chain this contract cannot add afterwards has to be built as the tasks are created. | +| `createTask(title, description, subIssueRef, deps)` | Create a task, tag it with the issue ref so all tasks for one issue can be listed directly, record `subIssueRef` on the task, and return its task id. This is the only operation here that takes `deps`, so the dependency edges between a split issue's child tasks are settled as those tasks are created and cannot be added to a task that already exists. Create the child tasks in planned order for that reason, so each task's predecessor id already exists when the next task needs it as a dep. The parent task's own dependency edges on its children are outside that guarantee and are added after the children exist, as the `parentTask` row below describes. When the issue was split into a stack, every task takes a dep on its predecessor so the whole issue forms one sequential chain across bundles as well as within them, which is what lets the backend itself enforce bundle order: a later bundle's task is never claimable while any earlier task is still open. A single edge at each bundle boundary would not achieve this, because a task carrying no deps at all has them trivially closed and stays claimable out of order. Whether the issue is split is therefore decided before the first `createTask` call, since a chain this contract cannot add afterwards has to be built as the tasks are created. | | `claimNext()` | Return and mark in-progress this issue's first open task whose deps are all closed; null when none remain. Scope every call to the issue being worked: a backend able to see other issues' tasks must filter to this one, or the loop will implement another issue's work on this branch and close the wrong sub-issue. When an interrupted run left one of this issue's tasks in progress, return that task to be resumed rather than claiming a new one. | | `close(taskId)` | Mark a task done. | | `status()` | Return this issue's open and done counts and its current in-progress task, scoped to the issue exactly as `claimNext` is. | From 6cf46b78cb89cd0d3bd87591d2a70c12bb119b57 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 02:32:08 -0700 Subject: [PATCH 52/68] fix(fathom): reuse the adopt branch on the split creation path --- skills/execute/SKILL.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index 76a90c9a..b41169e6 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -146,7 +146,10 @@ If any of these files cannot be found and read, stop immediately and report whic When no split was confirmed and the issue has no existing children, for each planned unit call `createSubIssue` first, then call `createTask` with the newly created sub-issue's ref as `subIssueRef`, then write the returned task id back onto that sub-issue so the link reads both ways, since the task id does not exist until `createTask` returns, setting `deps` to the id of the task it builds on so tasks chain sequentially by default whenever order matters. When no split was confirmed and the issue already had children, for each adopted sub-issue still call `createTask`, passing that sub-issue's existing ref as `subIssueRef` and skipping `createSubIssue` since the sub-issue already exists, then write the returned task id back onto that sub-issue the same way, and setting `deps` the same way. Those two are the single-review behavior exactly as it has always run, one sub-issue and its task at a time, so nothing watching the tracker sees a different sequence than before. - When a split was confirmed, create the sub-issues and tasks in whatever order the bundle records require, since a bundle names its sub-issues by ref and those refs must exist before the `Bundles` section can be written; this path is new behavior with no earlier sequence to preserve. + When a split was confirmed, take the same create-versus-adopt decision those two branches take: create a sub-issue for each planned unit when the issue has no existing children, and adopt the existing children when it has them, skipping `createSubIssue` for each adopted one exactly as the adopt branch above does. + A split never changes whether the sub-issues already exist, so an issue that arrived with children gets tasks created against those children and never a duplicate set alongside them. + Create them strictly one at a time in the planned order, from the first unit to the last, rather than in whatever order the bundle records suggest. + That order is what makes each task's predecessor id already exist when the next task needs it as a dep, and it also has every sub-issue ref created before the `Bundles` section that names them is written. Chain every task in the issue sequentially on that path, so each task deps on its predecessor across bundle boundaries as well as within them, rather than only where order matters. This is what makes `claimNext` structurally unable to hand out a later bundle's task while any earlier task is open, so the implementation loop needs no bundle-ordering logic of its own. A single edge at each bundle boundary is not enough: a task carrying no deps has them trivially closed, so it stays claimable out of order and the branch chain would be built on unfinished work. From 843969f000b42f39b40afedd2ea7aa204f4ccf72 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 02:33:32 -0700 Subject: [PATCH 53/68] fix(fathom): match a bundle review on its head and base pair --- skills/execute/SKILL.md | 7 +++++++ skills/fathom-shared/forges.md | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index b41169e6..cbc538a1 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -244,6 +244,13 @@ If any of these files cannot be found and read, stop immediately and report whic Waiting for the run's final closing commit instead would leave bundle 1's review id uncommitted through bundles 2 and 3, where a sweep run from another clone cannot see it and an interrupted run leaves it on one machine's disk only. - Apply `inReview` when bundle 1's review publishes, and never again for the later bundles; the issue is genuinely in review from that moment and re-applying a phase it already holds reports progress that did not happen. Skip the `openReview` call for a bundle whose review already exists and reuse that review, the same way the single-review path does, so a resumed run never opens a second review for a bundle that has one. + Decide whether one exists from that bundle's entry in the `Bundles` section first, since an entry carrying a `- Review:` line names the review outright and needs no lookup at all. + When the entry carries no such line, ask the forge with `findReviewByBranch` for branch k, then keep only the reviews whose base is the base `resolveBase` returned for this bundle. + That operation resolves reviews by head branch alone, as `../fathom-shared/forges.md` states, and bundle branches chain, so a head branch can name a review opened against a different base than this bundle now targets; matching on the exact head and base pair is what keeps this bundle's commits out of that review. + When exactly one review survives that filter, call `getReviewState` on its id before reusing or backfilling it, so its fate is read rather than assumed, and stop and hold when that state is anything other than open. + When more than one survives, stop and hold naming them, since choosing between two candidate reviews by guess is the failure this pairing exists to prevent. + Call `openReview` for this bundle only when nothing matches at all. + When the resolved adapter omits `findReviewByBranch`, which `../fathom-shared/forges.md` says is legitimate, no lookup is possible: say once that the forge cannot be asked, treat the missing `- Review:` line as meaning no review exists, and open one, accepting that a review interrupted before its id was recorded is opened a second time here. Reusing a review does not skip the two recording steps above it, and this is where a resumed run otherwise loses a bundle. Read that bundle's entry in the `Bundles` section, and when it carries no `- Review:` line, backfill one now from the existing review's own id and URL, in the same `- Review: (bundle k/N)` form, then commit it exactly as the recording step above does: stage only the plan document, by explicit path, and word it as the same bookkeeping commit. Push it on branch k before continuing, then carry on with the rest of this routine for that bundle. diff --git a/skills/fathom-shared/forges.md b/skills/fathom-shared/forges.md index 5d851ceb..9911f8fb 100644 --- a/skills/fathom-shared/forges.md +++ b/skills/fathom-shared/forges.md @@ -35,9 +35,11 @@ A branch name is not a review id. An adapter that cannot create reviews (see `generic-git.md`) returns this instead of an id, and it is a typed outcome of the contract rather than a failure. A caller receiving it must not call `publishReview`, must not record a review id, and must say plainly that opening the review is now the user's step. -One optional operation exists beyond the five, for legacy records only: `findReviewByBranch(branch)`, which resolves a review id from a head branch name where the forge can do that (`github.md` implements it with a bounded head-branch listing). +One optional operation exists beyond the five, for repairing incomplete records: `findReviewByBranch(branch)`, which resolves a review id from a head branch name where the forge can do that (`github.md` implements it with a bounded head-branch listing). Adapters that cannot implement it simply omit it. -The sweep uses it solely to repair records written before review ids were recorded; when the resolved adapter omits it, such a record cannot be swept, and the sweep reports that once instead of guessing. +It is used only where a review may exist while nothing in the repository records its id: the sweep repairs records written before review ids were recorded, and `execute` recovers a bundle whose review opened before its `- Review:` line was committed. +It resolves by head branch alone, so a caller that needs a review against a particular base must filter what comes back by that base itself rather than trusting a head branch to name exactly one review in a chained stack. +When the resolved adapter omits it, such a record cannot be repaired, and the caller reports that once instead of guessing. ## Declared capabilities From 257c15ec4dfa64cac7e0eada63c3327d42ef4919 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 02:34:12 -0700 Subject: [PATCH 54/68] fix(fathom): verify the staged diff before a bookkeeping commit --- skills/execute/SKILL.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index cbc538a1..aabec16d 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -240,6 +240,8 @@ If any of these files cannot be found and read, stop immediately and report whic - Record `- Review: (bundle k/N)` beneath that bundle's line in the plan document's `Bundles` section, since the sweep looks reviews up by id and needs every one of them. - Commit and push that recorded line immediately, on branch k, before moving to bundle k+1's branch or doing anything else. Stage only the plan document, by explicit path, per the staging rules in `conventions.md`, and word it as bookkeeping rather than as a task: `chore(): record bundle k review id`, naming no task in the body. + Then do what those same staging rules require before every commit: list what is staged and confirm every part of it belongs to the work at hand, which here is the one added `- Review:` line and nothing else. + Staging that document by path takes whatever else is already sitting in it, so when the staged diff carries an unrelated edit as well, unstage it rather than committing it and cleaning up later, and leave it in the working tree for the run's final closing commit to carry. `conventions.md` excludes plan document and bookkeeping commits from task and commit reconciliation, and a commit shaped this way is one of them, so it cannot be miscounted as the commit that implemented a task. Waiting for the run's final closing commit instead would leave bundle 1's review id uncommitted through bundles 2 and 3, where a sweep run from another clone cannot see it and an interrupted run leaves it on one machine's disk only. - Apply `inReview` when bundle 1's review publishes, and never again for the later bundles; the issue is genuinely in review from that moment and re-applying a phase it already holds reports progress that did not happen. @@ -252,7 +254,7 @@ If any of these files cannot be found and read, stop immediately and report whic Call `openReview` for this bundle only when nothing matches at all. When the resolved adapter omits `findReviewByBranch`, which `../fathom-shared/forges.md` says is legitimate, no lookup is possible: say once that the forge cannot be asked, treat the missing `- Review:` line as meaning no review exists, and open one, accepting that a review interrupted before its id was recorded is opened a second time here. Reusing a review does not skip the two recording steps above it, and this is where a resumed run otherwise loses a bundle. - Read that bundle's entry in the `Bundles` section, and when it carries no `- Review:` line, backfill one now from the existing review's own id and URL, in the same `- Review: (bundle k/N)` form, then commit it exactly as the recording step above does: stage only the plan document, by explicit path, and word it as the same bookkeeping commit. + Read that bundle's entry in the `Bundles` section, and when it carries no `- Review:` line, backfill one now from the existing review's own id and URL, in the same `- Review: (bundle k/N)` form, then commit it exactly as the recording step above does: stage only the plan document, by explicit path, verify the staged diff carries only that backfilled line before committing, and word it as the same bookkeeping commit. Push it on branch k before continuing, then carry on with the rest of this routine for that bundle. Without that backfill the review exists on the forge and nothing in the repository names it, so the sweep never learns its id, step 7 keeps reading that bundle as the one in progress, and the completeness rule in step 2 leaves the whole issue undecided forever. When the entry already carries its `- Review:` line, the record is already durable: change nothing, make no commit, and continue. From 89fb748036c330e159674c855091b71d945c9b52 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 02:34:35 -0700 Subject: [PATCH 55/68] fix(fathom): apply inReview when bundle 1's review is reused --- skills/execute/SKILL.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index aabec16d..c5e2d360 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -245,6 +245,9 @@ If any of these files cannot be found and read, stop immediately and report whic `conventions.md` excludes plan document and bookkeeping commits from task and commit reconciliation, and a commit shaped this way is one of them, so it cannot be miscounted as the commit that implemented a task. Waiting for the run's final closing commit instead would leave bundle 1's review id uncommitted through bundles 2 and 3, where a sweep run from another clone cannot see it and an interrupted run leaves it on one machine's disk only. - Apply `inReview` when bundle 1's review publishes, and never again for the later bundles; the issue is genuinely in review from that moment and re-applying a phase it already holds reports progress that did not happen. + A resumed run that reuses bundle 1's existing review publishes nothing, so apply `inReview` there instead, whenever the tracker still shows the issue in an earlier phase; read that phase from the tracker rather than assuming the interrupted run got as far as applying it. + That is a phase update and nothing more: reusing a review never reopens it and never calls `publishReview` on it again. + Later bundles keep this rule exactly as written and never apply the phase, whether their reviews were newly opened or reused. Skip the `openReview` call for a bundle whose review already exists and reuse that review, the same way the single-review path does, so a resumed run never opens a second review for a bundle that has one. Decide whether one exists from that bundle's entry in the `Bundles` section first, since an entry carrying a `- Review:` line names the review outright and needs no lookup at all. When the entry carries no such line, ask the forge with `findReviewByBranch` for branch k, then keep only the reviews whose base is the base `resolveBase` returned for this bundle. From e9ff6b7968161fc455911867451fe41e4f43b0f7 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 02:34:58 -0700 Subject: [PATCH 56/68] docs(fathom): record bundle membership in one place only --- docs/plans/2026-08-07-fathom-stacked-reviews-design.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-design.md b/docs/plans/2026-08-07-fathom-stacked-reviews-design.md index 2bd94068..72a33422 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-design.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-design.md @@ -135,8 +135,9 @@ Full sequential chaining applies only when a split is confirmed; an ordinary sin ### 7. Durable record -Bundle membership is written at step 8 to the plan document and to the issue's file under `.fathom/`. +Bundle membership is written at step 8 to exactly one place, the plan document's `Bundles` section. It records, for each bundle, its index, the sub-issue refs and task ids it contains, and its branch name. +One record is deliberate: a second copy elsewhere under `.fathom/` would be a second version of the same fact, and two records of one fact can disagree. This is required rather than optional. `execute/SKILL.md:22` states that every run begins by reading durable state from the repository and the tracker, never from memory of a previous run. @@ -152,7 +153,7 @@ The per-bundle routine runs when the last task of bundle k closes: 2. Call `resolveBase`. Bundle 1's base is the resolved base branch; bundle k's base is branch k-1. 3. Push branch k, unless the adapter declares `pushesForYou`. 4. Call `openReview`, then `publishReview`. -5. Record `- Review: (bundle k/N)` in the issue's file under `.fathom/`. +5. Record `- Review: (bundle k/N)` beneath that bundle's line in the plan document's `Bundles` section, which is the one place bundle records live. 6. When another bundle remains, create branch k+1 from branch k and continue the implementation loop. When bundle k was the last one, fall through to the issue-level close instead. The issue-level close runs once, after the last bundle. From b98ccda66127684ecf4978885e42a216f7deddcd Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 02:36:37 -0700 Subject: [PATCH 57/68] fix(fathom): stop claiming no branch exists at the split stop --- docs/plans/2026-08-07-fathom-stacked-reviews-design.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-design.md b/docs/plans/2026-08-07-fathom-stacked-reviews-design.md index 72a33422..60208501 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-design.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-design.md @@ -79,7 +79,7 @@ No bundled adapter reaches it, because `generic-git.md` is the only bundled adap ### 3. The split proposal stop -The stop fires at step 8, after the breakdown exists and before any branch is created. +The stop fires at step 8, after the breakdown exists and before any task, commit, or review is created. It shows the proposed bundles, which sub-issues fall in each, and the resolved forge's stacking behavior. It goes on the skip list in `approval.md`, not the never-skip list. From 142fa503db7cb9e1b226e62f962cd5ee00afb7b6 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 02:51:04 -0700 Subject: [PATCH 58/68] fix(fathom): commit leftover changes before reconciling the range The per-bundle routine reconciled bundle k's closed tasks against its commit range before committing leftover changes belonging to those tasks, so a bundle with leftover work counted a range that was still missing a commit and stopped, and where the count happened to match anyway the later leftover commit was never reconciled at all. Swap the two so the leftover commit lands first and the reconciliation counts the bundle's final range. The single-review path carried the same ordering and is swapped with it. --- skills/execute/SKILL.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index c5e2d360..f6a17776 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -211,8 +211,8 @@ If any of these files cannot be found and read, stop immediately and report whic The single-review path, for an issue that was not split into a stack: - Run the commit reconciliation from `conventions.md` and stop if the task and commit counts disagree. Commit any leftover uncommitted change that belongs to this issue's tasks, leaving unrelated working-tree edits alone rather than sweeping them into the review. + Then run the commit reconciliation from `conventions.md` and stop if the task and commit counts disagree, in that order, so the range it counts already carries every commit this issue's tasks produced. Close the parent task in the memory backend (a no-op for the checklist adapter, whose file is the parent record). Then open the review through the forge contract in `../fathom-shared/forges.md`, never by invoking a forge CLI directly from this procedure. @@ -229,9 +229,11 @@ If any of these files cannot be found and read, stop immediately and report whic When this issue was split into a stack, the review-opening portion above is a per-bundle routine rather than a single closing action, and step 10 invokes it once per bundle as that bundle's last task closes. For bundle k of N: - - Reconcile bundle k's closed tasks against the commits on its branch, over that bundle's own range, per the per-bundle rule in `conventions.md`; stop and do not open this bundle's review when they disagree. - Commit any leftover uncommitted change that belongs to this bundle's tasks, leaving unrelated working-tree edits alone rather than sweeping them into the review, exactly as the single-review path does before it opens its one review. A change left uncommitted here is absent from bundle k's review and lands in bundle k+1's instead, which is worse than the single-review case rather than merely equivalent to it. + - Then reconcile bundle k's closed tasks against the commits on its branch, over that bundle's own range as it stands after the commit above, per the per-bundle rule in `conventions.md`; stop and do not open this bundle's review when they disagree. + These two run in this order because the leftover commit changes the very range the reconciliation counts. + Reconciling first would count a range still missing that commit, so a bundle with leftover work would come up short and stop the routine even though nothing was wrong; and where the count happened to match anyway, the leftover commit would land in the range afterwards and never be reconciled at all. - Call `resolveBase` on bundle 1's base, which is the resolved base branch, or on branch k-1 for every later bundle. - Push branch k, unless the adapter declares `pushesForYou`, exactly as the single-review path does. - Call `openReview` with branch k, that base, a title naming the bundle, and a body built per the stack rules in `conventions.md`: the closing reference only in bundle N, plus `Part k of N`, plus `Depends on` the previous bundle's review URL for every bundle after the first. From 01ce8425ad10c414be0698d8162ab3984d48c425 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 02:51:25 -0700 Subject: [PATCH 59/68] fix(fathom): guard the per-bundle routine against a manual handoff openReview may return the manual-handoff result, which carries no review id. The per-bundle routine passed it straight to publishReview and wrote a - Review: record from it, recording an invalid entry and leaving later bundles without a dependsOn id. Branch on the result instead: skip publishReview, write no record, and stop and report the handoff. Noted as a guard against an adapter returning the handoff from a non-manual tier, since the manual tier never proposes a split. --- skills/execute/SKILL.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index f6a17776..f1976cb5 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -238,6 +238,11 @@ If any of these files cannot be found and read, stop immediately and report whic - Push branch k, unless the adapter declares `pushesForYou`, exactly as the single-review path does. - Call `openReview` with branch k, that base, a title naming the bundle, and a body built per the stack rules in `conventions.md`: the closing reference only in bundle N, plus `Part k of N`, plus `Depends on` the previous bundle's review URL for every bundle after the first. Pass the previous bundle's review id as `dependsOn` for every bundle after the first, and omit it for bundle 1. + - Branch on what `openReview` returned before doing anything with it, since the manual-handoff result defined in `../fathom-shared/forges.md` is a typed outcome of that call and carries no review id. + When it is that result, there is no review object for this bundle: do not call `publishReview`, do not write a `- Review:` line for it, and stop and report the handoff for bundle k rather than continuing to bundle k+1. + Writing a record from it would put an entry in the `Bundles` section with no id behind it, which the sweep reads as a review it can look up and cannot, and continuing would leave bundle k+1 with no id to pass as `dependsOn` and no URL for its `Depends on` line. + A stacked run should not normally reach this at all, because the manual tier never proposes a split, as `../fathom-shared/forges.md` states, and it is the only tier that hands a review off by hand. + So treat this branch as a guard against an adapter that returns the handoff result from a non-manual tier, rather than as a path a correct run is expected to take, and say that plainly when it fires. - Call `publishReview` with the returned id. - Record `- Review: (bundle k/N)` beneath that bundle's line in the plan document's `Bundles` section, since the sweep looks reviews up by id and needs every one of them. - Commit and push that recorded line immediately, on branch k, before moving to bundle k+1's branch or doing anything else. From e4d1c9293201e23c5ed18ee1b6a3df9492212dbf Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 02:51:52 -0700 Subject: [PATCH 60/68] fix(fathom): state a true rationale for the bundle-split skip entry The entry claimed the stop fires before any branch exists, but step 7 creates bundle 1's branch before step 8 runs, and it claimed a wrong answer is corrected by re-running with stacking: never, which does not roll back a split auto mode already applied. Rewrite the rationale in terms that hold and drop the re-run claim, matching section 3 of the design document, and drop the same overclaim from that section. --- docs/plans/2026-08-07-fathom-stacked-reviews-design.md | 2 +- skills/fathom-shared/approval.md | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/plans/2026-08-07-fathom-stacked-reviews-design.md b/docs/plans/2026-08-07-fathom-stacked-reviews-design.md index 60208501..e24ef5c3 100644 --- a/docs/plans/2026-08-07-fathom-stacked-reviews-design.md +++ b/docs/plans/2026-08-07-fathom-stacked-reviews-design.md @@ -83,7 +83,7 @@ The stop fires at step 8, after the breakdown exists and before any task, commit It shows the proposed bundles, which sub-issues fall in each, and the resolved forge's stacking behavior. It goes on the skip list in `approval.md`, not the never-skip list. -It fires before any commit or review exists, so being wrong costs nothing and is trivially corrected. +It fires before any commit or review exists, so being wrong destroys nothing and misdirects nothing. Bundle 1's branch does exist by then, because step 7 creates it before step 8 runs, but that branch is the one a single-review run needs anyway, so declining the split wastes nothing and leaves nothing to clean up. That is the shape of every existing skip-list item, and unlike every never-skip item it destroys nothing and misdirects nothing. In `ask` mode the run waits for an answer; in `auto` mode it applies the split and reports it. diff --git a/skills/fathom-shared/approval.md b/skills/fathom-shared/approval.md index 89f5b4b3..2bb69445 100644 --- a/skills/fathom-shared/approval.md +++ b/skills/fathom-shared/approval.md @@ -34,7 +34,9 @@ Skipping them changes how much the run interrupts you, not whether it is correct Record the answer, and note in the profile that it was auto-accepted rather than confirmed, so a wrong destination is traceable later. - The bundle-split proposal in `execute`. Apply the proposed split and report the bundles rather than asking for confirmation first. - This belongs here rather than on the safety list because it fires before any branch, commit, or review exists, so a wrong answer costs nothing and is corrected by re-running with `stacking: never` or a different instruction. + This belongs here rather than on the safety list because it fires before any commit or review exists, so being wrong destroys nothing and misdirects nothing, which is the shape of every other item on this list. + Bundle 1's branch does exist by then, since step 7 creates it before step 8 runs, but that branch is the one a single-review run needs anyway, so declining the split wastes nothing and leaves nothing to clean up. + Being on this list is not a claim that an applied split is undone by a later run: in auto mode the split is already written into the breakdown by the time anyone reads the report, and the task dependency chain and the plan document's `Bundles` section persist until someone edits them. It is skipped only when the profile's `stacking` field permits a split at all; `stacking: never`, and an absent field which means the same thing, suppress the split itself, in both modes, rather than suppressing the question. ## What auto mode never skips From f94c22b6971236e0863da8561bf3b0cfc4265a83 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 02:52:59 -0700 Subject: [PATCH 61/68] fix(fathom): return candidate records from findReviewByBranch Bundle review recovery required matching on the exact head and base pair, but the operation was defined to return only a review id and the GitHub adapter returned only the newest pull request number, so the requirement was unimplementable and the backfill had no URL to record. Extend the operation to return bounded candidate records carrying the review id, its URL, and its base; the caller reuses only an exact head-and-base match. State in both files what happens when an adapter omits the operation entirely. --- skills/execute/SKILL.md | 11 ++++++----- skills/fathom-shared/forges.md | 15 ++++++++++++--- skills/fathom-shared/forges/github.md | 10 +++++++--- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index f1976cb5..460387d4 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -257,14 +257,15 @@ If any of these files cannot be found and read, stop immediately and report whic Later bundles keep this rule exactly as written and never apply the phase, whether their reviews were newly opened or reused. Skip the `openReview` call for a bundle whose review already exists and reuse that review, the same way the single-review path does, so a resumed run never opens a second review for a bundle that has one. Decide whether one exists from that bundle's entry in the `Bundles` section first, since an entry carrying a `- Review:` line names the review outright and needs no lookup at all. - When the entry carries no such line, ask the forge with `findReviewByBranch` for branch k, then keep only the reviews whose base is the base `resolveBase` returned for this bundle. - That operation resolves reviews by head branch alone, as `../fathom-shared/forges.md` states, and bundle branches chain, so a head branch can name a review opened against a different base than this bundle now targets; matching on the exact head and base pair is what keeps this bundle's commits out of that review. - When exactly one review survives that filter, call `getReviewState` on its id before reusing or backfilling it, so its fate is read rather than assumed, and stop and hold when that state is anything other than open. + When the entry carries no such line, ask the forge with `findReviewByBranch` for branch k, which returns bounded candidate records carrying each review's id, its URL, and its base, as `../fathom-shared/forges.md` defines the operation, then keep only the candidates whose base is exactly the base `resolveBase` returned for this bundle. + Bundle branches chain, so a head branch can carry a review opened against a different base than this bundle now targets; matching on the exact head and base pair is what keeps this bundle's commits out of that review, and the base in the candidate record is what makes that match possible at all. + When exactly one candidate survives that filter, call `getReviewState` on its id before reusing or backfilling it, so its fate is read rather than assumed, and stop and hold when that state is anything other than open. + Keep that candidate's URL alongside its id, since the backfill below records both and no other operation in the contract reports a review's URL. When more than one survives, stop and hold naming them, since choosing between two candidate reviews by guess is the failure this pairing exists to prevent. - Call `openReview` for this bundle only when nothing matches at all. + Call `openReview` for this bundle only when no candidate matches at all. When the resolved adapter omits `findReviewByBranch`, which `../fathom-shared/forges.md` says is legitimate, no lookup is possible: say once that the forge cannot be asked, treat the missing `- Review:` line as meaning no review exists, and open one, accepting that a review interrupted before its id was recorded is opened a second time here. Reusing a review does not skip the two recording steps above it, and this is where a resumed run otherwise loses a bundle. - Read that bundle's entry in the `Bundles` section, and when it carries no `- Review:` line, backfill one now from the existing review's own id and URL, in the same `- Review: (bundle k/N)` form, then commit it exactly as the recording step above does: stage only the plan document, by explicit path, verify the staged diff carries only that backfilled line before committing, and word it as the same bookkeeping commit. + Read that bundle's entry in the `Bundles` section, and when it carries no `- Review:` line, backfill one now from the id and URL on the candidate record that matched, in the same `- Review: (bundle k/N)` form, then commit it exactly as the recording step above does: stage only the plan document, by explicit path, verify the staged diff carries only that backfilled line before committing, and word it as the same bookkeeping commit. Push it on branch k before continuing, then carry on with the rest of this routine for that bundle. Without that backfill the review exists on the forge and nothing in the repository names it, so the sweep never learns its id, step 7 keeps reading that bundle as the one in progress, and the completeness rule in step 2 leaves the whole issue undecided forever. When the entry already carries its `- Review:` line, the record is already durable: change nothing, make no commit, and continue. diff --git a/skills/fathom-shared/forges.md b/skills/fathom-shared/forges.md index 9911f8fb..1aaab88a 100644 --- a/skills/fathom-shared/forges.md +++ b/skills/fathom-shared/forges.md @@ -35,11 +35,20 @@ A branch name is not a review id. An adapter that cannot create reviews (see `generic-git.md`) returns this instead of an id, and it is a typed outcome of the contract rather than a failure. A caller receiving it must not call `publishReview`, must not record a review id, and must say plainly that opening the review is now the user's step. -One optional operation exists beyond the five, for repairing incomplete records: `findReviewByBranch(branch)`, which resolves a review id from a head branch name where the forge can do that (`github.md` implements it with a bounded head-branch listing). +One optional operation exists beyond the five, for repairing incomplete records: `findReviewByBranch(branch)`, which finds the reviews opened from a head branch where the forge can do that (`github.md` implements it with a bounded head-branch listing). Adapters that cannot implement it simply omit it. + +**It returns a bounded list of candidate records, newest first, and each record carries three fields: the review id, the review's URL, and the base branch that review targets.** +It returns an empty list when the branch has no reviews, and it never returns a bare id. +A caller needs all three fields. +The id is what `getReviewState` and every later record are written against, the URL is what a `- Review:` line needs in order to name the review to a human, and the base is the only thing that tells apart two reviews sharing one head branch. +That last case is routine rather than exotic: bundle branches chain, so one head branch can carry a review opened against a base the caller no longer targets, and `getReviewState` reports a review's fate without reporting what it targets, so the base has to come from here or from nowhere. +The list is bounded, so treat it as a set of candidates rather than an exhaustive answer, and match within it rather than trusting it to hold exactly one review. + It is used only where a review may exist while nothing in the repository records its id: the sweep repairs records written before review ids were recorded, and `execute` recovers a bundle whose review opened before its `- Review:` line was committed. -It resolves by head branch alone, so a caller that needs a review against a particular base must filter what comes back by that base itself rather than trusting a head branch to name exactly one review in a chained stack. -When the resolved adapter omits it, such a record cannot be repaired, and the caller reports that once instead of guessing. +When the resolved adapter omits the operation entirely, no lookup is possible at all and such a record cannot be repaired. +Each caller says that once, names the record, and then takes the path its own procedure defines for an unrepairable record rather than guessing: the sweep leaves that issue undecided and closes nothing, per `trackers.md`, and `execute` treats a bundle with no recorded review as having none and opens one, per `execute/SKILL.md`. +Those two differ because the costs differ, and each file states its own; neither is licensed to invent the other's. ## Declared capabilities diff --git a/skills/fathom-shared/forges/github.md b/skills/fathom-shared/forges/github.md index b8c328ff..786ba067 100644 --- a/skills/fathom-shared/forges/github.md +++ b/skills/fathom-shared/forges/github.md @@ -97,10 +97,14 @@ Look up each recorded id directly. Do not list pull requests to find one. An earlier version of the sweep matched `gh pr list --state all --json headRefName,state,mergedAt` against recorded branch names, which silently skipped older branches whenever the listing hit its default cap of 30; per-id lookup removes that hazard entirely and is the reason the sweep is keyed on ids. -## `findReviewByBranch(branch)` - optional, legacy records only +## `findReviewByBranch(branch)` - optional, record repair only -Run `gh pr list --state all --head --json number --limit 10` and return the newest number, or nothing when the list is empty. +Run `gh pr list --state all --head --json number,url,baseRefName --limit 10`. -This is the one sanctioned listing call, and it exists only so the sweep can repair a record written before review ids were recorded. +Return one candidate record per pull request the listing returned, newest first, each carrying the pull request number as the review id, its URL, and `baseRefName` as its base. +Return an empty list when the listing is empty. +Never collapse the list to the newest entry here: a head branch can carry more than one pull request, and which of them the caller wants is the caller's question to answer from the base, per the contract in `../forges.md`. + +This is the one sanctioned listing call, and it exists only so an incomplete record can be repaired: the sweep repairs a record written before review ids were recorded, and `execute` recovers a bundle whose pull request opened before its `- Review:` line was committed. Scoping the list to one head branch keeps it bounded regardless of repository age, which is what the unscoped listing above could not guarantee. Never use it for records that already carry an id. From addf204c300b7c7d724d9eaf871e055f2205aac2 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 02:53:42 -0700 Subject: [PATCH 62/68] fix(fathom): fold a resolved legacy review id into the issue's set A branch-only legacy record resolved through findReviewByBranch had its id left out of the issue's review set, so the completeness requirement and the aggregate cases could run against an incomplete set and case 3 could close an issue on the records that happened to carry ids. Add the resolved id to the set and call getReviewState on it before any ordered case is evaluated, treat a record as resolved only on an exact single candidate, and leave the issue incomplete when resolution fails or the operation is unavailable so case 2 blocks closure. --- skills/fathom-shared/trackers.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/skills/fathom-shared/trackers.md b/skills/fathom-shared/trackers.md index 7993c35d..bf88c6f3 100644 --- a/skills/fathom-shared/trackers.md +++ b/skills/fathom-shared/trackers.md @@ -104,8 +104,16 @@ Look each id up directly; never list a forge's reviews and match them locally. A listing has to be bounded, and any bound silently drops the oldest records once a repository has more reviews than the bound allows, which is a defect that grows quietly with the repository's age. Records written before review ids were recorded carry a branch name and no id. -For those, fall back to the optional `findReviewByBranch` operation defined in `forges.md`, and rewrite the record with the id once one is known, so the fallback path drains over time rather than becoming permanent. -When the resolved adapter does not implement that operation, the record cannot be swept: report that once, naming the record, rather than guessing or treating a branch name as a review id. +For those, fall back to the optional `findReviewByBranch` operation defined in `forges.md`, which returns bounded candidate records carrying each review's id, its URL, and its base. +Treat such a record as resolved only when exactly one candidate comes back, since a legacy record names a branch and nothing else and so carries nothing to tell two candidates apart; two or more candidates leave it unresolved rather than presenting a choice to make. + +Resolution is not complete at the id. +Add the resolved id to that issue's set of review ids and call `getReviewState` on it, and do both before any of the ordered cases below are evaluated for that issue, so every case judges the issue on its whole set rather than on the subset that already carried ids. +Doing this after the cases, or not at all, would let the completeness requirement and the aggregate cases run against an incomplete set: an issue whose only unresolved record is the branch-only one would read as fully recorded, and case 3 would close it on the strength of the reviews that happened to have ids. +Then rewrite the record with the id, so the fallback path drains over time rather than becoming permanent. + +When resolution fails, and when the resolved adapter does not implement that operation at all, that record yields no id and no state: report that once, naming the record, rather than guessing or treating a branch name as a review id. +Leave the issue incomplete in that case, exactly as a missing `- Review:` record leaves it, so case 2 below blocks closure on it instead of the aggregate cases deciding the issue on partial data. Judge each issue on all of its results together, in the order below, letting the first case that applies decide that issue. An issue can satisfy more than one case at once, and a stack holding a merged bundle, an open bundle, and an abandoned one routinely does. @@ -114,14 +122,15 @@ An issue can satisfy more than one case at once, and a stack holding a merged bu Apply the closed-without-merging path below for that review, and, when the issue is a stack, name which bundles above it are now orphaned by it. Close nothing for that issue, and do not read its merged reviews as progress toward closure. This case is checked first and is terminal, however many of the issue's other reviews merged or stayed open, because whether to retry, rescope, or drop the orphaned work is the user's decision and nothing should be built on top of work that may be about to be discarded. -2. Any recorded review reports `unknown`, or some bundle between 1 and N has no `- Review:` record at all, and none reported `closed-unmerged`. +2. Any recorded review reports `unknown`, or some bundle between 1 and N has no `- Review:` record at all, or a branch-only record could not be resolved to a review id, and none reported `closed-unmerged`. `getReviewState` returns `unknown` when it could not determine the review's fate, which is not a state the review is in but an answer the sweep did not get. A missing record is the same kind of gap: the `Bundles` section says how many bundles the issue has, so N is known even when a record is not, and an issue judged on fewer records than N is judged on an incomplete set. + An unresolved branch-only record is that same gap in a third shape: the record is there, but nothing behind it can be looked up, so the review it stands for is exactly as unobserved as one whose record is missing. With N of 3 and only two records collected, the cases below would read a partly recorded three-bundle stack as a complete two-bundle one, and case 3 would then close a half-merged issue. - So require a record for every bundle from 1 to N before evaluating cases 3, 4, and 5 at all, and take this case whenever that requirement is unmet. + So require a record for every bundle from 1 to N, and a `getReviewState` result for every one of those records, before evaluating cases 3, 4, and 5 at all, and take this case whenever that requirement is unmet. Change nothing about the issue: close nothing, report nothing about its progress, and leave it exactly as it stands for a later sweep to decide. - Name the review ids that came back `unknown` and the bundles whose records are missing, and say that this issue was left undecided because of them. - Never fold an `unknown` result or a missing record into `merged`, `open`, or "still entirely in review": each of those is a specific claim about work the sweep cannot actually see, and the later cases would otherwise absorb it and make that claim anyway. + Name the review ids that came back `unknown`, the bundles whose records are missing, and the branch-only records that could not be resolved, and say that this issue was left undecided because of them. + Never fold an `unknown` result, a missing record, or an unresolved branch-only record into `merged`, `open`, or "still entirely in review": each of those is a specific claim about work the sweep cannot actually see, and the later cases would otherwise absorb it and make that claim anyway. This case sits below case 1 because a `closed-unmerged` result is a fact the sweep did observe, and its outcome does not depend on the undetermined or unrecorded ones: it closes nothing, restacks nothing, and hands the decision to the user, which is already the safest thing an incomplete picture could ask for. It sits above every case below because those judge the issue on all of its results at once, and neither an undetermined result nor a missing one can carry its share of such a judgment. 3. Every recorded review reports `merged`. From 56e0396aaa05e0f8133c5f5335c10709c6e93fc5 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 03:06:29 -0700 Subject: [PATCH 63/68] fix(fathom): hold rather than open a review absence cannot prove findReviewByBranch returns a bounded candidate list, so a lookup that finds no match is not proof that the branch has no review. The bundle recovery path in execute opened a new review on that basis, which can duplicate a review sitting outside the returned window. Execute now opens a bundle review only where the remote does not carry that bundle's branch at all, which is proof of absence that owes nothing to the lookup. When the branch exists and no candidate matches, or the adapter omits the operation, it stops and holds and tells the user a review may already exist for that branch. forges.md states the same distinction where the operation is defined: its result is bounded, absence cannot be read out of it, and a caller that would create something must establish absence elsewhere or hold. --- skills/execute/SKILL.md | 12 +++++++++--- skills/fathom-shared/forges.md | 6 +++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index 460387d4..b71fc3a8 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -257,13 +257,19 @@ If any of these files cannot be found and read, stop immediately and report whic Later bundles keep this rule exactly as written and never apply the phase, whether their reviews were newly opened or reused. Skip the `openReview` call for a bundle whose review already exists and reuse that review, the same way the single-review path does, so a resumed run never opens a second review for a bundle that has one. Decide whether one exists from that bundle's entry in the `Bundles` section first, since an entry carrying a `- Review:` line names the review outright and needs no lookup at all. - When the entry carries no such line, ask the forge with `findReviewByBranch` for branch k, which returns bounded candidate records carrying each review's id, its URL, and its base, as `../fathom-shared/forges.md` defines the operation, then keep only the candidates whose base is exactly the base `resolveBase` returned for this bundle. + When the entry carries no such line, read whether the remote already carries branch k, and read it before anything in this routine puts that branch on the remote, whether that is the push above or an `openReview` that owns the push under `pushesForYou`, since afterwards every bundle looks alike and the answer is gone. + A branch the remote does not carry cannot have had a review opened from it, so its absence is positive proof that this bundle has no review, and it is the only proof this procedure accepts for that: open the review, and skip the lookup below entirely. + That is the ordinary case on a run that has not been interrupted, which is why a first run through a stack never stops here. + When the remote already carries branch k, ask the forge with `findReviewByBranch` for branch k, which returns bounded candidate records carrying each review's id, its URL, and its base, as `../fathom-shared/forges.md` defines the operation, then keep only the candidates whose base is exactly the base `resolveBase` returned for this bundle. Bundle branches chain, so a head branch can carry a review opened against a different base than this bundle now targets; matching on the exact head and base pair is what keeps this bundle's commits out of that review, and the base in the candidate record is what makes that match possible at all. When exactly one candidate survives that filter, call `getReviewState` on its id before reusing or backfilling it, so its fate is read rather than assumed, and stop and hold when that state is anything other than open. Keep that candidate's URL alongside its id, since the backfill below records both and no other operation in the contract reports a review's URL. When more than one survives, stop and hold naming them, since choosing between two candidate reviews by guess is the failure this pairing exists to prevent. - Call `openReview` for this bundle only when no candidate matches at all. - When the resolved adapter omits `findReviewByBranch`, which `../fathom-shared/forges.md` says is legitimate, no lookup is possible: say once that the forge cannot be asked, treat the missing `- Review:` line as meaning no review exists, and open one, accepting that a review interrupted before its id was recorded is opened a second time here. + When no candidate matches at all, do not call `openReview`: stop and hold instead. + A lookup that comes back with nothing matching does not establish that nothing exists, because the list is bounded and can leave out a review that is really there, as `../fathom-shared/forges.md` states, and the remote already carrying branch k is the very state a review opened by an earlier run leaves behind. + Say in the hold report that the remote carries branch k, that a review may already be open for it, that this run could not find one and cannot prove there is none, and that the user should confirm whether a review exists for that branch before the run continues. + When the resolved adapter omits `findReviewByBranch`, which `../fathom-shared/forges.md` says is legitimate, no lookup is possible at all: say once that the forge cannot be asked, then hold on exactly those same terms, since a missing `- Review:` line on a branch the remote already carries says nothing about whether a review was opened from it. + Holding costs one confirmation on a run that was interrupted between pushing branch k and recording its review, while opening blindly costs a duplicate review that no record names and the sweep can never reconcile, so the hold is the cheaper of the two. Reusing a review does not skip the two recording steps above it, and this is where a resumed run otherwise loses a bundle. Read that bundle's entry in the `Bundles` section, and when it carries no `- Review:` line, backfill one now from the id and URL on the candidate record that matched, in the same `- Review: (bundle k/N)` form, then commit it exactly as the recording step above does: stage only the plan document, by explicit path, verify the staged diff carries only that backfilled line before committing, and word it as the same bookkeeping commit. Push it on branch k before continuing, then carry on with the rest of this routine for that bundle. diff --git a/skills/fathom-shared/forges.md b/skills/fathom-shared/forges.md index 1aaab88a..9a0d2ddb 100644 --- a/skills/fathom-shared/forges.md +++ b/skills/fathom-shared/forges.md @@ -44,10 +44,14 @@ A caller needs all three fields. The id is what `getReviewState` and every later record are written against, the URL is what a `- Review:` line needs in order to name the review to a human, and the base is the only thing that tells apart two reviews sharing one head branch. That last case is routine rather than exotic: bundle branches chain, so one head branch can carry a review opened against a base the caller no longer targets, and `getReviewState` reports a review's fate without reporting what it targets, so the base has to come from here or from nowhere. The list is bounded, so treat it as a set of candidates rather than an exhaustive answer, and match within it rather than trusting it to hold exactly one review. +The bound cuts both ways, so a result carrying no matching candidate is not proof that no such review exists, and an empty list is not proof that the branch has no review at all: each says only that the operation saw none inside its window, which is a different claim from there being none. +Adapters bound this differently and a caller cannot see how, so no caller may read absence out of this operation, however the result comes back. +A caller may act on a match it finds here, since a returned record is a review that demonstrably exists. +A caller that would create something on the strength of absence must not use this result for that: it has to establish absence from evidence outside the operation, or stop and hold, and each caller below states which of those it does. It is used only where a review may exist while nothing in the repository records its id: the sweep repairs records written before review ids were recorded, and `execute` recovers a bundle whose review opened before its `- Review:` line was committed. When the resolved adapter omits the operation entirely, no lookup is possible at all and such a record cannot be repaired. -Each caller says that once, names the record, and then takes the path its own procedure defines for an unrepairable record rather than guessing: the sweep leaves that issue undecided and closes nothing, per `trackers.md`, and `execute` treats a bundle with no recorded review as having none and opens one, per `execute/SKILL.md`. +Each caller says that once, names the record, and then takes the path its own procedure defines for an unrepairable record rather than guessing: the sweep leaves that issue undecided and closes nothing, per `trackers.md`, and `execute` opens a review for a bundle only where the remote does not carry that bundle's branch at all, which is evidence of absence that owes nothing to this operation, and otherwise holds rather than risk opening a second review, per `execute/SKILL.md`. Those two differ because the costs differ, and each file states its own; neither is licensed to invent the other's. ## Declared capabilities From ef9c91473be3ca9a55bb31f42c1877a09861486b Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 03:18:42 -0700 Subject: [PATCH 64/68] fix(fathom): mark a bundle review pending before opening it Branch absence cannot prove a bundle has no review: a forge retains a review after its head branch is deleted, and nothing prevents a bundle branch being deleted or reused before its `- Review:` record is durable, so an interrupted run can leave a review with neither a branch nor a recorded id. The per-bundle routine could then open a duplicate. Add a write-ahead `- Review: pending (bundle k/N)` marker, committed as a bookkeeping commit before `openReview` is called and replaced by the real record once the review publishes. Recovery now reads the marker: no line at all means the call was never attempted, so open the review; a marker with no id means the outcome is unknown, so look it up and hold when that cannot settle it; a full record is reused as before. Document the marker in conventions.md, note that readers collecting review ids treat a marker-only bundle as having no record, and drop the branch-absence claim from the forges.md cross-reference. --- skills/execute/SKILL.md | 42 ++++++++++++++++++----------- skills/fathom-shared/conventions.md | 8 ++++-- skills/fathom-shared/forges.md | 2 +- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index b71fc3a8..11bb3038 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -74,6 +74,7 @@ If any of these files cannot be found and read, stop immediately and report whic Otherwise, when any bundle reports `unknown`, or the collection above found no `- Review:` record for some bundle between 1 and N, change nothing about the issue and leave it for a later sweep: name the review ids that came back `unknown` and the bundles whose records are missing, close nothing, restack nothing, and report no progress for the issue. `unknown` means the sweep did not learn that review's fate, not that the review is open or merged, so calling it any of those states is a claim about work that was never observed. A missing record is the same kind of gap and is treated identically: the `Bundles` section says how many bundles this issue has, so N is known even when a record is not, and a stack judged on fewer records than N is judged on an incomplete set. + A bundle carrying only the `- Review: pending (bundle k/N)` marker described in `conventions.md` counts as a missing record here rather than as a review: the marker names no id, so there is nothing for `getReviewState` to be called on and nothing is known about that bundle's fate. With N of 3 and only two records collected, every case below would read a partly recorded three-bundle stack as a complete two-bundle one, and the first of them would move a half-merged issue to `done`. So require a record for every bundle from 1 to N before evaluating any of the aggregate cases below, and take this case whenever that requirement is unmet. This case sits below the `closed-unmerged` case, which closes nothing and restacks nothing whatever the undetermined or unrecorded bundles turn out to be, and above the three cases below, each of which judges the whole stack on all of its bundles at once and cannot do that with an undetermined or missing bundle among them. @@ -235,19 +236,25 @@ If any of these files cannot be found and read, stop immediately and report whic These two run in this order because the leftover commit changes the very range the reconciliation counts. Reconciling first would count a range still missing that commit, so a bundle with leftover work would come up short and stop the routine even though nothing was wrong; and where the count happened to match anyway, the leftover commit would land in the range afterwards and never be reconciled at all. - Call `resolveBase` on bundle 1's base, which is the resolved base branch, or on branch k-1 for every later bundle. + - Write `- Review: pending (bundle k/N)` beneath that bundle's line in the plan document's `Bundles` section, and commit it on branch k, before calling `openReview` for this bundle. + Stage only the plan document, by explicit path, per the staging rules in `conventions.md`, list what is staged and confirm it carries only that one added marker line, and word it as bookkeeping rather than as a task: `chore(): mark bundle k review pending`, naming no task in the body. + That is the same kind of commit as the `- Review:` record below and `conventions.md` excludes it from task and commit reconciliation for the same reasons. + Make it before branch k reaches the remote, so that whichever push puts the branch there carries it: the push below on an ordinary adapter, or the push `openReview` owns under `pushesForYou`. + This marker is a write-ahead record of intent, and writing it ahead of the call is the whole point: after `openReview` has been entered, a run that dies leaves no other trace that the call was ever made. - Push branch k, unless the adapter declares `pushesForYou`, exactly as the single-review path does. - Call `openReview` with branch k, that base, a title naming the bundle, and a body built per the stack rules in `conventions.md`: the closing reference only in bundle N, plus `Part k of N`, plus `Depends on` the previous bundle's review URL for every bundle after the first. Pass the previous bundle's review id as `dependsOn` for every bundle after the first, and omit it for bundle 1. - Branch on what `openReview` returned before doing anything with it, since the manual-handoff result defined in `../fathom-shared/forges.md` is a typed outcome of that call and carries no review id. - When it is that result, there is no review object for this bundle: do not call `publishReview`, do not write a `- Review:` line for it, and stop and report the handoff for bundle k rather than continuing to bundle k+1. + When it is that result, there is no review object for this bundle: do not call `publishReview`, do not write a `- Review: ` record for it, and stop and report the handoff for bundle k rather than continuing to bundle k+1. Writing a record from it would put an entry in the `Bundles` section with no id behind it, which the sweep reads as a review it can look up and cannot, and continuing would leave bundle k+1 with no id to pass as `dependsOn` and no URL for its `Depends on` line. + Remove the pending marker written above as part of stopping, committing that removal as the same kind of bookkeeping commit, since this result says outright that no review object was created and a marker left behind would hold every later run on a bundle that provably has none. A stacked run should not normally reach this at all, because the manual tier never proposes a split, as `../fathom-shared/forges.md` states, and it is the only tier that hands a review off by hand. So treat this branch as a guard against an adapter that returns the handoff result from a non-manual tier, rather than as a path a correct run is expected to take, and say that plainly when it fires. - Call `publishReview` with the returned id. - - Record `- Review: (bundle k/N)` beneath that bundle's line in the plan document's `Bundles` section, since the sweep looks reviews up by id and needs every one of them. + - Replace that bundle's `- Review: pending (bundle k/N)` marker with `- Review: (bundle k/N)` in the plan document's `Bundles` section, since the sweep looks reviews up by id and needs every one of them. - Commit and push that recorded line immediately, on branch k, before moving to bundle k+1's branch or doing anything else. Stage only the plan document, by explicit path, per the staging rules in `conventions.md`, and word it as bookkeeping rather than as a task: `chore(): record bundle k review id`, naming no task in the body. - Then do what those same staging rules require before every commit: list what is staged and confirm every part of it belongs to the work at hand, which here is the one added `- Review:` line and nothing else. + Then do what those same staging rules require before every commit: list what is staged and confirm every part of it belongs to the work at hand, which here is the one `- Review:` line that replaced the marker and nothing else. Staging that document by path takes whatever else is already sitting in it, so when the staged diff carries an unrelated edit as well, unstage it rather than committing it and cleaning up later, and leave it in the working tree for the run's final closing commit to carry. `conventions.md` excludes plan document and bookkeeping commits from task and commit reconciliation, and a commit shaped this way is one of them, so it cannot be miscounted as the commit that implemented a task. Waiting for the run's final closing commit instead would leave bundle 1's review id uncommitted through bundles 2 and 3, where a sweep run from another clone cannot see it and an interrupted run leaves it on one machine's disk only. @@ -256,26 +263,31 @@ If any of these files cannot be found and read, stop immediately and report whic That is a phase update and nothing more: reusing a review never reopens it and never calls `publishReview` on it again. Later bundles keep this rule exactly as written and never apply the phase, whether their reviews were newly opened or reused. Skip the `openReview` call for a bundle whose review already exists and reuse that review, the same way the single-review path does, so a resumed run never opens a second review for a bundle that has one. - Decide whether one exists from that bundle's entry in the `Bundles` section first, since an entry carrying a `- Review:` line names the review outright and needs no lookup at all. - When the entry carries no such line, read whether the remote already carries branch k, and read it before anything in this routine puts that branch on the remote, whether that is the push above or an `openReview` that owns the push under `pushesForYou`, since afterwards every bundle looks alike and the answer is gone. - A branch the remote does not carry cannot have had a review opened from it, so its absence is positive proof that this bundle has no review, and it is the only proof this procedure accepts for that: open the review, and skip the lookup below entirely. - That is the ordinary case on a run that has not been interrupted, which is why a first run through a stack never stops here. - When the remote already carries branch k, ask the forge with `findReviewByBranch` for branch k, which returns bounded candidate records carrying each review's id, its URL, and its base, as `../fathom-shared/forges.md` defines the operation, then keep only the candidates whose base is exactly the base `resolveBase` returned for this bundle. + Decide that from that bundle's entry in the `Bundles` section and from nothing else, since the pending marker above is written and committed before `openReview` is called and is therefore the only record that separates a deliberate attempt from an accident. + Exactly one of three cases holds for bundle k. + When the entry carries a full `- Review: (bundle k/N)` line, the review exists and is already recorded: reuse it, open nothing, change no record, and skip the lookup below entirely. + When the entry carries no line at all beneath it, `openReview` was never attempted for this bundle, because the marker is committed before the call and no run reaches the call without it, so no review can exist for this bundle: write the marker as the routine above says, open the review, and skip the lookup below entirely. + That is the ordinary case on a first run through a stack, which is why a first run never stops here. + When the entry carries a `- Review: pending (bundle k/N)` marker and no id, the call was attempted and its outcome was never recorded, so a review may or may not exist: work through the lookup below, and hold wherever it cannot settle the question. + Do not read the remote's branch list as evidence in any of these three cases, and never treat a branch the remote does not carry as proof that no review was opened from it. + A forge retains a review after its head branch is deleted, and nothing in the lifecycle rules prevents a bundle branch being deleted or reused before its `- Review:` record is durable, so branch absence cannot tell a bundle that was never attempted from one whose review was opened and whose branch later went away. + The pending marker carries that intent instead, and it is the only evidence this procedure accepts for it. + On the pending case, ask the forge with `findReviewByBranch` for branch k, which returns bounded candidate records carrying each review's id, its URL, and its base, as `../fathom-shared/forges.md` defines the operation, then keep only the candidates whose base is exactly the base `resolveBase` returned for this bundle. Bundle branches chain, so a head branch can carry a review opened against a different base than this bundle now targets; matching on the exact head and base pair is what keeps this bundle's commits out of that review, and the base in the candidate record is what makes that match possible at all. When exactly one candidate survives that filter, call `getReviewState` on its id before reusing or backfilling it, so its fate is read rather than assumed, and stop and hold when that state is anything other than open. Keep that candidate's URL alongside its id, since the backfill below records both and no other operation in the contract reports a review's URL. When more than one survives, stop and hold naming them, since choosing between two candidate reviews by guess is the failure this pairing exists to prevent. When no candidate matches at all, do not call `openReview`: stop and hold instead. - A lookup that comes back with nothing matching does not establish that nothing exists, because the list is bounded and can leave out a review that is really there, as `../fathom-shared/forges.md` states, and the remote already carrying branch k is the very state a review opened by an earlier run leaves behind. - Say in the hold report that the remote carries branch k, that a review may already be open for it, that this run could not find one and cannot prove there is none, and that the user should confirm whether a review exists for that branch before the run continues. - When the resolved adapter omits `findReviewByBranch`, which `../fathom-shared/forges.md` says is legitimate, no lookup is possible at all: say once that the forge cannot be asked, then hold on exactly those same terms, since a missing `- Review:` line on a branch the remote already carries says nothing about whether a review was opened from it. - Holding costs one confirmation on a run that was interrupted between pushing branch k and recording its review, while opening blindly costs a duplicate review that no record names and the sweep can never reconcile, so the hold is the cheaper of the two. + A lookup that comes back with nothing matching does not establish that nothing exists, because the list is bounded and can leave out a review that is really there, as `../fathom-shared/forges.md` states, and the pending marker is exactly the state an earlier run leaves behind when it was interrupted around its `openReview` call. + Say in the hold report that bundle k carries a pending marker, that a review may already exist for this bundle, that this run could not find one and cannot prove there is none, and that the user should confirm whether a review exists for that bundle before the run continues. + When the resolved adapter omits `findReviewByBranch`, which `../fathom-shared/forges.md` says is legitimate, no lookup is possible at all: say once that the forge cannot be asked, then hold on exactly those same terms, since a pending marker with no id beside it says nothing about whether the call that followed it created a review. + Holding costs one confirmation on a run that was interrupted between marking bundle k pending and recording its review, while opening blindly costs a duplicate review that no record names and the sweep can never reconcile, so the hold is the cheaper of the two. Reusing a review does not skip the two recording steps above it, and this is where a resumed run otherwise loses a bundle. - Read that bundle's entry in the `Bundles` section, and when it carries no `- Review:` line, backfill one now from the id and URL on the candidate record that matched, in the same `- Review: (bundle k/N)` form, then commit it exactly as the recording step above does: stage only the plan document, by explicit path, verify the staged diff carries only that backfilled line before committing, and word it as the same bookkeeping commit. + That bundle's entry carries the pending marker, since the marker is what brought this run into the lookup at all: replace it now with a real `- Review: (bundle k/N)` line built from the id and URL on the candidate record that matched, then commit it exactly as the recording step above does: stage only the plan document, by explicit path, verify the staged diff carries only that one replaced line before committing, and word it as the same bookkeeping commit. Push it on branch k before continuing, then carry on with the rest of this routine for that bundle. Without that backfill the review exists on the forge and nothing in the repository names it, so the sweep never learns its id, step 7 keeps reading that bundle as the one in progress, and the completeness rule in step 2 leaves the whole issue undecided forever. - When the entry already carries its `- Review:` line, the record is already durable: change nothing, make no commit, and continue. - A bundle with no reusable review is unaffected by any of this and runs the routine above unchanged. + A bundle whose entry already carries its full `- Review:` line never reaches the lookup at all: its record is already durable, so it changes nothing and makes no commit. + A bundle with no line at all is unaffected by any of this and runs the routine above unchanged. After bundle N's routine completes, close the parent task in the memory backend (a no-op for the checklist adapter, whose file is the parent record), which is the one action the single-review path takes that no bundle routine has taken yet. Then skip the single-review path above entirely and continue into the closing actions below, which run once for the issue rather than once per bundle. The parent task is closed exactly once either way: the single-review path closes it before opening its review, and a stacked issue closes it here, after the last bundle's review and before the issue's completion comment. diff --git a/skills/fathom-shared/conventions.md b/skills/fathom-shared/conventions.md index fdc9dd73..7178c492 100644 --- a/skills/fathom-shared/conventions.md +++ b/skills/fathom-shared/conventions.md @@ -62,9 +62,13 @@ Include these sections: - **Tasks** - the planned units of work with their sub-issue links. - **Bundles** - present only when this issue was split into a stack, and omitted entirely otherwise. One line per bundle, in stack order, each reading `- Bundle /: - `. - Add a `- Review: (bundle k/N)` line beneath a bundle once its review exists. + Add a `- Review: pending (bundle k/N)` marker beneath a bundle before its review is attempted, then replace that marker with a `- Review: (bundle k/N)` line once its review exists. The suffix is redundant with the nesting on purpose: the sweep reads these lines individually, and a self-describing record survives being read out of its surrounding context. - Each of those lines is committed and pushed as soon as it is written rather than riding the run's final closing commit, so that every review id is durable and visible from another clone the moment its review is published; `execute` describes exactly where in its per-bundle routine that happens. + The marker is a write-ahead record of intent rather than a record of a review: it names no id, so nothing can be looked up from it, and every reader collecting review ids treats a bundle carrying only the marker as carrying no record at all. + The done-on-merge sweep therefore counts such a bundle among the missing records and leaves the whole issue undecided, and `execute` holds on it rather than opening a review that may duplicate one. + What the marker distinguishes is a bundle whose `openReview` was never attempted, which carries no line at all, from a bundle whose call was attempted and whose outcome was never recorded, which carries the marker. + Branch absence cannot make that distinction, because a forge retains a review after its head branch is deleted, so a bundle branch deleted or reused before its record was durable leaves a review that no branch and no record names; that is why the marker is written ahead of the call rather than inferred afterwards. + Each of those lines, the marker included, is committed and pushed as soon as it is written rather than riding the run's final closing commit, so that both the intent and the review id are durable and visible from another clone the moment each is written; `execute` describes exactly where in its per-bundle routine that happens. Each one lands on its own bundle's branch, though, because that is the branch the run is on when it writes the line. So a checkout of the base branch carries the records of the bundles that have already merged into it and none of the records above them, and reading only what that checkout holds would judge a three-bundle stack on one bundle's record. The branch name on each `- Bundle` line is what makes the rest reachable: the done-on-merge sweep fetches every branch named in this section and reads that branch's own copy of this document to collect the `- Review:` lines it cannot see locally, as `trackers.md` describes. diff --git a/skills/fathom-shared/forges.md b/skills/fathom-shared/forges.md index 9a0d2ddb..246954ab 100644 --- a/skills/fathom-shared/forges.md +++ b/skills/fathom-shared/forges.md @@ -51,7 +51,7 @@ A caller that would create something on the strength of absence must not use thi It is used only where a review may exist while nothing in the repository records its id: the sweep repairs records written before review ids were recorded, and `execute` recovers a bundle whose review opened before its `- Review:` line was committed. When the resolved adapter omits the operation entirely, no lookup is possible at all and such a record cannot be repaired. -Each caller says that once, names the record, and then takes the path its own procedure defines for an unrepairable record rather than guessing: the sweep leaves that issue undecided and closes nothing, per `trackers.md`, and `execute` opens a review for a bundle only where the remote does not carry that bundle's branch at all, which is evidence of absence that owes nothing to this operation, and otherwise holds rather than risk opening a second review, per `execute/SKILL.md`. +Each caller says that once, names the record, and then takes the path its own procedure defines for an unrepairable record rather than guessing: the sweep leaves that issue undecided and closes nothing, per `trackers.md`, and `execute` opens a review for a bundle only where its own plan document records no attempt for that bundle at all, which is evidence of absence that owes nothing to this operation, and otherwise holds rather than risk opening a second review, per `execute/SKILL.md`. Those two differ because the costs differ, and each file states its own; neither is licensed to invent the other's. ## Declared capabilities From b960da78cc4ff05d662501061e8567d89e7b6967 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 03:29:44 -0700 Subject: [PATCH 65/68] fix(fathom): define the pending review marker honestly The marker was described as proof that openReview had been entered, but it is committed before the call, so a run can stop between the commit and the call. Define it in execute/SKILL.md and conventions.md as meaning the call may or may not have started, with the marker's job being to force a lookup rather than to prove anything. Both files carry the same wording. Give the resulting hold a stated remedy: the hold reports the marker, the user confirms whether a review exists, and a confirmation that none does is recorded as a "- Review: none confirmed (bundle k/N)" line in the plan document's Bundles section, so the next run opens the review instead of holding again. The sweep counts that line among the missing records, the same way it counts the bare marker. --- skills/execute/SKILL.md | 24 +++++++++++++++--------- skills/fathom-shared/conventions.md | 10 ++++++++-- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index 11bb3038..23238b0c 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -74,7 +74,7 @@ If any of these files cannot be found and read, stop immediately and report whic Otherwise, when any bundle reports `unknown`, or the collection above found no `- Review:` record for some bundle between 1 and N, change nothing about the issue and leave it for a later sweep: name the review ids that came back `unknown` and the bundles whose records are missing, close nothing, restack nothing, and report no progress for the issue. `unknown` means the sweep did not learn that review's fate, not that the review is open or merged, so calling it any of those states is a claim about work that was never observed. A missing record is the same kind of gap and is treated identically: the `Bundles` section says how many bundles this issue has, so N is known even when a record is not, and a stack judged on fewer records than N is judged on an incomplete set. - A bundle carrying only the `- Review: pending (bundle k/N)` marker described in `conventions.md` counts as a missing record here rather than as a review: the marker names no id, so there is nothing for `getReviewState` to be called on and nothing is known about that bundle's fate. + A bundle carrying only the `- Review: pending (bundle k/N)` marker described in `conventions.md`, or only the `- Review: none confirmed (bundle k/N)` line that records a user's confirmation that no review exists, counts as a missing record here rather than as a review: neither line names an id, so there is nothing for `getReviewState` to be called on and nothing is known about that bundle's fate. With N of 3 and only two records collected, every case below would read a partly recorded three-bundle stack as a complete two-bundle one, and the first of them would move a half-merged issue to `done`. So require a record for every bundle from 1 to N before evaluating any of the aggregate cases below, and take this case whenever that requirement is unmet. This case sits below the `closed-unmerged` case, which closes nothing and restacks nothing whatever the undetermined or unrecorded bundles turn out to be, and above the three cases below, each of which judges the whole stack on all of its bundles at once and cannot do that with an undetermined or missing bundle among them. @@ -240,7 +240,9 @@ If any of these files cannot be found and read, stop immediately and report whic Stage only the plan document, by explicit path, per the staging rules in `conventions.md`, list what is staged and confirm it carries only that one added marker line, and word it as bookkeeping rather than as a task: `chore(): mark bundle k review pending`, naming no task in the body. That is the same kind of commit as the `- Review:` record below and `conventions.md` excludes it from task and commit reconciliation for the same reasons. Make it before branch k reaches the remote, so that whichever push puts the branch there carries it: the push below on an ordinary adapter, or the push `openReview` owns under `pushesForYou`. - This marker is a write-ahead record of intent, and writing it ahead of the call is the whole point: after `openReview` has been entered, a run that dies leaves no other trace that the call was ever made. + The marker means only that a run reached the point of calling `openReview` for that bundle: it is committed before the call, so the call may or may not have started and a review may or may not exist. + Its job is to force the next run to look the review up rather than to prove that any review was created. + Writing it ahead of the call is still the whole point, since once `openReview` has been entered a run that dies leaves no other trace that anything was tried at all. - Push branch k, unless the adapter declares `pushesForYou`, exactly as the single-review path does. - Call `openReview` with branch k, that base, a title naming the bundle, and a body built per the stack rules in `conventions.md`: the closing reference only in bundle N, plus `Part k of N`, plus `Depends on` the previous bundle's review URL for every bundle after the first. Pass the previous bundle's review id as `dependsOn` for every bundle after the first, and omit it for bundle 1. @@ -263,15 +265,16 @@ If any of these files cannot be found and read, stop immediately and report whic That is a phase update and nothing more: reusing a review never reopens it and never calls `publishReview` on it again. Later bundles keep this rule exactly as written and never apply the phase, whether their reviews were newly opened or reused. Skip the `openReview` call for a bundle whose review already exists and reuse that review, the same way the single-review path does, so a resumed run never opens a second review for a bundle that has one. - Decide that from that bundle's entry in the `Bundles` section and from nothing else, since the pending marker above is written and committed before `openReview` is called and is therefore the only record that separates a deliberate attempt from an accident. - Exactly one of three cases holds for bundle k. + Decide that from that bundle's entry in the `Bundles` section and from nothing else, since the pending marker above is written and committed before `openReview` is called and is therefore the only record that separates a bundle no run has tried to open a review for from a bundle where one may exist. + Exactly one of four cases holds for bundle k. When the entry carries a full `- Review: (bundle k/N)` line, the review exists and is already recorded: reuse it, open nothing, change no record, and skip the lookup below entirely. - When the entry carries no line at all beneath it, `openReview` was never attempted for this bundle, because the marker is committed before the call and no run reaches the call without it, so no review can exist for this bundle: write the marker as the routine above says, open the review, and skip the lookup below entirely. + When the entry carries no line at all beneath it, no run has ever reached this bundle's `openReview` call, because the marker is committed before the call and no run reaches the call without it, so no review can exist for this bundle: write the marker as the routine above says, open the review, and skip the lookup below entirely. That is the ordinary case on a first run through a stack, which is why a first run never stops here. - When the entry carries a `- Review: pending (bundle k/N)` marker and no id, the call was attempted and its outcome was never recorded, so a review may or may not exist: work through the lookup below, and hold wherever it cannot settle the question. - Do not read the remote's branch list as evidence in any of these three cases, and never treat a branch the remote does not carry as proof that no review was opened from it. - A forge retains a review after its head branch is deleted, and nothing in the lifecycle rules prevents a bundle branch being deleted or reused before its `- Review:` record is durable, so branch absence cannot tell a bundle that was never attempted from one whose review was opened and whose branch later went away. - The pending marker carries that intent instead, and it is the only evidence this procedure accepts for it. + When the entry carries a `- Review: pending (bundle k/N)` marker and no id, a run reached the call and recorded no outcome, so the call may or may not have started and a review may or may not exist: work through the lookup below, and hold wherever it cannot settle the question. + When the entry carries a `- Review: none confirmed (bundle k/N)` line, the user has already confirmed for an earlier hold that no review exists for this bundle: replace that line with the pending marker as the routine above says, open the review, and skip the lookup below entirely. + Do not read the remote's branch list as evidence in any of these four cases, and never treat a branch the remote does not carry as proof that no review was opened from it. + A forge retains a review after its head branch is deleted, and nothing in the lifecycle rules prevents a bundle branch being deleted or reused before its `- Review:` record is durable, so branch absence cannot tell a bundle no run ever reached from one whose review was opened and whose branch later went away. + The pending marker records that a run got as far as the call instead, and it is the only evidence this procedure accepts on that question. On the pending case, ask the forge with `findReviewByBranch` for branch k, which returns bounded candidate records carrying each review's id, its URL, and its base, as `../fathom-shared/forges.md` defines the operation, then keep only the candidates whose base is exactly the base `resolveBase` returned for this bundle. Bundle branches chain, so a head branch can carry a review opened against a different base than this bundle now targets; matching on the exact head and base pair is what keeps this bundle's commits out of that review, and the base in the candidate record is what makes that match possible at all. When exactly one candidate survives that filter, call `getReviewState` on its id before reusing or backfilling it, so its fate is read rather than assumed, and stop and hold when that state is anything other than open. @@ -280,6 +283,9 @@ If any of these files cannot be found and read, stop immediately and report whic When no candidate matches at all, do not call `openReview`: stop and hold instead. A lookup that comes back with nothing matching does not establish that nothing exists, because the list is bounded and can leave out a review that is really there, as `../fathom-shared/forges.md` states, and the pending marker is exactly the state an earlier run leaves behind when it was interrupted around its `openReview` call. Say in the hold report that bundle k carries a pending marker, that a review may already exist for this bundle, that this run could not find one and cannot prove there is none, and that the user should confirm whether a review exists for that bundle before the run continues. + Say with it what unblocks the next run, since a hold with no stated remedy leaves the bundle blocked forever: when the user confirms that no review exists, replace bundle k's marker with a `- Review: none confirmed (bundle k/N)` line in the `Bundles` section, committed and pushed on branch k as the same bookkeeping commit the recording step below makes, and the next run opens that bundle's review rather than holding again. + When the user instead finds a review that does exist, record it as a full `- Review: (bundle k/N)` line the same way, and the next run reuses it. + Either confirmation belongs in the `Bundles` section, because that is where the next run reads it; a confirmation given only in conversation leaves the durable record unchanged and every later run holds identically. When the resolved adapter omits `findReviewByBranch`, which `../fathom-shared/forges.md` says is legitimate, no lookup is possible at all: say once that the forge cannot be asked, then hold on exactly those same terms, since a pending marker with no id beside it says nothing about whether the call that followed it created a review. Holding costs one confirmation on a run that was interrupted between marking bundle k pending and recording its review, while opening blindly costs a duplicate review that no record names and the sweep can never reconcile, so the hold is the cheaper of the two. Reusing a review does not skip the two recording steps above it, and this is where a resumed run otherwise loses a bundle. diff --git a/skills/fathom-shared/conventions.md b/skills/fathom-shared/conventions.md index 7178c492..ed3f028f 100644 --- a/skills/fathom-shared/conventions.md +++ b/skills/fathom-shared/conventions.md @@ -64,10 +64,16 @@ Include these sections: One line per bundle, in stack order, each reading `- Bundle /: - `. Add a `- Review: pending (bundle k/N)` marker beneath a bundle before its review is attempted, then replace that marker with a `- Review: (bundle k/N)` line once its review exists. The suffix is redundant with the nesting on purpose: the sweep reads these lines individually, and a self-describing record survives being read out of its surrounding context. - The marker is a write-ahead record of intent rather than a record of a review: it names no id, so nothing can be looked up from it, and every reader collecting review ids treats a bundle carrying only the marker as carrying no record at all. + The marker means only that a run reached the point of calling `openReview` for that bundle: it is committed before the call, so the call may or may not have started and a review may or may not exist. + Its job is to force the next run to look the review up rather than to prove that any review was created. + It names no id, so nothing can be looked up from the marker itself, and every reader collecting review ids treats a bundle carrying only the marker as carrying no record at all. The done-on-merge sweep therefore counts such a bundle among the missing records and leaves the whole issue undecided, and `execute` holds on it rather than opening a review that may duplicate one. - What the marker distinguishes is a bundle whose `openReview` was never attempted, which carries no line at all, from a bundle whose call was attempted and whose outcome was never recorded, which carries the marker. + What the marker separates is a bundle no run has ever tried to open a review for, which carries no line at all, from a bundle where a review may exist and no record names it, which carries the marker. Branch absence cannot make that distinction, because a forge retains a review after its head branch is deleted, so a bundle branch deleted or reused before its record was durable leaves a review that no branch and no record names; that is why the marker is written ahead of the call rather than inferred afterwards. + When the lookup cannot settle whether a review exists, the run holds and reports the marker, and the user confirms whether one exists. + Record a confirmation that none exists by replacing that bundle's marker with a `- Review: none confirmed (bundle k/N)` line, committed and pushed on that bundle's branch as the same kind of bookkeeping commit, so the next run opens that bundle's review instead of holding again. + Every reader that treats the bare marker as no record treats a `none confirmed` line the same way, since neither names an id. + A hold that recorded nothing would stop every later run identically, which is why the confirmation lands in this section rather than staying in the conversation that produced it. Each of those lines, the marker included, is committed and pushed as soon as it is written rather than riding the run's final closing commit, so that both the intent and the review id are durable and visible from another clone the moment each is written; `execute` describes exactly where in its per-bundle routine that happens. Each one lands on its own bundle's branch, though, because that is the branch the run is on when it writes the line. So a checkout of the base branch carries the records of the bundles that have already merged into it and none of the records above them, and reading only what that checkout holds would judge a three-bundle stack on one bundle's record. From 0d94041dcb639b4976e5b0a520b2b26a4e2ec0de Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 03:30:24 -0700 Subject: [PATCH 66/68] fix(fathom): settle what the depends-on body line represents github.md forbade encoding a stack dependency a second way while the per-bundle routine wrote a "Depends on " line into every review body after the first, so the two files contradicted each other. Resolve it in favor of the body line being prose: it is written for a human reviewer and carries no machine meaning, so it is not a second representation, and the prohibition covers machine-readable ones such as a label or an extra API call. github.md and conventions.md now carry that sentence identically, and execute/SKILL.md says the same where it passes dependsOn alongside the body line. --- skills/execute/SKILL.md | 1 + skills/fathom-shared/conventions.md | 4 ++++ skills/fathom-shared/forges/github.md | 2 ++ 3 files changed, 7 insertions(+) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index 23238b0c..7b995895 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -246,6 +246,7 @@ If any of these files cannot be found and read, stop immediately and report whic - Push branch k, unless the adapter declares `pushesForYou`, exactly as the single-review path does. - Call `openReview` with branch k, that base, a title naming the bundle, and a body built per the stack rules in `conventions.md`: the closing reference only in bundle N, plus `Part k of N`, plus `Depends on` the previous bundle's review URL for every bundle after the first. Pass the previous bundle's review id as `dependsOn` for every bundle after the first, and omit it for bundle 1. + Those two are not two representations of one dependency: `dependsOn` is the contract's machine-readable argument, which an adapter with no dependency mechanism of its own ignores, while the `Depends on ` body line is prose for a human reviewer and carries no machine meaning, exactly as `conventions.md` and `../fathom-shared/forges/github.md` both state. - Branch on what `openReview` returned before doing anything with it, since the manual-handoff result defined in `../fathom-shared/forges.md` is a typed outcome of that call and carries no review id. When it is that result, there is no review object for this bundle: do not call `publishReview`, do not write a `- Review: ` record for it, and stop and report the handoff for bundle k rather than continuing to bundle k+1. Writing a record from it would put an entry in the `Bundles` section with no id behind it, which the sweep reads as a review it can look up and cannot, and continuing would leave bundle k+1 with no id to pass as `dependsOn` and no URL for its `Depends on` line. diff --git a/skills/fathom-shared/conventions.md b/skills/fathom-shared/conventions.md index ed3f028f..8a679663 100644 --- a/skills/fathom-shared/conventions.md +++ b/skills/fathom-shared/conventions.md @@ -155,5 +155,9 @@ Every bundle's body carries two additional lines instead: - `Part of ` so a reviewer knows this diff is a slice rather than the whole change. - `Depends on `, omitted for bundle 1, which depends on nothing. +`forges/github.md` forbids encoding a stack dependency a second way, and this body line is not that. +The `Depends on ` line in a review body is prose for a human reviewer and carries no machine meaning, so it is not a second representation of the dependency; the prohibition is on machine-readable representations such as a label or an extra API call. +The machine-readable representation is whatever the resolved forge declares: the `dependsOn` argument to `openReview` on a forge with a dependency mechanism of its own, and the base branch alone on a `retarget` forge, whose adapter ignores that argument. + Earlier bundles still name the issue for context, as a plain link with no closing keyword. The distinction is between referencing an issue and instructing the forge to close it, and only the last bundle does the second one. diff --git a/skills/fathom-shared/forges/github.md b/skills/fathom-shared/forges/github.md index 786ba067..0ef0d991 100644 --- a/skills/fathom-shared/forges/github.md +++ b/skills/fathom-shared/forges/github.md @@ -65,6 +65,8 @@ The number is what `getReviewState` looks up, and it resolves from any clone wit Ignore `dependsOn` when it is supplied. `stackedReviews` is `retarget`, so passing the previous bundle's branch as `base` is the entire mechanism, and GitHub needs no separate dependency declaration. Never encode the dependency a second way, such as by adding a label or an extra API call; the base branch already carries it and a second representation can disagree with the first. +The `Depends on ` line in a review body is prose for a human reviewer and carries no machine meaning, so it is not a second representation of the dependency; the prohibition is on machine-readable representations such as a label or an extra API call. +Nothing on GitHub reads that line, which is why the calling skill writes it into every bundle after the first while this operation still ignores `dependsOn`. Two body conventions matter on GitHub specifically, and the calling skill supplies them: From c77083bfdd4fce9459d3ab9fd67de3b682160ea6 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 03:31:09 -0700 Subject: [PATCH 67/68] fix(fathom): backfill a matched review id whatever its state Recovery reused a uniquely matched review only when getReviewState said open and stopped on every other state without writing anything, so a bundle whose interrupted review had merged kept its id unrecorded and the sweep read that bundle as missing a record forever. Record the matched id and URL first, since the candidate came back keyed on this bundle's exact head and base and is true whatever the fate, then use the state only to decide continuation: continue on open and merged, hold on closed-unmerged and unknown, and push the backfilled record before any such hold. --- skills/execute/SKILL.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index 7b995895..fceb506d 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -278,7 +278,13 @@ If any of these files cannot be found and read, stop immediately and report whic The pending marker records that a run got as far as the call instead, and it is the only evidence this procedure accepts on that question. On the pending case, ask the forge with `findReviewByBranch` for branch k, which returns bounded candidate records carrying each review's id, its URL, and its base, as `../fathom-shared/forges.md` defines the operation, then keep only the candidates whose base is exactly the base `resolveBase` returned for this bundle. Bundle branches chain, so a head branch can carry a review opened against a different base than this bundle now targets; matching on the exact head and base pair is what keeps this bundle's commits out of that review, and the base in the candidate record is what makes that match possible at all. - When exactly one candidate survives that filter, call `getReviewState` on its id before reusing or backfilling it, so its fate is read rather than assumed, and stop and hold when that state is anything other than open. + When exactly one candidate survives that filter, that review exists and belongs to this bundle, so back its id and URL into the record first, then call `getReviewState` on that id to decide whether this run may continue. + The state decides continuation and never whether the record may be written: the candidate came back from the forge keyed on this bundle's exact head and base, which makes the id true whatever the review's fate turns out to be, and a merged, closed, or undetermined review whose id goes unrecorded is exactly the bundle the sweep reads as missing a record forever. + Then read the state and act on it. + On `open`, carry on with the rest of this routine for bundle k, which is the ordinary recovery. + On `merged`, carry on the same way: the bundle's outcome is known and good, its review needs no reopening, and its id is now recorded, so the sweep can see that bundle merged. + On `closed-unmerged`, stop and hold after recording, naming bundle k and saying its review was abandoned, since whether to retry, rescope, or drop that work is the user's judgment exactly as it is in the sweep's own abandoned case. + On `unknown`, stop and hold after recording, since nothing was learned about that review's fate and building the next bundle on an outcome this run never observed is the guess this whole lookup exists to avoid. Keep that candidate's URL alongside its id, since the backfill below records both and no other operation in the contract reports a review's URL. When more than one survives, stop and hold naming them, since choosing between two candidate reviews by guess is the failure this pairing exists to prevent. When no candidate matches at all, do not call `openReview`: stop and hold instead. @@ -289,9 +295,10 @@ If any of these files cannot be found and read, stop immediately and report whic Either confirmation belongs in the `Bundles` section, because that is where the next run reads it; a confirmation given only in conversation leaves the durable record unchanged and every later run holds identically. When the resolved adapter omits `findReviewByBranch`, which `../fathom-shared/forges.md` says is legitimate, no lookup is possible at all: say once that the forge cannot be asked, then hold on exactly those same terms, since a pending marker with no id beside it says nothing about whether the call that followed it created a review. Holding costs one confirmation on a run that was interrupted between marking bundle k pending and recording its review, while opening blindly costs a duplicate review that no record names and the sweep can never reconcile, so the hold is the cheaper of the two. - Reusing a review does not skip the two recording steps above it, and this is where a resumed run otherwise loses a bundle. + A matched candidate does not skip the two recording steps above it, whatever its state, and this is where a resumed run otherwise loses a bundle. That bundle's entry carries the pending marker, since the marker is what brought this run into the lookup at all: replace it now with a real `- Review: (bundle k/N)` line built from the id and URL on the candidate record that matched, then commit it exactly as the recording step above does: stage only the plan document, by explicit path, verify the staged diff carries only that one replaced line before committing, and word it as the same bookkeeping commit. - Push it on branch k before continuing, then carry on with the rest of this routine for that bundle. + Push it on branch k before anything else, including before any hold the state above calls for, since a record that never leaves this clone closes none of the gaps below. + Then continue or hold as that state directs. Without that backfill the review exists on the forge and nothing in the repository names it, so the sweep never learns its id, step 7 keeps reading that bundle as the one in progress, and the completeness rule in step 2 leaves the whole issue undecided forever. A bundle whose entry already carries its full `- Review:` line never reaches the lookup at all: its record is already durable, so it changes nothing and makes no commit. A bundle with no line at all is unaffected by any of this and runs the routine above unchanged. From f5c8c1d0850e88ed1e0453aae59e9c3cd34d9155 Mon Sep 17 00:00:00 2001 From: Chris Rodrigues Date: Sat, 8 Aug 2026 17:20:50 -0700 Subject: [PATCH 68/68] fix(fathom): record pending-review recovery on a branch that exists Both outcomes of the pending-review lookup, the backfilled review id and the "none confirmed" line, required a commit and push on branch k. A bundle branch may be deleted or reused before its record is durable, which is the very case the pending marker exists to survive, so branch k was not a guaranteed write path and the recovery outcome could never be made durable there. Every later run then repeated the same lookup and the same hold. Write both recovery records on the branch the run is currently on. Step 7 always resolves a branch that exists, and that branch is always one named in the Bundles section, which the sweep already fetches and reads in full, so nothing becomes unreachable. Also stop step 7 from recreating a missing bundle branch that already carries a review line, since recreating it from the branch below yields an empty branch and silently drops that bundle's commits. The run stays on the highest surviving bundle branch, records what the lookup learns, and then holds on the missing branch. conventions.md and trackers.md are updated to match: the collection rule now takes every review line each fetched branch carries rather than only the line for the bundle that branch belongs to. --- skills/execute/SKILL.md | 22 +++++++++++++++++++--- skills/fathom-shared/conventions.md | 6 ++++-- skills/fathom-shared/trackers.md | 5 +++-- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/skills/execute/SKILL.md b/skills/execute/SKILL.md index fceb506d..f5e9ede2 100644 --- a/skills/execute/SKILL.md +++ b/skills/execute/SKILL.md @@ -65,7 +65,8 @@ If any of these files cannot be found and read, stop immediately and report whic Check it before the cases below rather than after them, since it decides whether `getReviewState` can be called at all. An issue split into a stack has one recorded review per bundle rather than one in total, so collect every bundle's record first, then call `getReviewState` on every id collected before deciding anything about the issue. Those records are not all reachable from the checkout this sweep runs in: each bundle's `- Review:` line is committed on that bundle's own branch, so a sweep running from the base branch checkout sees the records of the bundles that have merged and none of the records above them. - Collect the rest by fetching, per the collection rule in `../fathom-shared/trackers.md`: read the branch names from the plan document's `Bundles` section, fetch each of those branches, and read each fetched branch's own copy of the plan document for that bundle's `- Review:` line. + Collect the rest by fetching, per the collection rule in `../fathom-shared/trackers.md`: read the branch names from the plan document's `Bundles` section, fetch each of those branches, and read each fetched branch's own copy of the plan document, taking every `- Review:` line it carries rather than only the line for the bundle that branch belongs to. + Take them all because a recovery run records a bundle's outcome on whichever branch it was on, which is that bundle's own branch in the ordinary case and a different one when that bundle's branch is gone. This is read-only git work that writes nothing, which is why the ids stay in the plan document rather than being mirrored into a second store the base branch could read directly; one record of a fact cannot disagree with itself. A stack can satisfy more than one of the cases below at once, so check them in the order written and let the first one that applies decide the whole sweep. In particular a stack can hold a merged bundle, an open bundle, and an abandoned one simultaneously, and the abandoned bundle wins: restacking the bundles above it would force-push a rebase onto work the user may be about to discard, which is exactly the unattended destruction that stop exists to prevent. @@ -113,6 +114,10 @@ If any of these files cannot be found and read, stop immediately and report whic When step 8 confirms a stack, later bundles take the same name with their index appended, so bundle 2 of `feat/ONC-5-add-webhooks` is `feat/ONC-5-add-webhooks-2`. Create each of those from the previous bundle's branch at the moment that bundle starts, not up front: creating them all at breakdown time would leave empty branches behind whenever a run stops early. Give every one of them the same already-exists guard bundle 1 has: check out a bundle branch that already exists rather than creating it, and create it only when it is genuinely absent, since creating a branch name that already carries that bundle's commits either fails outright or resets the branch and discards them. + Genuinely absent means absent from the local repository and from the remote both, and it also means no run has ever built that bundle, which holds only when the bundle's entry in the `Bundles` section carries no `- Review:` line of any kind, the pending marker included. + When a bundle's entry carries one of those lines and its branch is absent from both, do not create the branch: some run already committed on it, and recreating the name from the branch below would produce an empty branch that silently drops that bundle's commits. + Stay on the highest bundle branch at or below that one that still exists, and let the run reach the per-bundle routine in step 11 for that bundle, which records what it can learn about that bundle's review and then holds on the missing branch. + Staying rather than stopping outright is what makes that record possible: the branch this run is on is a branch that exists, so a bookkeeping commit can be written and pushed on it, where branch k offers no write path at all. 8. Ensure the breakdown exists. - Skip the rest of this step when a breakdown already exists for this issue. Every decision below is made once, at breakdown time, so a resumed run reads the split, the bundles, and their branches out of the plan document instead of deciding any of them again. @@ -276,6 +281,12 @@ If any of these files cannot be found and read, stop immediately and report whic Do not read the remote's branch list as evidence in any of these four cases, and never treat a branch the remote does not carry as proof that no review was opened from it. A forge retains a review after its head branch is deleted, and nothing in the lifecycle rules prevents a bundle branch being deleted or reused before its `- Review:` record is durable, so branch absence cannot tell a bundle no run ever reached from one whose review was opened and whose branch later went away. The pending marker records that a run got as far as the call instead, and it is the only evidence this procedure accepts on that question. + Branch k being gone is therefore a live possibility here rather than a hypothetical, and it changes what this bundle's routine may do. + When branch k is absent from both the local repository and the remote, run only the lookup below and the recording it calls for, then stop and hold for bundle k: skip the leftover-commit step, skip the reconciliation, and skip `openReview`, since all three read or write a branch that is not there. + The lookup itself still works, because a forge retains a review after its head branch is deleted, which is exactly why branch absence was ruled out as evidence above. + Say that branch k is missing, that bundle k's commits cannot be located from it, and that this run recorded what it learned about that bundle's review and changed nothing else. + Say what unblocks it, too: restore branch k from a clone, a reflog, or a branch above it that still carries those commits, or decide that bundle's work is gone and rebuild it. + Both are the user's judgment call rather than this procedure's, and recreating branch k from branch k-1 is never the remedy, since the name would come back empty and this bundle's commits would be silently absent from its review. On the pending case, ask the forge with `findReviewByBranch` for branch k, which returns bounded candidate records carrying each review's id, its URL, and its base, as `../fathom-shared/forges.md` defines the operation, then keep only the candidates whose base is exactly the base `resolveBase` returned for this bundle. Bundle branches chain, so a head branch can carry a review opened against a different base than this bundle now targets; matching on the exact head and base pair is what keeps this bundle's commits out of that review, and the base in the candidate record is what makes that match possible at all. When exactly one candidate survives that filter, that review exists and belongs to this bundle, so back its id and URL into the record first, then call `getReviewState` on that id to decide whether this run may continue. @@ -290,16 +301,21 @@ If any of these files cannot be found and read, stop immediately and report whic When no candidate matches at all, do not call `openReview`: stop and hold instead. A lookup that comes back with nothing matching does not establish that nothing exists, because the list is bounded and can leave out a review that is really there, as `../fathom-shared/forges.md` states, and the pending marker is exactly the state an earlier run leaves behind when it was interrupted around its `openReview` call. Say in the hold report that bundle k carries a pending marker, that a review may already exist for this bundle, that this run could not find one and cannot prove there is none, and that the user should confirm whether a review exists for that bundle before the run continues. - Say with it what unblocks the next run, since a hold with no stated remedy leaves the bundle blocked forever: when the user confirms that no review exists, replace bundle k's marker with a `- Review: none confirmed (bundle k/N)` line in the `Bundles` section, committed and pushed on branch k as the same bookkeeping commit the recording step below makes, and the next run opens that bundle's review rather than holding again. + Say with it what unblocks the next run, since a hold with no stated remedy leaves the bundle blocked forever: when the user confirms that no review exists, replace bundle k's marker with a `- Review: none confirmed (bundle k/N)` line in the `Bundles` section, committed and pushed on the branch this run is on as the same bookkeeping commit the recording step below makes, and the next run opens that bundle's review rather than holding again. When the user instead finds a review that does exist, record it as a full `- Review: (bundle k/N)` line the same way, and the next run reuses it. Either confirmation belongs in the `Bundles` section, because that is where the next run reads it; a confirmation given only in conversation leaves the durable record unchanged and every later run holds identically. When the resolved adapter omits `findReviewByBranch`, which `../fathom-shared/forges.md` says is legitimate, no lookup is possible at all: say once that the forge cannot be asked, then hold on exactly those same terms, since a pending marker with no id beside it says nothing about whether the call that followed it created a review. Holding costs one confirmation on a run that was interrupted between marking bundle k pending and recording its review, while opening blindly costs a duplicate review that no record names and the sweep can never reconcile, so the hold is the cheaper of the two. A matched candidate does not skip the two recording steps above it, whatever its state, and this is where a resumed run otherwise loses a bundle. That bundle's entry carries the pending marker, since the marker is what brought this run into the lookup at all: replace it now with a real `- Review: (bundle k/N)` line built from the id and URL on the candidate record that matched, then commit it exactly as the recording step above does: stage only the plan document, by explicit path, verify the staged diff carries only that one replaced line before committing, and word it as the same bookkeeping commit. - Push it on branch k before anything else, including before any hold the state above calls for, since a record that never leaves this clone closes none of the gaps below. + Push it on the branch this run is on, before anything else, including before any hold the state above calls for, since a record that never leaves this clone closes none of the gaps below. Then continue or hold as that state directs. Without that backfill the review exists on the forge and nothing in the repository names it, so the sweep never learns its id, step 7 keeps reading that bundle as the one in progress, and the completeness rule in step 2 leaves the whole issue undecided forever. + Both recovery records, the backfilled `- Review: (bundle k/N)` line and the `- Review: none confirmed (bundle k/N)` line, go on the branch this run is on rather than on branch k, and that is what makes either of them writable at all. + Branch k may have been deleted or reused, which is the very possibility the pending marker exists to survive, so requiring the record on branch k would leave the recovery outcome undurable exactly when it matters and every later run would repeat this lookup and this hold. + The branch this run is on is always a branch step 7 resolved and confirmed to exist, so it is always a valid write target. + This costs the sweep nothing, because that branch is always one named in the `Bundles` section, and the sweep fetches every branch named there and reads each one's own copy of the plan document, as `../fathom-shared/trackers.md` and `conventions.md` both describe. + A record on any of those branches is therefore a record the sweep already reads, wherever in the chain that branch sits. A bundle whose entry already carries its full `- Review:` line never reaches the lookup at all: its record is already durable, so it changes nothing and makes no commit. A bundle with no line at all is unaffected by any of this and runs the routine above unchanged. After bundle N's routine completes, close the parent task in the memory backend (a no-op for the checklist adapter, whose file is the parent record), which is the one action the single-review path takes that no bundle routine has taken yet. diff --git a/skills/fathom-shared/conventions.md b/skills/fathom-shared/conventions.md index 8a679663..a59e79ec 100644 --- a/skills/fathom-shared/conventions.md +++ b/skills/fathom-shared/conventions.md @@ -71,11 +71,13 @@ Include these sections: What the marker separates is a bundle no run has ever tried to open a review for, which carries no line at all, from a bundle where a review may exist and no record names it, which carries the marker. Branch absence cannot make that distinction, because a forge retains a review after its head branch is deleted, so a bundle branch deleted or reused before its record was durable leaves a review that no branch and no record names; that is why the marker is written ahead of the call rather than inferred afterwards. When the lookup cannot settle whether a review exists, the run holds and reports the marker, and the user confirms whether one exists. - Record a confirmation that none exists by replacing that bundle's marker with a `- Review: none confirmed (bundle k/N)` line, committed and pushed on that bundle's branch as the same kind of bookkeeping commit, so the next run opens that bundle's review instead of holding again. + Record a confirmation that none exists by replacing that bundle's marker with a `- Review: none confirmed (bundle k/N)` line, committed and pushed on the branch that run is on as the same kind of bookkeeping commit, so the next run opens that bundle's review instead of holding again. Every reader that treats the bare marker as no record treats a `none confirmed` line the same way, since neither names an id. A hold that recorded nothing would stop every later run identically, which is why the confirmation lands in this section rather than staying in the conversation that produced it. Each of those lines, the marker included, is committed and pushed as soon as it is written rather than riding the run's final closing commit, so that both the intent and the review id are durable and visible from another clone the moment each is written; `execute` describes exactly where in its per-bundle routine that happens. - Each one lands on its own bundle's branch, though, because that is the branch the run is on when it writes the line. + Each one lands on whichever branch the run is on when it writes the line, which in the ordinary routine is that bundle's own branch. + A recovery is the exception, and deliberately so: a run recovering a bundle whose branch was deleted or reused records that bundle's outcome on the branch it is on instead, because that branch exists and is a write path while the bundle's own branch offers none. + Either way the record is reachable, since the collection below fetches every branch named in this section rather than only the highest one and takes every `- Review:` line each of them carries. So a checkout of the base branch carries the records of the bundles that have already merged into it and none of the records above them, and reading only what that checkout holds would judge a three-bundle stack on one bundle's record. The branch name on each `- Bundle` line is what makes the rest reachable: the done-on-merge sweep fetches every branch named in this section and reads that branch's own copy of this document to collect the `- Review:` lines it cannot see locally, as `trackers.md` describes. Those branch names are therefore load-bearing for the sweep as well as for a resumed run, and a bundle line without one leaves that bundle's record unreachable. diff --git a/skills/fathom-shared/trackers.md b/skills/fathom-shared/trackers.md index bf88c6f3..e62cf8d3 100644 --- a/skills/fathom-shared/trackers.md +++ b/skills/fathom-shared/trackers.md @@ -92,10 +92,11 @@ A single-review issue records one id; an issue split into a stack records one pe Read the records rather than assuming a count: acting on the first id found would decide a stacked issue's fate from one bundle's result while the rest of its work was still open, which is the early close the `Merge-closer: suppressed` marker exists to prevent. A stack's records are spread across its bundle branches rather than gathered in one place. Each bundle's `- Review:` line is committed on that bundle's own branch as that bundle's review publishes, so a checkout of the base branch carries the records of the bundles that have merged into it and none of the records above them. -Collect the missing ones before judging anything: read the branch names from the plan document's `Bundles` section, fetch each of those branches, and read each fetched branch's own copy of the plan document for that bundle's `- Review:` line. +Collect the missing ones before judging anything: read the branch names from the plan document's `Bundles` section, fetch each of those branches, and read each fetched branch's own copy of the plan document, taking every `- Review:` line it carries rather than only the line for the bundle that branch belongs to. +Take them all because a run recovering a bundle whose branch was deleted or reused records that bundle's outcome on the branch it is on, which is a write path that exists, so that bundle's line can sit on a branch other than its own. A bundle branch is created from the branch below it, so the highest one that still exists carries every record beneath it, and fetching all of them costs nothing beyond that. Prefer this to mirroring the ids into a store the base branch can read directly, such as a tracker comment or a second file: fetching is read-only git work that needs no write anywhere and cannot drift, whereas a second record of the same fact is a second thing that can disagree with the plan document. -When a bundle's branch is absent from the remote and its record is not on the current branch either, that bundle simply has no record, and case 2 below decides what happens then. +When no `- Review:` line for a bundle turns up on the current branch or on any branch this collection fetched, that bundle simply has no record, and case 2 below decides what happens then. An issue none of whose bundles have merged has no record on the base branch at all, since the plan document itself is committed on bundle 1's branch, so from a base checkout that issue is not found by the search above. That is exactly how an unmerged single-review issue behaves, and it is correct: nothing has merged, so there is nothing to close.