Skip to content

fix(mobile): scope Git result banners to their originating thread - #41015

Merged
juliusmarminge merged 6 commits into
pingdotgg:mainfrom
StiensWout:t3/1312-a-git-result-can-appear-in-a-different-p
Nov 22, 2026
Merged

juliusmarminge merged 6 commits into
pingdotgg:mainfrom
StiensWout:t3/1312-a-git-result-can-appear-in-a-different-p

Conversation

@StiensWout

Copy link
Copy Markdown
Contributor

The mobile Git banner read a single app-wide result, so a pull could show up in a different project's thread. Android and iOS now display, dismiss, and expire success and error banners independently for the originating environment and thread, including when persisted IDs contain colons.

Fixes #41014

Reproduction on main

Commit 6972026121 (main). The second thread shows “Pulled latest on” with the branch name from the first project. The cause is at apps/mobile/src/state/use-vcs-action-state.ts:156. Followed the steps under Evidence in the app on Pixel_9_API_37 (Android 17.0): After I tapped Pull in Orchard and opened the idle Harbor checklist thread, Harbor displayed “Pulled latest on orchard-update” above its chat. The banner named Orchard’s branch, and the pull ran only in Orchard.

Evidence

Environment: Pixel_9_API_37, Android 17.0, Android Emulator on Linux x64

Steps:

  1. On an Android phone emulator, open a thread on a checked-out branch that is one commit behind its upstream.
  2. Open Git controls in the thread header.
  3. Tap Pull.
  4. Once the pull starts, return to the thread list.
  5. Open an idle thread in a different Git project before the pull result disappears. If the pull finishes quickly, switch while its success banner is still visible.
  6. Look at the banner above the second thread's chat.

Proven: the bug shows on main at 6972026121 and no longer shows on head 19ac6fb17b.

Before After
Commit 6972026121 19ac6fb17b
Result Shows: After I tapped Pull in Orchard and opened the idle Harbor checklist thread, Harbor displayed “Pulled latest on orchard-update” above its chat. The banner named Orchard’s branch, and the pull ran only in Orchard. Does not show: Orchard showed “Pulled latest on orchard-update.” I switched to Harbor checklist while that result was still visible in Orchard, and Harbor’s idle chat opened without a Git banner.
Orchard Git controls before Pull Before: Orchard Git controls before Pull After: Orchard Git controls before Pull
Harbor chat after Orchard pull Before: Harbor chat after Orchard pull After: Harbor chat after Orchard pull
Pull and switch projects Before: Pull and switch projects After: Pull and switch projects

Tests

  • bc22f116d9 adds the failing test, alone, before the fix.
  • cd apps/mobile && pnpm exec vp test run src/state/use-selected-thread-git-state.test.tsx src/state/use-selected-thread-git-actions.test.ts passed on head.
  • pnpm exec vp run check:changed passed on head.

Not in this change

  • Web and desktop use a separate thread-scoped toast path.
  • Running progress follows checkout state, including Git activity in tracked repositories.
  • Quiet status-refresh failures use the existing connection error channel.
  • Git branch and remote discovery, permissions, and metadata updates are handled upstream of banner ownership.
  • Banner duration, haptic feedback, and latest-completion ordering within one thread retain their existing behavior.
  • The supplied Android walkthrough covers the native navigation and pull interaction.

Who did the work

  • Written by GPT 6.2 Sol, in Codex
  • Review findings fixed by GPT 6.2 Sol, in Codex
  • Reviewed by GPT 6.2 Sol, in Codex, and by Claude Opus 5.5, in Claude Code, each on its own
  • Also reviewed by cubic, run locally by a program, with no score
  • Reproduced on the device, on main and on the head, by GPT 6.2 Sol, in Codex
  • Checks run by a program on base and head, not by an agent
  • Left open after review: should, apps/mobile/src/state/use-selected-thread-git-state.test.tsx:172: The new banner tests exercise useGitActionProgress, showGitActionResult and dismissGitActionResult from use-vcs-action-state.ts, but they sit in the branch-state test for useSelectedThreadGitState. To fit them there, the file drops its mock of ./use-vcs-action-state and adds expo-haptics and connection runtime mocks that its existing branch test does not need. Put them in use-vcs-action-state's own test file instead: rename it to .tsx and add it to the jsdom reactTests list in apps/mobile/vite.config.ts. The branch test then keeps its original mocks.

Made in T3 Code by GPT 6.2 Sol and Claude Opus 5.5

StiensWout and others added 4 commits November 22, 2026 19:46
Co-authored-by: GPT 6.2 Sol <codex@openai.com>
Co-authored-by: GPT 6.2 Sol <codex@openai.com>
Co-authored-by: GPT 6.2 Sol <codex@openai.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 22, 2026
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Git action results now carry an environment-and-thread reference, are stored and dismissed per thread, and appear only for the selected thread. Notification producers attach the selected reference, and tests cover scope isolation and result feedback.

Changes: Thread-scoped Git results

Layer / File(s) Summary
Store and read results by thread
apps/mobile/src/state/use-vcs-action-state.ts, apps/mobile/src/state/use-vcs-action-state.test.ts, apps/mobile/src/state/use-vcs-action-state.test.tsx, apps/mobile/vite.config.ts
Results are stored by environment and thread. Showing a result replaces that thread’s prior result and schedules dismissal after five seconds; dismissing a result cancels its timer. The selected-thread hook reads only the matching result. React tests cover haptic feedback and thread/environment isolation.
Attach thread scope to notifications
apps/mobile/src/state/use-selected-thread-git-actions.ts, apps/mobile/src/state/use-selected-thread-git-actions.test.ts
Git action errors and successes use a helper that adds the selected thread reference. The helper does not show a result when no thread is selected. The error-result test expects the reference.
Pass the selected thread reference to the display
apps/mobile/src/features/threads/ThreadRouteScreen.tsx
The thread route passes its selected thread reference to the progress hook and uses it when dismissing a result.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested labels: bugfix

Suggested reviewers: juliusmarminge, maria-rcks, macroscopeapp

Merge Risk: Minimal · up to 735e3

This change scopes mobile Git result banners to the thread that started them, which fixes the wrong-project banner. The supplied evidence shows no remaining merge-blocking risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(mobile): scope Git result banners to their originating thread" matches the main change. The diff stores Git action results per environment and thread, and the banner hides results from …
Description check Passed The description follows the template. It has a Problem section (the app-wide Git result shows in the wrong thread), a Change section (per-thread, per-environment banner ownership), and a Scope section…
Linked Issues check Passed Issue #41014 requires that a Git result appears only in the thread that produced it, including when the user switches projects during a pull or within five seconds of its completion. At head, apps/mob…
Out of Scope Changes check Passed Each changed area connects to thread-scoped banner ownership. The changes are in use-vcs-action-state.ts (keyed result storage and scoped show, dismiss, and read), use-selected-thread-git-actions.ts (…
Full details: Title check

Explanation

The title "fix(mobile): scope Git result banners to their originating thread" matches the main change. The diff stores Git action results per environment and thread, and the banner hides results from other threads. The title is specific, follows the conventional commit form, and names the affected area (mobile).

Full details: Description check

Explanation

The description follows the template. It has a Problem section (the app-wide Git result shows in the wrong thread), a Change section (per-thread, per-environment banner ownership), and a Scope section that links issue #41014. Its Verification section lists focused tests, a reproduction on main and head with before/after evidence, and the commands run. The description also names the agents that did the work, as the template asks. The Scope section does not clearly say why the fix needs no issue, but it links one. The template asks for a short recording when timing or interaction matters, and the description includes one. Two gaps remain: the description does not state what could not be checked, and it leaves a review question open (moving tests into use-vcs-action-state's own test file). Those gaps are minor, so the description is mostly complete.

Full details: Linked Issues check

Explanation

Issue #41014 requires that a Git result appears only in the thread that produced it, including when the user switches projects during a pull or within five seconds of its completion. At head, apps/mobile/src/state/use-vcs-action-state.ts stores results in gitActionResultsAtom, keyed by gitActionResultKey(threadRef), which is JSON.stringify([environmentId, threadId]). Colons in IDs therefore do not cause key collisions. useGitActionProgress reads only the entry for the selected thread's key, so an idle thread in another project receives no banner. showGitActionResult requires a threadRef, replaces and clears any prior timer for that thread, and schedules dismissal after RESULT_DISMISS_MS (5 s). dismissGitActionResult(threadRef) clears only that thread's timer and entry, and returns early for null. The PR summary states that use-selected-thread-git-actions.ts routes results through reportGitActionResult with the selected thread reference, and that ThreadRouteScreen.tsx passes the same reference to the progress hook and dismiss handler. The head file content matches these claims. The before and after reproduction on main and head, and the added tests for per-thread visibility, independent expiry, and colon-containing IDs, support the fix. The change since the previous review (test file relocation and vite.config.ts include) does not alter the requirement logic. The incremental diff read returned no content, so the verdict relies on the head file content and the PR summary for call sites. No coding requirement remains unmet.

Full details: Out of Scope Changes check

Explanation

Each changed area connects to thread-scoped banner ownership. The changes are in use-vcs-action-state.ts (keyed result storage and scoped show, dismiss, and read), use-selected-thread-git-actions.ts (reportGitActionResult helper that attaches the thread reference), ThreadRouteScreen.tsx (passes the thread reference to the progress hook and dismiss handler), and the tests. The test changes support the new signatures and behavior: use-vcs-action-state.test.ts is replaced by use-vcs-action-state.test.tsx, and vite.config.ts adds that file to the jsdom reactTests list. The PR description's exclusions (web and desktop toast path, running progress, status-refresh errors, branch discovery, duration, haptics, in-thread ordering) are not changed by the reviewed code. The open test-placement note concerns test organization, not scope. No unrelated change was identified. The incremental diff read returned no content, so this verdict relies on the head file content and the PR summary.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 19ac6fb and 735e30b.

Files selected for processing: 3

  • apps/mobile/src/state/use-vcs-action-state.test.ts
  • apps/mobile/src/state/use-vcs-action-state.test.tsx
  • apps/mobile/vite.config.ts
Files with no reviewable changes: 1

  • apps/mobile/src/state/use-vcs-action-state.test.ts

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

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 22, 2026
juliusmarminge and others added 2 commits November 22, 2026 19:30
…can-appear-in-a-different-p

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The banner tests lived in the branch-state test file and replaced its use-vcs-action-state mock with the real module and a connection runtime stub. They now sit in use-vcs-action-state.test.tsx with only ./vcs mocked, and the colon-collision case is a row of the visibility table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

On Android Pixel 9 (API 36), light theme: open a thread whose branch is one commit behind upstream, open Git controls, tap Pull, return to the thread list, and open an idle thread in another Git project before the five-second banner expires. Both sides use fresh synthetic data and the same interaction script. Private environment subtitles are redacted.

Before After
Recording: foreign pull banner appears in Idle thread Recording: Idle thread stays clear
3806763022 735e30b187

Seed script · Interaction script

Not shown:

  • Returning to the originating thread before expiry was not captured.
  • Concurrent results replacing, dismissing, or expiring one another were not exercised; the recordings prove the reported cross-project navigation leak.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 22, 2026
@juliusmarminge
juliusmarminge merged commit 7ed41b7 into pingdotgg:main Nov 22, 2026
58 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 22, 2026
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Nov 22, 2026
**v0.1.12-nightly.20261122.5111** · 30 changes from 10 contributors

- **Multi-file diffs.** Open diff now shows every file in a multi-file Codex patch.
- **Mixed-content paste.** Pasting a message with text and a picture now keeps both.
- **Queued attachments.** Edit a queued message without losing its image or file attachment chips.
- **Pull request checks.** Agents watching a pull request can recognize checks that already passed instead of waiting indefinitely.
- **Notebook outputs.** Saved HTML outputs now appear when you scroll them into view.

### Plus 24 more bug fixes and performance improvements.

<details>
<summary>Full changelog</summary>

## What's Changed
* perf(mobile): keep image bytes outside draft JSON by @t3dotgg in pingdotgg/t3code#9727
* fix(server): watch_pull_request says when checks already passed by @juliusmarminge in pingdotgg/t3code#40866
* fix(codex): Open diff shows every file of a multi-file patch by @Abhiram-745 in pingdotgg/t3code#40874
* fix(server): ACP startup gives up when the agent never answers the handshake by @juliusmarminge in pingdotgg/t3code#40864
* fix(server): a branch prefixed with another remote's name publishes under its full name by @Abhiram-745 in pingdotgg/t3code#40877
* fix(server): list open delegated tasks when task_status or task_cancel finds no match by @Project516 in pingdotgg/t3code#40886
* fix(gitlab): find merge requests opened from a fork by @Abhiram-745 in pingdotgg/t3code#40894
* fix(web): pasting a chat message with text and a picture keeps both by @juliusmarminge in pingdotgg/t3code#40909
* fix(antigravity): bound silent post-settle background command holds by @Lokkuchakreshkumar in pingdotgg/t3code#40858
* fix(desktop): WSL is not offered or started when only the Windows install stub exists by @juliusmarminge in pingdotgg/t3code#40918
* fix(server): idle /ws connections behind a reverse proxy no longer drop every 60s by @juliusmarminge in pingdotgg/t3code#40932
* fix(server): thread reads no longer attribute T3 Code's compact-before-send /compact to the user by @juliusmarminge in pingdotgg/t3code#40934
* fix(web,mobile): @-file mentions show by name in message previews, not as raw links by @tiliakoos in pingdotgg/t3code#40924
* fix(web): tool calls stay grouped after a usage-limit pause again by @matthew-waters in pingdotgg/t3code#40905
* fix(server): t3 doctor no longer reports a database just under 1 GiB as "1024.0 MiB" by @tiliakoos in pingdotgg/t3code#40952
* fix(web): show clone failure after progress is dismissed by @StiensWout in pingdotgg/t3code#40951
* Invalidate pending theme imports when a replacement is too large by @StiensWout in pingdotgg/t3code#40965
* fix(mobile): show linked thread history page errors by @StiensWout in pingdotgg/t3code#40973
* fix(client-runtime): skip waiting for lower-priority linked addresses by @StiensWout in pingdotgg/t3code#40989
* fix(web): navigate Excel sheets from the focused tab by @StiensWout in pingdotgg/t3code#41008
* fix(mobile): bound app-owned composer attachment filenames by @StiensWout in pingdotgg/t3code#40991
* fix(web): prioritize visible saved notebook outputs by @StiensWout in pingdotgg/t3code#40998
* fix(web): editing a queued message keeps its attachment chips resolved by @smirea in pingdotgg/t3code#40945
* fix(server): unlinking an environment ends its session on the other machine by @juliusmarminge in pingdotgg/t3code#41005
* fix(mobile): scope Git result banners to their originating thread by @StiensWout in pingdotgg/t3code#41015
* fix(web): keep the conversation when a pairing tab closes by @StiensWout in pingdotgg/t3code#41025
* fix: restart linked thread reads when trying again by @StiensWout in pingdotgg/t3code#41020
* fix(client-runtime): count ambiguous projects in chat file links by @StiensWout in pingdotgg/t3code#40986
* fix(mobile): keep media actions on each sent image page by @StiensWout in pingdotgg/t3code#41018
* perf(server): a run's provider turn lookup is linear, not quadratic by @navidnadali in pingdotgg/t3code#38791

## New Contributors
* @Lokkuchakreshkumar made their first contribution in pingdotgg/t3code#40858
* @matthew-waters made their first contribution in pingdotgg/t3code#40905

**Full Changelog**: pingdotgg/t3code@v0.1.12-nightly.20261122.5098...v0.1.12-nightly.20261122.5111

</details>


Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.1.12-nightly.20261122.5111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: A Git result can appear in a different project's thread

2 participants