Skip to content

feat(source-control): reassess action and shared PR update criteria #14199

Description

@kyle-sexton

Brief

TLDR

  • A reassess action on /source-control:pull-request judges one open PR and returns continue, rework or close, with cited evidence.
  • Report-only by default; an explicit request carries out the verdict.
  • One shared set of update criteria replaces the fixed "merge, never rebase" rule in every step that updates a PR branch.
  • One repository setting can force merge or rebase; its default applies the shared table.
  • Proven on constructed PRs, one per verdict.

Problem

  • Gap: nothing judges whether a PR still fits before it merges; the nearest check refuses only a draft whose closing issue is closed (plugins/source-control/skills/pull-request/reference/ready-for-review.md:26-29).
  • Who: anyone landing work through this marketplace's PR skills.
  • Frequency: no measured case. 0 open PRs were created before 2026-11-01 across melodic-software and kyle-sexton (GitHub search, 2026-11-08); the owner chose to build ahead of need.
  • Evidence: rated weak for demand, strong for the absence of the check.

Intent

none stated

  • Q1 own answer: "Are we building it out? Of course, we can't test it until we have that, but I think we can build it out, right?"
  • note: "As far as rebasing versus merging stuff in, that's always an "it depends" scenario. As long as we have good criteria on when one should be done over the other, obviously that should be driven by facts and the latest consensus-based /research. Want to adhere to the DRY principle, single source of truth, low coupling, high cohesion, and all the extensibility and configurability for our plugins. Just go with recommendations based off of that."

Goal

A person or another skill can ask whether one open PR should still land and get a verdict backed by evidence, even when the PR is green and mergeable, and every step that updates a PR branch chooses its method from one shared, research-grounded set of criteria.

  • Intent (why, in the user's words): "driven by facts and the latest consensus-based /research"
  • Vision (where this heads): none stated
  • When goals conflict, prefer: "DRY principle, single source of truth, low coupling, high cohesion, and all the extensibility and configurability for our plugins"

Work size

  • Appetite: one plan, likely two changes (the shared criteria, then the action).
  • Size: medium; touches create, ready, babysit's refresh and a new action.
  • Uncertainty: knowable; research is done, four signal details are deferred below.
  • Split signals: the shared criteria can land before the action.

Constraints

  • Runs on one PR and is not a babysit step (the owner's earlier decision).
  • Named reassess; returns continue, rework or close.
  • Any force push uses git push --force-with-lease=<branch>:<sha>, with the remote tip this session last fetched, captured when the rewrite starts (AGENTS.md:41).
  • A close is marked with do-not-merge, label first and explanation after (AGENTS.md, "Pull request states").
  • Merge versus rebase is decided by stated criteria grounded in facts and current consensus research, never a fixed rule (user, round 2).
  • DRY, single source of truth, low coupling, high cohesion, extensible and configurable (user, round 2).
  • No agent takes a ticket until intent is captured (user).
  • Quality requirement: re-testing after an update: CI on the pushed head, not a local full suite.

Acceptance criteria

  • AC1: A default run on an open or draft PR returns one verdict and changes nothing on the PR.
  • AC2: A constructed green, mergeable PR whose change already landed on the base gets close, naming the commit or PR that replaced it.
  • AC3: A constructed PR whose goal still holds and whose implementation still fits gets continue.
  • AC4: A constructed PR whose goal holds but whose implementation is wrong or partly obsolete gets rework.
  • AC5: Every verdict states the PR's goal and where it was read, the base range examined, and the other PRs searched.
  • AC6: When evidence cannot be read or no goal is stated, the run reports failure and gives no verdict; a close is never given on unreadable evidence.
  • AC7: Acting on continue applies the shared criteria's result (no update, merge or rebase); a conflict follows the existing conflicted-merge rules and stops when both intents cannot hold. Owner decision D12, 2026-11-09, answered "go w/ recommendations": this applies from this session's own checkout of the branch. For a head this session does not hold, --act on continue is a pinned forge merge only: a conflict reports and stops, and no rebase happens, because resolving a conflict there would run that head's code.
  • AC8: Acting on rework posts one comment and nothing else; acting on close adds do-not-merge, then one comment; reassess never closes a PR or lifts a label; where the label does not exist the report says no hold was applied.
  • AC9: Continue posts nothing, except one before-and-after comparison when it rebased a PR that has reviewers.
  • AC10: A fork head gets the label and comment but no push; a PR held by another live session or a babysit lease gets a verdict and no change.
  • AC11: Before acting, the report says a push can dismiss approvals under the stale-review setting and re-runs the review lanes.
  • AC12: A PR in the merge queue or already labeled do-not-merge gets a verdict and no action; a closed or merged PR is refused.
  • AC13: A re-run edits its earlier comment; age alone never counts and no minimum age gates a run.
  • AC14: create's refresh, ready's base merge, babysit's refresh and reassess all read the same criteria source, and the fixed rule at ready-for-review.md:123 is gone.
  • AC15: One repository setting forces merge or rebase; its default applies the shared table.
  • AC16: In this repository the criteria return no update when none is needed, merge when one is needed, and rebase only for a native GitHub stack.

Captured assumptions

  • Quality bar: production
  • Variation intent: not applicable (confirmed)
  • The criteria table's row order is judgment; no source gives one rule: revisit if a repository's outcome surprises its owner.
  • Agents fall back to merge wherever the permission system refuses a force push: revisit if auto mode's default changes.
  • Research corrections to carry into the shipped criteria: state behavior claims as sourced page content, condition "merge does not preserve approvals" on the stale-review setting, and drop the force-push citation that does not support its row (rebase-vs-merge/RESEARCH.md, verification: fail rows 4,7,12).
  • Not requiring reassess before a merge: revisit if a superseded PR lands.

Out-of-scope

  • A babysit step or any automatic trigger for reassess.
  • Closing a PR or lifting a label.
  • Enabling rerere.
  • Scheduled or age-based runs.

Deferred questions

  • Q21: What base range and which other PRs does a run examine?, defer until planning; arbiter: /planning:plan
  • Q22: How are "no base change the PR needs" and "an agent mode that blocks force push" evaluated?, defer until planning; arbiter: /planning:plan
  • Q23: What counts as another author and as human review?, defer until planning; arbiter: /planning:plan
  • Q24: Which landing method applies when a repository allows several?, defer until planning; arbiter: /planning:plan

Design

Module layout

  • plugins/source-control/scripts/branch-update-method.sh: pure decision, stdin signals JSON to stdout decision JSON, no network. Owns every row condition.
  • plugins/source-control/scripts/branch-update-signals.sh: reads the signals for a PR or a branch from git and GitHub. GitHub field notes live under plugins/source-control/reference/providers/github/.
  • plugins/source-control/reference/branch-update-criteria.md: each row's reasoning and source pointers keyed by row id; restates no condition. A test holds the two row-id sets equal.
  • Key pr_update_method in plugins/source-control/schemas/source-control.schema.json, documented in reference/config-resolution.md.
  • Dependency direction: skills and babysit depend on the two scripts; the decision script depends on nothing in the plugin.
  • Readers: create §2.2 and §2.4.1 (branch-only mode, including its worker-mode path), ready §2.5.2, the merge action's stale-base update (plugins/source-control/skills/pull-request/reference/merge.md:30), monitor's stale-branch recovery (plugins/source-control/skills/pull-request/reference/monitor.md:423), babysit refresh_pr_branch.py and the babysit_merge.py enqueue update, and reassess.
  • Babysit passes rewrite: blocked, base_change_needed: yes (its gate already decided an update is due, so none cannot strand a head the gate holds) and a real native_stack read.
  • Exempt, because each carries out a merge already chosen or is an opt-in merge: push-branch.sh sync_stale_base (the criteria doc records that it still merges under a forced rebase; callers pass --no-sync-stale-base on hold or delegate), the babysit conflict worker, the babysit full-mode freshness merge (plugins/source-control/skills/babysit-prs/reference/loop.md:212, which cannot rewrite and already holds Dependabot heads), conflicts-ci.md, and the stacks.md restack, which is the mechanism native-stack names.
  • One overlap helper holds push-branch.sh's check and is used by the signals script: it runs the base ref's copy of scripts/check-stale-base-overlap.sh, never the head's, and otherwise compares paths changed on both sides.
  • GitHub facts live in the signals script and plugins/source-control/reference/providers/github/pull-request/reassess.md; the criteria doc cites sources per row.
  • Babysit stays merge-only: guard refresh.uses-server-side-update-branch, plugins/source-control/skills/babysit-prs/scripts/tests/test_skill_contract.py:285, babysit evals 71 and 74 and plugins/source-control/skills/babysit-prs/reference/safety.md:1466 are not edited.

Contracts

Evaluate top to bottom, first match. A row needing a signal reported unknown does not match, except the safety rows marked below, where unknown counts as a match.

Id Condition Method Forced value applies
no-update-needed Head holds the base tip; or no conflict, head not required up to date, base change not needed and not a native stack member none no
safety-unknown managed_head or native_stack is unknown (safety row) hold no
managed-head A dependency manager owns the head delegate no
native-stack Native stack member, rewrite allowed, no other authors rebase no
native-stack-blocked Native stack member, rewrite blocked or other authors present or unknown hold no
shared-history Another author's commits on the head, or a PR or branch based on it; unknown counts (safety row) merge no
no-rewrite Rewrite blocked merge no
base-merged Head already holds a merge of the base; unknown counts (safety row) merge no
human-reviewed Human review exists on the current commits merge yes
squash-landing Landing method is squash merge yes
keeps-commits Landing keeps commits, single author, no dependents, no review rebase yes
default-merge Anything else merge yes

Signals (all required; tri-state is yes, no or unknown): head_sha, setting (auto, merge, rebase), setting_level, behind, conflict, up_to_date_required, base_change_needed (judgment input, Q22), native_stack (the PR's REST stack object), managed_head, rewrite (allowed, blocked), other_authors (Q23), dependents, base_merged, human_review (Q23), landing (squash, keeps-commits, unknown; Q24).

{
  "method": "none | merge | rebase | delegate | hold",
  "rule": "<row id>",
  "reason": "<one sentence>",
  "head_sha": "<echoed>",
  "setting": { "value": "auto", "level": "default", "applied": false },
  "unknown": ["<signal names read as unknown>"]
}
  • Malformed input to the decision script exits 2 with no decision; a consumer treats that as hold. The signals script reports a failed read as unknown and exits 0; exit 2 is a usage error.
  • rewrite covers a force push, GraphQL updateMethod: REBASE and Rebase stack. Unreadable is blocked; a head never pushed is allowed; a fork head is blocked. Only attended create, ready and reassess --act may pass --allow-rewrite.
  • merge and none need no special handling. delegate asks the manager. hold skips the update and reports it; ready still runs its other gates. Only a rebase from a non-stack row falls back to a merge, reported, when its push is refused; a refused native-stack rebase is hold.
  • A rebase runs on a detached HEAD. push-branch.sh --preflight runs its default-branch, fork-URL and lane checks and prints the target; the caller then runs the literal git push --force-with-lease=<branch>:<sha>, so the permission system sees the force push. The branch moves only after that push succeeds, so a refusal leaves it untouched. A conflict during a rebase aborts it and stops.
  • Branch-only mode, with no PR: managed_head is no, native_stack comes from the local gh stack record or is no when nothing records the branch, human_review is no, other_authors compares local commit emails, dependents comes from gh pr list --base <branch>, and rewrite is allowed for a head never pushed.
  • The decision is valid only for its head_sha. Callers push local commits first, then read signals, then pin the update: REST update-branch with expected_head_sha, or the pinned lease.
  • pr_update_method: auto (default), merge, rebase. Team level only, read at the PR's base branch, honored only when that base is the default branch; an unknown value resolves to auto with a notice. A forced value replaces only the rows marked yes.

Reassess verdict:

{
  "verdict": "continue | rework | close",
  "goal": { "text": "...", "source": "<where it was read>" },
  "base_range": "<sha>..<sha>",
  "prs_searched": ["<query or number>"],
  "evidence": ["<citation>"],
  "replaced_by": "<commit or PR, close only>",
  "update": "<the decision above, continue only>"
}

No goal or unreadable evidence: the run reports failure and returns no verdict (AC6).

Variation verdicts

  • Forge: contain now, at the signals script and reference/providers/github/. Reason: Brief Variation intent: not applicable (confirmed).
  • Update method: one setting, leave inline. Reason: the Brief asks for one repository setting; no per-row settings and no userConfig level.

Conventions followed

  • plugins/source-control/scripts/landed-work.sh, lane-push.sh: cross-skill scripts with a sibling *.test.sh.
  • plugins/source-control/skills/pull-request/scripts/read-review-venue.sh, read-pre-ready.sh: a key read at the base branch and honored only for the default branch.
  • plugins/source-control/reference/config-resolution.md, schemas/source-control.schema.json: home of YAML keys.
  • plugins/source-control/skills/pull-request/reference/stacks.md: native stacks held for a human by default.
  • plugins/source-control/skills/babysit-prs/reference/freshness.md: Dependabot heads are asked to rebase, never updated.

Net new: the decision script and its JSON, because no existing script chooses an update method; the delegate and hold outcomes, because no method covers a manager-owned head or a stack that cannot be rewritten.
Challenges a pattern: plugins/source-control/skills/pull-request/reference/ready-for-review.md:123 and create.md §2.2, whose fixed rules give way to the criteria.

Plan

Citations checked at: 0a85548

Behavior

  • B1: A default reassess run returns one verdict stating the goal and its source, the base range and the PRs searched, and changes nothing. (AC1, AC5)
  • B2: A green, mergeable PR whose change already landed gets close, naming what replaced it. (AC2)
  • B3: A PR whose goal and implementation still hold gets continue. (AC3)
  • B4: A PR whose goal holds but whose implementation is wrong or partly obsolete gets rework. (AC4)
  • B5: With unreadable evidence or no goal, the run reports failure and gives no verdict. (AC6)
  • B6: Acting on a verdict does exactly the updates, label and single comment the verdict calls for, and a re-run edits that comment. (AC7, AC8, AC9, AC13)
  • B7: Fork heads, held PRs, queued PRs, labeled PRs and closed PRs get the limited outcome their case requires, and the report warns about stale approvals and re-run lanes before acting. (AC10, AC11, AC12)
  • B8: create's refresh, ready's base merge, babysit's refresh and reassess take their method from one source, and the fixed rule is gone. (AC14)
  • B9: One repository setting forces merge or rebase, and its default applies the shared table. (AC15)
  • B10: In this repository the criteria return no update when none is needed, merge when one is needed, and rebase only for a native stack. (AC16)

Load-bearing assumptions

Assumption Source Falsifying check Response if false
The criteria table's row order is judgment Brief Phase 1 Sanity Check: the row table test passes for all eleven rows Moderate: flag and continue
Agents fall back to merge wherever the permission system refuses a force push Brief Phase 3 Sanity Check: ready --unattended passes rewrite: blocked Major: stop and replan
Not requiring reassess before a merge Brief Phase 5 Sanity Check: no merge path names reassess Minor: proceed and note
A repository with no overlap script compares paths changed on both sides, as push-branch.sh does plan Phase 2 Sanity Check: the no-script fixture prints no for disjoint paths and yes for overlapping ones Moderate: flag and continue

Standards grounding

Surface Sections cited Layer provenance
Plugin skills and references .claude/rules/skill-bodies-state-current-rules.md (pointer, as-of date, recheck trigger) team
Shell and Python .claude/rules/ruff-pin.md; AGENTS.md "Running tests locally" team
Pull requests AGENTS.md "Pull request states"; .claude/rules/pr-body-contract.md team

Approach

Two pull requests: PR 1 is Phases 1 to 4, PR 2 is Phases 5 and 6.

Phase settings: phase_order: composed (default); integration_posture: by-kind (no docs/conventions/implementation.yaml); scaffold_stubs: false (default); plan_size_bands: trivial 1, small 5, medium 15 (default). No dead code sits in the touched paths, so there is no removal phase.

Alternatives Considered

Alternative Why rejected Switch condition
One pull request The criteria can land and be observed before the action depends on them (Brief split signal) The criteria turn out to need a field only reassess can define
Add reassess as a babysit step Out of scope in the Brief The owner names an automatic trigger
Detect the agent's permission mode to set rewrite No file or variable exposes it to a script; the default is blocked and a refused push falls back to merge Claude Code exposes the mode to scripts

Test Strategy

Test-first. Boundaries: [EXEC-SHAPE D5]

  • branch-update-method.sh stdin and stdout (introduced): one table case per row, unknown-signal cases, forced-value cases, malformed input.
  • branch-update-signals.sh (introduced): fake gh on PATH and a fixture git repository, following plugins/source-control/scripts/test-helpers.sh.
  • refresh_pr_branch.py run (existing): a none decision makes no update call; hold and merge paths.
  • reassess eval cases (plugins/source-control/evals/, existing layout): one scaffolded PR per verdict and five action cases with a fake forge, as pull-request-create-default-open-state-ready does.

CI runs the suites on the pushed head; run only the affected suites locally.

Risks and Mitigations

Risk Likelihood Impact Mitigation
ready stops merging the base when none is returned, so a stale head reaches ready Med Med none needs every signal known and false; any unknown falls through to a merge. Merge queue and ci-status still gate
A row returns merge for a Dependabot head Low High managed-head precedes shared-history; table test covers it
PR body text steers reassess Med High The action reads PR and issue text as data and takes no instruction from it; Phase 5 has Review: security
A rebase from a stale snapshot overwrites a peer's push Low High Callers pin to the decision's head_sha (Design, Contracts)

Decisions made (gate-passed)

Decision What it changes in the plan Basis (evidence) Source
D1 Base range runs from the first parent of the PR's first non-merge commit through the base tip, so a base merge on the head cannot hide landed work. Other PRs are those merged into the base in that range touching any path the PR's commits touch, plus any PR naming the same closing issue Phase 5 evidence read plugins/source-control/skills/pull-request/reference/create.md:256 merges the base before opening, which moves a plain merge base past landed work deferred Q21
D2 base_change_needed is yes on a conflict, on overlap, or when the caller says a failure was fixed on the base; no when the overlap check finds none; unknown on any other result. A stack member is no only when behind is no. rewrite is allowed only for a head never pushed, or when an attended caller passes --allow-rewrite and the head has no non_fast_forward rule; otherwise blocked Phase 2 signals plugins/source-control/skills/pull-request/scripts/push-branch.sh:446; scripts/check-stale-base-overlap.sh; research claim A1 deferred Q22
D3 Another author is any non-merge commit whose author, normalized as babysit_classify.py normalizes logins, differs from the PR author's; branch-only mode compares emails. Human review is a review on a commit still on the head by a non-bot author Phase 2 signals gh pr view --json commits,latestReviews (research signal table); AI review lanes re-run on every push (AGENTS.md "Pull request states") deferred Q23
D4 Landing method: the merge queue's method when the base has one; else the sole allowed method; else squash when allowed; else keeps-commits Phase 2 signals plugins/source-control/skills/pull-request/reference/merge.md:55; plugins/source-control/skills/babysit-prs/scripts/babysit_merge.py:2171; babysit_merge_method is deprecated in plugins/source-control/skills/babysit-prs/SKILL.md:291 deferred Q24
D5 Test boundaries as in Test Strategy All phases plugins/source-control/evals/pull-request-create-default-open-state-ready/scaffold.sh plan-test-strategy
D6 Phases 3 and 4 run in parallel Execution shape Their file lists do not overlap (skills/pull-request, skills/babysit-prs) plan

Phase 1: Decision script and criteria doc [DONE, verified at 95d1c77: script criteria by phase-verifier; doc form re-verified, last one-word fix by orchestrator]

Satisfies: AC15, AC16
Review: code-design

Implements Design, Module layout and Contracts.

  • Write plugins/source-control/scripts/branch-update-method.test.sh first, then branch-update-method.sh.
  • Write plugins/source-control/reference/branch-update-criteria.md: per row id, why and source pointers with as-of date and recheck trigger. Carry the three corrections: T1, C4 and U1 stated as sourced page content; "merge does not preserve approvals" conditioned on the stale-review setting (R1, R2); FP3 not cited for no-rewrite.
  • Record the sync_stale_base and forced-rebase combination in the doc.

Sanity Check: bash plugins/source-control/scripts/branch-update-method.test.sh exits 0, with cases for each row, a forced rebase with unknown authors returning merge, and an unknown stack returning hold; grep -n "no-rewrite" plugins/source-control/reference/branch-update-criteria.md shows no FP3 on that row.

Phase 2: Signals script and setting [DONE: phase-verifier 9 of 10, criterion 2 sanctioned; fork-head fix checked by orchestrator]

Satisfies: AC15, AC16
Delivers: B9, B10
Review: code-design
Review: security

Implements Design, Contracts and Variation verdicts. [EXEC-SHAPE D2] [EXEC-SHAPE D3] [EXEC-SHAPE D4]

  • Write plugins/source-control/scripts/branch-update-signals.test.sh first, then branch-update-signals.sh with --pr <n> and --branch <b> --base <b> modes. Stack membership reuses the REST stack object (plugins/source-control/skills/babysit-prs/reference/safety.md:790).
  • Add pr_update_method to plugins/source-control/schemas/source-control.schema.json and plugins/source-control/reference/config-resolution.md.
  • Extract push-branch.sh's overlap check (lines 446-469) into one helper both scripts use, always running the base ref's copy.
  • Add --preflight to push-branch.sh: its default-branch, fork-URL and lane checks and the printed target, with no push. The force push stays a literal command in the caller, never inside a script (user rule: never move a command into a script to change what the permission classifier sees).

Sanity Check: bash plugins/source-control/scripts/branch-update-signals.test.sh exits 0, including a behind no-PR branch returning merge rather than hold, no-script fixtures for disjoint and overlapping paths, a head-side script that is never executed, a refused read printing unknown with exit 0, and a non-default-base fixture whose setting_level is not repository; bash plugins/source-control/skills/pull-request/scripts/push-branch.test.sh exits 0; branch-update-signals.sh --pr <an open PR here> piped to branch-update-method.sh prints none or merge.

Phase 3: Pull-request readers [DONE except graded evals: phase-verifier 10 of 12, both failures fixed and checked by orchestrator; claude plugin eval refused by worktree isolation]

Satisfies: AC14
Delivers: B8
Review: code-design

Run budget: 2 runs (the two cases named in the Sanity Check), confirmed against the tokens of the first run; the implementer starts each run by hand and stops at the first usage-limit error, since the eval runner has no run cap

Pre-flight first: search the whole repository for the fixed rule and for each update step, and classify every hit as reader or exempt per Design before editing.

File Action Rationale
[ ] plugins/source-control/skills/pull-request/reference/ready-for-review.md MODIFY §2.5.2 reads the criteria; line 123's rule goes; each method's handling; a rebase procedure with range-diff and signing; rebase conflict stops
[ ] plugins/source-control/skills/pull-request/reference/create.md MODIFY §2.2 (line 77), §2.4.1 (line 260) and worker mode read the criteria through branch-only mode; line 111 points at the shared conflict rules
[ ] plugins/source-control/skills/pull-request/reference/merge.md MODIFY Line 30 reads the criteria
[ ] plugins/source-control/skills/pull-request/reference/monitor.md MODIFY Line 423 points at the criteria
[ ] plugins/source-control/skills/pull-request/SKILL.md MODIFY ready row wording
[ ] plugins/source-control/reference/providers/github/pull-request/ready-for-review.md MODIFY Pinned REST update-branch with expected_head_sha replaces gh pr update-branch
[ ] plugins/source-control/reference/providers/github/pull-request/merge.md MODIFY Line 34 reads the criteria
[ ] plugins/source-control/README.md MODIFY Option row and rule wording
[ ] plugins/source-control/evals/fixtures/gh-forge/gh MODIFY Serve the PR stack field, rules and reviews reads the signals script makes
[ ] plugins/source-control/evals/pull-request-ready-merges-base-never-rebases/ MODIFY Prompt and grader state the criteria result
[ ] docs/upstream/t3dotgg-tstack.md MODIFY Correct the reassess row
[ ] plugins/source-control/skills/pull-request/scripts/push-branch.sh KEEP Exempt, Design; changed only in Phase 2
[ ] plugins/source-control/schemas/source-control.schema.json sync_stale_base text KEEP Still true of that script

An --unattended run passes no --allow-rewrite. A ready run passes it only when attended.

Sanity Check: grep -c "never a rebase" plugins/source-control/skills/pull-request/reference/ready-for-review.md prints 0; grep -c "branch-update-method.sh" plugins/source-control/skills/pull-request/reference/ready-for-review.md prints at least 1 and the same grep on create.md prints at least 2; grep -c "merges the base rather than rebasing" docs/upstream/t3dotgg-tstack.md prints 0; the graded eval cases pull-request-ready-merges-base-never-rebases and pull-request-create-default-open-state-ready pass.

Phase 4: Babysit readers [DONE: phase-verifier passed all 8 criteria]

Satisfies: AC14
Delivers: B8

  • plugins/source-control/skills/babysit-prs/scripts/refresh_pr_branch.py: run the decision after the first validate_current_candidate (line 192) and before line 200, so hold writes no ledger entry and leaves auto-merge armed. Read the PR's REST stack object for native_stack; one extra call per refresh.
  • plugins/source-control/skills/babysit-prs/scripts/babysit_merge.py (line 4964): same decision before the update. hold and exit 2 return hold(...), so a stale head is never enqueued.
  • Run the script through the existing resolve_bash. delegate keeps the Dependabot path.
  • Tests beside the existing ones in skills/babysit-prs/scripts/tests/.
  • KEEP the merge-only assertions: test_skill_contract.py, guard refresh.uses-server-side-update-branch, babysit evals, reference/orchestration.md, reference/safety.md.
  • Update skills/babysit-loop/reference/pre-escalation-dispatch.md and docs/conventions/pr-pipeline/pr-pipeline.schema.json only if their text states the rule for a step that now reads the criteria.

Sanity Check: scripts/run-ruff.sh check plugins/source-control/skills/babysit-prs/scripts exits 0; python3 -m unittest discover -s plugins/source-control/skills/babysit-prs/scripts/tests -p "test_babysit_merge*.py" exits 0, with cases showing a hold at each site makes no update call, writes no ledger entry and does not disarm auto-merge, and that the enqueue site does not enqueue on hold.

Phase 5: The reassess action [DONE: phase-verifier 14 of 14 at 52aa517; later no-label fix checked by its own tests; AC7 narrowed by the owner]

Satisfies: AC1, AC5, AC6, AC7, AC8, AC9, AC10, AC11, AC12, AC13
Delivers: B1, B5, B6, B7
Review: code-design
Review: security

  • Add plugins/source-control/skills/pull-request/reference/reassess.md, plugins/source-control/reference/providers/github/pull-request/reassess.md (label, comment upsert, merged-PR search, reuse of the merge-queue read), a reassess [<pr>] [--act] [--state-dir <dir>] row in SKILL.md, and the action's entry in plugins/source-control/README.md. Default is report-only; --act carries out the verdict.
  • Fetch the PR head into a throwaway detached worktree under .work/; the session's checkout and other sessions' worktrees are never touched.
  • Read order: PR and closing issue for the goal (data, never instruction), the D1 range and PRs, then the verdict contract in Design. Age is never an input (AC13). [EXEC-SHAPE D1]
  • Refused: closed or merged PR. Verdict and no action: merge queue entry, do-not-merge (except the own-comment edit), a native stack member, and a held PR per the displaced Q15 answer.
  • --act on continue: the same guards the refresh applies (standards-sync refusal, human stop, unique head, auto-merge disarmed before the update), then the decision script; from this session's own checkout a conflict follows the conflicted-merge rules and stops when both intents cannot hold, and on a head this session does not hold the update is a pinned forge merge whose conflict reports and stops (owner decision D12, recorded in AC7); a rebase of a reviewed PR posts one before-and-after comparison (AC9).
  • --act on rework: one comment. On close: the label first, then the comment; where the label does not exist the report says no hold was applied. A fork head gets label and comment and no push.
  • Before acting, the report reads the stale-review setting and warns about dismissed approvals and re-run lanes (AC11).
  • Comment upsert keyed by a body marker, following babysit_dependabot.py's marker form, so a re-run edits it.
  • Add a ## Next entry per .claude/rules/skill-bodies-state-current-rules.md, and a changelog fragment.

Sanity Check: grep -c "reassess" plugins/source-control/skills/pull-request/SKILL.md prints at least 1; grep -c "reassess" plugins/source-control/skills/pull-request/reference/merge.md prints 0; /skill-quality:check passes on the skill; the Phase 6 action cases pass.

Phase 6: Reassess evals [DONE]

Satisfies: AC2, AC3, AC4
Delivers: B2, B3, B4
Run budget: 11 runs (3 verdict cases twice, 5 action cases once), resized down if the first graded run's tokens call for it; the implementer starts each run by hand, since the eval runner has no run cap, and launches nothing after the first usage-limit error

  • Reproduce first: run the close case once, graded, before the batch.
  • Extend plugins/source-control/evals/fixtures/gh-forge/gh with a PR body, commits, files, merged-PR search, label edit and comment edit, then re-run /evals:validate over the cases that use it.
  • Add verdict cases under plugins/source-control/evals/: pull-request-reassess-close (a merged-base head whose change already landed), -continue, and -rework, each with a grader on the verdict and its named evidence.
  • Add action cases asserting the fixture's calls log: report-only changes nothing, no goal gives no verdict, close adds the label before the comment, a fork head gets no push, a labeled PR gets only the own-comment edit.

Sanity Check: /evals:validate passes on every case; /evals:plugin-eval reports each verdict case passing in both repeats and each action case passing.

Blast radius

Blast radius: HIGH. It changes what ready, create and babysit do in every consuming repository and in unattended lanes across about twenty files. A revert undoes it.

Stress-test summary

The plan reviewer and /planning:devils-advocate ran at once against the same draft. Findings were read against the code and these were adopted: rebase had no execution path; the overlap script could run head-side code; update steps were missing from the reader list; unknown safety signals fell toward a rewrite; the fallback overrode delegate and hold; D1 missed landed work after a base merge; create §2.4.1 has no PR yet; the refresh insertion point disarmed auto-merge first; the shared eval fixture could not host the cases. The owner decided forced values do not replace base-merged, since the research row cites only C4. Not adopted: rewriting the Brief's Problem, since Phases 1 to 4 serve its Goal.

Execution shape

Dimension Value
Gates Phase 1 gates Phases 2 to 6; Phase 2 gates 3, 4 and 5; Phase 5 gates 6
Shared state plugins/source-control/README.md in Phases 3 and 5, and the eval fixture in Phases 3 and 6, each in separate PRs; a changelog fragment per PR
Disjoint streams Phase 3 (skills/pull-request) and Phase 4 (skills/babysit-prs)
Worker count 2 for Phases 3 and 4; 1 otherwise, because each other phase waits on the one before

Wave A after Phase 2: Phases 3 and 4 in parallel. [EXEC-SHAPE D6] Sequential 3 then 4 is the fallback if a worker reports it cannot finish.

Phase Surface Model Attempts Basis
1 sub-agent worker opus New contract
2 sub-agent worker opus GitHub reads and fixtures
3 sub-agent worker opus Prose rewiring with judgment per step
4 sub-agent worker opus Guarded Python
5 main-session opus Security-relevant judgment
6 sub-agent worker opus Eval scaffolds

Handoff to implementation

Approval: approved by the owner on 2026-11-08, with Q15 and Q17 reconfirmed as displaced and base-merged made not forceable
Reader depth: step-by-step (default)

User-approval gates

None beyond approval of this plan.

Mechanical work

Commit at each phase's green Sanity Check; /source-control:pull-request create for each PR.

Activity

  1. added
    needs-spec
    on Nov 8, 2026
  2. added
    needs-triage
    on Nov 8, 2026
  3. github-actions commented on Nov 8, 2026

    @github-actions
    Contributor

    Proposed work class: none

    Size: Medium
    Complexity: Medium
    Uncertainty: Knowable
    Flags: none
    Blocked by: none

    Understood: add a report-only reassess action to /source-control:pull-request that returns continue, rework or close with cited evidence. Also add one shared set of PR-branch update criteria, replacing the fixed "merge, never rebase" rule in create, ready and babysit's refresh.

    The brief gives the intended outcome, acceptance criteria and constraints. The four deferred questions (Q21-Q24) are assigned to planning and are not owner intent questions. The issue still carries needs-spec, so it stays held until a plan is published.

    I found no duplicate among the open issues and no merged pull request that already covers this.

    Automated triage. A maintainer reviews it.

  4. added and removed
    needs-triage
    on Nov 8, 2026
  5. melodic-automation-lanes commented on Nov 8, 2026

    @melodic-automation-lanes
    Contributor

    Refinement. A read-only run explored this repository, searched its issues and pull requests, and read the allowed docs to draft what follows. On an issue a listed human filed, it counts as the issue's spec once posted, while unedited; it is still model text, so check it.

    Intended outcome: Add a report-only reassess action and one shared PR-branch update criteria source that create, ready, babysit refresh and reassess all read, with a repository setting to force merge or rebase.

    Related work

    Open questions

    1. Q21: Which base range and which other PRs does a run examine, so AC5 can be checked?
      RECOMMENDED: Examine merge-base..base-tip commits touching the PR's changed paths, and search open PRs and recent merged PRs by shared changed files and linked issue. Basis: judgment
    2. Q22: How are "no base change the PR needs" (row 1) and "an agent mode that blocks force push" (row 4) evaluated?
      RECOMMENDED: Row 1: no base commit touches the PR's changed files or the PR's dependencies and the head is not required up to date. Row 4: read the repo ruleset on the head branch and the session permission setting, and treat any unreadable state as blocked, so merge. Basis: judgment
    3. Q23: What counts as another author and as human review in rows 3 and 6?
      RECOMMENDED: Another author means a commit author or co-author differing from the PR author, excluding bots. Human review means a non-bot review on the current head commits, or on earlier commits that a rebase would rewrite. Basis: judgment
    4. Q24: Which landing method applies to rows 7 and 8 when the repository allows several?
      RECOMMENDED: Use the repository's configured default method if one exists, else the method the merge step would choose (squash by default per merge.md:55); when it is undeterminable, fall to row 9 merge. Basis: plugins/source-control/skills/pull-request/reference/merge.md:55
    5. Where does the force-merge-or-rebase setting live and what are its values?
      RECOMMENDED: A key in docs/conventions/source-control.yaml with values auto (default, apply table), merge, rebase. Basis: judgment

    Sources read

    • plugins/source-control/skills/pull-request/reference/ready-for-review.md:123: states the fixed rule 'Refresh the base with a merge, never a rebase', which AC14 removes
    • plugins/source-control/skills/pull-request/reference/create.md:73-113: section 2.2 keeps a pre-push rebase, prefers merge if the branch already has a merge commit, and says every later refresh is a merge
    • plugins/source-control/skills/pull-request/reference/create.md:260: refers to a merge-never-rebase fallback tied to section 2.5.2
    • plugins/source-control/skills/pull-request/reference/merge.md:55: default merge mode is squash, following project convention if different
    • plugins/source-control/skills/pull-request/reference/monitor.md:550: monitor writes to the PR branch, including rebases

    To answer, post a comment that starts with this line:

    **Decision recorded.** <answer>
    

    Automated refinement by the lanes App. Answer with a comment whose first line is **Decision recorded.**.

  6. kyle-sexton commented on Nov 8, 2026

    @kyle-sexton
    MemberAuthor

    Sources behind the research claim ids used in this issue, as of 2026-11-08. The research verifier failed its rows 4, 7 and 12; the Brief lists the corrections to carry.

    Id Claim Sources
    S1 Rewriting history others built on is discouraged by git, Pro Git, the kernel guide and GitHub git-rebase, Pro Git, kernel guide, GitHub
    S2 The stated harm of rewriting pushed commits depends on others having built on them git-push, Pro Git, kernel guide
    S3 The kernel guide says do not rebase a branch that contains history created by others kernel guide
    K1 The kernel guide says back merges should be avoided almost all of the time kernel guide
    K2 The kernel guide says a newer base alone is not generally a good reason to reparent kernel guide
    K3 The kernel guide says a reparented series should be retested as new code kernel guide
    GH1 GitHub advises merging the base into the topic branch frequently to avoid diff confusion branches
    U1 GitHub's GraphQL branch update takes MERGE or REBASE and defaults to MERGE gh api graphql on UpdatePullRequestBranchInput, gh pr update-branch
    U2 GitHub advises updating a pull request branch before merging to catch conflicts or test failures early keeping in sync
    R1 GitHub says Update branch dismisses approvals under the stale-review setting when the diff changes protected branches
    R2 GitHub says approvals go stale when the merge base introduces new changes protected branches
    R3 GitHub says Rebase stack keeps approvals when the diff does not change stacked PRs, changelog
    R4 GitHub's 2018 changelog says the force-pushed link opens a two-dot comparison changelog
    R6 The git range-diff manual documents comparing a branch before and after a rebase git-range-diff
    L1 GitHub says a squash merge does not preserve intermediate pull request commits on the base merges
    L2 GitHub says squash merging suits short-lived branches and warns against reusing a head after a squash merges
    L3 GitHub says unsigned head-branch commits can block a squash merge when signing is required protected branches
    Q1 GitHub says a merge queue gives up-to-date protection without authors updating their branch merge queue
    Q2 GitHub says loose required checks do not require the head branch to be up to date protected branches
    T1 GitHub requires fully linear history between stack branches for merging stacked PRs
    T2 GitHub says rebasing a stack generates signed commits stacked PRs, changelog
    T3 git rebase --update-refs force-updates branches that point at rebased commits git-rebase
    FP1 git-push says a lease without an expected value interacts very badly with background fetch git-push
    FP2 git-push marks lease forms without an explicit expected value as still experimental git-push
    FP3 GitHub says a force push may remove commits collaborators based work on protected branches
    C1 git-rerere targets repeated conflicts on long-lived topic branches and needs rerere.enabled git-rerere
    C2 The git-rerere manual says git rebase also uses recorded resolutions git-rerere
    C3 git's path table marks rr-cache as shared across worktrees path.c
    C4 git rebase drops merge commits by default and --rebase-merges requires re-applying their conflict resolutions git-rebase
    B1 git bisect --first-parent identifies the merge commit when a merged branch introduced a regression git-bisect
    B2 Fossil's critique says bisecting works better on small check-ins than collapsed ones Fossil
    A1 Claude Code's permission docs list force push as blocked by default in auto mode permission modes
    A2 Claude Code Action docs say it cannot rebase or merge branches beyond pushing commits capabilities
  7. kyle-sexton commented on Nov 8, 2026

    @kyle-sexton
    MemberAuthor

    Design

    Module layout

    • plugins/source-control/scripts/branch-update-method.sh: pure decision, stdin signals JSON to stdout decision JSON, no network. Owns every row condition.
    • plugins/source-control/scripts/branch-update-signals.sh: reads the signals for a PR or a branch from git and GitHub. GitHub field notes live under plugins/source-control/reference/providers/github/.
    • plugins/source-control/reference/branch-update-criteria.md: each row's reasoning and source pointers keyed by row id; restates no condition. A test holds the two row-id sets equal.
    • Key pr_update_method in plugins/source-control/schemas/source-control.schema.json, documented in reference/config-resolution.md.
    • Dependency direction: skills and babysit depend on the two scripts; the decision script depends on nothing in the plugin.
    • Readers: create §2.2 and §2.4.1 (branch-only mode, including its worker-mode path), ready §2.5.2, the merge action's stale-base update (plugins/source-control/skills/pull-request/reference/merge.md:30), monitor's stale-branch recovery (plugins/source-control/skills/pull-request/reference/monitor.md:423), babysit refresh_pr_branch.py and the babysit_merge.py enqueue update, and reassess.
    • Babysit passes rewrite: blocked, base_change_needed: yes (its gate already decided an update is due, so none cannot strand a head the gate holds) and a real native_stack read.
    • Exempt, because each carries out a merge already chosen or is an opt-in merge: push-branch.sh sync_stale_base (the criteria doc records that it still merges under a forced rebase; callers pass --no-sync-stale-base on hold or delegate), the babysit conflict worker, the babysit full-mode freshness merge (plugins/source-control/skills/babysit-prs/reference/loop.md:212, which cannot rewrite and already holds Dependabot heads), conflicts-ci.md, and the stacks.md restack, which is the mechanism native-stack names.
    • One overlap helper holds push-branch.sh's check and is used by the signals script: it runs the base ref's copy of scripts/check-stale-base-overlap.sh, never the head's, and otherwise compares paths changed on both sides.
    • GitHub facts live in the signals script and plugins/source-control/reference/providers/github/pull-request/reassess.md; the criteria doc cites sources per row.
    • Babysit stays merge-only: guard refresh.uses-server-side-update-branch, plugins/source-control/skills/babysit-prs/scripts/tests/test_skill_contract.py:285, babysit evals 71 and 74 and plugins/source-control/skills/babysit-prs/reference/safety.md:1466 are not edited.

    Contracts

    Evaluate top to bottom, first match. A row needing a signal reported unknown does not match, except the safety rows marked below, where unknown counts as a match.

    Id Condition Method Forced value applies
    no-update-needed Head holds the base tip; or no conflict, head not required up to date, base change not needed and not a native stack member none no
    safety-unknown managed_head or native_stack is unknown (safety row) hold no
    managed-head A dependency manager owns the head delegate no
    native-stack Native stack member, rewrite allowed, no other authors rebase no
    native-stack-blocked Native stack member, rewrite blocked or other authors present or unknown hold no
    shared-history Another author's commits on the head, or a PR or branch based on it; unknown counts (safety row) merge no
    no-rewrite Rewrite blocked merge no
    base-merged Head already holds a merge of the base merge yes
    human-reviewed Human review exists on the current commits merge yes
    squash-landing Landing method is squash merge yes
    keeps-commits Landing keeps commits, single author, no dependents, no review rebase yes
    default-merge Anything else merge yes

    Signals (all required; tri-state is yes, no or unknown): head_sha, setting (auto, merge, rebase), setting_level, behind, conflict, up_to_date_required, base_change_needed (judgment input, Q22), native_stack (the PR's REST stack object), managed_head, rewrite (allowed, blocked), other_authors (Q23), dependents, base_merged, human_review (Q23), landing (squash, keeps-commits, unknown; Q24).

    {
      "method": "none | merge | rebase | delegate | hold",
      "rule": "<row id>",
      "reason": "<one sentence>",
      "head_sha": "<echoed>",
      "setting": { "value": "auto", "level": "default", "applied": false },
      "unknown": ["<signal names read as unknown>"]
    }
    • Malformed input to the decision script exits 2 with no decision; a consumer treats that as hold. The signals script reports a failed read as unknown and exits 0; exit 2 is a usage error.
    • rewrite covers a force push, GraphQL updateMethod: REBASE and Rebase stack. Unreadable is blocked; a head never pushed is allowed; a fork head is blocked. Only attended create, ready and reassess --act may pass --allow-rewrite.
    • merge and none need no special handling. delegate asks the manager. hold skips the update and reports it; ready still runs its other gates. Only a rebase from a non-stack row falls back to a merge, reported, when its push is refused; a refused native-stack rebase is hold.
    • A rebase runs on a detached HEAD. push-branch.sh --preflight runs its default-branch, fork-URL and lane checks and prints the target; the caller then runs the literal git push --force-with-lease=<branch>:<sha>, so the permission system sees the force push. The branch moves only after that push succeeds, so a refusal leaves it untouched. A conflict during a rebase aborts it and stops.
    • Branch-only mode, with no PR: managed_head is no, native_stack comes from the local gh stack record or is no when nothing records the branch, human_review is no, other_authors compares local commit emails, dependents comes from gh pr list --base <branch>, and rewrite is allowed for a head never pushed.
    • The decision is valid only for its head_sha. Callers push local commits first, then read signals, then pin the update: REST update-branch with expected_head_sha, or the pinned lease.
    • pr_update_method: auto (default), merge, rebase. Team level only, read at the PR's base branch, honored only when that base is the default branch; an unknown value resolves to auto with a notice. A forced value replaces only the rows marked yes.

    Reassess verdict:

    {
      "verdict": "continue | rework | close",
      "goal": { "text": "...", "source": "<where it was read>" },
      "base_range": "<sha>..<sha>",
      "prs_searched": ["<query or number>"],
      "evidence": ["<citation>"],
      "replaced_by": "<commit or PR, close only>",
      "update": "<the decision above, continue only>"
    }

    No goal or unreadable evidence: the run reports failure and returns no verdict (AC6).

    Variation verdicts

    • Forge: contain now, at the signals script and reference/providers/github/. Reason: Brief Variation intent: not applicable (confirmed).
    • Update method: one setting, leave inline. Reason: the Brief asks for one repository setting; no per-row settings and no userConfig level.

    Conventions followed

    • plugins/source-control/scripts/landed-work.sh, lane-push.sh: cross-skill scripts with a sibling *.test.sh.
    • plugins/source-control/skills/pull-request/scripts/read-review-venue.sh, read-pre-ready.sh: a key read at the base branch and honored only for the default branch.
    • plugins/source-control/reference/config-resolution.md, schemas/source-control.schema.json: home of YAML keys.
    • plugins/source-control/skills/pull-request/reference/stacks.md: native stacks held for a human by default.
    • plugins/source-control/skills/babysit-prs/reference/freshness.md: Dependabot heads are asked to rebase, never updated.

    Net new: the decision script and its JSON, because no existing script chooses an update method; the delegate and hold outcomes, because no method covers a manager-owned head or a stack that cannot be rewritten.
    Challenges a pattern: plugins/source-control/skills/pull-request/reference/ready-for-review.md:123 and create.md §2.2, whose fixed rules give way to the criteria.

  8. removed
    needs-spec
    on Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    Work status

    needs-owner-decision

    Priority

    medium

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions