An unreadable Devin identity no longer falls back to the shared name "Devin". `success` now names such an account `Devin · <12 hex>`, a SHA-256 of the API server and session token. The host de-duplicates plugin accounts by `metadata.email` (magpie `internal/plugin/host.js` `settle`/`whoOf`), so two different unreadable sign-ins used to replace each other's credential. Now each one keeps its own slot. Signing in again with the same key on the same server gives the same name, so it lands in the same slot. When `usage`'s `syncOrg` later reads the account, it renames the slot to the real email in place, as before. Fixes#931.
Ran (mica, bun 1.4.2, HOME=$(mktemp -d), PR head 14fa75a5 merged with origin/main 445f4143):
- bun test packages/devin: 209 pass, 0 fail; bun scripts/check.mjs devin ok
- root bun test: 8293 pass, 4 fail. The 4 are gumloop's "exclusive ledger updates > Node ..." reds that are already known on main (PR CI shows the same four). bun scripts/check.mjs: no failures
- 0.1.39 is free: npm has 0.1.38, and origin/dist tgz/ ends at 0.1.38
Broken by hand, one at a time, each made the new identity test red:
- fallback back to "Devin"
- key left out of the hash (server only)
- a random salt per sign-in (stable slot)
- the raw key in the name
Not changed / not tried: accounts saved earlier as "Devin" keep that name. A new unreadable sign-in with the same key now gets a "Devin · <hash>" slot beside the old one, where before it replaced it. The host's settle only matches by secret when neither side has a name. Not tried with a real Devin account (no vendor calls). magpie's Devin mover (migrate_side.go) only carries the built-in's saved user names and reads nothing from this fallback.
Co-authored-by: zhou.han <18181754+yetihan@users.noreply.github.com>
The declared model list is Devin's of 2026-11-05, with SWE-2 Flash (VictorVow).
Reviewed at 731f418e8. On a separate machine with a temporary HOME the package's tests pass 208, fail 0, and bun scripts/check.mjs devin passes. The author checked every new variant against live GetCliModelConfigs: each reports supports_images true, so none go in NO_IMAGES.
#626 (zelong77): keptAfter scheduled the first ping 285 s after the
reply's stop event, and run() scheduled each next one 285 s after the
ping before had come back. Devin renews its cache when it takes a
request, so a 33-47 s Fable reply or a 10-20 s ping put the next ping
past the 5 minutes. In zelong77's usage.jsonl every ping 315.9 s or more
after its request was sent missed and wrote ~500k tokens again.
- roundtrip stamps sentAt before it sends; scheduleKeepalive waits
max(0, interval - (now - sentAt)), and each ping is timed from when it
was sent. A reply or ping longer than the interval is followed at once.
- The timers object carries the clock (now), so tests hold it.
#620, after 0.1.33 (zelong77, 08:18): through magpie, check A and the
grown check B still kept separate pings. magpie hands a plugin's fetch
none of the agent's own headers, so x-claude-code-session-id never
reached keepaliveKey, and magpie's translation merges Claude Code's two
user messages into one whose history grows in the middle, which firstOf
can't follow.
- keepaliveKey reads x-magpie-session first and x-magpie-subagent beside
x-claude-code-agent-id. magpie sets both on a plugin's fetch in a
release that follows this one; the host strips them from what a plugin
sends on.
- README: the timing, and the headers.
Run on mote (Bun 1.4.2, HOME=$(mktemp -d)) at this tree, on main 63cd0e4:
- packages/devin `bun test`: 189 pass, 0 fail.
- The 3 new keepalive tests on main's index.mjs: 3 fail (22 pass). The
two timing tests got 285000 where 238200 and 0 were due; the merged
check A's timer was never cleared.
- Whole repo `bun test`: 4781 pass, 0 fail. `bun scripts/check.mjs
devin`: ok.
Not tried: a real Devin account or a real Claude Code session; fake
timers and a fake Devin only. Without any session header (not Claude
Code's case once magpie sends x-magpie-session), a merged check whose
history grows in the middle still gets a new key: matching on a shared
leading block would merge different conversations that start with the
same reminder, which costs a full rewrite rather than an extra read.
zelong77 found that Claude Code Auto's permission check left several
keepalive tasks running for one check. keepaliveKey hashed the first user
message, and the check sends the whole history in that message, so every
check got a new key. stopKeepalive(newKey) never stopped the old task,
and each reply started another one.
- The key is now the session, the Claude Code agent id and a hash of the
instructions and the tools' names. The first user message is left out
when the agent names a session. The lead, its permission check and a
subagent still get keys of their own, because their instructions,
tools or agent id differ.
- When a request names no session, the first message still tells two
conversations apart. A first message that grew from one seen before
(blocks appended, or text added to the last block) maps to the earlier
key (firstOf). firstOf keeps only hashes, of 256 conversations at most.
- README: what a conversation is.
Run on mote (Bun 1.4.2, HOME=$(mktemp -d)) at this tree, on main 2595d48:
- packages/devin `bun test`: 186 pass, 0 fail.
- The new keepalive tests on main's index.mjs: 4 fail (18 pass, 4 fail).
These are zelong77's repro, with and without session headers, plus a
grown last text and the stay-apart case.
- Whole repo `bun test`: 4741 pass, 12 skip, 0 fail.
`bun scripts/check.mjs`: exit 0.
Not tried: a real Devin account, or a real Claude Code Auto session. The
tests use zelong77's offline requests with fake timers and no network.
A request with no session whose first message starts with another
conversation's whole first message is taken as that conversation.
buildMessages now sends a role:"system" notice partway through a conversation as a user prompt that keeps its cache mark and its place. Before, the notice was lost or merged away. A notice that arrives while tool calls are still waiting for results is held until those results are answered, so it never comes between a call and its result. A notice after an interrupted call goes after the missing-result placeholder. An empty notice is skipped.
By leosocy (#599), reviewed at 647039a.
Run on the Mac mini with Bun 1.4.2 and HOME=$(mktemp -d), on 647039a merged with main 1a05a77:
- `bun test packages/devin`: 182 pass, 0 fail.
- The new tests on main's index.mjs: 4 of cache-marks.test.mjs fail (13 pass, 4 fail), as they should.
- Whole repo `bun test` (with #606 and #596 merged in too): 4592 pass, 11 skip, 0 fail. `bun scripts/check.mjs`: exit 0.
Not tried: a real Devin account.
zelong77 asked for two things once 0.1.30's keep-alive worked: the pings
were invisible in magpie, and the interval and ping count could only be
edited in plugins.json.
- Each ping that wasn't cut short is reported through magpie.usage (new
in magpie, plugins#592) with kind cache_keepalive, the conversation's
model (chat.model) and account (magpie.account at request time), its
input, output, cache read and write tokens, status, time, and why it
failed. The ping still goes straight to Devin, never back through the
gateway: the gateway re-shapes a request, and the cache would no
longer match. An older magpie or OpenCode has no magpie.usage and is
told nothing; the pings go on the same.
- pingOnce now also reads output tokens (usage field 3) and keeps the
failure's message.
- package.json magpie.options gives the two settings' defaults
(285 s, 6), which magpie's Plugins › Options editor now starts from
for a provider plugin. The switch's description says where they are
and that pings show in Usage, in all five languages, each under the
host's 300-character cap.
Run (on mote, sandbox HOME): bun test in packages/devin, 174 pass;
bun scripts/check.mjs devin ok.
Broken by hand: reporting aborted pings too fails "a ping cut short by
the conversation's next request isn't told"; dropping the report call
fails "each ping is told to magpie".
Not tried: a real Devin account's ping reported into a real magpie.
Devin's prompt cache lasts 5 minutes and has no longer TTL to ask for.
A switch, "Keep the cache warm" (cache_keepalive, off by default, with
zh, zh-TW, ja and de labels), keeps it as the CLI's cache_keepalive.rs
does: after a reply that read or wrote the cache, whatever it stopped
for, the same GetChatMessage goes again every 285 s with one more user
prompt, "continue", and max_tokens 1. The request's bytes are encoded
once, and the ping is them with that prompt and field 8's max_tokens.
- A conversation is session + Claude Code agent id (when the headers
reach the plugin) + a hash of the instructions, tool names and first
user message; its next real request stops its pings, so a subagent
never stops its lead's.
- Stops on 401, 402, 429, two pings in a row reading under half their
prompt from the cache, the most pings (6), the switch going off, and
process exit. Timers are unref'd. At most 32 conversations are kept.
- Options cacheKeepaliveInterval (30-299 s) and cacheKeepaliveMaxPings
(1-50); OpenCode, which has no switch, takes cacheKeepalive: true.
- README says the cost (each ping is a cache read of the whole context,
spent whether the user comes back or not) and why it is off.
Run (mote, HOME=$(mktemp -d)):
- bun test packages/devin: 170 pass, 0 fail (14 new in keepalive.test.mjs).
- Whole repo bun test: 4520 pass, 9 skip, 1 fail: gcp-ai's "a lock held
by another process is waited for, then taken" (ENOENT in abandoned()'s
stat, a race in lib/lock.mjs; passes 3 of 3 alone), filed as #594.
- bun scripts/check.mjs: ok.
- The new tests against the old index.mjs: 14 of 14 fail.
Broken by hand, each red in the test named for it: no cancel on the next
request, no agent id in the key, no prefix hash, no stop on 401/402/429,
no miss count, no cap, no unref, max_tokens kept, pings after a reply
that touched no cache.
Real account (the owner's Devin sign-in read, nothing written, sandbox
HOME, this Mac): claude-sonnet-5-5-low, an 11k-token prompt wrote 10,984
to the cache; one ping 287 s later read 10,984 from it (cacheWrite 3,
output 1) and, at max 1, stopped.
Not tried: more than one ping or a long Claude Code session; the OpenCode
2 (v2) path, which has no keepalive. magpie doesn't pass
x-claude-code-session-id / x-claude-code-agent-id to a plugin's fetch, so
under magpie the key rests on the prefix hash (a lead and a subagent
differ there; two sessions with the same prefix share one keepalive).
0.1.28 moved Devin's Claude models onto Anthropic's Messages API, where
a failed result arrives as tool_result is_error. On chat completions
magpie's gateway writes it into the text, "Error: " first (failedAsText:
Devin has no failed mark), and TestPluginToolFailureSaid holds that; the
Messages path dropped is_error. It now says it the same way.
Run:
- mote-run: HOME=$(mktemp -d) bun test in packages/devin, 156 pass 0
fail; bun scripts/check.mjs ok.
- Broken by hand: without the prefix the new test fails.
Not tried against the real Devin API (the change is text only).
Claude Code's growing classifier history read only ~558 tokens from
Devin's cache: the plugin declared @ai-sdk/openai-compatible for every
model, so magpie turned Anthropic Messages into chat and the blocks were
joined into one text with no cache_control, and encodeMsg never sent
ChatMessagePrompt.prompt_cache_options.
- Claude models (id matching /claude/i) now declare @ai-sdk/anthropic
(config provider.npm, runtime api.npm, variants {effort}); every other
model is unchanged (chat, {reasoningEffort}).
- The loader serves .../messages: buildMessages makes each text block,
system block, assistant text, tool-call turn and tool result its own
ChatMessagePrompt in order, every boundary kept (yetone/magpie#3835),
with field 8 {1: 1} (EPHEMERAL) where the client put cache_control.
The encoding is the devin CLI's own: a capture of devin 3000.11.92
through a recording proxy carries 0801 at field 8 of its user prompt.
Claude Code's billing line (cch changes each turn) is dropped. Tools
with a server type are not offered; tool_choice none offers none.
Effort: output_config.effort, else the thinking budget, none when
thinking is disabled.
- Replies come back as Anthropic's message / SSE events, usage with
cache_read_input_tokens and cache_creation_input_tokens; errors in
Anthropic's shape, X-Magpie-Sign-In: kept; /messages/count_tokens 404.
- The chat path's request bytes are unchanged (build's tail moved into
encodeRequest).
Run:
- mote-run: HOME=$(mktemp -d) bun test in packages/devin, 155 pass 0
fail (19 files, at this tree rebased on 42a5055); bun scripts/check.mjs
ok.
- Broken by hand: without the field 8 line, 3 of the 8 new tests fail;
with user blocks joined into one prompt, the two cache tests fail.
- Real Devin account (sandbox credentials, the plugin's completeMessages
called directly, no magpie), the issue's sequence ~7.3k tokens, first /
resend / grown history / resend, cache read/write:
claude-haiku-5-5 whole: 558/6760, 7318/0, 7318/560, 7878/0
claude-opus-5-5 streamed: 558/6760, 7318/0, 7318/560, 7878/0
old 0.1.27 chat path, same text: 558/6787, 7345/0, 558/7344, 7902/0
A tool round trip on haiku (streamed tool_use, then a tool_result
marked, two assistant text blocks as two prompts) answered correctly.
Not tried: through a magpie gateway end to end with Claude Code (the
non-streaming Messages path for plugin accounts is yetone/magpie#4571);
images in a Messages request against the real API; the v2 (OpenCode 2)
path, which is unchanged.
blue12345655 (magpie Discord #help): a Command Code account signed in
through the plugin was signed out, and magpie offered no 重新登录, on
v0.1.1844 and still on v0.1.2021.
Cause: commandcode said X-Magpie-Sign-In "kept" on every answer and
signIn "kept" on every usage read, so a revoked key came back as a card
saying "Unauthorized" while magpie kept the account signed in, routed to
it, and never showed Sign in again on its rows. Devin and Kiro did the
same in their usage reads: their errors already said "sign in again",
but "kept" stops magpie from reading those words.
- commandcode: a usage read whose credits are refused (401/403), or a
request answered 401, asks /alpha/whoami; when whoami refuses the key
too, the usage says signIn "expired" with "Command Code's sign-in has
expired; sign in again", and the answer carries X-Magpie-Sign-In:
expired, its body unchanged. A 403 for a model the plan lacks, a 401
whoami still takes, and a whoami 500 keep the account. A clean usage
read says "renewed", which takes a mark off.
- devin: a usage read Devin answers 401 says "expired"; a clean read
"renewed"; other failures "kept". Requests unchanged.
- kiro: a usage read whose sign-in Kiro refused (the errors made by
gone) says "expired"; a clean read "renewed"; other failures "kept".
auth.refresh and requests unchanged.
The response bytes in commandcode/signed-out.test.mjs are what
api.commandcode.ai answered an unknown key on 2026-10-29 (whoami,
billing/credits, billing/subscriptions, provider/v1/chat/completions).
Run (WSL magpie-desktop, Bun 1.4.2, HOME=$(mktemp -d)):
- bun test in packages/commandcode: 82 pass, 0 fail; packages/devin:
142 pass; packages/kiro: 67 pass.
- bun scripts/check.mjs: every package ok.
Broken by hand: signed-out.test.mjs against the 0.1.18 index.mjs, 4 of
9 red (usage expired, clean read renewed, Provider API expired, Go
expired). kiro's and devin's changed usage tests against their old
index.mjs: red ("kept" received where "expired" expected).
Not tried: a real revoked Command Code, Devin or Kiro account; the
whoami check is only against an unknown key's real answers.
By mameikagou. Reviewed at 0966b4b (comment on #297); squashed onto
origin/main dc59000 with the version bump.
Run at this tree: HOME=$(mktemp -d) bun test: 2083 pass, 0 fail;
bun scripts/check.mjs ok. Earlier, at 0966b4b with main's
packages/devin/index.mjs put back, the three new or changed tests
(empty-reply, error-after-metadata, metadata-only) were red.
Not tried: a real Devin account answering with an empty reply.
Co-authored-by: mameikagou <mameikagou@users.noreply.github.com>
Two Devin organizations under one email both answered GetUserStatus with
the same email, so the plugin saved both sign-ins as the same
metadata.email and magpie's host (settle, which matches on it) put the
second over the first. The account is now named "email · <organization>"
when Devin names an organization (devinInfo.accountDisplayName) that isn't
the email, with orgId and teamId in its metadata. The usage hook brings an
older sign-in's name and ids up to date through client.auth.set, which the
host scopes to that account. `devin auth status`'s Team ID must match
before the CLI is taken to answer for a key. An account with no
organization in its status is left as it was and nothing is written.
Existing users: on the next usage poll, a sign-in whose status names an
organization is renamed "email · <org>" once; its slot, key and plan stay.
metadata.orgId and teamId aren't read by magpie's host today; the slot
split comes from the distinct name. The magpie side (a CLI account's label
overwritten by `devin auth status`) is yetone/magpie#3198.
Run at the reviewed head 7d589ab45323ee46a03af0f4b496c2dc94e67ba4
(base af360a5), on macOS, bun 1.4.2:
- HOME=$(mktemp -d) bun test: 2051 pass, 0 fail; bun scripts/check.mjs ok.
- Red without the change: the two new tests (identity, usage) fail against
main's index.mjs.
- Ad-hoc test (not committed): a status with no organization writes
nothing through auth.set and keeps the name; an organization named as
the email adds no suffix.
- With #297's change on the same tree: 2052 pass, check ok.
Not tried here: real Devin accounts (the author reports two live Devin Max
organizations under one email on Windows 11).
magpie's built-in Devin (internal/gateway/devin.go buildDevin) sends the
images a tool returned on the tool message that answers the call
(inlineImages(p.Images), field 10). A chat's tool message holds text
alone, so magpie's gateway hands the plugin those images in the user
message after the results (buildChat's seeLater: "[From the result of
<tool> (tool call <id>):]" then the images, and the result's text ends
"[The tool returned an image; it follows in the next message.]"). The
plugin sent them to Devin as a user message of their own, and a tool
message's own image_url parts were dropped.
build() now puts each result's images back on its tool message: the
images under a heading naming a result just sent, up to the number its
note says (so the user's own images after them stay the user's), and a
tool message's own data: image_url parts. The note is taken off the
result's text when every image it names went back with it; an empty
result is "(no output)", as the built-in words it. Images without bytes
(URLs) are left out, as inlineImages leaves them. A heading that names no
result just sent is left as the user's text.
Run:
- bun test in packages/devin under a mktemp HOME: 93 pass, 0 fail.
- bun scripts/check.mjs devin: ok.
- tool-images.test.mjs against the old index.mjs: 3 of its 4 tests red
(the fourth guards a heading naming no result, which held before too).
With the count limit broken by hand (images past the note's number taken
as the tool's), the two-results test goes red.
- The fixtures in testdata/ are magpie's literal buildChat output at
origin/main b03031738, captured with a throwaway test in a separate
magpie worktree (codexViewImage, and an Anthropic request with two Read
results and the user's own image).
Not tried: a real Devin account (whether Devin's model reads a tool
message's images better than a user message's was not measured); OpenCode
itself, outside magpie, whose own shape for a tool's images was not read.
On Windows the devin CLI reads %APPDATA%\devin\ whatever folder it is
given (#17), so cliAnswersFor turned it away for every account before
looking at whose sign-in it reads, and an account without the CLI never
asked at all. Both kept the 2026-09-30 SNAPSHOT, which has no Gemini 4
Argon; moving a built-in Devin with it ticked then failed with "the
plugin doesn't serve Gemini 4 Argon" (NieiR).
The list now comes from GetCliModelConfigs, asked with the account's
token (the call the plugin already made for images): its configs carry
each model's label, context (18), output (model_info 13), family uid
(model_info 23) and family label (30.1). Read over Devin's real response
for the owner's account, parseConfigFamilies gives exactly the 52
families and 262 variants `devin models list --format json` prints, in
its order, less Adaptive and Fusion. When Devin can't be asked, the CLI's
list is used if the CLI names the account Devin names the token's, even
when it reads its own folder (the Windows case); else SNAPSHOT, now
refreshed from the CLI (Gemini 4 Argon and Claude Haiku 5.5 added,
Inkling and Claude Sonnet 4.5 kept for the accounts still offered them).
Run:
- TMPDIR/HOME in a scratch dir, bun test packages/devin: 54 pass, 0 fail.
With index.mjs put back to 0.1.14, the 4 new identity tests fail
(parseConfigFamilies missing; familiesFor without gemini-4-argon;
"models list" never run for a same-account CLI reading its own folder;
provider.models without gemini-4-argon).
- bun scripts/check.mjs devin passes.
- Real account (owner's Devin, sandbox HOME, no devin CLI on PATH):
provider.models gave 85 models with gemini-4-argon (1048576/1000000)
and claude-haiku-5-5; 0.1.14 gave the declared list only.
Not tried: the Windows box itself; the new path doesn't run the CLI.
success() named a key's account by `devin auth status`, run with APPDATA and XDG_DATA_HOME set to a data folder of the plugin's own; the Windows CLI ignores both and reads %APPDATA%\devin\credentials.toml whatever it is given, so every browser sign-in was named after the CLI's own account. familiesFor() had the same flaw: `devin models list` there lists the CLI's account's models for every key.
- success() asks GetUserStatus with the key (the call usage() makes, now shared as userStatus()) and names the account by its email (or name) and tier (TEAMS_TIER_DEVIN_PRO is "Devin Pro", else planName); a key Devin refuses (401) fails the sign-in. Only when Devin can't tell does it fall back to the CLI.
- identity() no longer trusts a CLI whose report names a credentials file outside the data folder it was given (the "File:" line); it can't tell then, and the account is "Devin".
- familiesFor() asks the CLI for a key's models only once the CLI answers for it: it reads the key's folder, and the account it names is the one GetUserStatus names. Otherwise (Windows) the account keeps the declared SNAPSHOT list, and the CLI isn't asked again for that key.
identity.test.mjs (a fake devin CLI always signed in as a@x.dev): key B is named b@x.dev; a refused key fails; with Devin unable to tell, a CLI reading its own folder doesn't name the account and one honouring the folder does; the models list isn't taken from a CLI that reads another folder or names another account, and is from one that answers for the key. They fail against 0.1.6. HOME=$(mktemp -d) bun test (474 pass) and bun scripts/check.mjs pass.