Skip to content

fix(mesh): refuse to open prod dashboard from non-prod gateway#88

Merged
George-iam merged 1 commit intomainfrom
fix/mesh-dashboard-url-context-aware-20260410
Apr 10, 2026
Merged

fix(mesh): refuse to open prod dashboard from non-prod gateway#88
George-iam merged 1 commit intomainfrom
fix/mesh-dashboard-url-context-aware-20260410

Conversation

@George-iam
Copy link
Copy Markdown
Contributor

Summary

Fixes B-005: "Agent Mesh: Invalid exchange token" when running `axme mesh dashboard` under a non-prod context.

Root cause: `mesh.go` had `defaultMeshDashboardURL = "https://mesh.axme.ai\"\` hardcoded. Under staging context, the CLI created an exchange token via the staging gateway then opened the prod dashboard. Prod dashboard's backend tried to validate the token against prod DB, found nothing, returned "Invalid exchange token".

Changes

  • New `resolveDashboardURL()` with precedence:
    1. `--dashboard-url` flag
    2. `AXME_MESH_DASHBOARD_URL` env var
    3. context-aware: refuse if gateway is not `api.cloud.axme.ai`
    4. `https://mesh.axme.ai\` (default)
  • Non-prod gateways now fail fast with a clear error message and remediation hint
  • 6 unit tests covering all precedence branches

Test plan

  • `go test ./cmd/axme/ -run TestResolveDashboardURL` — 6/6 pass
  • Full test suite passes
  • Manual: under staging context returns clear error with hint
  • Manual: with `AXME_MESH_DASHBOARD_URL=http://localhost:3000\` returns localhost URL with valid staging token
  • Manual: under prod context still opens `mesh.axme.ai` (should keep working — backwards compat)

Adds resolveDashboardURL() with this precedence:
  1. --dashboard-url flag override
  2. AXME_MESH_DASHBOARD_URL env var
  3. context-aware: refuse if gateway is not api.cloud.axme.ai
  4. https://mesh.axme.ai (prod default)

Before this fix, running `axme mesh dashboard` under a staging context would
create a token via the staging gateway and then open https://mesh.axme.ai
(prod). The prod dashboard would call its prod gateway which doesn't know the
staging token, returning "Invalid exchange token" — confusing the user with no
hint about the cross-environment mismatch.

Now staging contexts fail fast with a clear message and a hint to set
AXME_MESH_DASHBOARD_URL or pass --dashboard-url. Tested via 6 unit tests
covering all precedence branches.

Fixes the "Agent Mesh: Invalid exchange token" report.
@George-iam George-iam merged commit c18a92c into main Apr 10, 2026
1 check passed
@George-iam George-iam deleted the fix/mesh-dashboard-url-context-aware-20260410 branch April 10, 2026 14:34
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