Skip to content

fix: preserve account state across OAuth pool transitions - #32

Closed
BH4EHN wants to merge 7 commits into
cortexkit:mainfrom
BH4EHN:fix/stale-account-pool-saves
Closed

BH4EHN wants to merge 7 commits into
cortexkit:mainfrom
BH4EHN:fix/stale-account-pool-saves

Conversation

@BH4EHN

@BH4EHN BH4EHN commented Oct 8, 2026 •

Copy link
Copy Markdown

OAuth account-pool transitions could leave stale managers writing snapshots, lose pending changes after persistence failures, or install a manager before validating the persisted account.

This change confirms accepted saves before retiring a manager, captures direct-save snapshots at invocation time, and retains failed intents for guarded recovery. OAuth transitions validate authoritative storage before installing the replacement manager. Eligibility-state save failures now allow requests to continue through another usable account while preserving account restrictions, cancellation, and transition checks.

Validation

  • 2,089 unit tests passed.
  • 10 local OpenCode 2 host tests passed with a mocked upstream.
  • Build, project typecheck, Biome formatting, and lint passed.
  • Independent full-branch review found no actionable issues.
  • Docker-isolated tests were not run locally because Docker is unavailable.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Fixes account-state loss across OAuth pool transitions: stale managers can no longer write snapshots after being retired, pending changes survive persistence failures, and new managers are only installed after the persisted account is validated.

  • Confirms accepted saves before retiring a manager.
  • Captures direct-save snapshots at invocation time and on dispose.
  • Retains failed save intents for guarded recovery after pool fences, with retries scoped to lock-contention failures.
  • Validates authoritative storage before installing the replacement manager.
  • Eligibility-state save failures fall through to another usable account while preserving restrictions and transition checks.
  • Routes OpenCode pool reads and writes through core's lock-held persistence so concurrent saves and ordered writes survive transitions.

Written for commit 98220b4. Summary will update on new commits.

View guided diff

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 5 files

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

View guided diff | Re-trigger cubic

Comment thread packages/opencode-v2/src/plugin.ts Outdated
Comment thread packages/opencode-v2/src/plugin.ts
Comment thread packages/core/src/account-manager.ts

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 4 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread packages/opencode-v2/test/plugin.test.ts Outdated
Comment thread packages/core/src/account-manager.ts Outdated
Comment thread packages/core/src/account-manager.test.ts Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 4 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread packages/opencode-v2/test/plugin.test.ts Outdated
Comment thread packages/core/src/account-manager.test.ts Outdated
@BH4EHN BH4EHN closed this Oct 10, 2026
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.

1 participant