Skip to content

Conversation

@JacobRWebb
Copy link
Contributor

Summary

  • Fixed session start crash caused by missing plugin_meta table
  • session-start.ts was attempting to INSERT into a table that didn't exist in the schema
  • Added the table to both schema.ts (fresh installs) and as a v6 migration (existing databases)

session-start.ts attempts to INSERT into plugin_meta table during
initialization, but the table was never created in the schema.

Changes:
- Add plugin_meta table to schema.ts for fresh installs
- Add v6 migration in migrate.ts for existing databases
- Add v6 version detection in getCurrentVersion()

Fixes session start crash: "no such table: plugin_meta"
@JacobRWebb JacobRWebb force-pushed the fix/add-plugin-meta-table branch from d4c50a7 to 97883c7 Compare January 18, 2026 17:04
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 18, 2026

Greptile Summary

This PR fixes a critical session start crash by adding the missing plugin_meta table to the database schema. The table was being referenced in session-start.ts:163-171 but wasn't defined in the schema, causing INSERT failures on session initialization.

  • Added plugin_meta table definition to schema.ts for fresh database installations
  • Created v6 migration in migrate.ts to add the table for existing databases
  • Updated version detection logic to properly identify v6 databases
  • Documented the fix in CHANGELOG for v2.1.4 release

The fix follows existing database patterns and properly handles both upgrade paths (fresh install vs migration).

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix correctly addresses a critical bug by adding the missing table to both the base schema and migration path. The implementation is clean, follows existing patterns, and has no edge cases or logical errors.
  • No files require special attention

Important Files Changed

Filename Overview
src/db/schema.ts Added plugin_meta table definition with proper constraints and indexes
src/db/migrate.ts Bumped schema to v6, added migration and version detection for plugin_meta table
CHANGELOG.md Documented v2.1.4 release with database schema fix details

Sequence Diagram

sequenceDiagram
    participant Session as session-start.ts
    participant Migrate as migrate.ts
    participant DB as SQLite Database
    
    Session->>Migrate: runMigrations()
    Migrate->>DB: getCurrentVersion()
    
    alt Fresh Database (v0)
        DB-->>Migrate: version = 0
        Migrate->>DB: Execute SCHEMA_SQL (includes plugin_meta)
        Migrate->>DB: INSERT schema_version = 6
    else Existing Database (v5)
        DB-->>Migrate: version = 5
        Migrate->>DB: Execute migration v6 (CREATE plugin_meta)
        Migrate->>DB: INSERT schema_version = 6
    else Already Updated (v6)
        DB-->>Migrate: version = 6
        Note over Migrate: No migrations needed
    end
    
    Migrate-->>Session: Migration complete
    Session->>DB: INSERT plugin_meta (install_source)
    Session->>DB: INSERT plugin_meta (version)
    DB-->>Session: Success (table now exists)
Loading

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 18, 2026

Greptile's behavior is changing!

From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section.

This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR".

@JacobRWebb JacobRWebb closed this Jan 18, 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