Skip to content

workspace: follow a squash merge to the pull request's original commits #3035

Closed

Description

@lex00

Problem

A squash merge folds a pull request's commits into one new commit. chant already reads the pull request number from a squash subject (packages/core/src/workspace/intent.ts:186), but the per-commit detail is lost to the intent walk: which unit or agent run made which part, and each original commit's trailers and signatures. When a pull request carried several units or runs, the squash commit joins to at most one of them.

The forge keeps the original commits: GitHub keeps refs/pull/<n>/head for good, and Forgejo has an equivalent.

Proposal

  • For a commit in a region whose subject names a pull request, the intent walk can read the pull request's original commits from refs/pull/<n>/head (fetched on demand, or when the reader passes --follow-squash) and report their joins, trailers and signatures under the squash commit.
  • The walk then says which units and runs the squash carried, not only the first one it can see.
  • workspace verify can report the original commits' signatures for a squash commit whose own signature is the forge's (today attested-unverifiable-here).
  • Where the ref can't be fetched (no forge, no access), the walk says so and keeps today's answer.

Acceptance

  • graph --intent --follow-squash shows a squash commit's original commits and what each joins to.
  • graph --intent --record counts a squash commit's work under each unit and run it carried.
  • A missing or unfetchable ref is reported, never fatal.
  • Works on GitHub and Forgejo (refs/pull/* and Forgejo's pull refs), with the forge detected from the remote.

Activity

  1. added
    provenance
    area:workspace
    on Sep 29, 2026
  2. lex00 commented on Oct 4, 2026

    @lex00
    ContributorAuthor

    Design as built in #3427 (stacked on #3425), recorded as ws-092.

    Following is opt-in: --follow-squash on graph --intent, graph --intent --record and workspace runs, plus followSquash on the MCP tools. This matches studio-032 b. The mapping comes from the forge's own refs/pull/<n>/head, which GitHub and Forgejo both keep. A read takes it from the clone when it is there (refs/chant/pull/<n>/head, refs/pull/<n>/head or refs/remotes/origin/pr/<n>). Otherwise it fetches the missing ones from origin in one fetch and keeps them under refs/chant/pull/<n>/head, so the network is used once per pull request. I rejected a squash map written at merge time because it only covers merges made through chant, while a squash done in the forge's web page has no chant step, and because it would be a second copy of what the ref holds. I also rejected parsing the squash body: it depends on a repo setting, people edit it, and it has no SHAs or signatures.

    A squash is a commit whose subject ends with (#<n>), has one parent, and whose PR head is not already in its history. The squash commit node gets squash with the originals' trailers, joins and signatures. It carries what they carry and joins their runs as joinedBy: ["squash"] with via. why narrows each squash line to the original that wrote it, by blame at the head. A ref that can't be read or fetched is the reason squash-unfollowed and is never fatal.

    The workspace verify bullet from the proposal is not built. The originals' signatures are in squash.commits[].signature for a reader to show.

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

    area:workspaceprovenance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions