Repository navigation
mac: a superseded display-candidate hold carries its work forward, so the v2 frame isn't evicted (#799, supersedes #803) - #808
Merged
Conversation
…799) Fixes the primary, unambiguous part of #799: a frame-wait timeout on a helper `requireHelperAndRender` already confirmed present threw `XCTSkip`, so `NavigationMultiFileV2Tests`'s second case could time out and be marked skipped instead of failed — exactly the "CI run can show green without running it" impact the issue describes. `waitUntil`'s timeout branch now calls `XCTFail` with the same diagnostic state string instead. Also added `waitForControllerExit`, called from each test's teardown right after `detachController()` (with the `PreviewControllerClient` captured before that call, since it nils `model.controller`): blocks until the helper's process has actually exited (or a 5s timeout, itself an `XCTFail`) rather than assuming `detachController()`'s SIGTERM-and-return is enough. `PreviewControllerClient.terminate()` never calls `waitUntilExit`, so a back-to-back test could previously start a new helper while the old one was still shutting down. Honest status on the underlying race, since I could not fully root-cause it this session: with fresh, matching `flashtex-preview-controller`/ `flashtex-render` binaries and the machine otherwise idle, the second test still failed in 3 of 5 runs even with `waitForControllerExit` in place — this is NOT a rare flake, it reproduces roughly 60-100% of the time in a clean back-to-back run, and in one run manifested as a *different* failure shape (`XCTUnwrap failed: expected non-nil value of type "ClusterHit"` rather than the `waitUntil` timeout), suggesting more than one thing is wrong, not only teardown timing. `waitForControllerExit`'s own polling never observed a still-running old process before the new attach in the runs I captured, which argues against "the literal parent process outlives detach" as the whole story. My best remaining lead, not yet checked: `flashtex-preview-controller`'s own producer-process management (I found where its `Command` is *built*, `producer_command`/`producer_command_with_ limit` in `crates/preview-controller/src/main.rs`, but not where it is *spawned*+reaped — that lives in a worker abstraction I did not have time to trace this session) may not be killing/reaping its own child `flashtex-render` process on shutdown, leaving an orphan that the next test's fresh helper contends with. What I verified today, for whoever continues: - `swift build --target FlashTeXMacTests`: clean. - The `XCTFail` path fires correctly and reports the exact state string (confirmed via direct runs with both stale and fresh binaries). - Reproduction rate with fresh binaries, machine otherwise idle: 3/5 and 1/1 failed runs across two back-to-back sessions today (this PR's fix in place); 1/2 runs passed cleanly. Two distinct failure shapes observed. - (Unrelated finding from today, already reported and resolved separately on issue #2: this Mac was under extreme, unrelated CPU contention for much of the day from 8 abandoned infinite busy-loop processes left by a different, already-fixed issue's repro script — killed before this investigation, not the cause of this race.) Implementation-Agent: daniel-muse-lead (Claude Sonnet) Commit-Executor: daniel-muse-lead (Claude Sonnet)
…tead of running it early (#799) When a newer preview arrived during an earlier preview's 80 ms display-candidate hold, displayCandidatesAfterSibling ran the older hold's work straight away. That work was the completion fetch. Its required reply then reached the controller inside the newer revision's window and evicted that revision's optional v2 frame, which is documented as dropped when a required reply arrives. The newer revision stayed on the plain preview, with no v2 navigation or exact click-to-source, until the next compile. A superseded hold now moves its work, in order, into the new hold, and it runs when that hold ends (the v2 frame arrives or the timeout passes). The work is still never dropped. Diagnosis: FLASHTEX_CONTROLLER_DIAGNOSTIC_TIMINGS=1 showed the 35,697-byte frame admitted to the optional slot and then evicted_by_required 0.1 ms later by a 757-byte reply. There were no orphaned helpers between tests. Tests: - NavigationMultiFileV2Tests run clusters-first failed 9 of 21 runs before the fix and passed 10/10 after. - Default order passed 5/5. - DisplayCandidateTests 12/12. - DocumentFilesTests 13/13. Implementation-Agent: Claude Opus 5 (daniel-parent subagent) Commit-Executor: daniel-parent (Claude Opus 5) Co-authored-by: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
This was referenced Sep 17, 2026
Contributor
Author
|
Commander (daniel-parent): independent Opus review of PR #808 review (head 2e5ac13, reviewer: opus, read-only)Scope: MATERIAL findingsNone. Adversarial checks (why nothing is material)
Non-blocking notes
Tests run
VERDICT: APPROVE |
ItsAkilesh
pushed a commit
to ItsAkilesh/flashtex
that referenced
this pull request
Sep 18, 2026
Non-blocking follow-ups from the flash-tex#808 review: waitUntil now throws after recording its XCTFail so a timeout stops the test instead of cascading; the post-detach helper-exit bound is 20s (was 5s) and logs via XCTContext instead of failing when a slow runner exceeds it, force- killing the helper so it's never left running; DisplayCandidateTests gains model-level cases for carried hold work released by a v2 frame arriving and by invalidation (only the timeout path was covered). Implementation-Agent: Claude Sonnet 5 (daniel-parent subagent) Commit-Executor: daniel-parent subagent (Claude Sonnet 5) Co-authored-by: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #799. Supersedes #803: this branch contains #803's commit
bce66857(a real helper timeout fails instead of skipping), plus the product fix that makes that change safe to land.Root cause
It wasn't a test-harness race. It's a real app bug.
displayCandidatesAfterSiblingran the older hold's work immediately.display-forwarding.mddocuments as expected.FLASHTEX_CONTROLLER_DIAGNOSTIC_TIMINGS=1showed a 35,697-byte frame admitted and thenevicted_by_required0.1 ms later by a 757-byte reply. There were no orphaned helpers between tests.User impact: when two previews land within 80 ms (a startup preview followed by ⌘B, or opening includes followed by a recompile), the newer revision stays on the plain preview. It has no v2 navigation or exact click-to-source until the next compile.
Fix
A superseded hold moves its work, in order, into the new hold. The work runs when that hold ends (the v2 frame arrives or the timeout passes) and is still never dropped.
DisplayCandidateTests.testHeldWorkRunsOnCandidateTimeoutOrSupersessionNeverDroppednow asserts that carried work doesn't run early and still runs after the timeout.Tests
All runs were niced and sequential, with fresh release helpers.
NavigationMultiFileV2Tests, clusters test forced first (the failing order)NavigationMultiFileV2Tests, default orderDisplayCandidateTestsDocumentFilesTestsNot covered: the separate
DocumentFilesTests:437CI flake (a scripted fake project-files helper with a 0.4 s timeout). It's unrelated to this root cause and is tracked with the #800 timing work.🤖 Generated with Claude Code