Skip to content

Fix CLI session loss on background refresh failures - #8946

Open
efegokdemir wants to merge 1 commit into
Shopify:mainfrom
efegokdemir:efe/fix-cli-session-refresh-isolation
Open

efegokdemir wants to merge 1 commit into
Shopify:mainfrom
efegokdemir:efe/fix-cli-session-refresh-isolation

Conversation

@efegokdemir

Copy link
Copy Markdown

WHY are these changes introduced?

Fixes #8945

A background refresh failure currently clears every saved account. Concurrent refreshes can race on stale session data, while theme dev only logs failures at debug level.

WHAT is this pull request doing?

Refreshes and updates the latest session under a shared file lock, preserves unrelated accounts, and removes only a session whose credentials were rejected. Theme dev warns when interactive reauthentication is needed. Regression tests cover concurrent refreshes, targeted cleanup and the warning. Focused CLI auth/store tests (79), Theme environment tests (246), type-check, lint and builds passed for both packages.

How to manually test your changes?

With two saved CLI accounts, trigger a no-prompt refresh failure for one and confirm the other remains selectable. In shopify theme dev, confirm the failed background refresh produces a terminal warning.

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing — I've identified the correct bump type (patch for bug fixes · minor for new features · major for breaking changes) and added a changeset with pnpm changeset add

@efegokdemir
efegokdemir requested review from a team as code owners October 19, 2026 05:20

This branch has not been deployed

No deployments
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.

A background token refresh failure in a non-interactive process wipes every saved CLI session (all accounts)

1 participant