Skip to content

fix(v2): persist AGY OAuth auth atomically - #133

Merged
anthonyhaussman merged 1 commit into
anthonyhaussman:tone/feat/opencode-v2-dual-compatfrom
marcelokarval:fix/v2-auth-store-atomic-write
Sep 25, 2026
Merged

anthonyhaussman merged 1 commit into
anthonyhaussman:tone/feat/opencode-v2-dual-compatfrom
marcelokarval:fix/v2-auth-store-atomic-write

Conversation

@marcelokarval

Copy link
Copy Markdown

Summary

Follow-up for #132 and the active OpenCode V2 compatibility work in #107.

  • replace direct auth.json writes with an exclusive same-directory 0600 temporary file followed by atomic rename;
  • retain other providers while updating google-agy;
  • avoid replacing corrupt existing auth stores;
  • clean up only a temporary file opened by this invocation;
  • return a clear OAuth-login failure if persistence fails, while allowing an already refreshed request to continue with a sanitized warning.

Validation

  • npm test -- --run test/plugin/v2-storage.test.ts test/plugin/v2-session.test.ts test/plugin/v2.test.ts — 24 passed
  • npm run test:coverage — 486 passed
  • npm run typecheck
  • npm run build
  • npm run smoke:node-import
  • git diff --check

Scope

This PR intentionally targets tone/feat/opencode-v2-dual-compat (the head of #107), rather than main, so it is a dependent focused patch rather than a competing V2 implementation. It contains no credentials, auth records, provider responses, or production configuration.

Relates to #132.

@anthonyhaussman
anthonyhaussman merged commit 68104cf into anthonyhaussman:tone/feat/opencode-v2-dual-compat Sep 25, 2026
3 checks passed
@anthonyhaussman

Copy link
Copy Markdown
Owner

Thank you for the contribution! The fix has been incorporated and published to npm under @anthonyhaussman/[email protected] (alpha dist-tag).

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