Skip to content

Verify efficiency 1/3: shared build cache across worktrees (#390) - #664

Merged
currentbits merged 2 commits into
mainfrom
coder/verify-cache-390
Aug 22, 2026
Merged

currentbits merged 2 commits into
mainfrom
coder/verify-cache-390

Conversation

@currentbits

Copy link
Copy Markdown
Owner

First of three stacked PRs for #390. Self-contained: this one can land alone and does nothing to the verify command.

What

electron/verifyEfficiency.js — cacheEnv() points every worktree of a repo at one cache directory, so thread B reuses thread A's build output instead of rebuilding from scratch.

The key is the main checkout, resolved through git rev-parse --git-common-dir, so all worktrees of one clone land on the same ~/.solenta/build-cache/<repo>-<sha1>. The sha1 of the realpath keeps two clones both named app apart. Override the root with SOLENTA_BUILD_CACHE.

marker present in cwd vars set
turbo.json TURBO_CACHE_DIR
nx.json / workspace.json NX_CACHE_DIRECTORY, NX_DAEMON=false
Cargo.toml CARGO_TARGET_DIR, SCCACHE_DIR
CMakeLists.txt / .ccache CCACHE_DIR

No marker means no vars. An already-set var is never overridden, so a project that configures its own cache wins.

NX_DAEMON=false is deliberate: the nx daemon is keyed per workspace path and would defeat cache sharing across worktrees.

Wired into two spawn paths — runVerifyCommand in electron/verify.js, and agentSpawnOptions in electron/proc.js so agent CLIs building inside a worktree hit the same cache.

Testing

npm run test:electron: 1939 pass / 0 fail, run from this branch alone.

Reviewer note

agentSpawnOptions now does a synchronous git rev-parse --git-common-dir on every agent CLI spawn (memoised per cwd, 2s timeout) plus a few existsSync calls. It is in the spawn hot path.

On solenta itself this is a no-op — no turbo, nx, cargo or cmake here. The payoff is for other projects.

Part of #390. Stacked under it: 2/3 affected-scope core, 3/3 the remaining runners.

Point every worktree of a repo at ~/.solenta/build-cache/<repo> so
thread B reuses thread A's task results. Injected into the verify
spawn and every agent CLI. Does not override env the user already set.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

* feat(verify): affected-scope node --test selection (#390)

Rewrite the verify command to the tests the diff touches when the
runner is node --test. Docs-only diffs skip the suite; lockfiles, --all,
unknown diffs, and compound npm scripts stay full-suite. Wired into
the runner gate and Verify now. Post-merge verify is unchanged.

* feat(verify): affected-scope turbo/nx/jest/vitest/pytest/go (#390) (#666)

Add the remaining verify-command matchers on top of the node --test
framework. Unknown runners and already-filtered commands stay full-suite.

Co-authored-by: Willem <[email protected]>

---------

Co-authored-by: Willem <[email protected]>
@currentbits
currentbits merged commit 4479fd3 into main Aug 22, 2026
5 of 6 checks passed
@currentbits
currentbits deleted the coder/verify-cache-390 branch October 3, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant