feat(miner): add a --full-execution dry-run mode to the cross-repo harness#7641
feat(miner): add a --full-execution dry-run mode to the cross-repo harness#7641bitfathers94 wants to merge 2 commits into
Conversation
…rness Extend the cross-repo evaluation harness (JSONbored#4788) from readiness-only to a full-execution mode that drives the live discover -> plan -> code -> test loop against a curated subset of the benchmark repos, generating a real diff and running each target repo's own build + test commands locally. Dry-run only, same read/execute-locally-and-discard posture as the readiness harness: the coding agent edits a throwaway clone, the diff is captured with git, and no PR is opened against any third-party repo. - executeRepoAttempt / runCrossRepoExecution classify the outcome; the agent, build, and test runners are injectable (real spawnSync defaults). - Extend CROSS_REPO_FAILURE_CATEGORY with execution_no_diff, execution_compile_gap, execution_test_failure, and execution_noop_diff; results reuse the existing report + summary format. - --full-execution CLI flag wires a real driver-backed executor; a fullExecution manifest flag marks the subset (--repo overrides it). - Document the new mode and taxonomy in docs/cross-repo-evaluation.md. Closes JSONbored#7634
| command: string, | ||
| context: { cwd: string; env?: NodeJS.ProcessEnv }, | ||
| ): LocalCommandResult { | ||
| const result = spawnSync("sh", ["-c", command], { |
There was a problem hiding this comment.
P1: Arbitrary shell command execution from cloned repo stack detection
defaultRunLocalCommand passes untrusted repo commands directly to sh -c, enabling arbitrary code execution from cloned repository metadata.
Avoid sh -c wrapper; run commands directly as argument arrays, or validate/sanitize before shell execution.
AI prompt
Check if this security scanner issue is valid. If so, understand the root cause and fix it. If appropriate, update or add tests. Keep the change focused and preserve intended behavior.
<file name="packages/loopover-miner/lib/cross-repo-evaluation.ts">
<violation number="1" location="packages/loopover-miner/lib/cross-repo-evaluation.ts:492">
<priority>P1</priority>
<title>Arbitrary shell command execution from cloned repo stack detection</title>
<evidence>defaultRunLocalCommand uses spawnSync("sh", ["-c", command], ...) where command comes directly from stack.buildCommand or stack.testCommand, inferred from cloned repository metadata (e.g., package.json scripts). A malicious benchmark repo can inject shell metacharacters to execute arbitrary commands on the host evaluating the harness.</evidence>
<recommendation>Validate and sanitize commands before passing to sh -c. Prefer running commands directly via their binary (e.g., "npm test" as ["npm", "test"]) rather than through a shell wrapper. Consider sandboxing or restricting the execution environment for untrusted repos.</recommendation>
</violation>
</file>
… injection surface defaultRunLocalCommand executed `sh -c <command>` where the command is derived from untrusted cloned-repo metadata (e.g. a crafted package.json script name), so shell metacharacters could inject extra commands on the evaluating host. Split the command into a plain argv and spawn it directly with `shell: false`; stack commands are already whitespace-separated argv. Adds direct unit tests covering the no-shell argv, inert-metacharacter, spawn-error, and empty-command paths.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7641 +/- ##
==========================================
- Coverage 88.51% 88.49% -0.02%
==========================================
Files 724 724
Lines 76001 76069 +68
Branches 22619 22652 +33
==========================================
+ Hits 67272 67319 +47
- Misses 7681 7688 +7
- Partials 1048 1062 +14
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Caution 🛑 LoopOver review result - reject/close recommendedReview updated: 2026-07-21 06:32:11 UTC
Review summary Blockers
Nits — 5 non-blocking
Why this is blocked
📋 Copy for AI agents — paste into your coding agentCI checks failing
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
|
LoopOver is closing this pull request on the maintainer's behalf (CI is failing (validate, codecov/patch, validate-code); AI reviewers agree on a likely critical defect: codecov/patch is at 79.71% (target 99%) and validate/validate-code are failing — the PR does not meet this repo's coverage and validation gates as submitted, so changed branches in the new pipeline (e.g. some of the compile/test/no-diff branches in `executeRepoAttempt`, packages/loopover-miner/lib/cross-repo-evaluation.ts:558-660) are not demonstrably covered.). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
Summary
Extends the cross-repo evaluation harness (#4788) from readiness-only to a full
--full-executionmode(#7634): it drives the live discover → plan → code → test loop against a curated subset of the existing
benchmark repos, generates a real diff, and runs each target repo's own build + test commands locally —
then classifies the outcome. This is the missing signal behind #4810's launch-readiness bar: not just "can the
miner plan for this repo" but "does the miner actually produce working, correct code for it".
Dry-run only, same safety posture as the readiness harness, one step further. The coding agent edits a
throwaway local clone; the harness captures the diff with
gitand runs the repo's own tests. There is no liveGitHub PR submission, no write access to the third-party repos, and no credentials beyond the local clone.
What changed
lib/cross-repo-evaluation.ts— newexecuteRepoAttempt/runCrossRepoExecutionpipeline that gates onthe existing readiness check first, then runs the live attempt and classifies it. The coding-agent step, build,
and test runners are all injectable (real
spawnSyncdefaults for build/test).CROSS_REPO_FAILURE_CATEGORY, not replacing it):execution_no_diff,execution_compile_gap,execution_test_failure,execution_noop_diff. Results flowthrough the same
formatCrossRepoEvaluationReport/summarizeCrossRepoEvaluationoutput.scripts/cross-repo-evaluation.mjs—--full-executionflag wiring a real, driver-backed executor(
constructProductionCodingAgentDriver+gitdiff capture) plusrunCrossRepoExecutionCli.benchmarks/cross-repo/manifest.json— afullExecutionopt-in flag marks the subset (2 Node repos:expressjs/express,lodash/lodash); a--repofilter overrides it.docs/cross-repo-evaluation.md— documents the new mode, taxonomy, dry-run safety, and the manifest flag.Testing
packages/loopover-miner/**is outsidecoverage.include, but the new logic has real unit tests following thispackage's existing conventions (
test/unit/miner-cross-repo-evaluation.test.ts): every taxonomy branch(readiness pass-through, no-diff, compile gap, test failure, no-op, end-to-end pass), the default spawn-based
build/test runners via an injected command runner, subset/
--repofiltering, manifest parsing of the new flag,and the CLI's real driver-backed executor (with an injected fake driver/spawn).
Closes #7634