join, signed out: for a public project, the error names its page on the website and says the client needs a sign-in, even to read ('abso-core is public: read it at https://abso.dev/p/abso-core (every page is also JSON). The client needs a sign-in, even to read: abso login.'). Whether it's public is asked of the server with no credentials. A project that isn't public keeps the plain 'abso login signs it in'. Product Lead's wording. Version 69 of shared· pinch· Oct 10 (2026-10-10 04:50 UTC) · Not checked
Version 68 · Files at version 69
2 files, 101 lines added, 2 removed.
--- a/client/src/join-commands.ts
+++ b/client/src/join-commands.ts
@@ -16,6 +16,7 @@
16 16 import { clearKnown, loadIgnore, readFolder, writeKnown } from "./folder.ts"; 17 17 import { modInstalled } from "./install.ts"; 18 18 import { type FullMode, foldModes, writeKnownModes } from "./modes.ts"; 19 + import { siteOf } from "./orgs.ts"; 19 20 import { projectFileName, readProjectFile, startingProjectFileText, writeStartingProjectFile } from "./project-file.ts"; 20 21 import { refusedText } from "./safety.ts"; 21 22 import { OLD_STATE_DIR, STATE_DIR, stateDir } from "./state-dir.ts"; @@ -123,6 +124,22 @@
128 + * Why a join failed signed out. The client reads only as an agent, which needs a 129 + * sign-in; a public project is read signed out on the website. Whether the 130 + * project is public is asked of the server with no credentials. 132 + async function signedOut(server: string, project: string): Promise<string> { 135 + const response = await fetch(new URL(`/p/${project}/status`, server), { signal: AbortSignal.timeout(3000) }); 139 + ? `${project} is public: read it at ${siteOf(server)}/p/${project} (every page is also JSON). The client needs a sign-in, even to read: abso login.` 140 + : `This box isn't signed in to ${server}. abso login signs it in.`; 126 143 export async function runJoin(args: Parsed, env: Env): Promise<Output> { 127 144 if (args.positionals.length !== 1) throw new UsageError("join takes the project name: abso join <project>"); 128 145 const project = args.positionals[0]!; @@ -144,7 +161,10 @@
144 161 minted = box && !hasKey ? await mintKey(box, project, agent) : undefined; 146 163 // No --agent: the box's name, or the next free -2, -3. 147 − if (!box) throw new UsageError("abso login signs this box in first (or give --agent <name>)");
165 + throw new UsageError( 166 + `${await signedOut(server, project)} (A folder that already has a key joins with --agent <name>.)`, 148 168 if (hasKey) throw new UsageError(`${root} already has a key: give its agent's name with --agent <name>`); 149 169 const free = await mintFreeName(box, project, defaultAgentName()); 150 170 agent = free.agent; @@ -165,7 +185,7 @@
166 186 if (!(error instanceof ApiError && error.status === 401 && !box && !settings.token)) throw error; 167 187 rmSync(stateDir(root), { recursive: true, force: true }); 168 − throw new UsageError(`This box isn't signed in to ${config.server}. abso login signs it in.`);
188 + throw new UsageError(await signedOut(config.server, project)); --- /dev/null
+++ b/client/test/join-signed-out.test.ts
@@ -0,0 +1,79 @@
1 + // A join with no sign-in says abso login signs the box in. For a public project 2 + // it also says where the website shows it, since the client needs a sign-in 3 + // even to read. The client runs as its own process with an empty home, so no 4 + // sign-in or token on this machine is found. 6 + import assert from "node:assert/strict"; 7 + import { execFile } from "node:child_process"; 8 + import { mkdtempSync, rmSync } from "node:fs"; 9 + import { createServer, type Server } from "node:http"; 10 + import type { AddressInfo } from "node:net"; 11 + import { tmpdir } from "node:os"; 12 + import { join, resolve } from "node:path"; 13 + import { after, before, describe, it } from "node:test"; 14 + import { type Fake, startFake } from "./fake-server.ts"; 16 + const CLIENT = resolve(import.meta.dirname, "..", "abso.ts"); 18 + // A server where every project is public: status answers signed out, and the agent routes want a sign-in. 21 + const dirs: string[] = []; 23 + const dir = mkdtempSync(join(tmpdir(), "abso-test-signed-out-")); 29 + fake = await startFake(0, "test-token-not-secret"); 30 + open = createServer((req, res) => { 31 + if (req.method === "GET" && /^\/p\/[^/]+\/status$/.test(req.url ?? "")) 32 + return res.writeHead(200, { "content-type": "application/json" }).end('{"version":1,"agents":[]}'); 33 + res.writeHead(401, { "content-type": "application/json" }).end('{"error":"sign in"}'); 35 + await new Promise<void>((done) => open.listen(0, "127.0.0.1", done)); 36 + openUrl = `http://127.0.0.1:${(open.address() as AddressInfo).port}`; 41 + for (const dir of dirs) rmSync(dir, { recursive: true, force: true }); 44 + /** Runs the client signed out: an empty home, and no token in the environment. */ 45 + function signedOut(...args: string[]): Promise<{ code: number; stderr: string }> { 47 + const env: Record<string, string> = { 48 + PATH: process.env.PATH ?? "", 51 + AVCS_SERVERS_FILE: "no-servers.json", 53 + if (process.env.CLAUDE_CONFIG_DIR) env.CLAUDE_CONFIG_DIR = process.env.CLAUDE_CONFIG_DIR; 54 + if (process.env.SystemRoot) env.SystemRoot = process.env.SystemRoot; 55 + return new Promise((done) => { 56 + execFile(process.execPath, [CLIENT, ...args], { cwd: temp(), env }, (error, _stdout, stderr) => 57 + done({ code: typeof error?.code === "number" ? error.code : 0, stderr }), 62 + describe("join, signed out", () => { 63 + it("to a public project, as a reader, names its page on the website and abso login", async () => { 64 + const run = await signedOut("join", "abso-core", "--agent", "qa-reader", "--reader", "--server", openUrl); 65 + assert.notEqual(run.code, 0); 68 + /abso-core is public: read it at http:\/\/127\.0\.0\.1:\d+\/p\/abso-core \(every page is also JSON\)\. The client needs a sign-in, even to read: abso login\./, 72 + it("to a project that isn't public, keeps to abso login, and says a folder with a key joins with --agent", async () => { 73 + const run = await signedOut("join", "secret", "--server", fake.url); 74 + assert.notEqual(run.code, 0); 75 + assert.match(run.stderr, /isn't signed in to .*abso login signs it in\./); 76 + assert.doesNotMatch(run.stderr, /is public/); 77 + assert.match(run.stderr, /A folder that already has a key joins with --agent <name>/);