Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): subagents drop pull request links they inherited from their parent #19054

ClosedMnigos(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/19054/headopened View on GitHub

Follow-up to #19039 and its triage. #14918 stopped new subagent and delegated-task threads from copying their parent's pull request links, but threads created before it still hold their copies. The pull request sweep syncs every copy as its own thread, so each change to one of the parent's PRs writes one full-thread thread.pull-request-synced event per old subagent. On the install from #19039, 288 such non-archived threads held 5,462 links. They received 19,587 of the day's 20,754 sync events (928 of 997 MB).

PullRequestSyncReactor now removes those links in every sweep, before it syncs anything. A subagent thread qualifies only if it holds a link older than itself, which only a copy can be. On such a thread, it removes those copies and every stack link and dismissed stack link, since the sweep added those because of a copy. Links the thread added itself after creation stay; the sweep re-adds their stack siblings the next time it reads their stack. The check runs on the rows the sweep already reads, so periodic and requested sweeps alike never sync an inherited link, and once nothing qualifies it adds no query. Archived threads are not swept and keep their copies until unarchived.

The removal goes through a new internal command, thread.pull-request.links.remove. It emits one thread.pull-request-synced per thread, so a projection rebuild reproduces the result. Unlike thread.pull-request.unlink, it leaves no stack tombstones, and it clears the legacy linkedPullRequest when that pull request is removed. A failed removal is logged, those links are still not synced, and the next sweep retries.

Known limitation: the projection does not record a link's history. A pre-#14918 subagent that unlinked and re-linked a copied PR loses that link, and one that dismissed a sibling of its own PR's stack sees that sibling linked again.

Tests

  • Orchestrator.control-reads.test.ts, removes pull request links in one replayable event, without tombstones: one event, no tombstones, clears the legacy link, and a projection rebuild returns the same thread.
  • PullRequestSyncReactor.test.ts, removes the links a pre-fix subagent inherited before any sweep syncs them: removes copied links, swept-in stack links and tombstones in one command, keeps the subagent's own later link, leaves a post-fix subagent and a top-level thread untouched, never syncs a copy even when its refresh was requested before the first sweep, and sends nothing on the next sweep.

From apps/server, vp test run src/orchestration-v2/Orchestrator.control-reads.test.ts src/orchestration-v2/PullRequestSyncReactor.test.ts --maxWorkers=1 --no-file-parallelism passes. vp test run src/orchestration-v2 src/serverRuntimeStartup passes 1,980 tests; the 2 failures are AntigravityAdapterV2 file-system tests that fail on macOS because the temp workspace resolves through /var → /private/var. Typecheck, lint and format pass for t3 and @t3tools/contracts.

Implemented with Claude Opus 5.5, verified with GPT-6 Astra, coordinated by Claude Fable 5.1 in Claude Code.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. 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: Advanced
      • Run ID: 6b1da824-a2c2-41b4-bfc9-ef2746a123c8

      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

      .coderabbit.config.ts has a parsing error

      The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

      Parsing errors (1)
      Error while evaluating .coderabbit.config.ts
      ⚙️ Configuration instructions
      • Please see the configuration documentation for more information.
      • You can also validate your configuration using the online YAML validator.
      • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Comment `@coderabbitai help` to get the list of available commands.
    3. Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This is a production startup-recovery and durable data-cleanup change rather than a contained code-only fix. It can remove persisted links across many existing threads, emit follow-on events, and alter when pull-request synchronization occurs, creating a meaningful runtime blast radius.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Note

      🤖 Claude Fable 5.1 on behalf of Mnigos

      Closing this draft: the root cause is fixed by #14918 and whether the pre-fix copies should be cleaned up is a maintainer call. The numbers and the offer are on #19039; happy to reopen if a cleanup is wanted.

Sign in to join this conversation.