Repository navigation
Commit 8261376
feat(server): threads persist linked GitHub issues (#1440)
## What Changed
A thread stores its linked GitHub issues as orchestration state, modeled on its pull request links.
### Model
- **Link:** host, repository, number, url
- **Record:** source (`manual`, `handoff`, `agent`), `linkedAt`
- **Snapshot:** title, state, `syncedAt`
- **Commands:** `thread.issue.link`, `thread.issue.unlink`
- **Sync:** internal `thread.issue-link.sync`
- **Capability:** `threadIssues`, missing means unsupported
- **Reverse lookup:** RPC for the threads on one issue
### Storage and reads
- **Table:** idempotent `ForkSchema.ts` pass, never a numbered migration
- **Thread and shell:** optional `issues`, omitted when empty
- **Live:** shell subscribers refetch on a link change
- **Detail stream:** carries no issue events
- **Sync order:** an older snapshot never wins
- **Deletion:** a re-created thread has no links
Upstream files change only by one-line `fork-hook` lines; logic lives in `*.fork.ts`.
## Why
Threads link pull requests but not the issues they work on.
This is layer 1 of #1430: the web controls, MCP tools, sync and mobile build on it.
### Version skew
| Client | Server | Result |
| --- | --- | --- |
| Old | New | decodes thread, shell and every stream item |
| New | Old | missing `issues` reads as none; capability off |
A server from before this change cannot reopen a database holding link events; `fork-delta.md` records that downgrade limit.
## Checks
```text
tsc --noEmit (contracts, server, web, client-runtime, mobile) → exit 0
vp test run src/server.test.ts → exit 0 (211 tests)
vp test run threadIssues + orchestration (contracts) → exit 0 (68 tests)
vp test run 10 server files → exit 1 (146/147)
vp run fork:ci → exit 0
```
The one failure is `ServerEnvironment.fork.test` on this machine: the local service launcher started a different t3 version.
CI is the authority for it.
## Evidence
A second client holds a live shell subscription on a dev server running a snapshot copy of real data.
The driver speaks the WebSocket RPC the clients use.
1. Link issues 1430 and 1431 on a real thread
2. Live shell update carries both links
3. Reverse lookup returns the thread
4. Duplicate link: rejected, no event, no update
5. Unlink 1430: live update drops it
6. Read-only database: projection row and events
7. Unlink 1431: `issues` key gone

<details>
<summary>Stills</summary>


</details>
## Close conditions
Refs #1431
- [x] Replay: events rebuild the same projection
- [x] Stale sync: older than linkedAt is ignored
- [x] Duplicate: linking twice is a no-op
- [x] Re-link: works after an unlink
- [x] Authorization: only readable threads return
- [x] Deletion: deleted thread leaves the lookup
- [ ] Gate: no link control without capability
| Condition | Evidence |
| --- | --- |
| Replay, re-link, deletion | "link, sync, unlink, re-link and delete agree across every projection" |
| Stale sync | "both projectors drop a sync for a removed link, an earlier link, or an older read" |
| Duplicate | decider rejects it, no event; state unchanged |
| Authorization | orchestration read scope, beside the pull request lookup |
| Gate | server advertises `threadIssues`; the control lands with #1432, so this PR refs, not closes |
## Checklist
- [x] This PR is small and focused
- [x] I explained what changed and why
- [x] I included before/after screenshots for any UI changes
- [x] I included a video for animation/interaction changes
No UI changes; the recording above is server evidence.
Opus 5.5 via Claude Code in T3 Code.
## Fork trailers
Squashes:
- 68809f6 feat(server): threads persist linked GitHub issues (#1440) (#1440) (#1584)
- 4af452c fixup! feat(server): threads persist linked GitHub issues (#1440) (#1440)
- 50fce2b feat(server): threads persist linked GitHub issues (#1440) (#1440) (#1584)
- 5510f5b fixup! feat(server): threads persist linked GitHub issues (#1440) (#1440)
- b06fe75 feat(server): threads persist linked GitHub issues (#1440) (#1440) (#1584)
- b4d8082 feat(issues): threads keep linked issues on Orchestrator V2 thread state
- 0530808 feat(issues): the legacy importer carries V1 issue links onto V2 threads
Fork-Domain: github-issues
Fork-Tier: qol
Fork-Upstreamable: no1 parent 45cadb1 commit 8261376
29 files changed
Lines changed: 2392 additions & 11 deletions
File tree
- apps/server/src
- auth
- environment
- githubIssue
- orchestration-v2
- legacy
- testkit
- orchestration
- persistence
- packages
- client-runtime/src
- operations
- state
- contracts/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
150 | 151 | | |
151 | 152 | | |
152 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| 225 | + | |
225 | 226 | | |
226 | 227 | | |
227 | 228 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| |||
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| 37 | + | |
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
| |||
40 | 44 | | |
41 | 45 | | |
42 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
43 | 53 | | |
44 | 54 | | |
45 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
| 169 | + | |
169 | 170 | | |
170 | 171 | | |
171 | 172 | | |
| |||
501 | 502 | | |
502 | 503 | | |
503 | 504 | | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
504 | 508 | | |
505 | 509 | | |
506 | 510 | | |
| |||
12583 | 12587 | | |
12584 | 12588 | | |
12585 | 12589 | | |
| 12590 | + | |
| 12591 | + | |
| 12592 | + | |
| 12593 | + | |
| 12594 | + | |
| 12595 | + | |
| 12596 | + | |
| 12597 | + | |
| 12598 | + | |
| 12599 | + | |
12586 | 12600 | | |
12587 | 12601 | | |
12588 | 12602 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
| |||
1658 | 1659 | | |
1659 | 1660 | | |
1660 | 1661 | | |
| 1662 | + | |
1661 | 1663 | | |
1662 | 1664 | | |
1663 | 1665 | | |
| |||
1941 | 1943 | | |
1942 | 1944 | | |
1943 | 1945 | | |
| 1946 | + | |
1944 | 1947 | | |
1945 | 1948 | | |
1946 | 1949 | | |
| |||
0 commit comments