Skip to content

Fix identity prompts to respect --interactive flag - #2130

Merged
Andriy Knysh (aknysh) merged 4 commits into
mainfrom
copilot/fix-identity-prompt-behavior
Mar 4, 2026
Merged

Andriy Knysh (aknysh) merged 4 commits into
mainfrom
copilot/fix-identity-prompt-behavior

Conversation

Copilot AI commented Mar 3, 2026 •

Copy link
Copy Markdown
Contributor

Identity selection prompts appeared even when --interactive=false was specified. The isInteractive() function in pkg/auth/manager.go checked TTY and CI status but not the flag itself.

Changes

  • pkg/auth/manager.go: Modified isInteractive() to check viper.GetBool("interactive") before TTY/CI checks
  • pkg/auth/interactive_test.go: Added test coverage for flag behavior

Implementation

func isInteractive() bool {
    // Check if interactive mode is enabled via flag or environment.
    if !viper.GetBool("interactive") {
        return false
    }
    
    // Check if stdin is a TTY and not in CI.
    return term.IsTTYSupportForStdin() && !telemetry.IsCI()
}

Now aligns with the existing pattern in pkg/flags/interactive.go.

Behavior

Command Result (no default identity)
atmos list stacks --interactive=false Error: "no default identity configured"
atmos list stacks (default) Prompts user (if TTY)
ATMOS_INTERACTIVE=false atmos list stacks Error
Original prompt

This section details on the original issue you should resolve

<issue_title>Identity related prompts doesn't follow the "Interactive" settings</issue_title>
<issue_description>### Describe the Bug

When identities are present and no default is set.
Atmos will always prompt for identity.

Expected Behavior

If no default is set, and multiple identity are present, atmos should exit with an error code.

Steps to Reproduce

  • Add 2+ identities to the atmos.yaml files (with no default value set)
  • Execute atmos list stacks --interactive=false

Screenshots

$ atmos list stacks --interactive=false                                                                                                                                                                                                                                                                                  
┃ No default identity configured. Please choose an identity:                                                                                                                                                                                                                                                                                                                
┃ Press ctrl+c or esc to exit                                                                                                                                                                                                                                                                                                                                               
┃ > dev                                                                                                                                                                                                                                                                                                                                                                     
┃   dev2                                      

Environment

No response

Additional Context

No response</issue_description>

Comments on the Issue (you are Copilot in this section)

Erik Osterman (Cloud Posse) (@osterman) That does appear to be the incorrect behavior.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@mergify mergify Bot added triage Needs triage wip Work in Progress: Not ready for final review or merge labels Mar 3, 2026
- Updated isInteractive() in pkg/auth/manager.go to check viper for --interactive flag
- Added viper import to support flag checking
- Added comprehensive tests for --interactive flag behavior
- Updated existing tests to preserve viper state

Co-authored-by: osterman <52489+osterman@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix identity prompts to follow interactive settings Fix identity prompts to respect --interactive flag Mar 3, 2026
@mergify mergify Bot removed the wip Work in Progress: Not ready for final review or merge label Mar 3, 2026
@osterman Erik Osterman (Cloud Posse) (osterman) added the patch A minor, backward compatible change label Mar 3, 2026
@osterman
Erik Osterman (Cloud Posse) (osterman) marked this pull request as ready for review March 3, 2026 15:58
@github-actions github-actions Bot added the size/m Medium size PR label Mar 3, 2026
@github-actions

github-actions Bot commented Mar 3, 2026 •

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

None

@codecov

codecov Bot commented Mar 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.58%. Comparing base (8cd0056) to head (9254a53).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2130   +/-   ##
=======================================
  Coverage   76.57%   76.58%           
=======================================
  Files         832      832           
  Lines       79500    79502    +2     
=======================================
+ Hits        60879    60884    +5     
+ Misses      14822    14820    -2     
+ Partials     3799     3798    -1     
Flag Coverage Δ
unittests 76.58% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pkg/auth/manager.go 81.00% <100.00%> (+0.10%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aknysh
Andriy Knysh (aknysh) merged commit 3f3b552 into main Mar 4, 2026
56 checks passed
@aknysh
Andriy Knysh (aknysh) deleted the copilot/fix-identity-prompt-behavior branch March 4, 2026 14:23
@mergify mergify Bot removed the triage Needs triage label Mar 4, 2026
@github-actions

github-actions Bot commented Mar 5, 2026

Copy link
Copy Markdown

These changes were released in v1.208.1-test.0.

Igor Rodionov (goruha) added a commit that referenced this pull request Mar 9, 2026
…raform-plan

* osterman/native-ci-terraform: (28 commits)
  feat: Add source cache TTL for JIT-vendored components (#2138)
  feat: Per-target version overrides in vendor manifests (#2141)
  docs: Add PRD for browser-based auth in aws/user identity (#1887)
  docs: Add EKS kubeconfig authentication integration PRD (#1884)
  fix: correct marketplace.json schema and update docs with install/uninstall commands (#2142)
  fix: propagate auth to all YAML functions in multi-component execution (#2140)
  fix: Use atmos_component for source provisioner workdir paths (#2137)
  Fix identity prompts to respect --interactive flag (#2130)
  Increase PR size thresholds to accommodate AI-assisted development (#2136)
  docs: Add Azure authentication provider documentation (#2132)
  fix: propagate component-type level dependencies through stack processor (#2127)
  fix: Add retry and missing workflow step properties to all schema copies (#2113)
  Exclude unsupported windows/arm from goreleaser build matrix (#2133)
  Add AI Agent Skills for LLM-Powered Infrastructure Development (#2121)
  Fix: Convert toolchain paths to absolute in PATH to resolve exec.LookPath failures (#2095)
  Fix workdir collision for component instances sharing base component (#2093)
  fix(auth): propagate TTY state to subprocesses for SSO device flow in workflows (#2126)
  fix(security): prevent SSRF in GitHub OIDC token URL handling (CWE-918) (#2106)
  Fix #2112: add workflow_retry definition and retry property to workflow step schema (#2114)
  fix(auth): auto-detect GitHub Actions WIF with proper audience, host validation, and lazy GSM init (#2109)
  ...
@github-actions

github-actions Bot commented Mar 9, 2026

Copy link
Copy Markdown

These changes were released in v1.208.1-test.9.

@github-actions

github-actions Bot commented Mar 9, 2026

Copy link
Copy Markdown

These changes were released in v1.208.1-test.10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch A minor, backward compatible change size/m Medium size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Identity related prompts doesn't follow the "Interactive" settings

3 participants