Skip to content

feat(deliver)!: deliver to a level the repo's workflows define, resumably - #98

Merged
jtomaszewski merged 8 commits into
mainfrom
feat/deliver-levels
Nov 28, 2026
Merged

jtomaszewski merged 8 commits into
mainfrom
feat/deliver-levels

Conversation

@jtomaszewski

@jtomaszewski jtomaszewski commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Implements step 1 of the spec in fullstackhouse/fsh-monorepo#622 (the skills part; the skills-internal parts are separate).

🎯 Too many layers decide whether an agent may merge, and they disagree

deliver auto-merged "small" changes with no label check, gated --admin on a per-repo ownerCanSelfMerge knob, and had a separate --merge-only mode for owner approvals. Callers (kickoff, pickup, overnight) each ended with their own merge asks. The result was double clicks: an owner's one decision ("ship it") routinely took two or three asks, plus re-approvals after rebases.

🔧 One Deliver click per level, resumable, read from the repo

  • Without a click, deliver stops at ready. That means checks, review loop, QA evidence when the PR needs it, and CI green, with nothing merged. Small changes no longer auto-merge.

  • Levels are read from the repo. Sources, in order:

    1. .github/workflows triggers: a push to the default branch is the merge level; a workflow_run of a level's workflow follows it; a dispatch-only workflow with a commit/ref input is a dispatched level.
    2. Otherwise, AGENTS.md/README prose.
    3. Otherwise, merged.

    Every ask lists the levels it read and where each came from.

  • One ask per PR, with one Deliver to <level> button per level. The buttons are capped by the clicker's GitHub permission. There are no "when green" variants.

  • --pr N --to <level> carries out the click. It is resumable: each step is skipped when its proof still matches the PR's git patch-id. Proof comes from:

    • this session's own work;
    • CI green on the head, which covers the local checks;
    • a QA evidence comment naming the head;
    • review-loop's existing state.json.

    No state file is added.

    It stops on hard stops: do-not-merge, blocked and qa-failed labels, a CHANGES_REQUESTED review by anyone but the clicker, and unresolved human threads. On needs-qa with evidence on the head, it applies qa-approved (the click is the sign-off). An admin's click merges with --admin only after the base's required checks passed on the head. A non-admin's click requests a review from reviewers and continues once approved. It then promotes the merge commit up to the clicked level and updates the same ask.

  • Rebases keep the approval. Same patch-id (or same-change with docs tolerance), or a non-material follow-up (under ~100 lines, no new files), keeps the click valid. Anything else re-asks.

  • Repos with their own delivery skills (the Open Mercato om-* pipeline) are not merged or promoted through deliver.

  • kickoff, pickup and overnight end with deliver's Deliver ask. overnight's merge train becomes one Deliver ask for the train.

  • ownerCanSelfMerge is removed from deliver and the README profile keys, and a leftover key is ignored. --merge-only / --expect-head remain as deprecated aliases for one release. Version 2.24.0 → 3.0.0 (breaking: no auto-merge, profile knob removed).

🧩 How the pieces fit

flowchart TD
  run["deliver (no --to)"] -->|"phases 1-6b, skip on proof"| ready["ready: Phase 7 assesses"]
  ready -->|"opens"| ask["Deliver ask: one button per level, capped by permission"]
  ask -->|"click: --pr N --to L"| click["Deliver to a level"]
  click -->|"hard stops, approval vs head"| proof["steps 5-7: re-prove ready, CI green, QA sign-off"]
  proof -->|"merge (admin bypass or review request)"| merged["merge level"]
  merged -->|"follows / dispatch"| promote["promote up to L"]
  promote -->|"updates"| ask
Loading

🔍 Spec section → diff

  • Proposed Solution 1 and 4 (levels, buttons, permission cap) → new ## Levels and ## The Deliver ask sections in deliver/SKILL.md.
  • Proposed Solution 2 (--merge-only folded into a rerun; own-skills repos) → ## Deliver to a level replaces ## Merge-only mode, keeping its rebase-and-prove and same-change. Also a Project-specifics bullet and hard rule 14.
  • Proposed Solution 3 (resumable, no state file) → new ## Proof section, "skip on proof" lines in Phases 2–4, step 5 of Deliver to a level, and the new scripts/patch-id.sh.
  • KDD 3 and 4 (the click authorizes the change; material change re-asks) → the "approved head" paragraph and step 2.
  • KDD 6 (admin bypass after required checks; non-admin requests review) → step 8.
  • KDD 7 (the click is the QA sign-off) → step 7.
  • Phase 7 hard-stop label check → step 1 "Hard stop", step 8 re-check, hard rule 13.
  • Without a click, stop at ready → Phase 7 rewritten as "Ready — and the Deliver ask", and hard rule 12.
  • API contract → Arguments (--pr N [--to <level>], aliases).
  • Data model (ownerCanSelfMerge removed) → Project specifics and README.
  • Step 1 (kickoff, overnight, pickup end with a Deliver ask) → those three skills, plus README rows.

⚠️ Spec gaps (simplest reading taken)

  1. project-bootstrap template: it lives in skills-internal, not here, so it is untouched by this PR. Its ownerCanSelfMerge line needs a separate change there, alongside fleet-process-change.
  2. Path filters: a push-triggered deploy whose paths/paths-ignore excludes every file in the PR's diff is left out of that PR's merge level. Levels are therefore per PR, not per repo. Without this, a side-service deploy to prod on push would name the merge level prod for every PR.
  3. Level names: taken from the stage word in the workflow's name:/file (dev, staging, prod/production, released/release), then from environment names, then the file name. Environment names are often credential scopes (e.g. *-preview on a dev deploy), so they rank second. A merge level of several workflows takes the farthest stage.
  4. workflow_call callees (e.g. a demo deploy called by a release workflow) belong to their caller and are not separate levels. A dispatch whose input is a release tag (not a commit/ref) is not a level.
  5. Dispatched-level proof: a run's headSha is the branch it started on, not the input. So only a run this session dispatched, or one whose displayTitle names a commit containing the merge, counts as proof. Otherwise deliver dispatches again.
  6. Approved head in a fresh session: the button prompt names the head it was offered at (Deliver PR #N to <level> (offered at <sha>)). Without that, the session's own ask is used; for an instruction the owner typed bare, the head at the click is used.
  7. Material change reuses the old auto-merge measure: insertions plus deletions since the approved head under ~100, and no added files.
  8. QA: deliver does not run QA. ready requires a QA evidence comment naming the head only when the PR carries needs-qa; otherwise QA is not a condition.
  9. "Others' CHANGES_REQUESTED" is read as any latest review by someone other than the clicker. "Human threads" means review threads whose first author's GraphQL __typename is not Bot. Unresolved bot threads are worked by Phase 6b, not hard-stopped.
  10. Permission cap: read/triage get no buttons; write/maintain get every level (a merge on a REVIEW_REQUIRED PR requests review); admin can bypass. A dispatched level whose environment has required reviewers excluding the clicker caps the buttons below it.
  11. Stacked children: buttons carry --parent <P> --parent-head <psha>. A click before the parent lands waits for it, like waiting for CI.
  12. The alias --merge-only maps to --to <first level above ready>, which now also waits for that level's deploy and may push small CI fixes.
  13. --no-merge is kept as an accepted no-op (the default), so docs-audit and blacksmith, which still say deliver --no-merge, keep working without edits.
  14. Merge branch deletion: deliver now always uses the old merge-only form (--match-head-commit, remote branch deleted with git push --delete) instead of --delete-branch.

✅ Testing

  • scripts/patch-id.sh: shellcheck clean. In a scratch repo, a rebased head keeps the patch-id, an added change alters it, a bad ref exits 2, and no arguments prints usage and exits 2. same-change.sh is untouched.
  • Version check: plugin.json was bumped to 3.0.0. The repo has no other lint or tests.
  • Level derivation, by hand against four real workflow sets (read with gh api). Repos are anonymized here because this repo is public.
    • Repo A (3-stage app) gives dev → staging → prod, matching the spec.
      • The dev deploy runs on push to main (apps/<app>/** path filter), so it is the merge level, dev.
      • The staging deploy is a workflow_run of the dev deploy, so it follows as staging.
      • The prod deploy is dispatch-only with a sha input, so it is the dispatched level prod.
      • Not levels: CI, image builds (workflow_call), preview and cleanup workflows, scheduled jobs, and a DDL-install dispatch whose only input is an environment choice.
      • Two side-service push deploys with path filters join the merge level only for PRs that touch them. Such a PR's merge level then reads prod, which is the truth: merging deploys that service to prod.
    • Repo B (platform fork) gives released, matching the spec.
      • The release workflow is a workflow_run of CI on main, so it is reached by the merge.
      • The demo deploy is called by the release (workflow_call), and its dispatch takes a tag, not a commit.
      • A docs-site push deploy (path-filtered, no stage word) joins the merge level without naming it.
      • This repo delivers through its own om-* skills, so deliver doesn't merge there.
    • Repo C (client app) gives dev, matching the spec. The dev deploy runs on push (paths-ignore **.md). A dispatch-only seed workflow has no inputs, so it is not a level.
    • Repo D (our ERP app) gives prod, matching the spec. Dev and prod deploys both run on push, so they form one level named after the farthest. A docs-only PR misses the dev deploy (paths-ignore) but still reaches prod.
  • Review: one fresh-context review round over the diff. Its majors were fixed in the second commit:
    • bot-thread detection (GraphQL logins have no [bot] suffix);
    • the approved head carried in the button prompt;
    • the click path re-evaluating Phase 7's ready conditions;
    • pushes and gh pr calls in a detached worktree.
  • Not verified:
    • No live run of --pr N --to <level> against a real PR: no promotion, dispatch, admin merge or review request was exercised.
    • Whether the Claude Code permission classifier allows adding qa-approved on a click (spec open question 2). This needs an interactive session.

🤖 Generated with Claude Code


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

jtomaszewski and others added 2 commits November 27, 2026 13:07
…ably

deliver now stops at `ready` unless the owner clicks a Deliver button.
The PR's one ask offers a button per level read from the repo's
.github/workflows triggers (else its AGENTS.md/README, else `merged`),
capped by the clicker's GitHub permission. `--pr N --to <level>` carries
out the click: it skips every step whose proof (this session, GitHub CI
and QA evidence, review-loop's state) still matches the PR's patch-id,
stops on hard-stop labels, others' requested changes and open human
threads, applies `qa-approved` when QA evidence is on the head, merges,
and promotes the merge commit up to that level.

kickoff, pickup and overnight end with that Deliver ask instead of a
merge ask; overnight's merge train becomes a Deliver ask for the train.

BREAKING CHANGE: deliver no longer auto-merges small changes, and the
`ownerCanSelfMerge` profile key is ignored. `--merge-only` and
`--expect-head` remain as deprecated aliases for one release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jtomaszewski

Copy link
Copy Markdown
Contributor Author

@maxidragon could you review this as part of the delivery redesign (SPEC-051)? The spec is at https://app.notion.com/p/4254d59f776b813ea176f58107e69059 (Notion, FSH Internal) and explains why. The four PRs are the implementation and its end-to-end proof: #98, fullstackhouse/paseo-asks#104, fullstackhouse/paseo-asks#106 and fullstackhouse/paseo#297. paseo-asks#104 narrows your #85 check to buttons that cannot work, so your view there matters most (spec open question 3).

jtomaszewski and others added 5 commits November 28, 2026 02:18
…moves

deliver no longer drives a host's asks tool. It ends its report with a
Next moves block (one move per level, with the exact instruction); a
host such as Paseo's asks plugin turns the moves into buttons and owns
subscription and lifecycle. kickoff, pickup and overnight follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every run's final message ends with it, even with no moves (blocked,
waiting, or at the top level), and a blocked block never asks the owner
to do what a move does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rt and Next moves

The run-to-a-level path ended on hard stops and step 9 without pointing
back at the Next moves block, so agents ended with prose. Every exit now
goes to step 10, which ends with the block, with filled-in examples.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s no moves

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jtomaszewski

Copy link
Copy Markdown
Contributor Author

Update since the review request, for @maxidragon:

Head is b4ece6a.

@jtomaszewski
jtomaszewski marked this pull request as ready for review November 28, 2026 23:15
@jtomaszewski
jtomaszewski merged commit f76f851 into main Nov 28, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant