test: fix two parallelism-exposed flakes (probe re-run, live-tree census)

Both pass solo and on main but flaked under the parallel runner:

1. gstack-brain-context-load probed 'gbrain --version' PER QUERY with a
   500ms budget — a cold probe on a saturated box timed out (observed
   505ms), branding gbrain 'missing' for one query while siblings
   passed. The probe is now memoized (availability can't change
   mid-invocation) with a generous one-time 5s budget; query calls keep
   the tight timeout.

2. skill-size-budget's catalog estimate read the LIVE tree, so a
   concurrent worker's transient skill-shaped scratch dirs exactly
   doubled it (8356 vs 4177). The ratchet now counts git-TRACKED skills
   only — the catalog that ships, immune to sibling workers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-08-15 09:13:18 -07:00
co-authored by Claude Fable 5
parent 1e0ff1e1e2
commit c9df02877c
2 changed files with 35 additions and 7 deletions
+13 -3
View File
@@ -190,16 +190,26 @@ function resolveSkillFile(args: CliArgs): string | null {
// ── Dispatchers ────────────────────────────────────────────────────────────
// Memoized: availability can't change mid-invocation, and the per-query
// re-probe was both wasteful (N probes per run) and load-flaky — a cold
// `gbrain --version` on a saturated box can exceed the 500ms budget, branding
// gbrain "missing" for one query while its siblings succeed (observed under
// the parallel free-suite runner: SKIP at dur=505ms with two OKs after it).
let _gbrainAvailable: boolean | null = null;
function gbrainAvailable(): boolean {
if (_gbrainAvailable !== null) return _gbrainAvailable;
try {
execFileSync("gbrain", ["--version"], {
stdio: "ignore",
timeout: MCP_TIMEOUT_MS,
// Generous first-probe budget: this runs ONCE, and a slow-to-start CLI
// is not a missing CLI. Query calls keep the tight MCP_TIMEOUT_MS.
timeout: 5_000,
});
return true;
_gbrainAvailable = true;
} catch {
return false;
_gbrainAvailable = false;
}
return _gbrainAvailable;
}
function dispatchVector(q: GbrainManifestQuery, args: CliArgs): QueryResult {