Commit Graph
9 Commits
Author SHA1 Message Date
bbornandClaude Opus 5.5 ae7dc10ae2 docker: the image is Debian 12 slim, so the Cursor and Devin CLIs magpie installs at sign-in run in it (#2834, bborn2)
magpie installs a subscription's CLI at sign-in with its vendor's
`curl … | bash` (internal/provider/install.go: Cursor, Devin, Grok
Build). The distroless image had no curl and no /usr/bin/env (the
installers' shebang), so that install couldn't run there, and only
Grok Build had a native fallback. bborn2 reported that a Cursor CLI
installed by hand failed with "cannot execute: required file not
found". The image is now debian:12-slim with ca-certificates and
curl. It keeps the nonroot user at uid/gid 65532, HOME and XDG under
/config, the healthcheck, and magpie on PATH. Size: 157MB against
82MB for origin/main's image, both built here on arm64. Running a
feature magpie offers is worth the 75MB.

Changed in review: dropped the branch's GOPROXY build arg, a separate
goal. The comments in install.go and install_test.go that said the
image has no curl now say "had". docs/reference.md and the site's
Docker page (en, zh, ja) say Debian with bash and curl instead of
distroless with busybox.

Run, with OrbStack's docker:
- docker build of this tree and of d783df46c's Dockerfile: 157MB vs
  82MB.
- docker run of the new image: health "healthy", user nonroot (id
  65532). `curl https://cursor.com/install -fsS | bash` exit 0, then
  `~/.local/bin/cursor-agent --version` printed 2026.10.16-e3cb207.
  Devin's install.sh installed devin v3000.11.92 (its trailing
  `devin setup` said "Login canceled" with no terminal, as on any
  host). `devin --version` printed 3000.11.92. bash and `magpie
  version` run.
- Old image: `which curl` finds none, and /usr/bin/env doesn't exist.
- A volume written by the old image (file owned 65532) was read and
  written by the new image.
- gofmt -l clean; go vet darwin, linux (nogui) and windows clean.
- Full `go test -tags nogui -timeout 45m ./...`: every package ok
  except internal/agent and internal/gateway, which timed out at 45m
  mid-test (TestConnectSaysHow, TestLargeRequestEndpoints) under a
  load average of about 200 from parallel suites. This commit changes
  no code those packages build, only comments in internal/provider,
  which passed (992s), so they weren't rerun.
Not tried: a Grok Build install inside the image, and a full
in-magpie Cursor/Devin sign-in with a real account in the container.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 00:19:53 +08:00
yetone 07a445f42b provider: Devin's built-in is retired; its plugin serves it
"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).
2026-10-17 23:11:01 +08:00
yetone 0896e9fad1 provider tests: waitPast waits up to signInDeadline, as waitDone does, not 5s
c702d9cfe (#1552) moved the sign-in tests' waits from 2s to
signInDeadline (90s), since a loaded CI box runs every package's binaries
at once. waitPast, the same wait for leaving any state, kept its own 5s.
At load ~125, TestSignInInstallsMissingCLI and TestMovedSignInAsBuiltIn
went red here with "still installing" after 5.0-5.8s, 3 of 40 runs.
waitPast returns as soon as the state moves, so the longer bound costs a
passing run nothing.

Ran:
- 6s injected into both fake installers after their release: the old
  bound red in both ("still installing"), this one green.
- go test ./internal/provider (at load ~120); gofmt -l; go vet, GOOS=linux
  and GOOS=windows go vet ./internal/provider.
2026-10-11 19:28:08 +08:00
yetone 2ff4ecb42d provider: the Devin install tests' held installer gives up when its test ends, and writes the CLI without the test's t
TestSignInInstallsMissingCLI and TestMovedSignInAsBuiltIn hold their fake
installer on a channel the test closes only after its first checks. A
Fatal before that left the installer blocked for the rest of the package's
run. f3c098da8 fixed the same hold in the Grok sibling with a cleanup;
these two were already gated and kept the leak. The hold now also ends on
the test's cleanup, and the installer returns an error then.

The installsMissingCLI fake also called testenv.Program(t, ...) on the
sign-in's goroutine. Under load (~125) its test hit waitPast's 5s first,
and the fake's late t.Fatal panicked the whole package ("Fail in goroutine
after TestSignInInstallsMissingCLI has completed"). It now uses
testenv.WriteProgram and returns the error.

Ran:
- An injected t.Fatal right after StartSignIn / StartPluginSignIn, plus a
  test that dumps goroutines a second later: on origin/main the fake is
  still blocked at install_test.go:40; with this, nothing is left.
- -race -count=20 of both tests, 2 runs each beside origin/main at load
  ~125-140: green on both.
- gofmt -l; go vet, GOOS=linux and GOOS=windows go vet ./internal/provider.
2026-10-11 19:28:08 +08:00
yetone 522da8f2e7 provider: Grok and Devin install in the Docker image again: a vendor's shell one-liner needs curl, which the image (bash and busybox wget since 7bfe3137) doesn't have, so the native installer runs there
ghcr.io/yetone/magpie:latest has /bin/bash and /bin/wget but no curl, so
shellInstallerRuns said yes and `curl … | bash` failed. TestShellInstallerNeedsCurl
fails on the old check.
2026-10-08 09:01:23 +08:00
hisilingandSiling 84d2d75205 provider: Windows 上 Devin 的登录装得上 Devin CLI 了:安装命令从 stdin 进 PowerShell,devin setup 不再卡住登录 (#1225) (#1226)
* provider: a sign-in on Windows installs its CLI past Microsoft Defender, which stopped the installer's command line as a Trojan (#1225)

On Windows the sign-in ran the vendor's installer as `powershell -NoProfile -ExecutionPolicy Bypass -Command irm https://static.devin.ai/cli/setup.ps1 | iex`, and Microsoft Defender takes that command line for Trojan:Win32/Commando.A!ml. It stopped PowerShell before it ran, so Devin's sign-in failed with "installing Devin CLI failed (fork/exec C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe: Access is denied.)" while Windows Security said it found a threat (hisiling, Windows 11, v0.1.1106, three tries, three detections). The one-liner now reaches `powershell -NoProfile -ExecutionPolicy Bypass -Command -` on stdin, as one typed into PowerShell does, so no command line carries it. Cursor's and Grok's installers go the same way. The installer's output and exit code come back as before, and one that would ask something still reads nothing.

TestWindowsInstallerNotOnCommandLine fails without the change on Windows 11 (PowerShell's command line carries the installer: powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Output ([Environment]::CommandLine); exit 7") and passes with it. On the same machine, with Defender's real-time protection on, Devin's sign-in started the way the window's button starts it (provider.StartSignIn, from a program with no console) ran the real setup.ps1 with no detection and installed Devin CLI 3000.11.3. go vet ./internal/provider and go test -run 'Install|SignIn' ./internal/provider pass on Windows; go vet -tags nogui ./..., go build -tags nogui ./..., GOOS=windows go build ./... and the windowsgui build pass on Linux.

* provider: Devin's sign-in on Windows goes on once the Devin CLI is in place, where its installer's `devin setup` held it for ten minutes and was left running (#1225)

Devin's setup.ps1 ends in `devin setup`, whose menu asking how to sign in waits for a key on the console. The console an installer gets from magpie has no window (the app has none, so its children get CREATE_NO_WINDOW) and magpie keeps its output, so no one can answer it: the sign-in stayed "installing" until installTimeout ended the installer ten minutes later, and `devin setup` went on running. It waits the same way with stdin from NUL, and CI=true or TERM=dumb don't change it; `devin setup` has no option but --force-manual-token-flow. On Windows, the installer of a CLI marked setup (Devin's) now runs as a proc.Tree. Once the CLI is in place, read with the user PATH the installer wrote, it has installerTail (5s) to end by itself, then it is ended with everything it started, as it is when the sign-in is canceled or times out. magpie's own sign-in follows as before. Cursor's and Grok's installers, and every installer off Windows, run as they did.

TestWindowsDevinSetupDoesNotHoldTheSignIn fails without the change on Windows 11 (the sign-in waited 47s for the installer after the CLI was in place, installTimeout set to 45s) and passes with it in 6s, its setup ended. On the same machine the real Devin sign-in went from installing to Devin's sign-in page in 18s, with no devin.exe or PowerShell left running and setup.ps1's distribution marker and user PATH written; with the first change alone it took ten minutes and left `devin.exe setup` running. go vet ./internal/provider and go test -run 'Install|SignIn|NotOnCommandLine|DevinSetup' ./internal/provider pass on Windows; GOOS=windows go vet ./internal/provider ./internal/proc passes on Linux.

---------

Co-authored-by: Siling <179151647+hisiling@users.noreply.github.com>
2026-10-08 08:58:15 +08:00
yetone 06420a7121 tests: a fake program is a file macOS has already let run (testenv.Program), so a fake's first start no longer eats a test's wait under load
macOS checks a newly written executable before its first exec: 0.27s
alone, 2-5s while other new programs start (a go test ./... starting its
test binaries). The same file again takes 0.009s, and the pass is kept
across a rename and an in-place rewrite. 108852b4 worked round this for one
test with /bin/sh -c; the class was every test that writes a `#!/bin/sh`
fake and times its answer.

testenv.Program(t, path, script) replaces os.WriteFile(path, script, 0o755)
for fakes. On macOS it renames a file that has run once from a pool to path
and writes the script into it in place; at the test's cleanup the file goes
back to the pool (only a path the test created; a stand-in it wrote over
stays). Fakes still end with their tests: nothing about how they are
started or waited on changed. Run (and gateway's TestMain) remove the pool
at the end. TestMain's PATH stand-ins are run once in the background
(testenv.StandIns). Other systems write the file as before.

Converted every `#!/bin/sh` fake written by tests under internal/ (agent,
gateway, gui, library, plugin, proc, provider, update). Windows, binary
and node/bun fakes are unchanged.

Under the same load (3 loops each starting 8 freshly written scripts at a
time), 4 rounds each, before (108852b4 / origin/main) vs after:
- provider TestSavedButSignedOutClaudeServed: 4/4 fail (8.01s) -> 4/4 pass
- provider TestClaudeSignInOverStaleCredentials: 4/4 fail (5.00s) -> 4/4 pass
- provider TestDevinSignedInOnlyInMagpie: 3/4 fail ("CLI's own []") -> 4/4 pass
- gateway TestClaudeRunEndsWhenTheClientLeaves: 4/4 fail -> 4/4 pass
  (and 3/3 fail -> 3/3 pass at a third of that load)
- gateway TestClientGoneRecordedAsCanceled: 4/4 fail -> 4/4 pass
- gui TestProvidersAnswerWhileListsComeIn ("cursor found false" at 3.03s):
  4/4 fail -> 4/4 pass. The same class, not bfe8bcaf's test order.
- proc TestUserPath (login shell's PATH never came, 7.01s): 4/4 fail ->
  4/4 pass
Unloaded, every touched package passes; no pool directory or process is
left after a run.
2026-10-07 03:00:47 +08:00
yetone a2714f7506 claude: a Claude account's usage resets are read in the zone /usage names on Windows too, and the provider tests pass whole on Windows (goal: 插件订阅 provider 跟内置的所有逻辑都要一模一样, run on Windows and Linux) — Windows has no time zone database, so "resets Oct 1 at 3:30pm (Asia/Shanghai)" was read in the machine's own zone, hours off for anyone not in that zone; magpie now carries the database (time/tzdata). The provider tests set HOME but not USERPROFILE, which Windows takes the home from, so on Windows they read the test box's own agent sign-ins (Gemini models in a list, an extra provider, a Cursor version); every test home sets both now. Tests whose fake CLI is a shell script (Claude Code's auth status, codex --version, macOS's security) skip on Windows, as the fake devin did, and file mode bits go unchecked there. TestParseClaudeUsage fails on Windows without the change. On Windows and on Linux (WSL) the provider package passes whole, three times on Windows (15 failed before), the plugin package and the move/plugin/Grok/Devin/usage tests five times over on Linux. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass. 2026-10-01 13:51:24 +08:00
yetone e072af501d provider: a subscription used through its vendor's CLI — Devin's, Cursor's, Grok's — installs that CLI when its sign-in starts, if this machine lacks it, rather than leaving the sign-in to fail or, as Devin's did, to say "signed in" and show nothing: Devin's sign-in wrote credentials.toml, but magpie sees the account only through devin auth status, so with no devin CLI no provider ever came and nothing said why. The sign-in is now "installing" while the vendor's own installer runs (curl … | bash, or its PowerShell one on Windows, with magpie's proxy), then opens the vendor's page as before; the window says what it is installing and why, can cancel it, and a failed install says the installer's last line and the command to run by hand. What counts is the CLI being there afterwards — Devin's installer ends in devin setup, whose sign-in gives up without a terminal and fails the script after it installed everything — and on Windows the PATH the installer wrote is taken up so the running app finds it. A Devin sign-in the CLI then can't see fails, where it said done with no one; the tests no longer see this machine's own devin 2026-09-25 16:30:00 +08:00