feat(swe2): relay client tools through the Devin CLI - #263
Draft
Smartnewb wants to merge 3 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #262
改了什么 / What changed
Add an experimental
DEVIN_SWE2_TRANSPORT=acpChat 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|objectmust produce a client tool call. Short Korean action announcements such as “스킬부터 읽을게” remain covered as a fallback.SWE-2 can also emit an empty
end_turnafter 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 specificSWE2_EMPTY_RESPONSEorSWE2_TOOL_CALL_REQUIREDerror 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 --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.test/devin-connect.test.jsalone 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.read_filecall, the client returned a unique fixture value, and the resumed session returned a final HTTP 200 answer containing that value.end_turn; the old route returnedDevin 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.read_file → read_file → repl → read_filewith 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.node scripts/secret-scan.mjsandgit 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.Checklist
.env.example,README.md,README.en.md, anddocs/ENV-SWITCHES.md.