Repository navigation
test(picker): quiesce background fills before arming the awaited preview key - #3726
Conversation
…iew key The RunPreview oracle in on_update_pokes_run_preview_only_when_the_visible_pane_changes counts pokes by draining skim's event channel between steps, but two producers feed that channel: on_update's notify_pr_status_changed (the behavior under test) and PreviewOrchestrator::fill -> notify_filled, driven by the LOCAL_GIT_MODES precompute on_skeleton spawns and the comments fetch on_update spawns. A background fill for a key a later step awaits pokes legitimately, but lands after that step's drain and is charged to the next step. Wait for orchestrator idle before each note_awaiting, so those fills land while no awaited key matches them. Closes #3725
worktrunk-bot
left a comment
There was a problem hiding this comment.
The wait_for_idle() placement is right — the skeleton LOCAL_GIT_MODES precompute is the producer that can strand a ("feature", WorkingTree) fill past a step's drain, and arming after quiescing removes it from every counted window. Two accuracy fixes on the explanations, since a future reader debugging a recurrence will start from them: in this test the comments fetch is not a second in-flight producer. make_handler's TestRepo has no remote, so spawn_worktree_comments_fetch resolves ci_platform(None) to None and takes the synchronous fill_external branch — nothing is spawned, nothing is pending. (Verified with temporary probes in the test: right after the second on_update, ("feature", Comments) is already in the cache and the orchestrator's pending count is 0, and ci_platform(None).is_none() holds.) It's also the second on_update, not the first, that reaches the comments path at all — maybe_spawn_comments returns early on is_priming, which the first step's row sets.
That leaves exactly one overlap between the precompute's keys (WorkingTree, Log, BranchDiff, UpstreamDiff) and the keys the steps await (Pr, Comments, WorkingTree) — which matches the reproduction in the PR body, where the probe pinned the producer to the WorkingTree precompute.
…innable (#3736) Daily `review-runs` sweep of the 2026-08-03/04 window. One maintainer correction in the window is generalizable repo knowledge, so it gets codified here. ## What happened Triaging [#3696](#3696) ("Allow selecting the `wt list` JSON schema on the command line"), the bot read [`resolve_json_schema`](https://github.com/max-sixty/worktrunk/blob/286004f1ebe5f6563c772be24987394144a29215/src/commands/list/mod.rs#L220), saw it reads `repo.config().list.json_schema`, and [posted](#3696 (comment)) that "there's no way to pin it per-invocation independent of that config" — then went further and said the usual alias deflection "can't substitute, since there's no composable way to select the schema without this flag existing first". max-sixty [corrected it](#3696 (comment)): "the need is real, but it's already met, so I'm not going to add the flag" — `wt --config-set 'list.json-schema = 2' list --format=json` pins it per invocation, and `WORKTRUNK_LIST__JSON_SCHEMA` does the same a layer down. The proposed `--schema` flag was declined as "a third spelling of the same thing on a surface I deliberately keep small". The issue was closed on that basis. `--config-set` has been documented since [#3138](#3138) (2026-06-19), in `after_long_help` in [`src/cli/mod.rs`](https://github.com/max-sixty/worktrunk/blob/286004f1ebe5f6563c772be24987394144a29215/src/cli/mod.rs#L2558) and its rendered mirror. It was available to read; the triage just never looked above the resolver. ## Why codify it rather than log it The specific miss is what the gates would call a single occurrence, but the shape isn't a behavioural nudge that risks noise elsewhere — it's a factual property of worktrunk's config layering, and the failure mode it prevents is a **publicly posted false capability claim**, which is the class `running-in-ci` treats as the most corrosive output failure. It's also invisible: nothing fails, the reply just reads as authoritative and wrong until a maintainer happens to catch it. It sits directly above **Suggesting Aliases for Niche Feature Requests** because it serves the same flag-growth limit that section already encodes, and is the cheaper answer when the ask is "select an existing config value per invocation" — the alias deflection is the fallback when it isn't. <details><summary>Window summary</summary> 46 token-bearing runs, **0 failed**, 0 near-timeout (longest job 68 min against the 360-min cap). 3 bot PRs opened ([#3731](#3731), [#3732](#3732), [#3734](#3734)), 2 merged ([#3722](#3722), [#3726](#3726)), 0 closed without merge. [#3721](#3721) — the PR stranded by the 08-03 outage — was reviewed and approved, confirming yesterday's recovery worked. Full evidence in the tracking issue [#3691](#3691). </details> --------- Co-authored-by: worktrunk-bot <[email protected]>
Problem
on_update_pokes_run_preview_only_when_the_visible_pane_changesfailed once undercode-coverageand passed on rerun of the same commit (#3725), counting an extraRunPreviewat its final step.The oracle counts pokes by draining skim's event channel between steps, but that channel has two producers.
on_update'snotify_pr_status_changedis the one under test; the other isPreviewOrchestrator::fill→notify_filled, driven here by theLOCAL_GIT_MODESprecomputeon_skeletonspawns for the row. (Thecommentsfetch is the othernotify_filledproducer in production, but not in this test:make_handler'sTestRepohas no remote, soci_platform(None)resolves toNoneandspawn_worktree_comments_fetchtakes the synchronousfill_externalbranch — nothing is spawned, nothing is left pending. It's also the secondon_updatethat reaches that path at all, sincemaybe_spawn_commentsreturns early on the first step'sis_primingrow.)That leaves exactly one overlap between the precompute's keys (
WorkingTree,Log,BranchDiff,UpstreamDiff) and the keys the steps await (Pr,Comments,WorkingTree):("feature", WorkingTree). Such a fill pokes legitimately (that isnotify_filled's contract), but if it lands after its step's drain it is charged to the next step. Hence the polarity: an extra poke, misattributed one step later.Solution
Wait for orchestrator idle before each
note_awaiting, so every background fill lands while the awaited key is one none of them match (Nonebefore the first step, then a key of a different mode). The events carry no payload —Event::RunPreviewis a unit variant — so asserting on poke identity isn't available; removing the second producer from each window is the structural equivalent.Also adds the flake class to the
No Retriestaxonomy intests/CLAUDE.md, alongside the existing timing / resource-pressure / shared-namespace entries.Testing
The failure is deterministically reproducible by forcing the in-flight fill to land inside the test's own step boundaries, which is the only thing CI's slower
llvm-covrun did by chance. Insertinghandler.orchestrator.wait_for_idle()after theWorkingTreestep's drain (before the fix) reproduces the exact CI panic — same assertion, same message, same polarity:Moving that same probe one line earlier — between the
WorkingTreestep'sawait_taband itson_update— fails theWorkingTreestep instead withleft: 1, right: 0, confirming the producer is the precompute fill for("feature", WorkingTree)rather than anythingon_updatedoes.With the fix, both probe placements pass (nothing is left in flight at either point), as does the unmodified test: 300 solo iterations and 150 under a concurrent loop of the full
commands::picker::set, all green.Closes #3725