feat(runtime): abstract Claude Code behind pluggable agent runtime#1780
feat(runtime): abstract Claude Code behind pluggable agent runtime#1780ifireball wants to merge 7 commits into
Conversation
Site previewPreview: https://c7b5769a-site.fullsend-ai.workers.dev Commit: |
Introduce internal/runtime with BootstrapInput and ClaudeHooksBootstrap interfaces so the runner can support other agent backends later. Move Claude bootstrap, execution, progress, and transcript handling out of cli/run while keeping host-side security scans in the runner. Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Barak Korren <bkorren@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
3e31589 to
d3e9c49
Compare
ReviewFindingsMedium
Low
Info
Previous runReviewFindingsMedium
Low
Info
Previous run (2)ReviewFindingsLow
Info
Previous run (3)ReviewFindingsLow
Info
Previous run (4)ReviewFindingsMedium
Low
Info
|
waynesun09
left a comment
There was a problem hiding this comment.
Review Squad Report — 7 agents, 14 findings after dedup, 4 false positives removed
Agents: 2x claude-coder, 2x claude-researcher, 2x gemini-code-review, 1x cursor-code-review
Clean mechanical refactor that successfully abstracts Claude Code behind a Runtime interface. The architecture and code movement are sound — no behavioral bugs detected.
Summary of findings (HIGH: 3, MEDIUM: 6, LOW: 4, INFO: 1)
High:
runtime → harnessdependency inversion viaBoolDefault(5-agent consensus)- 8 test cases dropped without replacement, including shell-injection-preventing quote escaping tests (5-agent consensus)
ClaudeHooksBootstrapin shared interface file couples portable layer to Claude (2 agents)
Medium:
4. No tests for 99 lines of security-critical bootstrap_scan.go (5-agent consensus)
5. TOCTOU regression — scan and upload no longer atomic per file (3 agents)
6. Runtime interface too wide at 10 methods + inconsistent SandboxName passing (5-agent consensus)
7. ClaudeSandboxHooks exports mutable harness.SandboxHooks pointer (5-agent consensus)
8. Duplicate ExtractTranscripts — deprecated copy with no remaining callers (4 agents)
See inline comments for details and suggestions.
ralphbean
left a comment
There was a problem hiding this comment.
I think this needs a few changes before we can merge. See inline comments.
Rebase onto main (remote resource resolve, --offline) while keeping the runtime abstraction. Port dropped command/plugin tests, drop duplicate sandbox.ExtractTranscripts, remove runtime→harness import, and move ClaudeHooksBootstrap to claude_bootstrap.go. Signed-off-by: Barak Korren <bkorren@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Add docs/runtimes.md, split TranscriptHandler from Runtime, narrow ClaudeSandboxHooks accessors, add bootstrap_scan tests, and document scan/upload TOCTOU follow-up. Signed-off-by: Barak Korren <bkorren@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Reject empty agent path before host-side scan. Document why plugin settings and security hooks use separate settings.json paths. Signed-off-by: Barak Korren <bkorren@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Validate agent path in Bootstrap, skip empty skill/plugin dirs, use ConfigDir/WorkspaceDir methods instead of sandbox constants, and unexport sanitizeOutput. Signed-off-by: Barak Korren <bkorren@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
|
All review threads from the first pass are resolved, and follow-ups from @maruiz93 / @rh-hemartin / fullsend-ai-review are addressed in Still blocking merge: TOCTOU hardening remains tracked in #1801 (accepted risk for this PR). |
bootstrapCommon is runner-level; Claude hook dirs belong in installClaudeHooks behind ClaudeHooksBootstrap. Signed-off-by: Barak Korren <bkorren@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
internal/runtimewith aRuntimeinterface andClaudeRuntimeas the default implementation.BootstrapInputand optionalClaudeHooksBootstrap(via harness adapter) instead of calling Claude Code directly fromcli/run.security.ClaudeSandboxHooksfor hook generation; host-side scans stay in the runner.Test plan
go test ./internal/runtime/... ./internal/security/...go test ./internal/cli/ -run 'TestNewHarnessBootstrap|TestBuildRunCommand|TestBuildScanContext'fullsend runagainst a harness agent in CI or locallyMade with Cursor