Skip to content

fix(server): child threads no longer flood the mobile thread list - #60

Merged
lukemaj merged 2 commits into
mainfrom
fix/59-mobile-hide-child-threads
Sep 28, 2026
Merged

lukemaj merged 2 commits into
mainfrom
fix/59-mobile-hide-child-threads

Conversation

@lukemaj

@lukemaj lukemaj commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Closes #59.

The store T3 Code mobile app has no Agents panel, so every child thread spawned through spawn_thread or Prism landed in its thread list and buried the threads the user started.

The server now leaves child threads (sub.<parent>.<suffix>) out of the shell it sends to mobile connections (clientSurface=mobile):

  • WebSocket subscribeShell: snapshot, replayed and live shell events.
  • getArchivedShellSnapshot.
  • HTTP /api/orchestration/shell, which looks up the surface the session last reported on its WebSocket connect (clients connect the socket before loading the shell over HTTP).

Web and desktop still receive child threads for the Agents panel. No mobile build is needed: a phone drops cached children on its next connection, because new sessions reload the HTTP snapshot. The client only dedupes shell events by sequence, so skipped events are safe.

Tradeoff: until upstream Orchestrator V2 (pingdotgg/t3code#2829) ships, child threads cannot be opened on mobile. They stay reachable from web and desktop. V2's mobile app hides subagent threads natively, so this goes away with the V2 port.

Proof

  • vp test run src/mcp/toolkits/threads/mobileShell.test.ts: 3 passed (stream filtering per surface, session surface lookup against SQLite).
  • vp test run src/server.test.ts -t "hides child threads from mobile": passes; fails with the ws.ts change reverted.
  • apps/server typecheck clean; lint on changed files has no errors; scripts/fork-check.sh OK.
  • Not verified on a real phone yet.

Done by Claude Opus 5.5 in Claude Code.

🤖 Generated with Claude Code

lukemaj and others added 2 commits September 28, 2026 19:07
The store mobile app has no Agents panel, so every child thread spawned
through spawn_thread or Prism showed up in its thread list and buried the
threads the user started.

The server now leaves child threads (sub.<parent>.<suffix>) out of the
shell it sends to mobile connections: the WebSocket shell snapshot, replayed
and live shell events, the archived shell snapshot, and the HTTP shell
snapshot, which looks up the surface the session last connected with. Web
and desktop still get child threads for the Agents panel. No mobile build
is needed; a phone drops cached children on its next connection because new
sessions reload the HTTP snapshot.

Until upstream Orchestrator V2 ships, child threads cannot be opened on
mobile; they stay reachable from web and desktop.

Done by Claude Opus 5.5 in Claude Code.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Sep 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.5 KiB 13.5 KiB +27 B (+0.2%) 15.1 KiB ✅
Codex Thread snapshot wire 7.1 KiB 7.1 KiB −4 B (−0.1%) 7.3 KiB ✅
Codex Live turn WebSocket wire 6.4 KiB 6.5 KiB +31 B (+0.5%) 7.8 KiB ✅
Codex Live turn WebSocket decoded 56.2 KiB 56.3 KiB +44 B (+0.1%) 66.4 KiB ✅
Codex Live turn messages 9 10 +1 (+11.1%) 21 ✅
Claude Total thread wire 13.5 KiB 13.5 KiB −1 B (−0.0%) 15.1 KiB ✅
Claude Thread snapshot wire 7.1 KiB 7.1 KiB −1 B (−0.0%) 7.3 KiB ✅
Claude Live turn WebSocket wire 6.4 KiB 6.4 KiB 0 B (0.0%) 7.8 KiB ✅
Claude Live turn WebSocket decoded 57.0 KiB 57.0 KiB 0 B (0.0%) 66.4 KiB ✅
Claude Live turn messages 9 9 0 (0.0%) 21 ✅

Baseline: 19a04dc · PR result: c209717 · Source CI: failure

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 113.9 KiB
  • Claude decoded thread snapshot: 114.6 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@lukemaj
lukemaj merged commit 6693567 into main Sep 28, 2026
17 of 18 checks passed
lukemaj added a commit that referenced this pull request Sep 28, 2026
Knip flagged three exports only used inside mobileShell.ts.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
lukemaj added a commit that referenced this pull request Sep 28, 2026
…63)

* feat(server): threads resume on their own after a usage limit resets (#61)

When a provider's usage limit stopped a thread, nothing brought it back:
the user had to return after the reset and type "continue". Three
threads stopped this way on 2026-09-28 alone.

When a thread the user started fails while its provider instance has an
exhausted usage window with a known reset (the data the Usage panel
shows), the threads toolkit sends one "Continue. (Sent automatically after
the usage limit reset.)" a minute after the latest reset. Starting another
turn or archiving the thread first cancels it. Child threads are skipped:
Model Router reroutes or blocks Prism jobs itself, and the planner decides
what to do with a blocked job once it resumes. Pending resumes live in
memory, so a server restart drops them. Upstream Orchestrator V2 has its
own "Resume at reset", so this goes away with the V2 port.

Done by Claude Opus 5.5 in Claude Code.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(fork): link #63 to the child-threads feature

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(server): keep the usage-limit settle delay private

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(server): keep mobile shell helpers private (#60 follow-up)

Knip flagged three exports only used inside mobileShell.ts.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@lukemaj
lukemaj deleted the fix/59-mobile-hide-child-threads branch September 28, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mobile: child threads flood the phone's thread list

1 participant