"devin" joins retiredBuiltins, as Zed (c0605abc2) and Grok (60ecd598c)
did. @magpie-community/opencode-devin-auth serves it, moved or not.
Removed:
- Sign-in: the PKCE localhost listen and callback branch in signin.go,
devinExchange/devinExchangeURL. The exchange is Codex's alone again.
- Accounts: devinAccount and devinProvider in the account list, and the
Logins, switch, on and forget cases (devinSide, devinLoginList,
switchDevinLogin, setDevinLoginOn, forgetDevinLogin, removeDevinHome,
addDevinLogin, devinAlsoOn). "devin" keeps its place in Logins("") with
a nil list.
- Usage: devin_usage.go whole (perLogin fetch, usageLogins, loginQuota).
devinUsageVersion moved to devin_images.go, which still uses it.
- asksOwnBackend's "devin".
- Gateway: attempt()'s serveDevin dispatch and the Devin translator
(serveDevin, askDevin, buildDevin, decodeDevin, the Gemini schema and
tool-description rewriting, the call-id helpers). gateway/devin.go is
now connect_pb.go and keeps only the protobuf and Connect framing that
cursor.go uses.
- Tests of the built-in alone: gateway devin_test, devin_gemini_schema,
devin_sampling and devin_tool_ids; provider devin_usage_test,
devin_cli_signed_out_test, TestDevinSignIn, TestDevinSeveralAccounts,
TestSignInInstallsMissingCLI, TestDevinSignInUnseen, the Devin case of
the required-tools test, and TestDevinSplitParallelCallsKeepTheirResults.
Kept, because the plugin, the devin agent or the move uses them:
- The mover, devinLogins, devinIdentity/devinStatus, DevinAuthAt,
devinCredentialsAt, newDevinHome, devinCommand/devinProxy.
- DevinFamilies, DevinVariant and models.go's p.ID == "devin" shaping
(the plugin's provider id is "devin" too). internal/agent/devin.go
reads the families.
- The installer's "devin" case: the plugin's sign-in installs the CLI.
- The PLUGIN-SERVED notices in devin.go, devin_accounts.go and
devin_images.go, reworded as retired.
Also fixed:
- cliIdentities no longer lists devinStatus. No look at the accounts
asks it now, so it stayed unsettled, and FetchNewBehind told every page
that lists were on their way (TestFetchingNewOnceStarted went red).
- 60ecd598c (Grok) left TestFetchingNewForgottenWhileListed red: its
hook was GrokExecutable in the account listing. It and
TestFetchNewListsAgainForAnAnswerWhileListing now hook kiroCLIDB,
which is read after Cursor's account. Retiring Kiro will need another
hook.
Tests whose meaning changed:
- TestSignInInstallFails and TestSignInCanceledWhileInstalling go
through StartPluginSignIn("devin"), the plugin's install of the CLI.
- TestDevinCLIGoesThroughItsProxy seeds both accounts in logins.json
instead of signing one in. The sign-in's proxy is covered by
TestPluginSignInGoesThroughItsProxy.
- TestLeftAloneRunsNoCLI no longer expects `devin auth status` when the
subscription is switched on.
- TestFetchingNewOnceStarted's unanswered CLI is Cursor's.
- devinRawID moved to anthropic_call_ids_test.go. A Devin call id is
checked as safeCallID("dv_", ...).
Run:
- gofmt -l internal: clean.
- go vet -tags nogui ./... on darwin, GOOS=linux and GOOS=windows: clean.
- staticcheck U1000 on provider and gateway: no Devin leftovers.
- go test -tags nogui -count=1 -run '^(every test in provider, cli and
gateway that names Devin|TestFetchNew.*|TestFetchingNew.*|
TestLeftAlone.*|.*Identit.*)$' ./internal/provider ./internal/cli
./internal/gateway: ok.
- -run 'Migrat|Move|Moved|Retir|SignIn|AsksOwnBackend|SideLogin|Logins|
Unmoved|Install|Proxy|Account' ./internal/provider: ok.
- -run 'Devin|Required|Split|CallID|Cursor|Connect|Parity|ToolImage|
Format|BillingLine' ./internal/gateway: ok.
- -run 'Devin|Plugin|Retired|Moved' ./internal/gui ./internal/agent: ok.
- Not run: the whole packages, the full suite, the GUI node suite (the
machine is loaded).
121 lines
4.4 KiB
Go
121 lines
4.4 KiB
Go
package gateway
|
|
|
|
import (
|
|
"encoding/json"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// splitCalls is #1275's request as an agent sent it: one turn's parallel
|
|
// tool_use blocks split over two consecutive assistant messages, answered
|
|
// by one user message carrying both results.
|
|
const splitCalls = `{"model":"m","max_tokens":1024,"messages":[
|
|
{"role":"user","content":"read a and b"},
|
|
{"role":"assistant","content":[{"type":"tool_use","id":"toolu_a","name":"read","input":{"path":"a"}}]},
|
|
{"role":"assistant","content":[{"type":"tool_use","id":"toolu_b","name":"read","input":{"path":"b"}}]},
|
|
{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_a","content":"A!"},
|
|
{"type":"tool_result","tool_use_id":"toolu_b","content":"B!"}]}]}`
|
|
|
|
func parseSplit(t *testing.T, body string) *Request {
|
|
t.Helper()
|
|
r, err := parseAnthropic([]byte(body))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
return r
|
|
}
|
|
|
|
// The two calls are one exchange on Chat: both answered by their real
|
|
// results, none marked interrupted, nothing left as a stray user message.
|
|
func TestChatSplitParallelCallsKeepTheirResults(t *testing.T) {
|
|
r := parseSplit(t, splitCalls)
|
|
trace, msgs := chatTrace(t, r)
|
|
if want := "user assistant(toolu_a,toolu_b) tool(toolu_a) tool(toolu_b)"; trace != want {
|
|
t.Fatalf("trace = %q, want %q", trace, want)
|
|
}
|
|
if a, b := msgs[2]["content"], msgs[3]["content"]; a != "A!" || b != "B!" {
|
|
t.Fatalf("results = %q, %q, want the real ones", a, b)
|
|
}
|
|
if !kimiValid(msgs) || !idsUsedOnce(msgs) {
|
|
t.Fatal("sequence fails Kimi's tool exchange validation")
|
|
}
|
|
if len(r.Messages) != 4 {
|
|
t.Fatalf("the request's own messages changed: %d", len(r.Messages))
|
|
}
|
|
}
|
|
|
|
// A call of the split turn that really went unanswered still gets the
|
|
// synthetic result, after the real ones as in a turn sent whole, and the
|
|
// answered one keeps its own.
|
|
func TestChatSplitCallsUnansweredStillSynthetic(t *testing.T) {
|
|
r := parseSplit(t, strings.Replace(splitCalls,
|
|
`{"type":"tool_result","tool_use_id":"toolu_a","content":"A!"},`, "", 1))
|
|
trace, msgs := chatTrace(t, r)
|
|
if want := "user assistant(toolu_a,toolu_b) tool(toolu_b) tool(toolu_a)"; trace != want {
|
|
t.Fatalf("trace = %q, want %q", trace, want)
|
|
}
|
|
if a, _ := msgs[3]["content"].(string); !strings.Contains(a, "unavailable") {
|
|
t.Fatalf("unanswered toolu_a = %q, want the synthetic result", a)
|
|
}
|
|
if b := msgs[2]["content"]; b != "B!" {
|
|
t.Fatalf("toolu_b = %q, want B!", b)
|
|
}
|
|
}
|
|
|
|
// Text the turn said after its call, in a message of its own, joins the
|
|
// turn too, so the call is still answered by its result.
|
|
func TestChatSplitTextAfterCallKeepsResult(t *testing.T) {
|
|
r := &Request{Messages: []Message{
|
|
{Role: "user", Parts: []Part{{Kind: Text, Text: "read a"}}},
|
|
{Role: "assistant", Parts: []Part{call("A")}},
|
|
{Role: "assistant", Parts: []Part{{Kind: Text, Text: "reading"}}},
|
|
{Role: "user", Parts: []Part{result("A", "1")}},
|
|
}}
|
|
trace, msgs := chatTrace(t, r)
|
|
if want := "user assistant(A) tool(A)"; trace != want {
|
|
t.Fatalf("trace = %q, want %q", trace, want)
|
|
}
|
|
if msgs[1]["content"] != "reading" || msgs[2]["content"] != "1" {
|
|
t.Fatalf("assistant %q, answer %q", msgs[1]["content"], msgs[2]["content"])
|
|
}
|
|
}
|
|
|
|
// Two assistant messages with no calls are left as they were.
|
|
func TestChatConsecutiveTextAssistantsUnchanged(t *testing.T) {
|
|
r := &Request{Messages: []Message{
|
|
{Role: "user", Parts: []Part{{Kind: Text, Text: "hi"}}},
|
|
{Role: "assistant", Parts: []Part{{Kind: Text, Text: "one"}}},
|
|
{Role: "assistant", Parts: []Part{{Kind: Text, Text: "two"}}},
|
|
}}
|
|
if trace, _ := chatTrace(t, r); trace != "user assistant assistant" {
|
|
t.Fatalf("trace = %q", trace)
|
|
}
|
|
}
|
|
|
|
// Responses carries calls as items of their own, so the split turn's
|
|
// results follow their calls there already.
|
|
func TestResponsesSplitParallelCallsKeepTheirResults(t *testing.T) {
|
|
var q struct {
|
|
Input []map[string]any `json:"input"`
|
|
}
|
|
if err := json.Unmarshal(buildResponses(parseSplit(t, splitCalls), "gpt-5.4", "api.openai.com", false), &q); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
var got []string
|
|
for _, it := range q.Input {
|
|
s, _ := it["type"].(string)
|
|
if id, ok := it["call_id"].(string); ok {
|
|
s += "(" + id
|
|
if out, ok := it["output"].(string); ok {
|
|
s += "=" + out
|
|
}
|
|
s += ")"
|
|
}
|
|
got = append(got, s)
|
|
}
|
|
want := "message function_call(toolu_a) function_call(toolu_b) function_call_output(toolu_a=A!) function_call_output(toolu_b=B!)"
|
|
if strings.Join(got, " ") != want {
|
|
t.Fatalf("input = %s\nwant %s", strings.Join(got, " "), want)
|
|
}
|
|
}
|