Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): finished threads leave Working once the grace ends #28169

Mergedplaycations(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/28169/headmerged by maria-rcks View on GitHub

Problem

On mobile, a thread that stops working stays in the Working section, with its row already showing Done, until some other thread update arrives. threadListInboxReturns holds a finished thread in Working for a 2-second grace period, then bumps a version so the list rebuilds. useThreadListV2 lists that version in its useMemo dependencies but never reads it. The React Compiler memoizes on the values a callback reads, so the compiled memo drops the version and only rebuilds when threads or workingShelfEnabled change.

On a busy list another shell update usually arrives within seconds, which hides the bug. After opening the app and syncing, nothing else changes, so the thread stays in Working.

Repro: leave a thread working, close the app, reopen it after the thread finishes, and wait a few seconds after the sync. The thread stays in Working with a Done label.

This is the finished-thread case of #24901. That report also describes threads waiting for input or approval staying in Working. Those leave Working without the grace timer when their shell changes, so this PR does not claim to fix that case.

Change

The memo now passes the version into the observe call through a small observeInbox helper, the way web passes inboxReturnsVersion into its list builder through clockKey. The compiled memo then depends on the version, and the list rebuilds when the grace expires.

Scope and approval

A very small, focused fix for an obvious bug: one memo in one file. It restores the behavior the code already intended, and the Working section's ordering and grace logic are unchanged.

Verification

Compiled output of the memo, using babel-plugin-react-compiler 1.0.0 with target: "19":

Before:

if ($[0] !== threads || $[1] !== workingShelfEnabled) {
  t0 = threadListInboxReturns.observe(workingShelfEnabled ? threads : null);

After:

const t0 = workingShelfEnabled ? threads : null;
if ($[0] !== inboxVersion || $[1] !== t0) {
  t1 = observeInbox(t0, inboxVersion);
  • vp test run apps/mobile/src/features/threads/threadListV2.test.ts: 63 passed, including the existing grace expiry test for the layout.
  • vp run check:changed: format, lint, knip, typecheck, and react compiler pass.
  • On an Android preview build with this change, a thread that finished while the app was closed left Working a couple of seconds after reopening and syncing.

There is no new automated test. The bug only exists in compiled output, and the mobile tests don't run hooks through the React Compiler, so a hook test would pass on main too.

Not changed here: HardwareKeyboardCommandProvider and ThreadFeed have the same unread-dependency pattern in a useMemo and a useFocusEffect callback.

Implemented with Claude Opus 5.5 in Claude Code, through T3 Code.

🤖 Generated with Claude Code

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. Approvability

      Verdict: Approved at 2b98bbc

      Macroscope's review found this PR approvable — This makes the mobile thread list refresh when the existing Working grace period expires. The change is limited to shelf presentation and leaves defaults, execution state, and persistent data unchanged.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      No actionable comments were generated in the recent review.

      Recent review info
      Run configuration
      Commits

      Reviewing files that changed from the base of the PR and between 15fe2832727893cbdd2214383f9f971474849695 and 2b98bbc324f9d84580bb1ef69d52aee926c363b0.

      Files selected for processing: 1
      • apps/mobile/src/features/threads/useThreadListV2.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

      Walkthrough

      The hook now routes inbox observation through observeInbox, passing inboxVersion. The memoized callback retains inboxVersion in its dependency list, and the helper observes threads.

      Changes: Thread list inbox observation

      Layer / File(s)Summary
      Inbox observation and memo dependency
      apps/mobile/src/features/threads/useThreadListV2.ts
      The helper accepts the thread input and a version, then observes the thread input. The memoized callback passes inboxVersion to the helper. The version remains in the callback's dependency list.

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix

      Possibly related issues

      • pingdotgg/t3code#24901: The issue reports completed threads remaining in the Working shelf until another list rebuild. The PR changes the inbox memo's version dependency associated with the grace-expiry rebuild.

      Suggested reviewers: juliusmarminge, t3dotgg

      Merge Risk: Minimal · up to 2b98b

      The targeted mobile thread-list change is ready to merge with no unresolved material risks.

      Pre-merge checks: Passed 4
      Check nameStatusExplanation
      Title checkPassedThe title clearly and concisely describes the primary mobile fix: finished threads leave the Working section after the grace period ends.
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Description checkPassedThe description includes all required sections. It clearly explains the problem and reproduction steps, the technical change, scope and approval rationale, verification results, limitations, and the a…
      Full details: Description check

      Explanation

      The description includes all required sections. It clearly explains the problem and reproduction steps, the technical change, scope and approval rationale, verification results, limitations, and the agent and harness used.

      Finishing Touches
      Generate unit tests (beta)
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
    4. Note

      Written by gpt-6.1-sol on behalf of Maria

      Verified in a real dev environment

      no changed behavior could be verified on this linux vm. i inspected the diff, description, discussion, inline review comments, commit authors and exact head 2b98bbc324f9d84580bb1ef69d52aee926c363b0. the pr is open. reported ci has 30 successful checks, but that is not runtime proof.

      runtime prerequisite check: timeout 20 adb devices -l found no connected devices. t3 device_list({}) returned Agent device access is turned off for this environment.

      verification transcript

      Not verified

      main reproduction, native ios/android grace expiry after reopening and syncing, and neighboring mobile behavior remain unverified. the changed useThreadListV2 hook is mobile-only; a web codex turn would not exercise it. the mobile verification skill requires stopping when device tools or the selected device are unavailable. no main worktree, install, dev server, provider turn, screenshots or recording were produced. no source changes were made.

      verification still needs a native mobile client: start a real codex gpt-6.1-sol turn, close the client while it is working, reopen after completion, and observe whether the done row leaves working after the two-second grace without another thread update. reproduce on main first, repeat on this head, and check active turns and waiting-for-input rows nearby.

    5. maria-rcks merged thisbe58795

    6. maria-rcks closed this

Sign in to join this conversation.