Skip to content

feat(forge): link a created pull request to its issue (RIG-4034) - #1926

Open
rigel-mintaka wants to merge 3 commits into
compass-obs/rig-4034-t3-projectionfrom
compass-obs/rig-4034-t4-create-link
Open

rigel-mintaka wants to merge 3 commits into
compass-obs/rig-4034-t3-projectionfrom
compass-obs/rig-4034-t4-create-link

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

This PR is part of a stack containing 6 PRs:

  1. main
  2. feat(store): store pull requests and their issue links (RIG-4034) #1900
  3. feat(forge): read PR timestamps, closing refs and PR list rows (RIG-4034) #1914
  4. feat(board): show linked pull requests on board issues (RIG-4034) #1917
  5. "feat(forge): link a created pull request to its issue (RIG-4034)" (this PR)
  6. feat(ingest): hydrate pull requests onto the board (RIG-4034) #1927
  7. feat(ingest): retry PR hydrates held by a budget pause (RIG-4826) #1971

Summary

This is T4 of the PR-to-issue linkage design (docs/designs/server/compass-issue-model-pr-linkage-amendment/design.md, §1 and §3). It stacks on #1917.

  • create_pull_request takes an optional issue link. The server checks only its shape and never reads the issue:
    • number 0 is rejected with invalid_argument;
    • an unresolvable forge is rejected with not_found;
    • a blank repo on another forge is rejected with invalid_argument.
  • An unset or blank repo on the PR's forge means the PR's repo.
  • An UNSPECIFIED forge means the PR's forge.
  • The ownership row, the PR row and the explicit link are written in one transaction:
    • the PR row keeps the forge's created_at;
    • its forge_updated_at is the epoch, so the next hydrate always wins.
  • IssueProjection.PublishExplicitLink then republishes the target issue, plus the issues whose closing-ref fallback it took over.
  • A memo hit writes nothing.
  • The agent tool forge_create_pull_request gains issue (selector + repo + number).
  • The manager and owner role prompts tell agents to pass it.

Verification

  • Go unit tests cover link mapping (including UNSPECIFIED forge and blank repo), each shape error, and the memo hit. Each test was mutation-probed red.
  • A pgtest checks that a linked create shows on the board issue at once with forge_created_at stored, and that a later hydrate replaces the row.
  • TS tests cover the wire mapping and the schema.
  • go test ./..., pgtests, golangci-lint, bun test, tsc and biome all pass.

Risks

A failed publish after the commit is only logged; the next issue hydrate heals the cache.

Compatibility

CreatePullRequestRequest.issue is additive (it lands in #1900).

Documentation

packages/compass-agent/AGENTS.md documents the new tool parameter.

Spec-impact: none. Refs RIG-4034

@linear-code

linear-code Bot commented Oct 7, 2026

Copy link
Copy Markdown

RIG-4034

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Compass engineering docs preview: https://compass-obs-rig-4034-t4-crea.compass-eng-docs.pages.dev

Deployed from compass-obs/rig-4034-t4-create-link at 755bca7.

Changed pages:

create_pull_request takes an optional issue coordinate. The server checks
its shape only, then writes the ownership row, the PR row and the explicit
link in one transaction and republishes the linked issue. The agent tool
gains the issue parameter and the role prompts tell agents to pass it.

Spec-impact: none. Refs RIG-4034

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@rigel-mintaka
rigel-mintaka force-pushed the compass-obs/rig-4034-t4-create-link branch from 31e8399 to e964938 Compare October 7, 2026 07:02
rigel-mintaka and others added 2 commits October 7, 2026 04:16
Board ingestion never refreshes a PR outside an enabled subscription, so the create path writes only the explicit link there; the link attaches once a hydrate stores the row.

Spec-impact: none. Refs RIG-4034

Co-authored-by: Matt Wilkinson <matt@rigel.build>
Create-path tests seed an enabled subscription so the gated insert runs and the hydrated-row-wins check stays live.

Spec-impact: none. Refs RIG-4034

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@rigel-mintaka
rigel-mintaka marked this pull request as ready for review October 7, 2026 11:09
@mattwilkinsonn
mattwilkinsonn added this pull request to stack #1947 October 8, 2026 03:17

This branch has not been deployed

No deployments
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