You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(cli): reuse @agent-relay/cloud auth as Bearer; drop workspace-token mint (#113)
* fix(cli): short-circuit workspace-list when --workspace is set; clearer 403 hint
When agentworkforce login is invoked with --workspace, listWorkspacesForLogin
should not be called — but the previous flow always listed first and only
short-circuited the picker. That meant users hitting 403 on /api/v1/workspaces
could not log in at all, even with the workspace id in hand. This PR:
- Short-circuits listWorkspacesForLogin when opts.workspace is provided
- Surfaces a clearer error when the list 403s, pointing at --workspace
- Surfaces a clearer error when the list is empty (no workspaces yet)
- Adds tests covering all three paths
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(cli): reuse @agent-relay/cloud auth as Bearer; drop workspace-token mint
agentworkforce login was hitting POST /api/v1/workspaces/{id}/tokens/workspace
(and two fallback paths) to mint a workspace-scoped token. Cloud does not
implement any of those routes -- all three 404, blocking login for every
user who already has a valid agent-relay cloud login.
Cloud's resolveRequestAuth already accepts the user's accessToken from
~/.agent-relay/cloud-auth.json as Authorization: Bearer. The mint step
exists for CI/service-account use, not interactive CLI use, but currently
blocks BOTH because cloud has not shipped the route.
This PR:
- Drops issueWorkspaceToken from runLogin.
- Persists a lightweight ~/.agentworkforce/active.json pointer
(workspaceId + workspaceSlug + cloudUrl) at login time.
- resolveWorkspaceToken reads active.json + @agent-relay/cloud's shared
auth and returns auth.accessToken as the Bearer. Refreshes the
accessToken via refreshStoredAuth when expired.
- Preserves the WORKFORCE_WORKSPACE_TOKEN env fallback (CI) and the
legacy keychain-stored workspace token path (back-compat for users
mid-upgrade).
- runLogout always clears active.json; --cloud-auth/--all still clears
the shared agent-relay auth as before.
Layered on top of workforce#112 (--workspace short-circuit) so login
works end-to-end with just a known workspace id.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
---------
Co-authored-by: Ricky Schema Cascade <ricky@agent-relay.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments