Skip to content

fix(auth): honor --org/--project in auth status and auth env - #319

Merged
sawka-harness merged 2 commits into
mainfrom
cosmos/auth-status-scope-overrides
Oct 20, 2026
Merged

sawka-harness merged 2 commits into
mainfrom
cosmos/auth-status-scope-overrides

Conversation

@augmentcode

@augmentcode augmentcode Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #321

Problem
harness auth status --project X ignored the flag and reported the profile's saved project; auth env had the same gap.

Solution
Add auth.LoadWithOverrides (Load + org/project overrides, no validation) and have ResolveWithOverrides build on it. auth status and auth env now use it; other Load callers (token, sso, debug ssolog) don't use scope and are unchanged.

@augmentcode

augmentcode Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

PR Author Agent⚡

👋 I've got this PR.
I'll handle review feedback, CI failures, and merge conflicts.

@sawka-harness
sawka-harness marked this pull request as ready for review October 20, 2026 21:45

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep Code Review Agent🐛

Review completed with 1 suggestion.

Reviewed commit: 47df123

r := statusResult{Source: anticipatedSource, Profile: profileName(anticipatedSource)}

resolved, loadErr := auth.Load(profileFlag)
resolved, loadErr := auth.LoadWithOverrides(profileFlag, orgFlag, projectFlag)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep Code Review Agent🐛

When a saved profile exists but its credentials are missing or unreadable, LoadWithOverrides returns before applying the flags, and runStatusChecks falls back to populateKnownProfileFields, which restores the saved org/project. In that diagnostic path, auth status --project other-project still reports the profile's original project (including in JSON), silently ignoring the requested override.

Severity: medium


🤖 Was this useful? React with 👍 or 👎

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Author Agent⚡

Good catch. populateKnownProfileFields now takes the org/project overrides and applies them over the saved profile values, so --project is honored on the credential-failure path too (0968d75). Added a test covering no overrides, both overrides, and project-only.

@sawka-harness
sawka-harness merged commit 971e238 into main Oct 20, 2026
1 check passed
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.

auth status and auth env ignore --org/--project flags

1 participant