fix(threads): keep older agents discoverable in Lineage #33498
main fromrefs/pull/33498/head·opened View on GitHubLong-running parent threads can have 137 stored child threads while Lineage shows only 33: its count and discovery depend on the loaded transcript window. Older child threads then disappear from the list.
Read previous-agent metadata through a separate bounded, paginated service, with distinct whole-history totals. The transcript remains windowed. Web/desktop Lineage shows the full count, pages 12 rows at a time and opens older children through the existing thread route. Current-page status refreshes retain the answered rows and cursor. A guarded index supports taskless-child discovery and excludes malformed legacy rows; the read RPC uses the owning environment and its existing read scope. Older servers retain an explicitly partial loaded-count fallback.
Fixes #33409.
Scope and approval#
This repairs existing Lineage discovery: a transcript page boundary hides child threads that are still stored and makes the displayed total depend on how many messages the client loaded. The 33-versus-137 reproduction demonstrates that defect. The correction reads bounded child metadata pages for the existing list and count, with the same environment ownership and read permission. The RPC, index and paging controls support that single discovery fix. It is submitted as a focused fix for an obvious bug; no maintainer approval of the implementation is claimed.
Verification:
- The original window fixture omits historical children. The final SQL test covers distinct identities, duplicate tasks, active child runs, deleted/taskless/remote children and bounded pages. The new active-run regression failed before its correction.
- Three paging regressions failed before the review fixes: pending pages lost rows, status changes reset the cursor, and initial queries ran twice. Focused browser and migration suites now pass.
- Rebased onto
ff7aa5ace311c70587631dcedb43f1d92068c342with an identical task patch (stable patch ID unchanged). Finalvp run check:changed upstream/mainpassed 224 tests in 16 files plus the cross-file case, typechecks for 37 affected packages, lint, format, Knip, GraphQL and React Compiler checks. Reviewer independently reran 19 browser/migration tests, the SQL case, all 19 recovery tests, and the two focused legacy/paging cases. The existing legacy-data regression failed before the JSON guard and passes after it; independent runtime checks confirm the full production SQL uses the index and handles malformed rows during creation, updates and reads. - Real service proof traversed 12 bounded pages; first-page response was 1,483 bytes without prompt/result/transcript fields. In the real app, the same synthetic fixture with 137 children showed 33 before and 137 after. Pagination reached child 136, opening it succeeded, and reload retained 137.
| Evidence | Before | After |
|---|---|---|
| Historical total | ![]() | ![]() |
| Older children | ![]() | ![]() |
Capture environment, reproducible fixture and additional page captures. All data is synthetic; Chromium ran headless, with no test windows on the main display. Native mobile UI is outside this change; Electron, Windows/macOS and a live remote/tunnel client were not separately exercised. Controlled browser tests cover delayed responses and status updates.
Reviewed with review-loop: 3 rounds with Claude Opus 5.5 on xhigh. Reviewer verdict: approved. Seven findings were fixed, including migration expectations, paging races and malformed legacy payloads. Optional icon and background-refresh-dimming polish remain. The bot’s optional error-message thread-ID nit is deferred: it does not change success, failure propagation, authorization or the historical results; the original SQL cause remains intact. Maintainers retain the direction decision.
Created with GPT-6.1 Sol in the Codex harness, running in T3 Code.
- 1
- 2
Pushedbb8e26a
github-actions[bot](GitHub profile, opens in a new tab) removed labelsneeds-rebase
Sign in to join this conversation.




Closing: this PR still conflicts with
mainand has had no activity for 7 days since the rebase request.To continue, rebase the branch and open a new PR that links this one. See the conflict window.