diff --git a/packages/devin/cli-key.test.mjs b/packages/devin/cli-key.test.mjs index df505f8..37268a5 100644 --- a/packages/devin/cli-key.test.mjs +++ b/packages/devin/cli-key.test.mjs @@ -18,7 +18,7 @@ afterAll(() => { }) test("the CLI's account follows credentials.toml; a browser sign-in stays", async () => { - const cli = { type: "api", key: "saved", metadata: { cli: true, server: "https://s.example" } } + const cli = { type: "api", key: "saved", metadata: { cli: "true", server: "https://s.example" } } expect(await _internal.live(cli)).toEqual({ key: "saved", server: "https://s.example" }) mkdirSync(join(data, "devin")) writeFileSync(join(data, "devin", "credentials.toml"), 'windsurf_api_key = "rotated"\napi_server_url = "https://t.example/"\n') diff --git a/packages/devin/index.mjs b/packages/devin/index.mjs index 3d245a1..3b54fb3 100644 --- a/packages/devin/index.mjs +++ b/packages/devin/index.mjs @@ -985,7 +985,10 @@ async function cliSignIn() { const c = readCredentials(await readFile(path, "utf8")) if (!c.windsurf_api_key) return { type: "failed", error: `Devin isn't signed in: ${path} has no key` } const r = await success(c.windsurf_api_key, (c.api_server_url || SERVER).replace(/\/+$/, "")) - r.metadata.cli = true + // a string: OpenCode 1 keeps an auth's metadata as strings and drops + // an auth.json entry with any other value, so its requests go past + // this fetch to BASE (a 404). live() takes it as truthy. + r.metadata.cli = "true" return r } catch (e) { return { type: "failed", error: e?.code === "ENOENT" ? "Devin isn't signed in: run `devin auth login`" : e.message }