feat(miner-hands): Agent-SDK CodingAgentDriver (query() loop) - #4535
feat(miner-hands): Agent-SDK CodingAgentDriver (query() loop)#4535reyanthony062001-ops wants to merge 1 commit into
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4535 +/- ##
=======================================
Coverage 94.04% 94.04%
=======================================
Files 422 423 +1
Lines 37579 37620 +41
Branches 13729 13748 +19
=======================================
+ Hits 35340 35381 +41
Misses 1583 1583
Partials 656 656
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-09 23:31:44 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 1 non-blocking
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🟩 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.
|
JSONbored
left a comment
There was a problem hiding this comment.
Merge conflicts, fix + resubmit:
This branch has conflicts that must be resolved
Use the [web editor](https://github.com/JSONbored/gittensory/pull/4535/conflicts) or the command line to resolve conflicts before continuing.
package-lock.json
packages/gittensory-engine/package.json
packages/gittensory-engine/src/index.ts
Closes #4267
What
The second
CodingAgentDriverimplementation (#4262's seam):createAgentSdkCodingAgentDriverdrives the coding agent in-process via@anthropic-ai/claude-agent-sdk'squery()async-iterable loop, complementing the CLI-subprocess path (#4266). New dependency@anthropic-ai/claude-agent-sdk@^0.3.205onpackages/gittensory-engine— verified net-new (no@anthropic-ai/*package anywhere in the repo before this), peer deps satisfied by existing root versions,npm audit --audit-level=moderateclean. One supply-chain note: the package publishes no SLSA/sigstore attestation yet; version is caret-pinned and lockfile-resolved.How it maps to the issue's deliverables
query()loop → shared result shape: streamed SDK frames are folded in the driver — assistant text into the transcript,tool_useframes forEdit/Write/NotebookEditintochangedFiles(deduped;Bashet al. are not file changes), the terminalresultframe into ok/error/turnsUsed/summary. No SDK event type leaks intoCodingAgentDriver— the exportedAgentSdkQueryFnconsumes plain records.cwd=task.workingDirectory,maxTurnsbudget, instructions verbatim as the prompt, acceptance criteria materialized in the worktree per feat(miner-hands): immutable acceptance-criteria file written before the coding agent starts #4271), structured failures that never throw,changedFilesreported only on success, and the same edit-permission scope as the CLI driver (permissionMode: "acceptEdits"here vs--permission-mode acceptEditsthere — documented at the call site) so test(miner-hands): parity/contract test suite for CodingAgentDriver implementations #4296's parity suite can hold both to one contract.hooksand forwards them verbatim onto thequery()session options (PreToolUseetc.) — the SDK's hook surface stays reachable from outside the module instead of being encapsulated.AgentSdkQueryFn(the injected-SpawnFnconvention from feat(miner-hands): define the CodingAgentDriver interface seam #4262/feat(miner-hands): CLI-subprocess CodingAgentDriver (reuse SpawnFn/redactSecrets/EFFORT_TIMEOUT_MS pattern) #4266); the real-SDK path is a lazy dynamic import behind the default.Failure mapping: non-
successresult subtype →agent_sdk_<subtype>;success+is_error→agent_sdk_errored; stream ending without a result frame →agent_sdk_no_result; a mid-stream throw →agent_sdk_thrown: <redacted detail>. Everything that can carry model output (summary, transcript, error detail) passes through the engine's sharedredactSecrets(#4284), bounded by a single namedMAX_REDACTED_TEXT_LENGTHceiling. Test fixtures build their secret-shaped strings at runtime, so no token-shaped literal appears anywhere in the diff.Testing
test/unit/agent-sdk-driver.test.ts(the codecov-measured path) and a parity-matchednode:testsuite inpackages/gittensory-engine/test/— success path (session options, hooks pass-through, changed-file tracking/dedupe, turn count),error_max_turns,is_erroron a success subtype, unknown-subtype fallback, missing result frame, Error and non-Error mid-stream throws (redacted), secret redaction in summary/transcript, malformed-frame tolerance, and the no-options constructor.typecheck,git diff --check,npm audit --audit-level=moderate, and 100% line+branch coverage on the new module (npx vitest run test/unit/agent-sdk-driver.test.ts --coverage).