codearts 0.3.14: a CodeArts Agent sign-in is kept (#998)

Signing in with "Sign in from CodeArts Agent" said ok, but the account
was never stored. A host keeps an OAuth sign-in only when the result has
a `refresh` field (OpenCode's CLI and magpie's host.js both test
`"refresh" in result`), and the IDE method's success had none. It now
has `refresh: ""`. This sign-in has no refresh token: it is renewed by
reading the IDE's state file again, and every reader of the refresh
token (firstOf) already skips an empty string.

The IDE sign-in test now checks the field is there and empty.

Ran on mica (Bun, HOME=$(mktemp -d)): bun test packages/codearts 203
pass 0 fail; bun scripts/check.mjs exit 0.
Broken by hand: without the refresh line, "signing in from the CodeArts
Agent: checked with its station…" goes red (202 pass, 1 fail).
Not tried: a real CodeArts Agent sign-in (no account here).

Reported-by: AyakaChen1 <AyakaChen1@users.noreply.github.com>
This commit is contained in:
yetone
2026-11-12 11:06:52 +08:00
parent b829a5541e
commit 4e3a786814
3 changed files with 11 additions and 2 deletions
+3 -1
View File
@@ -4449,7 +4449,9 @@ test("signing in from the CodeArts Agent: checked with its station, the account
assert.equal(r.type, "success", r.error)
assert.equal(r.accountId, "dom1")
assert.equal(r.uid, "dom1")
assert.equal(r.refresh, undefined)
// a host keeps an OAuth sign-in only when "refresh" is in the result (#998)
assert.ok("refresh" in r, "kept by the host")
assert.equal(r.refresh, "", "no refresh token: renewed from the IDE's file")
assert.equal(r.expires, Date.parse("2030-01-01T00:00:00Z"))
const cred = JSON.parse(r.access)
assert.equal(cred.station, "international")