Skip to content

fix(1password): checkOpCliAuth() always returns a completion callback#515

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/fix-issue-with-variable-locking
Closed

fix(1password): checkOpCliAuth() always returns a completion callback#515
Copilot wants to merge 2 commits intomainfrom
copilot/fix-issue-with-variable-locking

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 30, 2026

checkOpCliAuth() implements a mutex to serialize op CLI auth prompts. The first caller received opAuthDeferred.resolve; subsequent callers (including recursive retries in executeReadBatch) hit the if branch with no return, silently getting undefined. Call sites used authCompletedFn?.(true) to mask this — fine for the happy path, but in retry scenarios (partial batch failures: bad vault/item/field refs) the retried batch's completion was never properly signalled.

Changes

  • checkOpCliAuth() return type is now always Promise<OpAuthCompletedFn> — first caller gets opAuthDeferred.resolve; subsequent callers get a typed no-op (_success) => undefined instead of falling off the end
  • Added OpAuthCompletedFn type alias for the callback signature
  • Typed createDeferredPromise<boolean>() explicitly
// Before: subsequent callers returned undefined (implicit)
if (opAuthDeferred) {
  await opAuthDeferred.promise;
  // ← no return
}

// After: always callable
if (opAuthDeferred) {
  await opAuthDeferred.promise;
  return (_success: boolean) => undefined; // no-op, but never undefined
}

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 30, 2026

🦋 Changeset detected

Latest commit: ff5173a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@varlock/1password-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI changed the title [WIP] Fix issue with variable locking mechanism fix(1password): checkOpCliAuth() always returns a completion callback Mar 30, 2026
Copilot AI requested a review from theoephraim March 30, 2026 20:47
@theoephraim
Copy link
Copy Markdown
Member

did not need a PR here. Just copilot being dumb.

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.

2 participants