Skip to content

Fresh-user setup cannot complete: login and workspace commands use different credential stores #440

Description

@khaliqgant

Summary

A brand-new user cannot complete npx relayfile@latest setup. Sign-in succeeds, then setup fails with:

error: mint delegated relayfile credentials: http 404 workspace_not_found: Workspace not found

The underlying cause appears to be that the device-auth login and the workspace subcommands do not read the same credential store, so immediately after a successful sign-in the CLI behaves as though nobody is logged in.

Verified against published 0.10.47 on macOS (arm64), Node 22.22.2, in a fully isolated environment: fresh HOME, fresh npm cache, fresh npm prefix, fresh cwd, env -i. Not a stale-config artifact.

Reproduction

npx relayfile@latest setup --no-open

Complete the device authorization in a browser, then answer the three prompts.

Observed, with all three prompts genuinely answered over a real PTY (driven with expect, values echoed back correctly):

Logged in to https://agentrelay.com/cloud
Signed in as <user> (<Workspace Name>)
Workspace name [relayfile-20260823-204739]: relayfile-onboard-probe-0823
Integration (...) [github]: none
Local mount directory [./relayfile-mount]:
error: mint delegated relayfile credentials: http 404 workspace_not_found: Workspace not found

Evidence that this is a credential-store split, not a bad workspace name

Immediately after that successful sign-in, in the same isolated HOME:

$ relayfile workspace list --names-only
(empty)

$ relayfile workspace current
error: no active workspace; pass WORKSPACE, set RELAYFILE_WORKSPACE, or run 'agent-relay workspace switch NAME'

$ relayfile workspace create relayfile-onboard-probe-0823
error: credentials not found at $HOME/.relayfile/credentials.json;
       run relayfile login --api-key for self-hosted credentials or pass --token

But the login did persist credentials — just somewhere else:

$HOME/.agentworkforce/relay/cloud-auth.json       -rw-------
$HOME/.agentworkforce/relay/cloud-identity.json   -rw-------
$HOME/.relayfile/catalog-cache.json               -rw-r--r--

So workspace create looks for ~/.relayfile/credentials.json, while the device-auth flow writes ~/.agentworkforce/relay/cloud-auth.json. ~/.relayfile/ exists and contains only a catalog cache — no credentials.

That single split explains every symptom coherently: workspace list returns empty for a signed-in user, workspace current reports no active workspace, workspace create reports no credentials, and setup therefore tries to mint delegated credentials for a workspace it was never able to create — producing the 404.

Why every fresh user hits this

The workspace-name prompt defaults to a newly generated name (relayfile-<timestamp>). Whatever the intended semantics, that default cannot refer to an existing workspace, so accepting the default is guaranteed to 404. There is no path through the prompts that succeeds:

  • accept the default -> new name -> 404
  • type a new name -> 404
  • create the workspace first -> workspace create says credentials not found

One observation I am explicitly not drawing a conclusion from

The sign-in banner prints Signed in as <user> (<Workspace Name>), naming a real workspace the account owns — while workspace list in the same session is empty. Either the banner reads identity from the cloud-auth store while list reads the other one (consistent with the split above), or list is scoped to something different. Worth confirming rather than assuming.

Also note the error text mentions --api-key and "self-hosted credentials", so it is possible workspace create is a self-hosted-only path and the hosted flow is meant to provision differently. If so, the defect is that the hosted setup path has no working provisioning step at all, rather than that it calls the wrong one. Either way the fresh-user outcome is the same.

Credential hygiene — a positive finding, recorded deliberately

cloud-auth.json and cloud-identity.json are written 0600 inside 0700 directories. That is correct and worth stating, because a related defect was filed today in a different component where a generated script was written 0644 with a token inline (AgentWorkforce/sandbox#30). The local CLI path does this correctly.

Impact

This is the first-run path for every new user. It is not reachable by any automated test that stops short of a real browser sign-in, which is why it survived a full day of verification: an agent could prove the tarball contents, the sign-in URL, --no-open, timeout propagation and cancellation behaviour, but the failure only appears after a human completes the device authorization.

Suggested fix direction

  1. Make the login and workspace subcommands share one credential store, or have the workspace commands fall back to the cloud-auth store.
  2. Have setup explicitly create the workspace it prompted for before minting delegated credentials, and fail with a message naming the missing step rather than a raw HTTP 404.
  3. If the prompt is meant to select rather than create, default it to an existing workspace and list the available ones.

Environment

  • relayfile 0.10.47 (published; npx relayfile@latest)
  • macOS arm64, Node 22.22.2, npm 10.9.7
  • Isolated HOME, npm cache, npm prefix and cwd via env -i; real ~/.relayfile untouched
  • Prompts driven over a real PTY via expect; answers confirmed echoed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions