Repository navigation
feat(issues): move thread issue links onto thread.issues - #474
Merged
tannerpolley merged 3 commits intoNov 18, 2026
Merged
Conversation
A managed claim now writes its thread.issues[] link in the event that creates the claimed thread, and unmanaged delegated children link through upstream's thread link command. A one-time startup backfill moves the issue_thread_links rows, and claims made before claims carried links, onto thread.issues[] with commands keyed by thread and issue. The table reads, issues.unlink and the table's refresh stream are gone; linkedIssue stays the claim record and still counts as live work after its link is removed. Closes #455. Part of #451. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 18, 2026
…move-thread-issue-links-onto
…started delegation The backfill checks "already linked" first and reads a claim's event history only when the claim is unlinked, on the reader connection. Only github.com claims and rows are linked; other-host rows are dropped and their claims stay claims. A claim is skipped only when its own key once appeared in the thread's link history, and a claim's own URL is kept. Rows whose issue is not found are dropped; transient failures keep the row. An unmanaged delegated child whose issue read fails is linked by its number instead of failing a delegation that started. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tannerpolley
marked this pull request as ready for review
November 18, 2026 02:13
tannerpolley
deleted the
issue-455-451-step-4-move-thread-issue-links-onto
branch
November 18, 2026 02:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 4 of #451 ("Thread links: the data move"). Thread ↔ issue links lived in two places: the fork's
issue_thread_linkstable and upstream'sthread.issues[]. Nowthread.issues[]is the only store.Claims write their link. The issue-owned planner (
IssueWorkCommands.claimFields) puts thethread.issues[]entry in the samethread.createdevent aslinkedIssue, for both delegated workers andthread.createclaims. A worker's claim link replaces links it would otherwise inherit from its parent's thread. Unmanaged children delegated with anissue(reviewers, checkers, writers…) link through upstream'sThreadIssueServiceafter reading the issue's title. The child already exists and runs at that point, so a failed read or link never failsdelegate_task: a retry would start a second child. A failed read names the link#<number>and is logged, and worktree preparation still runs.Backfill at each start (
IssueLinkBackfill.ts, after server activation). It runs until the table is empty and every GitHub claim is linked; after that its reads find nothing and cost a few milliseconds.github.comclaims and rows are linked. Rows on other hosts (the archived Forgejo) are dropped without a link, and their claims stay claims. One summary line logs the counts.$.issuesof itsthread.createdorthread.issue-syncedevents). A claim made now carries its link from creation, so a missing link means someone removed it. An old claim whose thread later linked a different issue is still linked.github, scope = repository, key = number, project = the thread's,#ndisplay key, sourceagent. The URL is the claim's own when it has one, otherwise built from host, repository and number. The title is the claim's when it is the same issue, otherwise one upstreamIssueService.detailread per distinct issue, four at a time.fork:issue-link-backfill:<thread>:<host>/<repo>#<n>, so a leftover row replays its receipt. The table stays until a later fork migration drops it. Backfilled links carry the backfill time aslinkedAt.Startup cost, measured on a synthetic database: 2.6M thread events and 1,000 claimed threads, every claim already linked, five runs each.
Removed: the table reads in
IssueLinks.enrich,IssueLinks.linkand its refresh stream,issues.unlink(contract, handler, scope, client command), the fork's "Unlink from this thread" menu item andcanUnlink(upstream's issue panel already togglesthread.issues[]links), the table from the purge list, and the table insert inscripts/fork-dev/seed.py(seeded claims now carry their link).linkedIssuestays the claim record. Live work still counts a claim after its link is removed.Not removed:
issues.subscribeLinkRefreshes. Only the table's refresh source is gone. The RPC also carries the roadmap's work-state refresh (runs, requests, background tasks, issue work), and the roadmap still reads through the fork until step 5. Deleting it now would leave live work on the roadmap stale until the 5-minute poll. Step 5 can retire it.Side effect, no change made: native subagents copy their parent's thread fields, so a worker's native subagent now inherits the claim's link and counts as direct live work on that issue instead of inherited.
Evidence
IssueLinkBackfill.test.ts(real orchestrator, receipts and an in-memory database). It covers:IssueReviewDelegation.fork.test.ts:thread.createdevent carries bothlinkedIssueand itsthread.issues[]entry (one commit);#3, and has its run prepared.IssueLinks,IssueWorkProjection,IssueRoadmap,IssueService,ThreadLaunchService.readOnlyLimit/issueWorkandRpcAuthorizationtests updated and passing.vp run check:changedon head (after merging main with refactor(server): one completion decision for both cohort owners #471 and fix(server): tool-hiding test provides the issue services it needs #473): format, lint, knip, graphql, 20 test files and the react compiler pass. Typecheck fails only on the three knownapps/mobileerrors from 11 server tests fail on main: FoundationPersistence (9) and Orchestrator.control-reads (2) #449; server, web, contracts and client-runtime are clean.~/.t3/userdatawas not touched.Surfaces: server and contracts; web loses the fork unlink item (upstream's toggle remains). Mobile is out of scope for fork additions. Providers: Codex and Claude only, as before. No user-facing strings were added.
Closes #455. Part of #451.
🤖 Generated with Claude Code (Claude Opus 5.5, Claude Code harness in T3 Code)