Skip to content

doctor reports active_org 'none' while whoami and orgs list report an active org #4

Description

@gdameneses

Summary

urlbox doctor reports active_org: none on a machine where urlbox whoami and urlbox orgs list both report an active organisation. The two commands read different sources and never reconcile.

Reproduce

  1. Reach a state where a session exists but active_org was never written locally. The easiest route is the failure in login: session persisted before org resolution, so a failed login exits 1 while signed in #3:

    urlbox login | cat          # account with 2+ orgs; approve in browser
    # exits 1 at the org picker, session is persisted
  2. Ask the two commands the same question:

    urlbox whoami
    urlbox doctor

Expected

Both agree, or doctor states which source it is reporting on.

Actual

whoami names an org:

{"ok": true, "data": {"email": "", "org": {"id": "org_xxx", "name": ""}, "project": null}}

doctor says there isn't one:

{"message": "none (not needed for rendering)", "name": "active_org", "status": "warn"}

urlbox orgs list sides with whoami — it marks that org "active": true.

Cause

doctor reads the local config only — internal/cmd/doctor.go:324:

func checkActiveOrg(profile *config.Profile, credentialOnly bool) Check {
	if profile.ActiveOrg == "" {

whoami calls the API's /v1/auth/get-session and reports the server's active org. When the local cache was never written, the two disagree with no indication that they are answering from different places.

Suggested fix

When profile.ActiveOrg is empty but a session token exists, doctor could consult the session and either report the org it finds or say "none stored locally; session reports <org>" — rather than a bare none, which reads as "you have no active org" when the API disagrees.

Environment

urlbox 1.2.0 (commit 5530665), Linux.

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