fix: canonicalize git.cafe pull request links#22593

merged3
main
t3/gitcafe-pull-links
opened4d agobyMmaria
View on GitHubTwo-way sync enabledPR last imported 3h ago

git.cafe links supplied as host/repository/number, /pull/<n>, or /pulls/<n> now store t3's existing /pulls/<n> format. the git.cafe forge definition shares parsing and normalization across mcp, manual linking, checkout, and persisted links, including production and staging hosts. git.cafe's canonical browser route remains /pull/<n>; t3 accepts both routes.

verified on 2d7ff98483 against main 6548c006d4: a real codex turn linked pingdotgg/t3code #21353 all three ways, with unlink and empty-list checks between attempts. every new link stored /pulls/21353. manual singular-url linking also stored the plural form, and clicking the linked pr opened its loaded panel.

50 focused existing tests passed through blacksmith; the latest staging fix passed all 18 mcp tests and the persistence/rebuild test again. gitcafe, forge definitions, client-runtime, and server typechecks passed. scoped lint has zero errors and one existing warning; formatting passes. all 30 ci checks pass, and both independent source reviewers approved the final head. no new test files. old persisted singular links are covered by shared parsing but were not exercised in this dev database.

clicking the thread sidebar git.cafe PR badge opens its loaded panel

built by gpt-6.1-sol in the codex harness through t3 code.

Checks

All checks passed

Added 2 commits

  • fix: share git.cafe route recognition for checkout2a3009c
  • fix: canonicalize git.cafe pull request links4cd649e

Note

Written by gpt-6.1-sol on behalf of Maria

@versecafe confirmed: /pulls/22593 now returns 308 to /pull/22593, which returns 200. i clarified the description. this pr accepts both routes everywhere t3 parses them and preserves t3's existing /pulls/<n> storage format, following maria's explicit requirement. the forge's canonical browser route remains /pull/<n>.

Synced from GitHub

Approvability

Verdict: Approved at 2d7ff98

Macroscope's review found this PR approvable — This is a narrowly scoped GitCafe URL canonicalization fix that consistently handles both legacy and current routes across client, server, checkout, and persistence paths. It preserves unrelated URLs and adds focused coverage without schema, deployment, security, billing, default, or static-analysis changes.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ProviderMetricMain baselineThis PRImpactPR ceiling
CodexTotal thread wire5.0 KiB5.0 KiB+7 B (+0.1%)6.8 KiB✅
CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
CodexLive turn WebSocket wire1.2 KiB1.2 KiB+7 B (+0.6%)2.0 KiB✅
CodexLive turn WebSocket decoded20.9 KiB20.9 KiB0 B (0.0%)29.3 KiB✅
CodexLive turn messages220 (0.0%)8✅
ClaudeTotal thread wire5.0 KiB5.0 KiB−7 B (−0.1%)6.8 KiB✅
ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
ClaudeLive turn WebSocket wire1.2 KiB1.2 KiB−7 B (−0.6%)2.0 KiB✅
ClaudeLive turn WebSocket decoded21.2 KiB21.2 KiB0 B (0.0%)29.3 KiB✅
ClaudeLive turn messages220 (0.0%)8✅

Baseline: 6548c00 · PR result: 2d7ff98 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

Note

Written by gpt-6.1-sol on behalf of Maria

all 30 checks pass on 2d7ff98483dff0f17f5e7940d8c55c04dcb74688, including build/typecheck, lint, web tests, all eight server test shards, Macroscope, and CodeRabbit. CodeRabbit reported no actionable findings. both independent final source reviewers returned merge-ready for this exact head. no inline review threads remain.

the real dev build linked #21353 through fields, singular URL, and plural URL with unlink/empty-list checks between each, always storing /pulls/21353. manual linking stored the same URL. the parent independently clicked the thread's sidebar badge and saw the loaded panel. the updated recording shows that exact interaction. old persisted singular links were not present in the isolated database, so that runtime case remains unverified; existing parsing coverage includes both forms.

integration with main 6548c006d4 resolves the original conflicts and includes main's prior removal of the failed Cursor webhook. final scope against that base: 11 files, +174/-28; no new test files or unrelated ci changes. the forge's singular canonical browser route was acknowledged without changing maria's requested plural storage. nothing merged.

Synced from GitHub

Review in Change Stack →

No actionable comments were generated in the recent review.

External image Recent review info
External image Run configuration
External image Commits

Reviewing files that changed from the base of the PR and between 2a3009c658f0e1e08dfb55f51d44b8f349bfc778 and 2d7ff98483dff0f17f5e7940d8c55c04dcb74688.

External image Files selected for processing: 11
  • apps/server/src/mcp/toolkits/pullRequests/handlers.test.ts
  • apps/server/src/mcp/toolkits/pullRequests/handlers.ts
  • apps/server/src/orchestration-v2/Orchestrator.ts
  • apps/server/src/orchestration-v2/runtimeLayer.test.ts
  • packages/client-runtime/src/pullRequestLinkInput.test.ts
  • packages/client-runtime/src/pullRequestLinkInput.ts
  • packages/source-control-definitions/src/registry.ts
  • packages/source-control-gitcafe/src/server/GitCafeSourceControlProvider.test.ts
  • packages/source-control-gitcafe/src/server/GitCafeSourceControlProvider.ts
  • packages/source-control-gitcafe/src/shared/definition.test.ts
  • packages/source-control-gitcafe/src/shared/definition.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

GitCafe pull-request URL handling now recognizes both /pull/ and /pulls/ routes on the production and staging hosts. Link resolution and server storage paths canonicalize valid URLs to the plural route.

Changes: GitCafe URL normalization

Layer / File(s)Summary
Shared GitCafe URL parsing and canonicalization
packages/source-control-gitcafe/src/shared/definition.ts, packages/source-control-gitcafe/src/shared/definition.test.ts, packages/source-control-definitions/src/registry.ts
Shared helpers parse supported GitCafe hosts and route forms, and canonicalize valid links. The registry exports the canonicalization helper. Tests cover accepted and rejected references.
GitCafe client recognition and server resolution
packages/source-control-gitcafe/src/server/GitCafeSourceControlProvider.ts, packages/source-control-gitcafe/src/server/GitCafeSourceControlProvider.test.ts
The provider uses the shared parser to resolve pull-request references. Checkout tests cover both route forms.
Application link resolution and storage
packages/client-runtime/src/pullRequestLinkInput.ts, packages/client-runtime/src/pullRequestLinkInput.test.ts, apps/server/src/mcp/toolkits/pullRequests/handlers.ts, apps/server/src/mcp/toolkits/pullRequests/handlers.test.ts, apps/server/src/orchestration-v2/Orchestrator.ts, apps/server/src/orchestration-v2/runtimeLayer.test.ts
Client and server link paths canonicalize valid GitCafe URLs. Tests cover resolution, link commands, stored links, and projection rebuilding.

Priority: External image Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: External image Minimal · up to 2d7ff

No concrete issue remains that calls for a change before merging. Normal checks should still complete.

Security architecture risk: External image Low · up to 2a300

The change is narrowly scoped to accepting equivalent GitCafe links and storing one canonical format. Existing host and credential restrictions remain in place. No new security weakness was verified, although concurrent and interrupted updates were not fully validated.

Retained concerns No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed attack surface is user-supplied pull-request references flowing into thread associations and GitCafe retrieval or checkout. Recognition expands to another route on the two existing hosts, not to arbitrary destination hosts or new credential authorities.

Trust Boundaries and Controls

  • observed — Credential selection remains host-scoped: environment credentials require a matching configured host, settings credentials are restricted to production, and CLI lookup receives the selected host. Existing tests explicitly reject production-to-staging and staging-to-production environment-token reuse.

Resilience and Maintainability Implications

  • observed — Link deduplication, ordinary unlinking, and stack-dismissal restoration continue to use normalized identity rather than URL spelling. The unchanged commit mechanism reserves the command receipt, appends events, applies projections, and finalizes the receipt inside a transaction before publishing. Duplicate command IDs reuse the recorded result. These mechanisms provide counterevidence to partial-state concerns, but are not direct validation of every concurrent or interrupted link transition.
Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check nameStatusExplanationResolution
Description checkWarningThe description explains the problem, implementation, affected components, verification steps, observed results, limitations, and agent details. It does not include the required “Scope and approval” s…Add a “## Scope and approval” section. Link the triaged issue or approval discussion and identify the maintainer approval comment. If no prior issue or discussion exists, explain why this focused fix addresses an obvious bug and qualifies f…
Passed Passed checks: 3 passed
Check nameStatusExplanation
Title checkPassedThe title is concise, specific, and directly describes the primary change: canonicalizing GitCafe pull request links.
Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, implementation, affected components, verification steps, observed results, limitations, and agent details. It does not include the required “Scope and approval” section or a link to a triaged issue, approved discussion, or a clear explanation of why this focused fix qualifies for an exemption.

Resolution

Add a “## Scope and approval” section. Link the triaged issue or approval discussion and identify the maintainer approval comment. If no prior issue or discussion exists, explain why this focused fix addresses an obvious bug and qualifies for the exemption.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Added 1 commit

  • fix: preserve git.cafe link normalization on current main2d7ff98