Skip to content

fix(mobile): keep new threads available during creation - #37

Merged
khoi merged 5 commits into
mainfrom
supacode/fix-mobile-thread-unavailable
Oct 4, 2026
Merged

khoi merged 5 commits into
mainfrom
supacode/fix-mobile-thread-unavailable

Conversation

@khoi

@khoi khoi commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Problem

Opening a newly submitted mobile thread can show “Thread unavailable” while the server is running it. Composer readers can request its bounded snapshot before thread creation commits; the resulting 404 becomes a cached deleted state until the app restarts.

Change

Make reported model, queued count, subagent metadata, and composer queue workflow use selectedThreadDetailRef. This existing selection gate opens detail subscriptions after the server shell arrives or creation delivery succeeds.

Scope and approval

This is a focused fix for the obvious creation race reported by khoi. It applies to the shared iOS and Android thread screen across providers and connection modes. The matching upstream report documents the same ordering and includes a reproduction recording.

Verification

The mounted hook regressions verify zero snapshot requests while creation is pending or rejected, and one request after delivery or server shell arrival. The focused suite passed all 24 tests:

vp test run apps/mobile/src/state/use-thread-detail.test.tsx apps/mobile/src/state/pending-thread-creation.test.ts apps/mobile/src/features/threads/threadContentPresentation.test.ts

Changed-file lint and vp run --filter @supacode/mobile typecheck passed. The simplify pass and both thermos audits found no actionable findings.

Native iOS verification passed on final head 88ea790c3 after integrating the native crash fix from main. An existing conversation opened, and a new task showed its message, entered the starting state, displayed its reply, and reopened without “Thread unavailable”. The earlier Fabric crash occurred on both versions and is resolved by the change in main. Android was not tested. The successful iOS recording and screenshot were captured locally; GitHub attachment upload is unavailable because the collaborative browser is signed out.

Built with GPT-6.1 Sol in Supacode through the Codex harness.

khoi added 2 commits October 4, 2026 19:53
Composer metadata readers opened a thread subscription before its queued
creation reached the server. The resulting not-found response stayed in
the deleted resume state after the thread started running.

Read composer metadata through the selected thread's creation gate so
history loading begins once the server confirms the thread exists.
The composer subscribed to queue state using the optimistic thread shell, which could request a snapshot before the server created the thread and cache the missing response as deletion.

Use the selected detail reference so queue state follows the existing creation gate.
@khoi khoi added the bug Something is broken or behaving incorrectly. label Oct 4, 2026
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M labels Oct 4, 2026
@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 4.9 KiB 4.9 KiB +40 B (+0.8%) 6.8 KiB ✅
Codex Thread snapshot wire 3.7 KiB 3.7 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.1 KiB 1.2 KiB +40 B (+3.4%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 20.4 KiB 20.4 KiB +41 B (+0.2%) 29.3 KiB ✅
Codex Live turn messages 1 2 +1 (+100.0%) 8 ✅
Claude Total thread wire 4.9 KiB 4.9 KiB +41 B (+0.8%) 6.8 KiB ✅
Claude Thread snapshot wire 3.7 KiB 3.7 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB +41 B (+3.5%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 20.7 KiB 20.8 KiB +41 B (+0.2%) 29.3 KiB ✅
Claude Live turn messages 1 2 +1 (+100.0%) 8 ✅

Baseline: b7d8017 · PR result: 88ea790 · Source CI: success

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: 106.1 KiB
  • Claude decoded thread snapshot: 106.4 KiB

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

@khoi
khoi marked this pull request as ready for review October 4, 2026 19:41
@khoi
khoi merged commit 5e7253b into main Oct 4, 2026
39 of 41 checks passed
@khoi
khoi deleted the supacode/fix-mobile-thread-unavailable branch October 6, 2026 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something is broken or behaving incorrectly. size:M 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.

1 participant