feat(surface,sdk): f.mcp tools declaration + preflight-connect (#302) - #313
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
maintainability lens — FAILMaintainability review — PR #313Concerns
Notes
Nothing here would prevent the change from working, but items 1-5 will make six-months-later edits risky. REVIEW_FAILED |
history lens — FAILBlocker — repeats the previously fixed unrenewed-worker pattern. In The MCP transport’s separate deadlines ( Concern — authored-body recovery remains deferred. Notes. Lowering MCP calls into existing This is a static history review; I did not rerun the reported tests. The rejection rests solely on the documented worker-lifecycle regression. REVIEW_FAILED |
structure lens — MISSING |
|
🎯 review-swarm: FAILED (M:fail H:fail S:missing) Lens transcripts posted as sibling comments above. |
Session-Id: 01a08f7d-c504-7510-8651-0e2ebb694546 Session-Id: efeda5df-9b7c-48d4-b2ce-957f5bef0a82
Session-Id: 01a08f7d-c504-7510-8651-0e2ebb694546 Session-Id: efeda5df-9b7c-48d4-b2ce-957f5bef0a82
Session-Id: 01a08f7d-c504-7510-8651-0e2ebb694546 Session-Id: efeda5df-9b7c-48d4-b2ce-957f5bef0a82
Session-Id: efeda5df-9b7c-48d4-b2ce-957f5bef0a82
619e07f to
cdf85c1
Compare
The composed helper-body + trigger check should run against the same file extensions the pre-rebase helper-body check accepted (any .ts / .tsx / .mts / .mjs / .js). isAuthoredFlowPath only matches paths with the .flow. prefix, so a plain slack.mjs fixture was mis-routed to the YAML checkFlow path and refused with a spurious 'spec: expected an object' before the slack credential preflight could run. Fixes tests/authored-flow-slack.test.ts:106 refusing at the wrong layer. Session-Id: efeda5df-9b7c-48d4-b2ce-957f5bef0a82
…hild run on deadline Two Bugbot findings on PR#313: HIGH — MCP worker skipped lease renewal. The perform-effect body ran the MCP session's callTool without wrapping in withWorkerLease, so any tool that took longer than the initial lease-deadline lost ownership and the write-back failed. Wrap the perform-effect body in withWorkerLease so the existing renewal path (see worker-lease.ts) fires while the tool is in flight. MED — Nested MCP run left indeterminate when the dispatch deadline fires. When run.start returned a run_id but no dispatch arrived in 30s, the child run was orphaned. Capture the run_id and, on dispatch-expiry, call journal.runCancel best-effort in the finally block. Cancel errors do not mask the deadline diagnostic the parent flow already sees. Adds two regression tests: - Cancel-on-deadline: run.start resolves, dispatch never fires, journal.runCancel called with the child run_id. - Lease-renewed-under-load: dispatch delivered with a 30s lease, callTool hangs 45s, stepHeartbeat fires at least twice (initial + one renewal). Session-Id: efeda5df-9b7c-48d4-b2ce-957f5bef0a82
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e3043b4. Configure here.
| const starting = journal.runStart(spec); | ||
| await Promise.race([starting, completed]); | ||
| const outcome = await starting; | ||
| childRunId = outcome.run_id; |
There was a problem hiding this comment.
Cancel misses late child run
Medium Severity
childRunId is assigned only after Promise.race against completed succeeds, so a dispatch-deadline rejection skips the new runCancel even when unbounded run.start later returns a run. run.start uses a null timeout, so a slow daemon can still create the child after the parent has already failed and closed its worker.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit e3043b4. Configure here.


Closes #302.
Summary
Adds
f.mcp.<server>.<tool>(args)for declared MCP tools. Header:Preflight opens each declared MCP server before the run; unreachable =
mcp_unreachable.Design decision
Per the closed-vocabulary covenant (SURFACE.md §3), the MCP verb lowers to the closed kernel
agentprimitive. Output receipt shape:{ "type": "mcp", "server": "<name>", "tool": "<name>", "input": {...}, "output": {...}, "idempotencyKey": "<key>" }No new kernel StepKind. Effect key uses standard kernel run+step lease key.
Refusals
mcp_unreachable— declared server won't handshake at preflightmcp_undeclared_server—f.mcp.<name>referenced with<name>not intools.mcpWritten by codex agent
spec-C-f-mcp-v3on finn-mini; head atf642da09.Test plan
🤖 Generated with Claude Code
Note
Medium Risk
Spawns MCP subprocesses and opens HTTP endpoints during preflight and execution, with journal/effect and lease/dispatch timing behavior that must stay correct; kernel is unchanged but authored-run failure modes and process cleanup are security- and reliability-sensitive.
Overview
Adds MCP tool calls to authored TypeScript flows via
f.mcp.<server>.<tool>(args)whentools.mcplists server names, with connections defined in the nearestflows.jsonmcpmap (stdio subprocess or HTTP).Preflight and CLI:
flows checkon.flow.tsnow validates MCP declarations (composed with existing helper checks), connects to each declared server, cachestools/listinventory, and refuses withmcp_undeclared_serverormcp_unreachable. Project config parsing accepts the newmcpkey and resolves stdio commands like other CLI paths.Runtime: The SDK lowers each call to an existing
agenteffect (no kernel change): a short-lived worker opens an MCP session, records/confirms effects with the kernel attempt key, and journals an output receipt{ type: "mcp", server, tool, input, output, idempotencyKey }. Failures complete asworker_errorwith diagnostics intrajectory_tail(e.g.mcp_unknown_tool,mcp_disconnected). Stdio uses a custom transport (empty env + allowlist, process-group cleanup); HTTP uses the official Streamable HTTP client.Surface/types:
Ctxgainsmcp; dependency@modelcontextprotocol/sdkis added. Docs inSURFACE.mdand local evidence inops/reviews/20260911-spec-C-mcp.mddescribe the contract.Reviewed by Cursor Bugbot for commit e3043b4. Bugbot is set up for automated code reviews on this repo. Configure here.