Skip to content

PR Code tab: per-commit diffs, viewed marks that reset on push, stacked-PR actions, several PRs per thread #1527

Closed

Description

@currentbits

src/components/PrWorkspacePanel.tsx shows PR detail, comments and merge, but no file diff, so reviewing someone else's PR (or a worker's) means leaving the app. A thread links exactly one PR (prNumber: number | null, src/shared/ipc.ts:547). Stacks are only hinted at by the size-cap message (worktrees-pr.js:1591).

Proposal (M–L), in order:

  1. Code tab in the PR workspace: the PR diff using the 0.24 per-file lazy diff renderer, with an all-commits / single-commit picker.
  2. Viewed marks per file, stored per PR + head SHA. After a push, files that changed since they were marked flip to "Changed".
  3. Several PRs per thread (prNumbers[]), including PRs in other repos. The agent can link one with a link_pull_request MCP tool.
  4. Stack actions: detect a chain of PRs whose bases point at each other. "Rebase stack" and "Merge stack" (bottom-up, retargeting the next base to main before deleting the old one; see the stacked-PR lesson in memory).
  5. Auto-settle a thread when all its linked PRs are merged or closed.

Activity

  1. added
    plan:todo
    plan:doing
    and removed
    plan:todo
    on Oct 9, 2026
  2. currentbits commented on Oct 11, 2026

    @currentbits
    OwnerAuthor

    Implementing in the issue order: Code tab on the 0.24 lazy per-file renderer, viewed marks keyed per PR + head/blob SHA, prLinks[] (keeping prNumber as primary), link_pull_request MCP, stack rebase/merge, then settle only when every linked PR is merged or closed.

  3. currentbits commented on Oct 11, 2026

    @currentbits
    OwnerAuthor

    Landed on coder/pr-code-tab-per-commit-diffs-viewed-mark-f635f7 (uncommitted)

    1. Code tab — PrCodeTab uses the 0.24 lazy FileHunks renderer plus an all-commits / single-commit picker (git.prDiff).
    2. Viewed marks — stored per repo#number + head SHA (blob SHA when GitHub sends one). Same blob stays Viewed after a later head; a changed blob flips to Changed.
    3. Several PRs per thread — prLinks[] additive; prNumber stays primary. link_pull_request MCP tool is always registered. Other-repo slugs via -R.
    4. Stack actions — detect base→head chains. Merge is bottom-up and retargets the next PR onto the bottom PR's base (usually main) immediately after each merge. Rebase uses a temp worktree + --force-with-lease.
    5. Auto-settle — only when every linked PR is MERGED/CLOSED.

    Fix while verifying: prStack.defaultBase used the viewed PR's base, so opening the top of a stack would retarget onto a sibling. Now stack[0].baseRefName. Secret-block test was a false fail from inherited CODER_GUARDRAILS_PATH; the suite unsets it.

    Verified: electron/test/pr-workspace.test.js (incl. merge-stack retarget + secret-block), electron/test/pr-links.test.js, renderer helpers + test/prCodeTab.test.tsx. Preload IPC --check clean.

  4. added
    plan:done
    and removed
    plan:doing
    on Oct 11, 2026
  5. currentbits commented on Oct 11, 2026

    @currentbits
    OwnerAuthor

    Implemented on coder/pr-code-tab-per-commit-diffs-viewed-mark-f635f7: Code tab + viewed marks + prLinks + link_pull_request + stack rebase/merge (bottom-up, retarget next onto the stack bottom base) + settle only when every linked PR is terminal.

  6. currentbits commented on Oct 11, 2026

    @currentbits
    OwnerAuthor

    PR: #1602

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

    plan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions