fix(orchestration): persist linked pull requests#8689

merged1
t3code/codex-turn-mapping
agents/mcp-thread-metadata/persistence
openedAug 29, 2026byJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 4d ago

Problem

The V2 metadata command accepts linked pull requests, but the decider drops that field, so links never reach the persisted event or projection.

Change

Apply linkedPullRequest during metadata updates while preserving absent-field compatibility. Focused runtime coverage proves link, shell projection, projection rebuild, and unlink behavior.

Validation

  • vp test run apps/server/src/orchestration-v2/runtimeLayer.test.ts (14 tests)
  • Targeted lint for the two changed files
  • vp run --filter t3 typecheck

Dependency

Based directly on agents/mcp-controls/base-490318a at the agreed 490318a prerequisite snapshot. Native stack #8709: #8689 → #8690. The MCP metadata tool remains a separate dependent layer; no feature code changed when the rewritten live trunk was replaced as the review base.

Implemented by GPT-5.6-Sol via Codex in T3 Code.

Note

Fix Orchestrator.layer makeOrchestrator to persist linkedPullRequest

The makeOrchestrator function now includes linkedPullRequest in the built object when the command supplies it, including null to represent unlinking. When command.linkedPullRequest is undefined, the field is omitted from the payload. Adds a lifecycle test covering link, projection rebuild, and unlink flows in runtimeLayer.test.ts.

Macroscope summarized 1d9e754.


Note

Low Risk Small, targeted decider fix with regression tests; no auth or broad behavioral changes beyond persisting an already-defined metadata field.

Overview Fixes a gap where thread.metadata.update accepted linkedPullRequest but the V2 orchestrator decider never applied it, so links never made it into thread state, events, or projections.

The thread.metadata.update handler in Orchestrator.ts now merges linkedPullRequest when the command sets it (including null to unlink), and omits the field when it is undefined, matching other optional metadata fields.

A runtime-layer test covers linking a PR, reading it from the thread projection and shell, surviving a projection rebuild, and unlinking via linkedPullRequest: null.

Reviewed by Cursor Bugbot for commit 1d9e75452a1c2fe86590c864defd62fbe7f7d328. Bugbot is set up for automated code reviews on this repo. Configure here.

Synced from GitHub

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a0a7ebcd-a299-41d6-92cb-b3648ad37245

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Warning

Your free Security trial is over. An organization admin can activate Security or dismiss this notice.


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

Synced from GitHub

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for 1d9e754.

This comment will update automatically after the next completed run.

Synced from GitHub

Approvability

Verdict: Approved at 7bc232e

Macroscope's review found this PR approvable — This is a narrowly scoped orchestration persistence fix: an existing linked pull request is now retained through event projection rebuilds, with explicit unlinking preserved. The production change is minimal and covered by an integration test for linking, rebuilding, and unlinking.

No code changes detected at 1d9e754. Prior analysis still applies.

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

Synced from GitHub

Macroscope has since reviewed this pull request. An earlier review was skipped by a cost limit; a review has now completed, so that notice no longer applies.

Added 1 commit

  • fix(orchestration): persist linked pull requests1d9e754