GeezerVison is showing github.com — fix(task-cache): the hook test waits for every flusher it starts by juliusmarminge · Pull Request #26148 · pingdotgg/t3code
Conversation
infra/task-cache/src/runHook.test.ts flakes in its own cleanup: ENOTEMPTY: directory not empty, rmdir '/tmp/task-cache-hook-wJV6oY' (run 40573347544, attempt 1, job Test).
Cause
Outside GitHub Actions, the run hook passes its telemetry queue to a flusher it spawns with detached: true and stdio: "ignore", then unrefs. The integration test ran most vp steps that way with HOME set to the test root, and nothing could wait for those flushers.
On start, a flusher always creates $HOME/.cache/t3-task-cache/telemetry and flush.lock. It does this even when another flusher has already sent its events, or when there is nothing to send (--last-details, the --no-cache nested run). If that happens while rm(root, { recursive: true }) is walking the tree, the final rmdir fails. If it happens just after, it silently recreates the deleted root.
Fix
This change touches only the test; production code is unchanged.
-
Inline flushing in the integration test. Every vp step now runs with inline flushing, the existing GITHUB_ACTIONS path, so each vp run exits only after its telemetry is sent.
- I instrumented the hook to see which processes start it. Only the seven top-level
vp calls do. The nested vp processes resolve a different workspace root and skip it.
- So once the last
vp exits, nothing the test started can still write under root.
- This also removes the
report(n) waiting machinery. Each step now asserts the exact report count when it returns.
-
A separate test for the detached path. It calls the hook in-process and collects the flusher from Node's child_process diagnostics channel. It asserts two things:
finish() returns before the collector answers the flusher's request.
- The flusher delivers the queued summary.
It awaits the flusher's close before cleanup, whether the test passes or fails.
This closes the race rather than narrowing it. Every process the tests start is awaited, either by vp before it exits or by the test itself. There are no sleeps, polling or retries.
Trade-off
The detached path no longer runs through the real Vite+ runner. The old first-step check, that vp's process exits before the flusher's request is answered, also covered unref() and stdio: "ignore". The new test proves finish() does not wait for delivery, but it does not check process exit.
Keeping a detached flusher under real vp would need one of two things:
- Production surface that exists only for tests, such as exposing the flusher's completion.
- A pipe that leaks from the test through Node and the Vite+ Rust runner into the detached flusher. That relies on fd inheritance no layer promises.
I chose the test-only option.
Verification
- Late-flusher probe.
flush.ts temporarily slept a random 0–800 ms before flushing, using the package's vitest config.
main's test failed 2 of 20 runs with the same ENOTEMPTY, and 19 of 20 runs left the deleted root recreated in TMPDIR.
- This branch failed 0 of 20 runs and left nothing behind, covering both affected tests.
- Mutations. Making
finish() await the flusher fails the new test. So does flushing inline everywhere.
- Loops.
vp test run --config ../../vite.config.ts --dir . src/runHook.test.ts, with TMPDIR under $HOME/.cache: 180 of 180 runs passed: 40, then 40, then 100 run as four parallel lanes. In the first 40, one run found a stale directory in a TMPDIR path that an earlier loop had used. That loop ran without the package config, and under the 5 s default timeout some tests timed out and their vp processes were orphaned. The next 140 runs, on fresh paths, left nothing behind.
- CI-like environment. The file passes with
GITHUB_ACTIONS=true, ACTIONS_ID_TOKEN_*, T3_TASK_CACHE_TELEMETRY=off and VITE_CACHE_PATH set in the outer environment, and nothing is written outside its temp directories.
- Checks.
vp run check:changed passes.
The integration test is also about 0.5 s faster, since it no longer waits on detached delivery.
Done by Claude Opus 5.5 in Claude Code, running in T3 Code.
🤖 Generated with Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Outside GitHub Actions the run hook drains telemetry in a detached,
unref'd flusher that creates its queue and lock under HOME even when
there is nothing to send. The integration test ran most `vp` steps that
way with HOME set to its temp root, so a late flusher could recreate
directories while cleanup removed the root and fail with ENOTEMPTY.
Run every integration step with inline flushing, so each `vp run` exits
only after its telemetry is sent, and assert the report count after each
step. Cover the detached path with an in-process test that collects the
flusher from Node's child_process diagnostics channel, checks finish()
returns before delivery, and awaits the flusher before cleanup.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Approvability
Verdict: Approved at 359f6de
Macroscope's review found this PR approvable — This test-only change waits for telemetry flushers before removing temporary directories. Production behavior is unchanged, and the test-coverage trade-off presents no obvious material risk.
Notes:
- No code objects were reviewed. Approvability was decided on eligibility alone.
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 5b70d81 and 359f6de.
Files selected for processing: 1
-
infra/task-cache/src/runHook.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Walkthrough
-
The run-hook integration tests change runner configuration and report-count checks. A new test delays the telemetry server response, observes detached-flusher cleanup, and verifies the report data and connection state.
Changes: Run-hook telemetry tests
| Layer / File(s) |
Summary |
Integration test synchronization infra/task-cache/src/runHook.test.ts |
The existing test now configures spawned runners with GITHUB_ACTIONS set to "true" and checks report counts after runs. The server responds after recording each request, and the run helper no longer accepts a ci argument. |
Detached flusher coverage infra/task-cache/src/runHook.test.ts |
A new test holds a telemetry response open, observes the detached flusher, and verifies the report data and that the response was not destroyed. Cleanup releases the response and awaits the flusher. |
Priority: Low
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Possibly related PRs
Suggested reviewers: macroscopeapp
Merge Risk: Minimal · up to 359f6
-
The changed telemetry tests are ready to merge after normal checks; no actionable merge-blocking issue was found.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title clearly and concisely describes the primary test fix: waiting for every flusher started by the hook test. |
| Description check |
 |
The description provides a detailed problem statement, root cause, fix, trade-off, scope clarification that production code is unchanged, and focused verification results. It is sufficiently complete … |
| 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 provides a detailed problem statement, root cause, fix, trade-off, scope clarification that production code is unchanged, and focused verification results. It is sufficiently complete for review.
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.
github-actions Bot
added a commit
to omarcresp/t3code-flake
that referenced
this pull request
Oct 28, 2026
## What's Changed
* fix(mobile): center Android sheets and fit book-mode sheets in the left pane by @PixPMusic in pingdotgg/t3code#18492
* fix(mobile): keep the collapsed Android rail square by @PixPMusic in pingdotgg/t3code#26039
* fix(web): closing the last Browser tab hides the right panel again by @juliusmarminge in pingdotgg/t3code#26058
* refactor(web): pull requests Cmd+F focuses the topbar search directly by @juliusmarminge in pingdotgg/t3code#26045
* refactor(web): install draft model reconciliation at app start by @juliusmarminge in pingdotgg/t3code#26046
* perf(mobile): project favicons mount their image in one commit by @juliusmarminge in pingdotgg/t3code#26047
* refactor(web): the upload queue alone records finished file uploads on drafts by @juliusmarminge in pingdotgg/t3code#26050
* feat(mobile): Usage uses the width on iPad and unfolded phones by @juliusmarminge in pingdotgg/t3code#26061
* fix(gitcafe): PR panel follows renumbered pull requests by @juliusmarminge in pingdotgg/t3code#26079
* chore(infra): bump Alchemy to 2.0.0-beta.84 by @juliusmarminge in pingdotgg/t3code#26057
* refactor(mobile): stop writing the resolved project filter back from an effect by @juliusmarminge in pingdotgg/t3code#26049
* fix(mobile): a pairing link fills the open Add environment form instead of stacking another by @juliusmarminge in pingdotgg/t3code#26052
* fix(mobile): snooze menu times advance with the clock by @juliusmarminge in pingdotgg/t3code#26043
* fix(clients): prompt links find projects cloned from git.cafe by @juliusmarminge in pingdotgg/t3code#26042
* fix(server): retry Codex capacity failures with empty input by @Yash-Singh1 in pingdotgg/t3code#25611
* fix(server): recover handoffs when target context is exhausted by @Yash-Singh1 in pingdotgg/t3code#25610
* fix(web): chips drop their pill and stay readable on every theme by @flamboh in pingdotgg/t3code#25066
* fix(mobile): switching pull request tabs no longer jumps the page by @flamboh in pingdotgg/t3code#26064
* feat(mobile): report crashes to Axiom with symbolicated stacks by @gabrielelpidio in pingdotgg/t3code#19093
* fix(web): chip palette test follows the single design by @juliusmarminge in pingdotgg/t3code#26131
* feat(server): /mcp narrows a client's modes from T3-Mode-Limit by @juliusmarminge in pingdotgg/t3code#16653
* feat(server): t3_thread_launch takes clientRequestId by @juliusmarminge in pingdotgg/t3code#16654
* feat(server): link to another environment by @juliusmarminge in pingdotgg/t3code#16655
* feat(server): agents use linked environments through any T3 tool by @juliusmarminge in pingdotgg/t3code#16684
* feat(server): work a linked environment starts stays within its link by @juliusmarminge in pingdotgg/t3code#16695
* feat(web,mobile): linked environments in Connections by @juliusmarminge in pingdotgg/t3code#16698
* feat(server): delegate_task to a linked environment by @juliusmarminge in pingdotgg/t3code#16719
* feat(server,web,mobile): an agent sets up a link to another environment by @juliusmarminge in pingdotgg/t3code#17129
* feat(server,web,mobile): @-mention a machine, and linked environments become a Labs beta by @juliusmarminge in pingdotgg/t3code#17130
* fix(mobile): dragging a microphone or environment route now saves its new place by @juliusmarminge in pingdotgg/t3code#26096
* feat(web): channel artwork choice on Latest, plus nightly or dev art on any channel by @maria-rcks in pingdotgg/t3code#26138
* feat(mobile): browse ZIP attachments with the shared archive reader by @Bil0000 in pingdotgg/t3code#19463
* fix(server): Claude --settings launch args merge with T3's settings instead of being dropped by @t3dotgg in pingdotgg/t3code#22864
* feat(server,web): see and stop the dev servers a thread started by @t3dotgg in pingdotgg/t3code#22542
* fix(web): composer no longer jumps when a second line is added by @maria-rcks in pingdotgg/t3code#26155
* feat(web,mobile): queued messages show who sent them by @juliusmarminge in pingdotgg/t3code#26159
* fix(preview): agent and browser panel show the same page after a late desktop attach by @t3dotgg in pingdotgg/t3code#22877
* fix(web): pairing, connect, error, and Clerk sign-in surfaces match the app's dialog style by @maria-rcks in pingdotgg/t3code#25281
* fix(server): parallel worktree launches no longer fail on .git/config lock by @juliusmarminge in pingdotgg/t3code#25700
* fix(task-cache): the hook test waits for every flusher it starts by @juliusmarminge in pingdotgg/t3code#26148
* chore(lint): every React effect states its reason at the call site by @juliusmarminge in pingdotgg/t3code#26161
* test(server): the link-card retry test names a new MCP credential by @juliusmarminge in pingdotgg/t3code#26143
* perf(web): stop measuring table cells while replies stream by @t3dotgg in pingdotgg/t3code#26152
* feat(desktop): add a remote server by clicking its t3code://pair link by @t3dotgg in pingdotgg/t3code#24111
* fix(server): agent questions stay answerable after a server restart by @SunkenInTime in pingdotgg/t3code#19229
* chore(lint): the effect lint error walks the alternatives before the suppression by @juliusmarminge in pingdotgg/t3code#26181
* fix(web): settings avatar no longer hugs the modal corner by @t3dotgg in pingdotgg/t3code#26180
* fix(mobile): shared file names can no longer write outside the Android cache by @juliusmarminge in pingdotgg/t3code#26175
* fix(server): repository lookups no longer send GitHub tokens to arbitrary hosts by @juliusmarminge in pingdotgg/t3code#26176
* fix(github): long period runs no longer freeze reference autolinking by @juliusmarminge in pingdotgg/t3code#26177
* fix(mobile): Android diff ellipsis no longer measures text quadratically by @juliusmarminge in pingdotgg/t3code#26174
* fix(server): Codex works again after its app-server is killed by @t3dotgg in pingdotgg/t3code#26188
**Full Changelog**: pingdotgg/t3code@v0.1.4-nightly.20261027.3783...v0.1.4-nightly.20261027.3796
Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.1.4-nightly.20261027.3796
incognitojam
pushed a commit
to incognitojam/styal
that referenced
this pull request
Nov 5, 2026
…gdotgg#26148)
Co-authored-by: Claude Opus 5.5 <[email protected]>
Fork adaptation: The test mocks os.homedir() to follow HOME, because Fork CI runs this package in worker threads, where os.homedir() ignores a stubbed HOME.
(cherry picked from commit 4cb5f10)
Upstream-PR: 26148
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:L
100-499 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.
|