feat(miner): wire the Neon branch-per-attempt DB fork into runAttempt#8206
Merged
Conversation
Completes #7858's self-host scope: createAttemptDbFork/discardAttemptDbFork (#8205) are now called from runAttempt's real lifecycle, mirroring the worktree allocator's own acquire/finally-release shape exactly. Config-gated via LOOPOVER_MINER_NEON_API_KEY/_PROJECT_ID/_PARENT_BRANCH_ID (attempt-db-fork-config.ts) -- an operator who hasn't configured all three sees zero behavior change, proven by running the existing 84-test miner-attempt-cli.test.ts suite unmodified alongside the new tests. Fork creation failure aborts the attempt rather than proceeding without isolation, since this feature exists specifically so the coding agent's writes never reach the tenant's real database -- silently continuing on a fork failure would defeat that safety property. Discard failure is captured to Sentry but never blocks the rest of cleanup (same discipline this file already applies to its kill-switch ledger append). Boundary explicitly not crossed here: the resulting connection string is not threaded into the coding agent's own subprocess environment (CODING_AGENT_ENV_ALLOWLIST in cli-subprocess-driver.ts). That's a separate, security-relevant interface change to the driver/spawn layer -- widening what reaches the untrusted, attacker-content-processing subprocess -- and deserves its own focused review rather than a bolt-on here.
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
npm run test:miner-deployment-docs-audit failed CI: LOOPOVER_MINER_NEON_API_KEY/ _PROJECT_ID/_PARENT_BRANCH_ID (attempt-db-fork-config.ts) were read but undocumented.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8206 +/- ##
==========================================
- Coverage 92.10% 91.58% -0.53%
==========================================
Files 775 776 +1
Lines 78308 78328 +20
Branches 23661 23667 +6
==========================================
- Hits 72127 71736 -391
- Misses 5062 5524 +462
+ Partials 1119 1068 -51
Flags with carried forward coverage won't be shown. Click here to find out more.
|
This was referenced Jul 23, 2026
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.
Summary
Closes #7858 (self-host scope). Wires
createAttemptDbFork/discardAttemptDbFork(#8205, already merged) intorunAttempt's real lifecycle inattempt-cli.ts, mirroring the existing worktree allocator's acquire/finally-release shape exactly:LOOPOVER_MINER_NEON_API_KEY/LOOPOVER_MINER_NEON_PROJECT_ID/LOOPOVER_MINER_NEON_PARENT_BRANCH_IDare all configured (attempt-db-fork-config.ts— secrets stay in env vars, never.loopover-ams.yml, matching this repo's universal credential convention). Any one missing disables the feature entirely — zero behavior change for every operator who hasn't heard of it.finallyblock on every terminal outcome, alongsideallocator.release.Boundary deliberately not crossed in this PR: the resulting connection string is not threaded into the coding agent's own subprocess environment (
CODING_AGENT_ENV_ALLOWLISTincli-subprocess-driver.ts). Widening what reaches the untrusted, attacker-content-processing subprocess is a separate, security-relevant interface change to the driver/spawn layer that deserves its own focused review, not a bolt-on here.Test plan
npm run typecheckclean (repo-wide)npm run build --workspace @loopover/engineand--workspace @loopover/minercleantest/unit/miner-attempt-cli.test.tssuite passes completely unmodified (proves the default/no-Neon-configured path is a true no-op)test/unit/miner-attempt-db-fork-config.test.ts— the env-var resolver's own edge cases (trimming, blank-as-unset, any-one-missing-disables-all)attempt-cli.ts's file-wide number is pre-existing and outside this diff