Skip to content

base-commit pinning: baseCommit dispatch field split from ref, branch-o… - #1007

Merged
jayminwest merged 3 commits into
mainfrom
warren/run_9qf0tejnzy6a
Aug 19, 2026
Merged

base-commit pinning: baseCommit dispatch field split from ref, branch-o…#1007
jayminwest merged 3 commits into
mainfrom
warren/run_9qf0tejnzy6a

Conversation

@warren-forge-bnnl24

Copy link
Copy Markdown
Contributor

Summary

feat(runs): base-commit pinning — baseCommit dispatch field split from ref (warren-aaf7)

Agent notes

Split runs.ref's two meanings: ref stays branch-shaped (workspace base for
branch dispatches AND the reap PR base — byte-identical semantics for every
existing ref-dispatch), while a new optional baseCommit (exact 40-hex SHA)
pins the workspace cut point only, never the PR base.

  • runs.base_commit column, migrations both dialects (0051 sqlite / 0046 pg)
  • spawnRun: baseRef = baseCommit ?? continuation/ref resolution; baseCommit
    frozen on the row and echoed by the projections
  • HTTP boundary validation (src/runs/base-commit.ts): ref must pass
    isValidBranchRef; a 40-hex ref is a 400 pointing at baseCommit; baseCommit
    must be exactly 40-hex
  • pushCloneDeltasToOrigin skips a SHA ref with a logged reason instead of
    burning a clone_apply_push failure (legacy SHA-ref rows)
  • infra-lost retry carries baseCommit forward with ref
  • SDK CreateRunInput/DispatchRunInput/RunRow, UI types, warren run
    --base-commit; goldens + cli-reference regenerated

Run

  • Warren run: run_9qf0tejnzy6a
  • Agent: pi
  • Cost: $1.39 (97.5k in / 27.1k out / 11.5M cache-r)

Seeds

  • warren-aaf7 — base-commit pinning: baseCommit dispatch field split from ref, branch-or-SHA validation at the HTTP boundary, PR base stays branch-shaped

Commits (1)

  • 24b4d6d feat(runs): base-commit pinning — baseCommit dispatch field split from ref (warren-aaf7)

Files changed

.mulch/expertise/tracker.jsonl                     |    1 -
 .mulch/mulch.config.yaml                           |    1 -
 docs/cli-reference.md                              |    1 +
 scripts/check-wire-types.ts                        |    8 -
 .../commands/__golden__/prime/prime-document.json  |    4 +
 .../commands/__golden__/prime/prime-pretty.json    |    2 +-
 src/cli/commands/plan-status.test.ts               |    1 +
 src/cli/commands/run.test.ts                       |    1 +
 src/cli/commands/run.ts                            |    3 +
 src/cli/commands/show.test.ts                      |    1 +
 src/cli/commands/wait.test.ts                      |    1 +
 src/cli/main.ts                                    |    5 +-
 src/client/client.ts                               |    1 +
 src/client/types.ts                                |    6 +
 src/core/wire-tracker.test.ts                      |   49 -
 src/core/wire-tracker.ts                           |  156 --
 src/core/wire.ts                                   |    7 +-
 src/db/migrations/0051_massive_slapstick.sql       |    1 +
 src/db/migrations/meta/0051_snapshot.json          | 1420 ++++++++++++++++++
 src/db/migrations/meta/_journal.json               |    7 +
 .../postgres/0046_normal_imperial_guard.sql        |    1 +
 src/db/migrations/postgres/meta/0046_snapshot.json | 1550 ++++++++++++++++++++
 src/db/migrations/postgres/meta/_journal.json      |    7 +
 src/db/repos/runs.ts                               |    3 +
 src/db/schema/postgres.ts                          |    2 +
 src/db/schema/sqlite.ts                            |    4 +
 src/runs/base-commit.test.ts                       |   54 +
 src/runs/base-commit.ts                            |   67 +
 src/runs/reap/clone-apply.test.ts                  |   21 +
 src/runs/reap/clone-apply.ts                       |   14 +
 src/runs/retry/infra-lost-retry.ts                 |    1 +
 src/runs/spawn/base-commit.test.ts                 |   97 ++
 src/runs/spawn/dispatch.ts                         |    5 +-
 src/runs/spawn/types.ts                            |    7 +
 src/seeds-cli/schema.ts                            |   17 +-
 src/seeds-cli/show.test.ts                         |   12 -
 src/seeds-cli/show.ts                              |   21 +-
 .../handlers/__golden__/envelopes/run-detail.json  |    1 +
 .../handlers/runs.dispatch.base-commit.test.ts     |  188 +++
 src/server/handlers/runs/dispatch.ts               |    9 +-
 src/server/handlers/runs/lifecycle.ts              |    3 +
 src/tracker/contract.ts                            |  128 --
 src/tracker/seeds-tracker.test.ts                  |  270 ----
 src/tracker/seeds-tracker.ts                       |  244 ---
 src/ui/src/api/types.ts                            |   37 +-
 src/ui/tsconfig.app.json                           |    1 -
 46 files changed, 3523 insertions(+), 917 deletions(-)

Prompt

Show prompt
Work seeds issue warren-aaf7. First run `sd show warren-aaf7 --json` from the repo root — the issue body is the full spec; this summary is only a digest.

Context: step 15 of plan pl-a37b (v0.18.0), Track C (external-repo readiness). Track A (dispatch-context log) is merged on main. Track B (IssueTracker cut) is being worked in parallel on other branches — do not touch the seeds-cli/tracker wiring.

Scope: base-commit pinning. Split a `baseCommit` dispatch field from `ref` on the dispatch input (POST /runs and spawnRun), with branch-or-SHA validation at the HTTP boundary. A run dispatched with baseCommit=<sha> materializes the workspace at that commit; the PR base must stay branch-shaped (a SHA base → GitHub 422). CRITICAL regression risk: the reap PR-base resolution (src/runs/reap/run.ts around line 132) — the split must keep ref semantics byte-identical for branch refs, or every ref-dispatch (pr-fixer, conflict repair) breaks. Regenerate docs after route/OpenAPI changes: `bun run gen:docs && bun run gen:openapi` (and gen:cli-ref if the CLI gains a flag).

Quality gates are terminal: `bun run check:all` must be green (12/12) before you commit and report done.

Close the issue with `sd close warren-aaf7 --reason "<what you shipped>"`, then commit everything.


🤖 Opened by warren run run_9qf0tejnzy6a

…m ref (warren-aaf7)

Split runs.ref's two meanings: ref stays branch-shaped (workspace base for
branch dispatches AND the reap PR base — byte-identical semantics for every
existing ref-dispatch), while a new optional baseCommit (exact 40-hex SHA)
pins the workspace cut point only, never the PR base.

- runs.base_commit column, migrations both dialects (0051 sqlite / 0046 pg)
- spawnRun: baseRef = baseCommit ?? continuation/ref resolution; baseCommit
  frozen on the row and echoed by the projections
- HTTP boundary validation (src/runs/base-commit.ts): ref must pass
  isValidBranchRef; a 40-hex ref is a 400 pointing at baseCommit; baseCommit
  must be exactly 40-hex
- pushCloneDeltasToOrigin skips a SHA ref with a logged reason instead of
  burning a clone_apply_push failure (legacy SHA-ref rows)
- infra-lost retry carries baseCommit forward with ref
- SDK CreateRunInput/DispatchRunInput/RunRow, UI types, warren run
  --base-commit; goldens + cli-reference regenerated
@jayminwest
jayminwest enabled auto-merge (squash) August 19, 2026 21:29
@jayminwest
jayminwest merged commit 919a975 into main Aug 19, 2026
8 checks passed
@jayminwest
jayminwest deleted the warren/run_9qf0tejnzy6a branch August 19, 2026 22:01
jayminwest added a commit that referenced this pull request Aug 25, 2026
* chore(ci): report what overshot check:size on the PR (warren-8746, #1032)

The file-size budgets only ratchet down on purpose, so there is no honest
auto-heal for this gate the way bundle-size-autoheal re-baselines a
measured bundle, and editing a contributor's source on their branch is not
a bounded action. What was missing is the diagnosis. When a file sits at
its ceiling and two independently green PRs each add lines to it, the
update-branch merge pushes the union, CI re-runs on it, and check:size
fails on a branch where both sides passed alone. Each of #1007, #1009 and
#1011 needed a human to work out which file and by how much.

size-overshoot-report.yml re-runs the gate on the head branch after a
failed CI run. If the gate passes, the failure was something else and the
job says so and stops. If it fails, it posts one comment naming each
overshoot as `path: lines/budget (+N)`, edited in place on a re-run rather
than appended, and exits 0 so it never masks the real failure.

check-file-sizes.ts gains --headroom N, a non-failing mode that reports the
files with N lines of slack or less. The number worth watching is the
slack, not the pass: twelve files have zero headroom at HEAD and 32 sit
within ten lines of a ceiling, so the comment carries that list beside the
overshoot.

The workflow skeleton, the workflow_run trigger, the job-level guard, the
App-token mint and the pr-gate step are cloned from
bundle-size-autoheal.yml. It never pushes, so it asks for contents: read
rather than write.

* chore(ci): build the size report on the branch, post it from the artifact

The privileged workflow_run job checked out the head branch with the App
installation token and then ran bun install and check:size from it. Warren
pushes agent branches directly, so that handed branch-controlled code a
token with pull_requests write, and checkout left it in .git/config.

CI now builds the report on the branch, where no credential is in reach,
and uploads it as the size-overshoot-report artifact. The privileged job
downloads that artifact and posts the comment. It has no checkout, no bun
and no step that runs anything the branch wrote. The PR number still comes
from the API rather than the artifact, and the report text is fenced with
backticks neutralised and a size cap, since the branch wrote it.

No artifact means check:size was not the failure, and the job says so.

* fix(ci): encode the PR branch query

---------

Co-authored-by: Jaymin West <jayminwest@gmail.com>
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.

2 participants