Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): worktree setup clock pauses on hidden thread screens #20066

Mergedjuliusmarmingemerged 6 commits intomain fromrefs/pull/20066/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

A hidden mobile thread screen no longer re-renders every second for the worktree setup card and its "Working for" label.

WorktreeSetupCard renders per 20 s while worktree setup runs: main renders 20 times while the thread is hidden under Files, this PR renders 0-1 times; both render once per second while the thread is visible.

Problem

Mobile keeps a thread route mounted when another route is pushed over it (Files, Review, Terminal). The worktree setup card and the "Working for" header used a private one-second clock gated only on app state, so a hidden thread screen re-rendered every second until the app went to the background. #15397 fixed the same leak for the floating working timer and the subagent bar; these two labels were missed.

Change

WorktreeSetupCard and WorktreeWorkingHeader now use the existing useVisibleSecondClock, which ticks only while the label is live, the screen is focused and the app is active, and re-reads the time before paint when ticking resumes. The private useSetupClock is deleted (+5/-19, one file). Nothing changes while the screen is visible.

Scope and approval

Fixes #18922. Applies the hook #15397 added for the sibling timers to the two labels it missed.

Verification

  • Both components render only inside ThreadFeed under the native-stack thread routes, and the iPad column navigator supplies navigation context, so useIsFocused always resolves. The same subtree already uses the hook (ProviderSubagentBar, WorkingTimer, thread-subagent-group).
  • use-visible-second-clock.test.tsx covers the gating and the before-paint catch-up: 9/9 pass. vp run typecheck in apps/mobile and targeted lint: clean.
  • Two independent review rounds (Claude Opus 5.5 and GPT-6.1 Sol) found no issues.
  • While a route sheet (agents, git overview, queue) covers part of the thread, these labels pause and jump to the right value when it closes, matching the floating timer since #15397.
  • On an iPhone 17 Pro Max simulator (iOS 26.5, dev build), a render counter in WorktreeSetupCard was read while a worktree setup script ran. I measured 20 s with the thread visible, 20 s hidden under Files, and 20 s visible again, alternating builds: PR, main, PR, main.
    • main: 20 renders while hidden, in both runs, the same rate as while visible.
    • this PR: 1 and 0 renders while hidden. The single render is the push transition, before the screen loses focus.
    • Visible rates are unchanged, 19-20 per 20 s on both builds, and the label shows the correct elapsed time when the thread is shown again.

Original work by @bompus in #17701, taken over by maintainers.

Claude Opus 5.5 and Claude Fable 5.1 in Claude Code, with review by GPT-6.1 Sol in Codex.

🤖 Generated with Claude Code


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

    2. juliusmarminge added labelsmacroscope-review

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at 25b3b1b

      Macroscope's review found this PR approvable — This is a narrowly scoped mobile bug fix that reuses an existing visibility-aware clock, preserving visible timer behavior while preventing unnecessary updates on hidden thread screens. It changes one UI component file and introduces no schema, product-default, deployment, or static-analysis configuration changes.

      No code changes detected at 17ed825. Prior analysis still applies.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. 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
      • Configuration used: Path: .coderabbit.config.ts
      • Review profile: CHILL
      • Plan: Team
      • Run ID: 8a079104-abd4-4bb3-a29e-db5ef0e9ccf6
      📥 Commits

      Reviewing files that changed from the base of the PR and between 25b3b1bb3d9d129fc1ee7cf21d41e0ad5f2ee8a9 and 17ed825434027cdf8ce8268a0b6fe2acf5396888.

      📒 Files selected for processing: 1
      • apps/mobile/src/features/threads/worktree-setup-card.tsx

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

      📝 Walkthrough

      The worktree setup card and working header now use useVisibleSecondClock. The component-local clock hook, including its app-state listener and interval, was removed.

      Changes: Worktree setup clock

      Layer / File(s)Summary
      Use the visible-second clock
      apps/mobile/src/features/threads/worktree-setup-card.tsx
      WorktreeSetupCard retains its `running

      Priority: ⬇️ Low

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

      Change: Bug fix · Severity of issue fixed: Low

      Suggested reviewers: pixpmusic

      Merge Risk: ⚪ Minimal · up to 17ed8

      The worktree labels pause while the thread is beneath a pushed route and refresh when it becomes visible again. No actionable merge-blocking risk remains.

      Pre-merge checks: Passed 4
      Check nameStatusExplanation
      Linked Issues checkPassedPR #20066 satisfies the coding requirements in active issue #18922. In apps/mobile/src/features/threads/worktree-setup-card.tsx, both WorktreeSetupCard and WorktreeWorkingHeader now use `useVisi…
      Out of Scope Changes checkPassedThe whole-PR change is limited to apps/mobile/src/features/threads/worktree-setup-card.tsx. It directly replaces the clock identified by issue #18922 with the existing visibility-aware hook. No unre…
      Title checkPassedThe title clearly and concisely describes the fix: preventing the worktree setup clock from continuing on hidden mobile thread screens. It uses an appropriate conventional commit format.
      Description checkPassedThe description includes all required sections: Problem, Change, Scope and approval, and Verification. It explains the affected behavior, implementation, issue reference, tests, lint and typecheck res…
      ✨ Finishing Touches
      📝 Generate docstrings
      • Commit to this branch
      • Create a new PR
      🧪 Generate unit tests (beta)
      • Commit to this branch
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Comment `@coderabbitai help` to get the list of available commands.
    5. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ℹ️ The exact PR base did not have a successful artifact. Baseline uses the latest successful main measurement shown below.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire5.0 KiB5.0 KiB+7 B (+0.1%)6.8 KiB✅
      CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      CodexLive turn WebSocket wire1.2 KiB1.2 KiB+7 B (+0.6%)2.0 KiB✅
      CodexLive turn WebSocket decoded20.9 KiB20.9 KiB0 B (0.0%)29.3 KiB✅
      CodexLive turn messages220 (0.0%)8✅
      ClaudeTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
      ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      ClaudeLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
      ClaudeLive turn WebSocket decoded21.2 KiB21.2 KiB0 B (0.0%)29.3 KiB✅
      ClaudeLive turn messages220 (0.0%)8✅

      Baseline: eef0e4e · PR result: 25b3b1b · 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: 108.5 KiB
      • Claude decoded thread snapshot: 108.8 KiB

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

    6. juliusmarminge merged thise74f477

    7. juliusmarminge closed this

Sign in to join this conversation.