feat(miner-governor): shape the gated open-pr submission payload from a handoff (#2337)#5091
Conversation
… a handoff (#2337) Adds prepareOpenPrSubmission to harness-submission-trigger.js: bridges a completed handoff through evaluateAndRecordHarnessSubmissionTrigger to a submission-READY payload -- the exact input shape buildOpenPrSpec (root src/mcp/local-write-tools.ts) expects (repoFullName/base/head/title/ body/draft). On allow:true returns { ready: true, openPrInput, ... }; on allow:false returns { ready: false, ... } without requiring a source branch at all, since a blocked candidate never needs one. Fails closed on a missing PR title/base immediately, and on a missing handoff branchRef only once allow:true is known (the audit trail still records the gate's own decision even when the spec-build step itself fails). Does not call buildOpenPrSpec directly -- that remains unreachable from this portable package (same cross-package-boundary reason self-review- adapter.ts's slop injection exists). A real root-side/MCP call site (e.g. the existing gittensory_open_pr tool) takes openPrInput from a ready:true result and passes it through. The CLI/driver entrypoint that instantiates a real CodingAgentDriver and runs the loop end to end with live credentials still does not exist in this package -- separate, larger scope from this decision-to-payload bridge.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | a8cc316 | Commit Preview URL Branch Preview URL |
Jul 11 2026, 02:22 PM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5091 +/- ##
=======================================
Coverage 94.20% 94.20%
=======================================
Files 470 470
Lines 39736 39736
Branches 14501 14501
=======================================
Hits 37435 37435
Misses 1645 1645
Partials 656 656
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-11 14:26:29 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 5 non-blocking
Concerns raised — review before merging
Review context
Contributor next steps
Signal definitions
[BETA] Chat with GittensoryAsk Gittensory 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://gittensory.aethereal.dev/docs/gittensory-commands 🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Summary
Advances #2337.
Adds
prepareOpenPrSubmissiontopackages/gittensory-miner/lib/harness-submission-trigger.js: bridges one completed handoff through the existingevaluateAndRecordHarnessSubmissionTrigger(#2337 predecessor, PR #5054) to a submission-READY payload — the exact input shapebuildOpenPrSpec(rootsrc/mcp/local-write-tools.ts) expects:{ repoFullName, base, head, title, body, draft }.allow: true→{ ready: true, decision, event, openPrInput }.allow: false→{ ready: false, decision, event }, without requiring a source branch at all — a blocked candidate never needs one, so it must not throw for an unrelated missing-field reason.title/baseimmediately (before any gate evaluation or ledger write — a caller bug, not a policy decision).handoffPacket.branchRefonly onceallow: trueis already known — a PR cannot be opened without a branch, but the gate's own decision is still recorded to the audit ledger before this throws, so the trail survives even when the downstream spec-build step fails.What this does NOT do (honest scope, same tension PR #5054 already flagged)
This still does not call
buildOpenPrSpecitself — that lives in the private rootsrc/tree, unreachable from this portable package (same cross-package-boundary reasonself-review-adapter.ts's slop injection exists, #2334). A real root-side/MCP call site (e.g. the existinggittensory_open_prtool,src/mcp/server.ts) would takeopenPrInputfrom aready: trueresult and pass it through to that function or the equivalent tool call.More significantly: I traced every real (non-test) call site of
runIterateLoopin the repo and found there isn't one —packages/gittensory-miner's CLI (lib/cli.js) has no command that instantiates a realCodingAgentDriver(the SDK-backed one lives atpackages/gittensory-engine/src/miner/agent-sdk-driver.ts) and drives the loop end to end with live credentials. Building that CLI/driver entrypoint — the actual "real run" deliverable 1 asks for — is separate, materially larger scope (worktree/credential handling, a live driver instance, and a decision for how the miner's local process actually reaches gittensory'sgittensory_open_prMCP tool over the network) that I'm not comfortable inventing unilaterally in the same PR as this decision-to-payload bridge, given the issue's own explicit "manual owner sign-off on the wiring before this ships to any default-on profile" deliverable and its framing as the single highest-stakes trigger surface in the roadmap ("a bug here means an autonomous write happens when it should not have"). Flagging this precisely rather than claiming closure.Status of the issue's other deliverables (unchanged by this PR, already true from #5054)
allow:falsepauses the session) — already built, unaffected here.Scope
.d.ts+ its test file.CONTRIBUTING.md.Validation
npm run typecheck— clean.node --checkon the modified file + fullpackages/gittensory-minerbuild script (55 files) — all pass.npx vitest run test/unit/miner-harness-submission-trigger.test.ts— 20/20 passing (11 new, covering: the full ready:true shape, the ready:false/no-branch-required path, both new fail-closed checks with ledger-state assertions proving when each fires relative to the gate call, default/omitted fields, trimming, and malformed-candidate guards).npx vitest run test/unit/miner-harness-submission-trigger.test.ts --coverage --coverage.include="packages/gittensory-miner/lib/harness-submission-trigger.js"→ 100% stmts/branches/funcs/lines (43/43, 50/50, 4/4, 31/31).vitest.config.ts'scoverage.includeis["src/**/*.ts", "packages/gittensory-engine/src/**/*.ts", "review-enrichment/src/analyzers/codeowners.ts"]—packages/gittensory-miner/lib/**isn't in it. Checked PR feat(miner-governor): wire the gated-submission trigger into the driving loop's handoff signal (#2337) #5054 (touched the same file, same shape of change) actually merged withcodecov/patch: passandcodecov/project: pass, confirming this is a non-issue in practice, not a silent gap.npm audit --audit-level=moderate— no dependency changes.Safety
Notes
Read the full #2337 issue text directly (not just PR #5054's own paraphrase of it) before scoping this, specifically to check whether "root-side server/CLI integration" meant the gittensory root
src/server or the miner's own CLI — tracedrunIterateLoop's actual (zero) call sites to confirm the real remaining gap before writing any code, rather than guessing an architecture.