You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Verification efficiency: shared build cache across worktrees + affected-scope test selection #390
From the monorepo research: N parallel worktrees each running full builds/tests waste the machine. (1) Point all of a repo's worktrees at a shared local build cache (Turborepo/Nx/sccache/Bazel depending on the repo) so thread B reuses thread A's task results. (2) Affected-scoped verification: run only the tests the diff touches (affected graph or changed-path mapping) instead of the full suite. Big latency win when 5 agents verify simultaneously on one laptop.
Price tag from a read-only scan of the maintainer's machine (2026-08-19), for sizing this against #559: 166 worktrees, 96.0 GB, median 709 MB each — solenta alone is 119 directories and 57.3 GB. Nearly all of that is per-worktree node_modules and build output duplicated from the checkout.
Two different fixes for the same bill and they compose: #559 deletes the directories of settled threads (bounded history), this issue stops each new one from costing 709 MB in the first place (bounded per-thread cost). On this data the second matters more over time — the reclaim is one-off, the 709 MB is charged on every new thread. Worth noting APFS cp -c cloning already gets most of the way there for a same-volume copy and is what the repo's own nightly-build instructions use.
Shared local build cache — detect turbo.json / nx.json / Cargo.toml in the worktree and inject TURBO_CACHE_DIR, NX_CACHE_DIRECTORY (+ NX_DAEMON=false), CARGO_TARGET_DIR, SCCACHE_DIR pointing at ~/.solenta/build-cache/<repo>. Same project path → same cache, so thread B reuses thread A's task results. Wired into the verify spawn and agent CLI spawn (agentSpawnOptions) so agent-run tests hit it too. Never overrides an env var the user already set.
Affected-scope verify — before the gate / Verify now runs, list paths vs the project default branch (listChangedPaths). Rewrite well-known runners (turbo --filter=...[base], nx affected, jest --findRelatedTests, vitest related, node --test file list, pytest, go test) when the mapping is confident. Wide files (lockfile, tsconfig, CI) or unknown runners stay full-suite. Docs-only diffs skip the suite (exit 0). Post-merge verify stays full-suite.
Fail closed: git trouble → original command. Evidence records the command that actually ran.
Implementation is in this worktree (thread 572176a4):
electron/verifyEfficiency.js — shared ~/.solenta/build-cache/<repo> env (turbo/nx/cargo/sccache) plus affected-scope rewrites for turbo/nx/jest/vitest/node --test/pytest/go test
Wired into verify spawn, agent CLI spawn (agentSpawnOptions), the runner gate, and Verify now
Post-merge verify stays full-suite
Fail closed: unknown runner, lockfile/tsconfig/CI, or git trouble → original command
Tests: electron/test/verify-efficiency.test.js plus existing verify/gate/services/proc suites green
Not in this change: per-worktree node_modules sharing (the 709 MB disk comment). Cache sharing is task results, not install trees.
Each measures under 400 changed lines against its base and passes npm run test:electron on its own, so the stack can stop after 1 or 2 if the scoping half is not wanted.
Open question for review, raised on #665: scoping rewrites the user's verify command and there is currently no setting to turn it off.
Shipped on origin/main in electron/verifyEfficiency.js: shared build cache across worktrees plus affected-scope rewrites for turbo/nx/jest/vitest/node --test/pytest/go. Stack comments on this issue (#664/#665/#666) match the code that is live.
Activity
currentbits commentedon Aug 19, 2026
Price tag from a read-only scan of the maintainer's machine (2026-08-19), for sizing this against #559: 166 worktrees, 96.0 GB, median 709 MB each — solenta alone is 119 directories and 57.3 GB. Nearly all of that is per-worktree
node_modulesand build output duplicated from the checkout.Two different fixes for the same bill and they compose: #559 deletes the directories of settled threads (bounded history), this issue stops each new one from costing 709 MB in the first place (bounded per-thread cost). On this data the second matters more over time — the reclaim is one-off, the 709 MB is charged on every new thread. Worth noting APFS
cp -ccloning already gets most of the way there for a same-volume copy and is what the repo's own nightly-build instructions use.currentbits commentedon Aug 22, 2026
Implementing both halves in this thread:
Shared local build cache — detect turbo.json / nx.json / Cargo.toml in the worktree and inject
TURBO_CACHE_DIR,NX_CACHE_DIRECTORY(+NX_DAEMON=false),CARGO_TARGET_DIR,SCCACHE_DIRpointing at~/.solenta/build-cache/<repo>. Same project path → same cache, so thread B reuses thread A's task results. Wired into the verify spawn and agent CLI spawn (agentSpawnOptions) so agent-run tests hit it too. Never overrides an env var the user already set.Affected-scope verify — before the gate / Verify now runs, list paths vs the project default branch (
listChangedPaths). Rewrite well-known runners (turbo--filter=...[base],nx affected, jest--findRelatedTests,vitest related,node --testfile list, pytest,go test) when the mapping is confident. Wide files (lockfile, tsconfig, CI) or unknown runners stay full-suite. Docs-only diffs skip the suite (exit 0). Post-merge verify stays full-suite.Fail closed: git trouble → original command. Evidence records the command that actually ran.
currentbits commentedon Aug 22, 2026
Implementation is in this worktree (thread 572176a4):
electron/verifyEfficiency.js— shared~/.solenta/build-cache/<repo>env (turbo/nx/cargo/sccache) plus affected-scope rewrites for turbo/nx/jest/vitest/node --test/pytest/go testagentSpawnOptions), the runner gate, and Verify nowelectron/test/verify-efficiency.test.jsplus existing verify/gate/services/proc suites greenNot in this change: per-worktree
node_modulessharing (the 709 MB disk comment). Cache sharing is task results, not install trees.currentbits commentedon Aug 22, 2026
Implemented and split into a three-PR stack, land in order:
TURBO_CACHE_DIR/NX_CACHE_DIRECTORY/CARGO_TARGET_DIR/CCACHE_DIRkeyed on the main checkout). Self-contained, does not touch the verify command.node --testmatcher, with the bail-out rules that keep the gate honest.Each measures under 400 changed lines against its base and passes
npm run test:electronon its own, so the stack can stop after 1 or 2 if the scoping half is not wanted.Open question for review, raised on #665: scoping rewrites the user's verify command and there is currently no setting to turn it off.
feat(verify): affected-scope turbo/nx/jest/vitest/pytest/go (#390) (#666
Verify efficiency 2/3: affected-scope verify, node --test (#390) (#665)
Verify efficiency 1/3: shared build cache across worktrees (#390) (#664)
currentbits commentedon Sep 6, 2026
Shipped on origin/main in electron/verifyEfficiency.js: shared build cache across worktrees plus affected-scope rewrites for turbo/nx/jest/vitest/node --test/pytest/go. Stack comments on this issue (#664/#665/#666) match the code that is live.