GeezerVison is showing github.com — refactor(mobile): subagent timers share the visible second clock by juliusmarminge · Pull Request #25854 · pingdotgg/t3code
Conversation
Problem
The mobile agents sheet and the subagent group card each ran their own 1s setInterval for elapsed labels. The agents sheet's interval kept re-rendering while its route was hidden or the app was in the background. The group card paused correctly, but it rebuilt focus and AppState gating by hand with two effects. useFileChipShare copied the connection URL into a ref through a layout effect so its useCallback handler could read it.
Change
ThreadAgentsSheet (useSubagentElapsed) and thread-subagent-group (SubagentElapsed) now read useVisibleSecondClock. That hook is already on main and already used by ProviderSubagentBar, the worktree setup card, the thread list and the floating working control. It subscribes to the shared secondTick only while the label is live, its route is focused and the app is active.
useFileChipShare returns a plain handler that closes over the current httpBaseUrl. The React Compiler memoizes it on its inputs, so it no longer needs the latest-value ref or the layout effect.
What this improves
- Renders avoided: a running subagent row in the agents sheet no longer re-renders every second while the sheet is unfocused or the app is backgrounded.
- Sync removed: the hand-rolled AppState listener and interval in the group card, and the ref mirror in
useFileChipShare.
- All visible elapsed labels now tick on the same second boundary instead of each on its own mount phase.
- No bug-fix claim, so this PR adds no regression test.
Behavior changes:
- The agents sheet's elapsed labels stop ticking while the sheet is unfocused or the app is in the background. When they resume they show the current second.
- On mount, the first elapsed value is floored to the whole second (shared tick) rather than taken from
Date.now().
- No logging or refresh changes.
Effects
ThreadAgentsSheet.tsx: 1 -> 0
thread-subagent-group.tsx: 2 -> 0
useFileChipShare.ts: 2 -> 1. The unmount abort stays because it is component-lifetime cleanup.
Verification
vp run check:changed: format, lint, knip 1/2 and 2/2, and typecheck (mobile, scripts) all pass.
- None of the touched files has an existing test.
Model: Claude Opus 5.5, Claude Code harness.
🤖 Generated with Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
The agents sheet and the subagent group card each ran their own 1s
interval for elapsed labels. The sheet's kept ticking while its route was
hidden or the app was backgrounded; the group card rebuilt focus and app
state gating by hand. File chip sharing mirrored the connection URL into a
ref through a layout effect.
Both elapsed labels now read useVisibleSecondClock, the shared second tick
that pauses while unfocused or backgrounded. useFileChipShare returns a
plain handler that closes over the current connection URL.
Effects: ThreadAgentsSheet 1 -> 0, thread-subagent-group 2 -> 0,
useFileChipShare 2 -> 1 (the unmount abort stays: component-lifetime
cleanup).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Approvability
Verdict: Approved at 77f6e97
Macroscope's review found this PR approvable — This is a contained mobile refactor that replaces duplicated subagent intervals with the existing shared visible-second clock and simplifies file-sharing URL handling. Its runtime effects are limited to synchronized visible timers and localized callback identity/closure behavior, with no schema, deployment, security, billing, or default changes.
You can add or adjust custom eligibility rules. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|

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 4cb29a5 and 77f6e97.
Files selected for processing: 3
-
apps/mobile/src/features/threads/ThreadAgentsSheet.tsx
apps/mobile/src/features/threads/thread-subagent-group.tsx
apps/mobile/src/features/threads/useFileChipShare.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
Walkthrough
-
Two mobile subagent elapsed-time displays now use useVisibleSecondClock instead of local intervals. The file-sharing hook now uses the httpBaseUrl from the render that created its handler.
Changes: Subagent elapsed-time updates
| Layer / File(s) |
Summary |
Shared clock for elapsed time apps/mobile/src/features/threads/ThreadAgentsSheet.tsx, apps/mobile/src/features/threads/thread-subagent-group.tsx |
Both displays use useVisibleSecondClock instead of local intervals. The hook is enabled according to each display’s existing activity conditions. |
File chip sharing
| Layer / File(s) |
Summary |
Render-time URL for sharing apps/mobile/src/features/threads/useFileChipShare.ts |
The share handler uses the render’s httpBaseUrl. Request guarding, abort handling, download and sharing, error reporting, and cleanup remain in the handler. |
Priority: Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Refactor
Possibly related PRs
Suggested reviewers: macroscopeapp
Merge Risk: Minimal · up to 77f6e
-
The shared-clock and file-sharing changes are mergeable after normal checks; no concrete issue remains identified.
Pre-merge checks: 3 · 1
-
Failed checks: 1 warning
| Check name |
Status |
Explanation |
Resolution |
| Description check |
 |
The description explains the problem, changes, behavior effects, and verification results. It does not provide the required Scope and approval information, and it omits the required UI screenshots or … |
Add the triaged issue or explicit maintainer approval with scope justification. Include before/after screenshots and a short recording if needed to demonstrate the elapsed-label timing behavior. |
Passed checks: 3 passed
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title clearly and concisely describes the primary change: replacing subagent timers with the shared visible second clock. |
| 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. |
Full details: Description check
-
Explanation
The description explains the problem, changes, behavior effects, and verification results. It does not provide the required Scope and approval information, and it omits the required UI screenshots or recording for timing-related behavior.
Resolution
Add the triaged issue or explicit maintainer approval with scope justification. Include before/after screenshots and a short recording if needed to demonstrate the elapsed-label timing behavior.
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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:M
30-99 changed lines (additions + deletions).
vouch:trusted
Author is trusted by repo permissions or the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|