Skip to content

fix: serve companion-tokens at the user-scoped path the web UI calls#40

Merged
Anton-Horn merged 1 commit into
mainfrom
fix/companion-tokens-route-path
Jun 3, 2026
Merged

fix: serve companion-tokens at the user-scoped path the web UI calls#40
Anton-Horn merged 1 commit into
mainfrom
fix/companion-tokens-route-path

Conversation

@Anton-Horn
Copy link
Copy Markdown
Contributor

Problem

Account → Companion always showed "No computers connected" even when a laptop was linked.

The list/revoke routes were mounted under a project-scoped path:

GET    /api/projects/:projectId/companion-tokens
DELETE /api/projects/:projectId/companion-tokens/:tokenId

…but the handlers are user-scoped (listCompanionTokensByUser, ignores projectId), and the web client (web/src/api/companion-tokens.ts) calls the top-level path:

GET    /api/companion-tokens
DELETE /api/companion-tokens/:tokenId

So every request 404'd and the query returned empty — the panel rendered its empty state. This never worked, not a regression from the recent companion changes.

Fix

Register the routes at the path the client actually calls. They still sit before the /api/* catch-all, so match precedence is unchanged. :tokenId resolves via Hono's c.req.param() exactly as before. Server-only change.

Testing

  • Confirmed web calls /api/companion-tokens (+/:tokenId) and nothing references the old project-scoped path.
  • Route registered ahead of app.all("/api/*") (line ~557) and app.get("*") static handler, so it matches first.

After deploy, Account → Companion lists connected computers (name, project, last-used, expiry) and revoke works.

🤖 Generated with Claude Code

Account → Companion always showed "No computers connected" even with a
companion linked. The list/revoke routes were mounted under
/api/projects/:projectId/companion-tokens, but the handlers are user-scoped
(listCompanionTokensByUser, ignores projectId) and the web client calls the
top-level /api/companion-tokens. Every request 404'd, so the query came back
empty.

Register the routes where the client actually calls them:
  GET    /api/companion-tokens
  DELETE /api/companion-tokens/:tokenId

Both still sit before the /api/* catch-all, so matching is unchanged.
Server-only fix; the frontend already used the correct paths.
@Anton-Horn Anton-Horn merged commit 6848719 into main Jun 3, 2026
2 checks passed
@Anton-Horn Anton-Horn deleted the fix/companion-tokens-route-path branch June 3, 2026 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant