Skip to content

[APP-5097] Defer startup API key validation - #14711

Merged
moirahuang merged 1 commit into
masterfrom
moira/consolidate-startup-api-key-auth
Aug 5, 2026
Merged

[APP-5097] Defer startup API key validation#14711
moirahuang merged 1 commit into
masterfrom
moira/consolidate-startup-api-key-auth

Conversation

@moirahuang

@moirahuang moirahuang commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Description

Explicit startup API keys were installed into shared AuthState before the server validated them. Credential presence made GUI and TUI startup appear authenticated and allowed unrelated clients to retrieve an unvalidated key.

This change makes GUI, interactive TUI, and Oz CLI hold explicit startup API keys outside shared auth state until fetch_user succeeds. GUI and TUI share the deferred startup-auth path, while Oz CLI keeps its separate IAP-gated command lifecycle and validates the pending key before dispatch. The obsolete eager API-key initializer has been removed so failed validation leaves the process fully logged out.

PR with more context: #14620

Linked Issue

APP-5097

Testing

  • ./script/format
  • Focused cargo nextest selection covering launch-mode policy, CLI authentication-source selection, failed pending-key validation, and successful key promotion: 10 passed
  • cargo clippy -p warp --lib --tests -- -D warnings
  • git diff --check
  • Full workspace/all-features Clippy was not run, per request
  • I have manually tested my changes locally with ./script/run

Agent Mode

CHANGELOG-NONE

Co-Authored-By: Warp Agent agent@warp.dev

Co-Authored-By: Warp Agent <agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@moirahuang moirahuang changed the title Defer startup API key validation [APP-5097] Defer startup API key validation Aug 4, 2026
Comment thread app/src/lib.rs
entrypoint: TuiEntryPoint::CliCommand { .. },
} => true,
fn auth_initialization(&self) -> AuthInitialization {
match self.api_key() {

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.

basically making no eager installation anymore

Comment thread app/src/lib.rs
(user_is_logged_in && !matches!(launch_mode, LaunchMode::CommandLine { .. }))
.then_some(StartupUserAuthentication::RefreshUser)
});
let startup_authentication = if matches!(launch_mode, LaunchMode::CommandLine { .. }) {

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.

can simplify the logic here too

@moirahuang
moirahuang requested a review from kevinyang372 August 5, 2026 00:08
@moirahuang
moirahuang marked this pull request as ready for review August 5, 2026 17:07
@moirahuang
moirahuang enabled auto-merge (squash) August 5, 2026 17:07
@oz-for-oss

oz-for-oss Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@moirahuang

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overview

This PR defers explicit startup API keys out of shared AuthState until server validation succeeds, and updates GUI, TUI, and CLI startup auth paths to promote validated credentials later. I reviewed the attached diff, PR description, and spec context; no approved repository spec context was available.

Concerns

  • This changes user-visible GUI/TUI startup and CLI authentication behavior, but the PR description does not include screenshots or a screen recording demonstrating the new successful and failed API-key flows end to end. Per the repository review guidance, user-facing behavior changes need visual evidence attached before merge.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@moirahuang
moirahuang merged commit 2ac0586 into master Aug 5, 2026
57 checks passed
@moirahuang
moirahuang deleted the moira/consolidate-startup-api-key-auth branch August 5, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants