You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Part of #451. Step 4 of 7, after step 3. Plan: #451 (comment) ("Thread links: the data move" and "Order", item 4).
Managed claims write a thread.issues[] link in the same commit as the claim. A one-time command backfill at server start, keyed so that repeats do nothing, moves issue_thread_links rows and claims without links. Then delete the table reads, issues.unlink and the refresh stream. linkedIssue stays as the claim record.
Done: server tests cover a repeated backfill, a deleted thread, a failed title read, and claim plus link in one commit.
Issue #455 is implemented in draft PR #474. It closes #455, references #451, and is not merged.
What changed
Claims carry their link. When the planner (IssueWorkCommands.claimFields) creates a claimed thread, the same thread.created event now holds both linkedIssue and its thread.issues[] entry. This covers delegated workers and thread.create claims. Reviewers, checkers, writers and other children that take an issue without claiming it now link through upstream's ThreadIssueService after reading the issue title.
Startup backfill.apps/server/src/issues/IssueLinkBackfill.ts runs once after server activation. It follows the plan: field mapping, the claim's title when it's the same issue, otherwise one upstream IssueService.detail read per distinct issue, four at a time. Each thread.issue.link command gets an id built from the thread and the issue. A failed title read keeps the row for the next start, and rows for deleted or missing threads are dropped. Each row is deleted after its command commits.
One addition beyond the plan. The backfill skips a claim whose thread has ever had a thread.issue-synced event. A claim made now carries its link from the start, so a missing link means someone removed it. Without this check, the next start would put that link back.
Removed: the table reads in IssueLinks.enrich, IssueLinks.link and its refresh stream, and issues.unlink (contract, handler, scope, client command). Also gone: the fork's "Unlink from this thread" menu item and the canUnlink flag, because upstream's issue panel already toggles these links. The table is out of the purge list, and the seed script now writes claim links instead of table rows.
linkedIssue stays the claim record, and a claim still counts as live work after its link is removed.
Decision for you: issues.subscribeLinkRefreshes is still there. I removed only the table's refresh source. That stream also drives the roadmap's live-work refresh (runs, requests, background tasks), and the roadmap still reads through fork code until step 5. Deleting it now would leave live work stale on the roadmap until its 5-minute poll. I recommend retiring it in step 5; the PR says so.
Tests
New IssueLinkBackfill.test.ts, using a real orchestrator on an in-memory database. It covers:
a repeated run adding no events;
deleted and missing threads having their rows dropped;
a failed title read keeping its row, with a later run linking it;
a removed claim link staying removed;
a leftover row reusing its earlier command result and adding no event.
This is a new file because no existing test covered the new module.
IssueReviewDelegation.fork.test.ts checks that a worker's thread.created event carries the claim and its link together.
Other existing tests now seed links in thread.issues[]. The focused runs all pass (57 tests in the last run).
vp run check:changed
Format, lint, knip and 20 test files (341 tests) pass.
All testing used synthetic databases; ~/.t3/userdata was never touched. Nothing in the diff touches completion delivery. I stopped two duplicate type-check jobs of mine by PID after confirming their working directory was this worktree.
PR #474, head 3a5ee87, checks and reviews: none reported yet (draft, just opened).
I fixed all four items from the Checker's review. Main is merged in (clean, no rebase), the fixes are pushed, and the PR body is updated.
Startup cost: the backfill now checks "already linked" first and reads event history only for claims that are still unlinked. Its reads use the reader connection. On a synthetic database with 2.6M events and every claim already linked, the claim query went from about 4.2 s per start to about 2.3 ms. The table is in the PR body.
GitHub only: only github.com claims and rows get links. Forgejo rows are dropped without a link, Forgejo claims stay claim records, and one summary line logs the counts. A claim's own URL is used for its link when it has one.
delegate_task: once the child exists, linking can no longer fail the call. A failed issue read names the link #<number> and logs it, and the child's run is still prepared.
Rows for issues GitHub reports as not found are now dropped; network or rate-limit failures keep the row for the next start. docs/operations/fork.md and the PR body now say the backfill runs at each start until the table is empty and every GitHub claim is linked, after which it finds nothing to do. The PR body also mentions that a worker's native subagents inherit the claim's link and count as direct live work; I made no change for that.
Each fix has a test, including Forgejo-host claim and row cases, the #15/#99 case, a not-found row, and the isolated-reviewer case where the issue read fails. The focused tests pass (27). vp run check:changed passes everything except type checking, which fails only on the three known apps/mobile errors from #449. The McpHttpServer.test.ts error from last round is gone now that main has #472.
PR #474, head d5f0a74, checks and reviews: none reported yet (draft).
Activity
tannerpolley commentedon Nov 18, 2026
T3 Code status: Done
Issue: #455 #451 step 4: Move thread issue links onto upstream thread.issues
Thread: thread:delegated-task:command%3Amcp%3A53eed4d4-49de-4205-ba6f-a35a0b15b7c9%3Adelegate-task%3Aissue-455-451-step4-2026-11-18
Model: claude-opus-5-5
Branch: issue-455-451-step-4-move-thread-issue-links-onto
Updated: 2026-11-18T02:13:22.332Z
tannerpolley commentedon Nov 18, 2026
T3 Code closeout: done
Issue: #455 #451 step 4: Move thread issue links onto upstream thread.issues
Thread: thread:delegated-task:command%3Amcp%3A53eed4d4-49de-4205-ba6f-a35a0b15b7c9%3Adelegate-task%3Aissue-455-451-step4-2026-11-18
Model: claude-opus-5-5
Branch: issue-455-451-step-4-move-thread-issue-links-onto
Completed: 2026-11-18T01:47:45.707Z
Issue #455 is implemented in draft PR #474. It closes #455, references #451, and is not merged.
What changed
IssueWorkCommands.claimFields) creates a claimed thread, the samethread.createdevent now holds bothlinkedIssueand itsthread.issues[]entry. This covers delegated workers andthread.createclaims. Reviewers, checkers, writers and other children that take anissuewithout claiming it now link through upstream'sThreadIssueServiceafter reading the issue title.apps/server/src/issues/IssueLinkBackfill.tsruns once after server activation. It follows the plan: field mapping, the claim's title when it's the same issue, otherwise one upstreamIssueService.detailread per distinct issue, four at a time. Eachthread.issue.linkcommand gets an id built from the thread and the issue. A failed title read keeps the row for the next start, and rows for deleted or missing threads are dropped. Each row is deleted after its command commits.thread.issue-syncedevent. A claim made now carries its link from the start, so a missing link means someone removed it. Without this check, the next start would put that link back.IssueLinks.enrich,IssueLinks.linkand its refresh stream, andissues.unlink(contract, handler, scope, client command). Also gone: the fork's "Unlink from this thread" menu item and thecanUnlinkflag, because upstream's issue panel already toggles these links. The table is out of the purge list, and the seed script now writes claim links instead of table rows.linkedIssuestays the claim record, and a claim still counts as live work after its link is removed.Decision for you:
issues.subscribeLinkRefreshesis still there. I removed only the table's refresh source. That stream also drives the roadmap's live-work refresh (runs, requests, background tasks), and the roadmap still reads through fork code until step 5. Deleting it now would leave live work stale on the roadmap until its 5-minute poll. I recommend retiring it in step 5; the PR says so.Tests
New
IssueLinkBackfill.test.ts, using a real orchestrator on an in-memory database. It covers:This is a new file because no existing test covered the new module.
IssueReviewDelegation.fork.test.tschecks that a worker'sthread.createdevent carries the claim and its link together.Other existing tests now seed links in
thread.issues[]. The focused runs all pass (57 tests in the last run).vp run check:changedapps/server/src/mcp/McpHttpServer.test.ts:1711. Main (e1d054250b) fails with the identical error; I type-checked main in this worktree to confirm. Every other package passes, so this branch adds no new failures beyond 16 tests already fail on main in files check:changed rarely selects #470, the 11 server tests fail on main: FoundationPersistence (9) and Orchestrator.control-reads (2) #449 web ones and the Webhook test fails when an extra migration is registered (interrupt point moves) #468 quarantine.All testing used synthetic databases;
~/.t3/userdatawas never touched. Nothing in the diff touches completion delivery. I stopped two duplicate type-check jobs of mine by PID after confirming their working directory was this worktree.PR #474, head 3a5ee87, checks and reviews: none reported yet (draft, just opened).
tannerpolley commentedon Nov 18, 2026
T3 Code closeout: done
Issue: #455 #451 step 4: Move thread issue links onto upstream thread.issues
Thread: thread:delegated-task:command%3Amcp%3A53eed4d4-49de-4205-ba6f-a35a0b15b7c9%3Adelegate-task%3Aissue-455-451-step4-2026-11-18
Model: claude-opus-5-5
Branch: issue-455-451-step-4-move-thread-issue-links-onto
Completed: 2026-11-18T02:13:22.718Z
I fixed all four items from the Checker's review. Main is merged in (clean, no rebase), the fixes are pushed, and the PR body is updated.
github.comclaims and rows get links. Forgejo rows are dropped without a link, Forgejo claims stay claim records, and one summary line logs the counts. A claim's own URL is used for its link when it has one.delegate_task: once the child exists, linking can no longer fail the call. A failed issue read names the link#<number>and logs it, and the child's run is still prepared.Rows for issues GitHub reports as not found are now dropped; network or rate-limit failures keep the row for the next start.
docs/operations/fork.mdand the PR body now say the backfill runs at each start until the table is empty and every GitHub claim is linked, after which it finds nothing to do. The PR body also mentions that a worker's native subagents inherit the claim's link and count as direct live work; I made no change for that.Each fix has a test, including Forgejo-host claim and row cases, the #15/#99 case, a not-found row, and the isolated-reviewer case where the issue read fails. The focused tests pass (27).
vp run check:changedpasses everything except type checking, which fails only on the three knownapps/mobileerrors from #449. TheMcpHttpServer.test.tserror from last round is gone now that main has #472.PR #474, head d5f0a74, checks and reviews: none reported yet (draft).