[131-1] feat: add POST /session/:id/tool/call direct tool execution endpoint#1
[131-1] feat: add POST /session/:id/tool/call direct tool execution endpoint#1andreiships-bot merged 2 commits intodevfrom
Conversation
Adds 4 failing test cases proving the endpoint doesn't exist yet: - 404 for non-existent session - 400 for malformed request body - 200 with isError:true for unknown tool name - 200 with content array for successful tool execution (glob) All tests use test.fails() to prove the endpoint is missing.
…ndpoint Adds a direct tool execution endpoint that bypasses the LLM loop. The Rust DO's SandboxMcpExecutor will call this endpoint for edit/write/patch tools instead of going through MCP JSON-RPC. - tool-call.ts: POST /session/:sessionID/tool/call handler - Validates session exists (404 if not found) - Parses request body with Zod (400 if malformed) - Looks up tool via ToolRegistry (returns isError for unknown tools) - Executes tool with session context, returns MCP content format - server.ts: register ToolCallRoutes at /session - tool-call.test.ts: remove test.fails() markers (4 tests now pass)
Claude Single-Pass ReviewSummaryThis PR adds a solid Vitest integration test infrastructure using Findings[FINDING-1] issue: P1 | api/src/middleware/auth.ts:117 | TEST_MODE guard uses a truthy check on a boolean env binding but the Env type declares it as [FINDING-2] issue: P1 | api/src/middleware/auth.ts:31 | The [FINDING-3] issue: P1 | api/test/setup.ts:121 | Inline SQL migration is duplicated from (presumably) the real migration files. If the production schema drifts from what is defined in [FINDING-4] nit: P2 | api/test/setup.ts:140 | [FINDING-5] nit: P2 | api/test/nodes.test.ts:296 | Uses [FINDING-6] nit: P2 | api/test/edges.test.ts:134 | The cross-user edge deletion test expects [FINDING-7] nit: P2 | api/vitest.config.ts:12 | The Code Quality
Recommendation[x] Approve with changes The test infrastructure is valuable and well-written. FINDING-1 (TEST_MODE production guard) and FINDING-3 (schema duplication) are the two issues most worth addressing before merge. FINDING-2 ( |
Claude Review - Out-of-Diff FindingsThe following findings are on lines outside the PR diff: api/src/middleware/auth.ts:117 api/src/middleware/auth.ts:31 api/test/setup.ts:121 api/test/setup.ts:140 api/test/nodes.test.ts:296 api/test/edges.test.ts:134 api/vitest.config.ts:12 |
Fixes issues found during retroactive review of PRs #1, #2, #3. tool-call.ts: - Agent.defaultAgent() returns a name string, not Agent.Info — resolve with Agent.get() before passing to ToolRegistry.tools() - Fix agent: agent.id (undefined on string) → agent: agentName - Use agent's configured model instead of hardcoded opencode/default Dockerfile: - Quote $(find ...) and add existence check to prevent cryptic failures when binary is missing - Remove BUN_RUNTIME_TRANSPILER_CACHE_PATH env var — irrelevant for a compiled native binary that does not use Bun's transpiler fly.toml: - min_machines_running: 0 → 1 to avoid cold starts on interactive sessions scripts/ci/test-opencode-integration.sh: - Replace hardcoded /tmp/ paths with mktemp tmpdir + EXIT trap to avoid collisions in parallel CI runs .github/workflows/build-push.yml: - Gate :latest push on stable tags only (no pre-release suffix like -rc1) - Add provenance: false to prevent OCI attestation manifests from breaking fly deploy digest resolution - Explicitly set platforms: linux/amd64 to avoid silent arch mismatches
…, CI) (#4) * fix(131): address P1 review findings from retroactive review Fixes issues found during retroactive review of PRs #1, #2, #3. tool-call.ts: - Agent.defaultAgent() returns a name string, not Agent.Info — resolve with Agent.get() before passing to ToolRegistry.tools() - Fix agent: agent.id (undefined on string) → agent: agentName - Use agent's configured model instead of hardcoded opencode/default Dockerfile: - Quote $(find ...) and add existence check to prevent cryptic failures when binary is missing - Remove BUN_RUNTIME_TRANSPILER_CACHE_PATH env var — irrelevant for a compiled native binary that does not use Bun's transpiler fly.toml: - min_machines_running: 0 → 1 to avoid cold starts on interactive sessions scripts/ci/test-opencode-integration.sh: - Replace hardcoded /tmp/ paths with mktemp tmpdir + EXIT trap to avoid collisions in parallel CI runs .github/workflows/build-push.yml: - Gate :latest push on stable tags only (no pre-release suffix like -rc1) - Add provenance: false to prevent OCI attestation manifests from breaking fly deploy digest resolution - Explicitly set platforms: linux/amd64 to avoid silent arch mismatches * ci: replace blacksmith runners with ubicloud-standard-2 All blacksmith-* runner labels replaced: - blacksmith-4vcpu-ubuntu-2404 → ubicloud-standard-2 - blacksmith-8vcpu-ubuntu-2404-arm → ubicloud-standard-8-arm - blacksmith-4vcpu-ubuntu-2404-arm → ubicloud-standard-2-arm - blacksmith-4vcpu-windows-2025 → windows-latest (no Ubicloud Windows runner) --------- Co-authored-by: Andrei Cojocaru <andrei@pistachiorama.ai> Co-authored-by: andreiships-bot <andreiships-bot@users.noreply.github.com>
Summary
Adds a direct tool execution endpoint to the OpenCode fork. The Rust DO SandboxMcpExecutor will call this endpoint for state-mutating tools (edit, write, patch) instead of MCP JSON-RPC transport.
Changes
Files
Test Plan
Related