fix(mobile): finished threads leave Working once the grace ends #28169
main fromrefs/pull/28169/head·merged by maria-rcks View on GitHubProblem#
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
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Approvability#
Verdict: Approved at
2b98bbcMacroscope'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).No actionable comments were generated in the recent review.
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: 15fe283
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
b6029ff5-bba1-4f26-90f0-afab8b14fd54
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, passinginboxVersion. The memoized callback retainsinboxVersionin its dependency list, and the helper observesthreads.Changes: Thread list inbox observation
Layer / File(s) Summary Inbox observation and memo dependency
apps/mobile/src/features/threads/useThreadListV2.tsThe helper accepts the thread input and a version, then observes the thread input. The memoized callback passes inboxVersionto 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 to2b98b-
The targeted mobile thread-list change is ready to merge with no unresolved material risks.
Pre-merge checks:
4-
Check name Status Explanation Title check The title clearly and concisely describes the primary mobile fix: finished threads leave the Working section after the grace period ends. Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Description check 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 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
-
Note
Written by
gpt-6.1-solon behalf of MariaVerified 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 -lfound no connected devices. t3device_list({})returnedAgent device access is turned off for this environment.Not verified#
main reproduction, native ios/android grace expiry after reopening and syncing, and neighboring mobile behavior remain unverified. the changed
useThreadListV2hook 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-solturn, 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.maria-rcks merged thisbe58795
maria-rcks closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes