Skip to content

feat(swe2): relay client tools through the Devin CLI - #263

Draft
Smartnewb wants to merge 3 commits into
dwgx:masterfrom
Smartnewb:feat/swe2-acp-client-tools
Draft

feat(swe2): relay client tools through the Devin CLI#263
Smartnewb wants to merge 3 commits into
dwgx:masterfrom
Smartnewb:feat/swe2-acp-client-tools

Conversation

@Smartnewb

@Smartnewb Smartnewb commented Sep 12, 2026

Copy link
Copy Markdown

Closes #262

改了什么 / What changed

Add an experimental DEVIN_SWE2_TRANSPORT=acp Chat Completions route for the official signed-in Devin CLI. It relays client tools through a small MCP catalog, selects the actual Medium/High/Max variant, and preserves tool-result identity across clients such as Aside, OMO, and OpenClaw. The switch is off by default and other model routes are unchanged.

Completion is now checked from protocol structure before prose heuristics. An explicit skill link must produce a matching client file-read call and result, and tool_choice=required|any|object must produce a client tool call. Short Korean action announcements such as “스킬부터 읽을게” remain covered as a fallback.

SWE-2 can also emit an empty end_turn after a long sequence of successful client tools or subagents. The transport now gives that same ACP session one bounded continuation asking for the final answer without repeating completed side effects. If it still returns no answer or client tool call, the API returns a specific SWE2_EMPTY_RESPONSE or SWE2_TOOL_CALL_REQUIRED error instead of treating the unfinished turn as complete.

The client still executes and approves tools. Native CLI tools are denied, original caller instructions remain intact, and policy errors are returned without filtering or model fallback. Updated instructions during a pending tool call restart the ACP prompt with the complete updated transcript before more work. The relay avoids Fetch's implicit five-minute headers timeout, and initializing sessions are reserved against eviction.

为什么 / Why

The integration previously required client-specific prompt/schema patches when SWE-2 was given large tool catalogs, returned an action announcement without a usable call, or finished a post-tool turn with no final content. This puts the connection work in an opt-in transport and documents model-scoped client settings rather than modifying those clients' shared defaults.

This is source/npm-only, text-only, uses one CLI account, and keeps at most 12 in-memory sessions. Sessions expire after 30 idle minutes and do not survive restart. Standalone packaged executables fail explicitly rather than spawning themselves as a Node relay. It does not add cloud-account billing/quota management or fallback. These limits and the rollback switch are documented in docs/SWE2-ACP.md.

Related prior-art and compatibility work: openclaw/openclaw#93073 and dwgx/WindsurfAPI#241.

测试 / Testing

  • Node.js 24.19.0: node --import ./test/setup-env.mjs --test --test-force-exit test/swe2-acp.test.js test/swe2-acp-route.test.js test/swe2-acp-action-completion.test.js: 38 passed, 0 failed on the final PR source.
  • Installed bridge compatibility bundle covering ACP completion, SWE-2 compatibility, docs consistency, retry/rescue budgeting, and the Chat handler: 138 passed, 0 failed.
  • The installed repository-wide run had 0 assertion failures and 88 cancellations. The same 88 cancellations reproduce in unchanged test/devin-connect.test.js alone because its unref'ed absolute-deadline timer does not keep the isolated Node test process alive; this PR does not change that shared timer behavior.
  • Real Devin CLI 3000.10.21 (611c1cba) on both a MacBook and a Mac mini: an explicit skill request produced the exact client read_file call, the client returned a unique fixture value, and the resumed session returned a final HTTP 200 answer containing that value.
  • A real Aside run that had completed client tools and five subagents ended with empty end_turn; the old route returned Devin finished without an answer or client tool call. The new regression test reproduces that post-tool state and verifies one same-session continuation returns the final answer.
  • Additional real Aside validation: Medium completed read_file → read_file → repl → read_file with a random fixture value and checked calculation, zero tool errors, and a final answer. A resumed High session also read a complete skill across multiple calls and proceeded to its workflow initialization. This is client integration evidence, not a claim that a full research task finished.
  • Independent autoreview identified three issues (updated instructions, relay timeout, startup eviction); they were corrected and covered by the focused route/lifecycle checks. The review is not represented as an unconditional clean verdict.
  • node scripts/secret-scan.mjs and git diff --check: passed. All 98 existing mutation anchors in the touched Chat handler matched exactly once across eight specifications; the full historical mutation suites were not run.
  • AI-assisted implementation and verification. No credentials, personal settings, or private conversation traces are included.

Checklist

  • Code style matches existing files.
  • No new npm runtime dependencies.
  • Tests were run and results, including the repository-wide cancellation limitation, are recorded above.
  • New tests assert protocol and route behavior rather than source text.
  • The new transport switch defaults off.
  • Switches are documented in .env.example, README.md, README.en.md, and docs/ENV-SWITCHES.md.
  • No cloud protobuf field numbers or dashboard UI changes.
  • No AI attribution trailers in commit messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: opt-in SWE-2 ACP transport with client-owned tools

1 participant