# R7 switched-in-flight-read

Evidence for [#33263](https://git.cafe/pingdotgg/t3code/pull/33263). Both discard the old A read after switching to B; neither publishes A as B. Before: synthetic null prevents B's fresh subscription from reading within 6.5 seconds. After: B's fresh subscription publishes upstream/ahead 2/behind 1/default-ahead 2.

The old remote refresh completes successfully before its active subscription ends; only then does the fresh B subscription start. A passive observer remains throughout.

AI-assisted; verified with the tests and tools listed above.

| Before | After |
|---|---|
| [4c361199f4](https://git.cafe/pingdotgg/t3code/commit/4c361199f47f6ea32a2c14835df392640d0f7c63) | [456327574c](https://git.cafe/pingdotgg/t3code/commit/456327574c52ad1c7624083bb97eaf382edd1732) |
| [Full timestamped log](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/b0a8387221be1d30/R7-before.log) | [Full timestamped log](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/44492bfcc56013e7/R7-after.log) |

Before environment: Linux 6.8.0-117-generic x64; Node v26.12.1; `T3CODE_DEV_SEED=0 node apps/server/src/bin.ts serve --host 127.0.0.1 --port 40671 --base-dir /tmp/lead-33263-r1/evidence-capture/2026-11-10T07-13-46.020Z-before-R7/t3 --no-browser --log-level warn --dev-url http://127.0.0.1:40671`; settings: `automaticGitFetchInterval=30 seconds`. Fresh explicit base dir; Replay provisioned by `--dev-url`; forwarding git wrapper first on PATH. No dev runner or live-data seeding.

After environment: Linux 6.8.0-117-generic x64; Node v26.12.1; `T3CODE_DEV_SEED=0 node apps/server/src/bin.ts serve --host 127.0.0.1 --port 46557 --base-dir /tmp/lead-33263-r1/evidence-capture/2026-11-10T07-13-45.994Z-after-R7/t3 --no-browser --log-level warn --dev-url http://127.0.0.1:46557`; settings: `automaticGitFetchInterval=30 seconds`. Fresh explicit base dir; Replay provisioned by `--dev-url`; forwarding git wrapper first on PATH. No dev runner or live-data seeding.

The recordings below preserve action/event order independently in each column. Rows align by event ordinal, not wall-clock synchronization. Full payloads, command traces, and server completion spans are in the linked logs. Bounded windows establish only the recorded absence of an update, not a full 30-second delay.

| Before recording | After recording |
|---|---|
| `2026-11-10T07:13:46.400Z +380ms` SYNTHETIC_SEED {"facts":{"A":{"status":"## feature/A...origin/feature/A [ahead 1]","divergence":"1\t0"},"B":{"status":"## feature/B...origin/feature/B [ahead 2, behind 1]","divergence":"2\t1"}}} | `2026-11-10T07:13:46.298Z +303ms` SYNTHETIC_SEED {"facts":{"A":{"status":"## feature/A...origin/feature/A [ahead 1]","divergence":"1\t0"},"B":{"status":"## feature/B...origin/feature/B [ahead 2, behind 1]","divergence":"2\t1"}}} |
| `2026-11-10T07:13:46.404Z +384ms` SERVER_SPAWNED {"pid":286682} | `2026-11-10T07:13:46.301Z +306ms` SERVER_SPAWNED {"pid":286660} |
| `2026-11-10T07:13:51.659Z +5639ms` RPC_SEND server.updateSettings automaticGitFetchInterval=30000ms | `2026-11-10T07:13:51.785Z +5790ms` RPC_SEND server.updateSettings automaticGitFetchInterval=30000ms |
| `2026-11-10T07:13:51.832Z +5812ms` RPC_RESULT server.updateSettings {"automaticGitFetchInterval":{"_id":"Duration","_tag":"Millis","millis":30000}} | `2026-11-10T07:13:51.930Z +5935ms` RPC_RESULT server.updateSettings {"automaticGitFetchInterval":{"_id":"Duration","_tag":"Millis","millis":30000}} |
| `2026-11-10T07:13:51.833Z +5813ms` SUBSCRIBE passive-1 includeRemote=False | `2026-11-10T07:13:51.932Z +5937ms` SUBSCRIBE passive-1 includeRemote=False |
| `2026-11-10T07:13:52.893Z +6873ms` VCS_EVENT passive-1 snapshot {"isRepo":true,"refName":"feature/A","isDefaultRef":false,"hasPrimaryRemote":true,"hasWorkingTreeChanges":false,"branchChanges":{"baseRef":"origin/main","insertions":1,"deletions":0}} worktree={"insertions":0,"deletions":0,"files":[]} remote=null | `2026-11-10T07:13:53.089Z +7094ms` VCS_EVENT passive-1 snapshot {"isRepo":true,"refName":"feature/A","isDefaultRef":false,"hasPrimaryRemote":true,"hasWorkingTreeChanges":false,"branchChanges":{"baseRef":"origin/main","insertions":1,"deletions":0}} worktree={"insertions":0,"deletions":0,"files":[]} remote=null |
| `2026-11-10T07:13:52.894Z +6874ms` SUBSCRIBE first-active-2 includeRemote=True | `2026-11-10T07:13:53.093Z +7098ms` SUBSCRIBE first-active-2 includeRemote=True |
| `2026-11-10T07:13:53.003Z +6983ms` VCS_EVENT first-active-2 snapshot {"isRepo":true,"refName":"feature/A","isDefaultRef":false,"hasPrimaryRemote":true,"hasWorkingTreeChanges":false,"branchChanges":{"baseRef":"origin/main","insertions":1,"deletions":0}} worktree={"insertions":0,"deletions":0,"files":[]} remote=null | `2026-11-10T07:13:53.162Z +7168ms` VCS_EVENT first-active-2 snapshot {"isRepo":true,"refName":"feature/A","isDefaultRef":false,"hasPrimaryRemote":true,"hasWorkingTreeChanges":false,"branchChanges":{"baseRef":"origin/main","insertions":1,"deletions":0}} worktree={"insertions":0,"deletions":0,"files":[]} remote=null |
| `2026-11-10T07:13:53.424Z +7404ms` GATE_READ_IN_FLIGHT {"args":["--git-dir","/tmp/lead-33263-r1/evidence-capture/2026-11-10T07-13-46.020Z-before-R7/workspace/demo/.git","fetch","--quiet","--no-tags","--no-auto-gc","--","origin"]} | `2026-11-10T07:13:53.441Z +7446ms` GATE_READ_IN_FLIGHT {"args":["--git-dir","/tmp/lead-33263-r1/evidence-capture/2026-11-10T07-13-45.994Z-after-R7/workspace/demo/.git","fetch","--quiet","--no-tags","--no-auto-gc","--","origin"]} |
| `2026-11-10T07:13:53.424Z +7404ms` EXTERNAL_SWITCH {"branch":"feature/B"} | `2026-11-10T07:13:53.442Z +7447ms` EXTERNAL_SWITCH {"branch":"feature/B"} |
| `2026-11-10T07:13:53.449Z +7429ms` GIT_STATUS {"value":"## feature/B...origin/feature/B [ahead 2, behind 1]"} | `2026-11-10T07:13:53.457Z +7462ms` GIT_STATUS {"value":"## feature/B...origin/feature/B [ahead 2, behind 1]"} |
| `2026-11-10T07:13:53.450Z +7430ms` RPC_SEND vcs.refreshStatus localOnly=True | `2026-11-10T07:13:53.458Z +7463ms` RPC_SEND vcs.refreshStatus localOnly=True |
| `2026-11-10T07:13:54.111Z +8091ms` VCS_EVENT passive-1 localUpdated {"isRepo":true,"refName":"feature/B","isDefaultRef":false,"hasPrimaryRemote":true,"hasWorkingTreeChanges":false,"branchChanges":{"baseRef":"origin/main","insertions":2,"deletions":0}} worktree={"insertions":0,"deletions":0,"files":[]} | `2026-11-10T07:13:54.167Z +8172ms` VCS_EVENT passive-1 localUpdated {"isRepo":true,"refName":"feature/B","isDefaultRef":false,"hasPrimaryRemote":true,"hasWorkingTreeChanges":false,"branchChanges":{"baseRef":"origin/main","insertions":2,"deletions":0}} worktree={"insertions":0,"deletions":0,"files":[]} |
| `2026-11-10T07:13:54.112Z +8092ms` LOCAL_UPDATE_CONFIRMED_BEFORE_GATE_RELEASE {} | `2026-11-10T07:13:54.168Z +8173ms` LOCAL_UPDATE_CONFIRMED_BEFORE_GATE_RELEASE {} |
| `2026-11-10T07:13:54.114Z +8094ms` GATE_RELEASE_REQUESTED {} | `2026-11-10T07:13:54.170Z +8175ms` GATE_RELEASE_REQUESTED {} |
| `2026-11-10T07:13:54.116Z +8096ms` GATE_RELEASE_WRITTEN {} | `2026-11-10T07:13:54.172Z +8177ms` GATE_RELEASE_WRITTEN {} |
| `2026-11-10T07:13:54.118Z +8098ms` VCS_EVENT first-active-2 localUpdated {"isRepo":true,"refName":"feature/B","isDefaultRef":false,"hasPrimaryRemote":true,"hasWorkingTreeChanges":false,"branchChanges":{"baseRef":"origin/main","insertions":2,"deletions":0}} worktree={"insertions":0,"deletions":0,"files":[]} | `2026-11-10T07:13:54.176Z +8181ms` VCS_EVENT first-active-2 localUpdated {"isRepo":true,"refName":"feature/B","isDefaultRef":false,"hasPrimaryRemote":true,"hasWorkingTreeChanges":false,"branchChanges":{"baseRef":"origin/main","insertions":2,"deletions":0}} worktree={"insertions":0,"deletions":0,"files":[]} |
| `2026-11-10T07:13:55.980Z +9960ms` VCS_EVENT passive-1 remoteUpdated remote=null | `2026-11-10T07:13:54.179Z +8184ms` RPC_RESULT vcs.refreshStatus branch=feature/B remote={"hasUpstream":false,"aheadCount":0,"behindCount":0,"aheadOfDefaultCount":0} pr=null |
| `2026-11-10T07:13:55.984Z +9964ms` VCS_EVENT first-active-2 remoteUpdated remote=null | `2026-11-10T07:13:56.939Z +10944ms` REAL_SERVER_REMOTE_REFRESH_COMPLETED VcsStatusBroadcaster.refreshRemoteStatus exit=Success |
| `2026-11-10T07:13:55.985Z +9965ms` RPC_RESULT vcs.refreshStatus branch=feature/B remote={"hasUpstream":false,"aheadCount":0,"behindCount":0,"aheadOfDefaultCount":0} pr=null | `2026-11-10T07:13:57.695Z +11701ms` OBSERVATION_WINDOW_CLOSED {"timeoutMs":750} |
| `2026-11-10T07:13:56.832Z +10812ms` REAL_SERVER_REMOTE_REFRESH_COMPLETED VcsStatusBroadcaster.refreshRemoteStatus exit=Success | `2026-11-10T07:13:57.697Z +11702ms` UNSUBSCRIBE first-active-2 |
| `2026-11-10T07:13:57.587Z +11567ms` OBSERVATION_WINDOW_CLOSED {"timeoutMs":750} | `2026-11-10T07:13:57.701Z +11706ms` UNSUBSCRIBED first-active-2 |
| `2026-11-10T07:13:57.588Z +11568ms` UNSUBSCRIBE first-active-2 | `2026-11-10T07:13:57.701Z +11706ms` SUBSCRIBE B-fresh-active-3 includeRemote=True |
| `2026-11-10T07:13:57.589Z +11569ms` UNSUBSCRIBED first-active-2 | `2026-11-10T07:13:57.774Z +11779ms` VCS_EVENT B-fresh-active-3 snapshot {"isRepo":true,"refName":"feature/B","isDefaultRef":false,"hasPrimaryRemote":true,"hasWorkingTreeChanges":false,"branchChanges":{"baseRef":"origin/main","insertions":2,"deletions":0}} worktree={"insertions":0,"deletions":0,"files":[]} remote=null |
| `2026-11-10T07:13:57.590Z +11570ms` SUBSCRIBE B-fresh-active-3 includeRemote=True | `2026-11-10T07:13:58.811Z +12816ms` VCS_EVENT passive-1 remoteUpdated remote={"hasUpstream":true,"aheadCount":2,"behindCount":1,"aheadOfDefaultCount":2} pr=null |
| `2026-11-10T07:13:57.650Z +11630ms` VCS_EVENT B-fresh-active-3 snapshot {"isRepo":true,"refName":"feature/B","isDefaultRef":false,"hasPrimaryRemote":true,"hasWorkingTreeChanges":false,"branchChanges":{"baseRef":"origin/main","insertions":2,"deletions":0}} worktree={"insertions":0,"deletions":0,"files":[]} remote=null | `2026-11-10T07:13:58.814Z +12820ms` VCS_EVENT B-fresh-active-3 remoteUpdated remote={"hasUpstream":true,"aheadCount":2,"behindCount":1,"aheadOfDefaultCount":2} pr=null |
| `2026-11-10T07:14:04.153Z +18133ms` OBSERVATION_WINDOW_CLOSED {"timeoutMs":6500} | `2026-11-10T07:13:59.315Z +13321ms` OBSERVATION_WINDOW_CLOSED {"timeoutMs":500} |
| `2026-11-10T07:14:04.655Z +18635ms` OBSERVATION_WINDOW_CLOSED {"timeoutMs":500} | `2026-11-10T07:13:59.318Z +13323ms` UNSUBSCRIBE B-fresh-active-3 |
| `2026-11-10T07:14:04.658Z +18638ms` UNSUBSCRIBE B-fresh-active-3 | `2026-11-10T07:13:59.328Z +13333ms` UNSUBSCRIBED B-fresh-active-3 |
| `2026-11-10T07:14:04.663Z +18643ms` UNSUBSCRIBED B-fresh-active-3 | `2026-11-10T07:13:59.329Z +13334ms` SUBSCRIBE final-passive-4 includeRemote=False |
| `2026-11-10T07:14:04.672Z +18652ms` SUBSCRIBE final-passive-4 includeRemote=False | `2026-11-10T07:13:59.388Z +13393ms` VCS_EVENT final-passive-4 snapshot {"isRepo":true,"refName":"feature/B","isDefaultRef":false,"hasPrimaryRemote":true,"hasWorkingTreeChanges":false,"branchChanges":{"baseRef":"origin/main","insertions":2,"deletions":0}} worktree={"insertions":0,"deletions":0,"files":[]} remote={"hasUpstream":true,"aheadCount":2,"behindCount":1,"aheadOfDefaultCount":2} pr=null |
| `2026-11-10T07:14:04.791Z +18771ms` VCS_EVENT final-passive-4 snapshot {"isRepo":true,"refName":"feature/B","isDefaultRef":false,"hasPrimaryRemote":true,"hasWorkingTreeChanges":false,"branchChanges":{"baseRef":"origin/main","insertions":2,"deletions":0}} worktree={"insertions":0,"deletions":0,"files":[]} remote=null | `2026-11-10T07:13:59.390Z +13395ms` UNSUBSCRIBE final-passive-4 |
| `2026-11-10T07:14:04.792Z +18772ms` UNSUBSCRIBE final-passive-4 | `2026-11-10T07:13:59.390Z +13395ms` UNSUBSCRIBED final-passive-4 |
| `2026-11-10T07:14:04.792Z +18772ms` UNSUBSCRIBED final-passive-4 | `2026-11-10T07:13:59.390Z +13395ms` UNSUBSCRIBE passive-1 |
| `2026-11-10T07:14:04.793Z +18773ms` UNSUBSCRIBE passive-1 | `2026-11-10T07:13:59.391Z +13396ms` UNSUBSCRIBED passive-1 |
| `2026-11-10T07:14:04.794Z +18774ms` UNSUBSCRIBED passive-1 | `2026-11-10T07:13:59.391Z +13396ms` ROW_COMPLETE {"row":"R7"} |
| `2026-11-10T07:14:04.794Z +18774ms` ROW_COMPLETE {"row":"R7"} | `2026-11-10T07:13:59.558Z +13563ms` SERVER_STOPPED {"pid":286660,"exitCode":130,"signal":null} |
| `2026-11-10T07:14:05.015Z +18995ms` SERVER_STOPPED {"pid":286682,"exitCode":130,"signal":null} |  |

Final before: remote=null

Final after: remote={"hasUpstream":true,"aheadCount":2,"behindCount":1,"aheadOfDefaultCount":2} pr=null
