Skip to content

fix(skills): reopen DB after boot-time Turso close - #413

Merged
EyJunge1 merged 1 commit into
tickernelz:mainfrom
EyJunge1:fix/412-skills-stale-turso-handle
Oct 15, 2026
Merged

EyJunge1 merged 1 commit into
tickernelz:mainfrom
EyJunge1:fix/412-skills-stale-turso-handle

Conversation

@EyJunge1

Copy link
Copy Markdown
Collaborator

Summary

  • Detect stale SkillsManager Turso handles when the connection manager reopens skills.db after boot migrators call closeConnection (same pattern as TursoShardManager).
  • Reset skillsManager in closeTursoAndInvalidateCaches() for the dispose path.
  • Add regression tests for full lifecycle close and single-path closeConnection.

Fixes #412

Test plan

  • bun test tests/skills-manager.test.ts tests/turso-connection-lifecycle.test.ts tests/v2-skills-bridge.test.ts
  • bun run typecheck
  • Confirm no more Failed to load skills for OpenCode registration: database connection is not open after plugin boot / restart

Checklist

  • Branch is based on main (do not open PRs from commits already on main)
  • bun test passes (or N/A)
  • bun run typecheck passes (or N/A)
  • bun run check passes (format + lint + typecheck; or N/A)
  • Docs / README updated when behavior or contribution process changes

SkillsManager kept a stale Turso handle when migrators called
closeConnection on skills.db, breaking registerDbSkills. Detect
stale handles via getConnection identity and reset on lifecycle close.

Fixes tickernelz#412
@EyJunge1
EyJunge1 merged commit 832d8f8 into tickernelz:main Oct 15, 2026
7 checks passed
@EyJunge1 EyJunge1 mentioned this pull request Oct 15, 2026
5 of 8 tasks
dmr48rus pushed a commit to dmr48rus/opencode-mem that referenced this pull request Oct 16, 2026
ported from upstream 832d8f8. getDb() now asks the connection manager
whether the cached handle is still the live one and re-initialises when the
boot migrator closed or replaced skills.db; closeTursoAndInvalidateCaches resets
skillsManager alongside the other caches. Adapted by hand: skills-manager.ts
carries our remote/local branches, so the hunk was applied, not cherry-picked.
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.

SkillsManager keeps a stale Turso handle after boot-time closeConnection -> 'The database connection is not open' in registerDbSkills

1 participant