Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 047914d087 | |||
| bdf79a439b | |||
| 99b6b85d67 |
@@ -10,7 +10,7 @@
|
|||||||
"plugins": [
|
"plugins": [
|
||||||
{
|
{
|
||||||
"name": "claude-mem",
|
"name": "claude-mem",
|
||||||
"version": "6.0.6",
|
"version": "6.0.7",
|
||||||
"source": "./plugin",
|
"source": "./plugin",
|
||||||
"description": "Persistent memory system for Claude Code - context compression across sessions"
|
"description": "Persistent memory system for Claude Code - context compression across sessions"
|
||||||
}
|
}
|
||||||
|
|||||||
+43
-15
@@ -4,21 +4,49 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
## [6.0.5] - 2025-11-16
|
## [6.0.6] - 2025-11-17
|
||||||
|
|
||||||
### Added
|
## Critical Bugfix Release
|
||||||
- Automatic cleanup of orphaned MCP server processes on worker startup
|
|
||||||
- Self-healing maintenance runs on every worker restart
|
|
||||||
|
|
||||||
### Improved
|
|
||||||
- Removed manual cleanup notice from session context
|
|
||||||
- Streamlined worker initialization process
|
|
||||||
- Prevents orphaned process accumulation and resource leaks
|
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
- **Database Migration**: Fixed critical bug where `discovery_tokens` migration logic trusted `schema_versions` table without verifying actual column existence (#121)
|
||||||
|
- Migration now always checks if columns exist before queries, preventing "no such column" errors
|
||||||
|
- Safe for all users - auto-migrates on next Claude Code session without data loss
|
||||||
|
|
||||||
|
### Technical Details
|
||||||
|
- Removed early return based on `schema_versions` check that could skip actual column verification
|
||||||
|
- Migration now uses `PRAGMA table_info()` to verify column existence before every query
|
||||||
|
- Ensures idempotent, safe schema migrations for SQLite databases
|
||||||
|
|
||||||
|
### Impact
|
||||||
|
- Users experiencing "SqliteError: no such column: discovery_tokens" will be automatically fixed
|
||||||
|
- No manual intervention or database backup required
|
||||||
|
- Update to v6.0.6 via marketplace or `git pull` and restart Claude Code
|
||||||
|
|
||||||
|
**Affected Users**: All users who upgraded to v6.0.5 and experienced the migration error
|
||||||
|
|
||||||
|
## [6.0.5] - 2025-11-17
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
### Automatic MCP Server Cleanup
|
||||||
|
- Automatic cleanup of orphaned MCP server processes on worker startup
|
||||||
|
- Self-healing maintenance runs on every worker restart
|
||||||
|
- Prevents orphaned process accumulation and resource leaks
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
- Removed manual cleanup notice from session context
|
||||||
|
- Streamlined worker initialization process
|
||||||
|
|
||||||
|
## What's Fixed
|
||||||
- Memory leaks from orphaned uvx/python processes are now prevented automatically
|
- Memory leaks from orphaned uvx/python processes are now prevented automatically
|
||||||
- Workers self-heal on every restart without manual intervention
|
- Workers self-heal on every restart without manual intervention
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Release Date**: November 16, 2025
|
||||||
|
**Plugin Version**: 6.0.5
|
||||||
|
|
||||||
## [6.0.4] - 2025-11-17
|
## [6.0.4] - 2025-11-17
|
||||||
|
|
||||||
**Patch Release**
|
**Patch Release**
|
||||||
@@ -1117,12 +1145,12 @@ None (patch version)
|
|||||||
|
|
||||||
## [4.3.0] - 2025-10-25
|
## [4.3.0] - 2025-10-25
|
||||||
|
|
||||||
## What's Changed
|
## What's Changed
|
||||||
* feat: Enhanced context hook with session observations and cross-platform improvements by @thedotmack in https://github.com/thedotmack/claude-mem/pull/25
|
* feat: Enhanced context hook with session observations and cross-platform improvements by @thedotmack in https://github.com/thedotmack/claude-mem/pull/25
|
||||||
|
|
||||||
## New Contributors
|
## New Contributors
|
||||||
* @thedotmack made their first contribution in https://github.com/thedotmack/claude-mem/pull/25
|
* @thedotmack made their first contribution in https://github.com/thedotmack/claude-mem/pull/25
|
||||||
|
|
||||||
**Full Changelog**: https://github.com/thedotmack/claude-mem/compare/v4.2.11...v4.3.0
|
**Full Changelog**: https://github.com/thedotmack/claude-mem/compare/v4.2.11...v4.3.0
|
||||||
|
|
||||||
## [4.2.10] - 2025-10-25
|
## [4.2.10] - 2025-10-25
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ Claude-mem is a Claude Code plugin providing persistent memory across sessions.
|
|||||||
|
|
||||||
**Your Role**: You are working on the plugin itself. When users interact with Claude Code with this plugin installed, your observations get captured and become their persistent memory.
|
**Your Role**: You are working on the plugin itself. When users interact with Claude Code with this plugin installed, your observations get captured and become their persistent memory.
|
||||||
|
|
||||||
**Current Version**: 6.0.6
|
**Current Version**: 6.0.7
|
||||||
|
|
||||||
## IMPORTANT: Skills Are Auto-Invoked
|
## IMPORTANT: Skills Are Auto-Invoked
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "claude-mem",
|
"name": "claude-mem",
|
||||||
"version": "6.0.6",
|
"version": "6.0.7",
|
||||||
"description": "Memory compression system for Claude Code - persist context across sessions",
|
"description": "Memory compression system for Claude Code - persist context across sessions",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"claude",
|
"claude",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "claude-mem",
|
"name": "claude-mem",
|
||||||
"version": "6.0.6",
|
"version": "6.0.7",
|
||||||
"description": "Persistent memory system for Claude Code - seamlessly preserve context across sessions",
|
"description": "Persistent memory system for Claude Code - seamlessly preserve context across sessions",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Alex Newman"
|
"name": "Alex Newman"
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let s=Obje
|
|||||||
INSERT INTO user_prompts_fts(rowid, prompt_text)
|
INSERT INTO user_prompts_fts(rowid, prompt_text)
|
||||||
VALUES (new.id, new.prompt_text);
|
VALUES (new.id, new.prompt_text);
|
||||||
END;
|
END;
|
||||||
`),this.db.exec("COMMIT"),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(10,new Date().toISOString()),console.error("[SessionStore] Successfully created user_prompts table with FTS5 support")}catch(t){throw this.db.exec("ROLLBACK"),t}}catch(e){console.error("[SessionStore] Migration error (create user_prompts table):",e.message)}}ensureDiscoveryTokensColumn(){try{if(this.db.prepare("SELECT version FROM schema_versions WHERE version = ?").get(7))return;this.db.pragma("table_info(observations)").some(o=>o.name==="discovery_tokens")||(this.db.exec("ALTER TABLE observations ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to observations table")),this.db.pragma("table_info(session_summaries)").some(o=>o.name==="discovery_tokens")||(this.db.exec("ALTER TABLE session_summaries ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to session_summaries table")),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(7,new Date().toISOString())}catch(e){console.error("[SessionStore] Discovery tokens migration error:",e.message)}}getRecentSummaries(e,s=10){return this.db.prepare(`
|
`),this.db.exec("COMMIT"),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(10,new Date().toISOString()),console.error("[SessionStore] Successfully created user_prompts table with FTS5 support")}catch(t){throw this.db.exec("ROLLBACK"),t}}catch(e){console.error("[SessionStore] Migration error (create user_prompts table):",e.message)}}ensureDiscoveryTokensColumn(){try{if(this.db.prepare("SELECT version FROM schema_versions WHERE version = ?").get(11))return;this.db.pragma("table_info(observations)").some(o=>o.name==="discovery_tokens")||(this.db.exec("ALTER TABLE observations ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to observations table")),this.db.pragma("table_info(session_summaries)").some(o=>o.name==="discovery_tokens")||(this.db.exec("ALTER TABLE session_summaries ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to session_summaries table")),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(11,new Date().toISOString())}catch(e){throw console.error("[SessionStore] Discovery tokens migration error:",e.message),e}}getRecentSummaries(e,s=10){return this.db.prepare(`
|
||||||
SELECT
|
SELECT
|
||||||
request, investigated, learned, completed, next_steps,
|
request, investigated, learned, completed, next_steps,
|
||||||
files_read, files_edited, notes, prompt_number, created_at
|
files_read, files_edited, notes, prompt_number, created_at
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let s=Obje
|
|||||||
INSERT INTO user_prompts_fts(rowid, prompt_text)
|
INSERT INTO user_prompts_fts(rowid, prompt_text)
|
||||||
VALUES (new.id, new.prompt_text);
|
VALUES (new.id, new.prompt_text);
|
||||||
END;
|
END;
|
||||||
`),this.db.exec("COMMIT"),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(10,new Date().toISOString()),console.error("[SessionStore] Successfully created user_prompts table with FTS5 support")}catch(t){throw this.db.exec("ROLLBACK"),t}}catch(e){console.error("[SessionStore] Migration error (create user_prompts table):",e.message)}}ensureDiscoveryTokensColumn(){try{if(this.db.prepare("SELECT version FROM schema_versions WHERE version = ?").get(7))return;this.db.pragma("table_info(observations)").some(a=>a.name==="discovery_tokens")||(this.db.exec("ALTER TABLE observations ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to observations table")),this.db.pragma("table_info(session_summaries)").some(a=>a.name==="discovery_tokens")||(this.db.exec("ALTER TABLE session_summaries ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to session_summaries table")),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(7,new Date().toISOString())}catch(e){console.error("[SessionStore] Discovery tokens migration error:",e.message)}}getRecentSummaries(e,s=10){return this.db.prepare(`
|
`),this.db.exec("COMMIT"),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(10,new Date().toISOString()),console.error("[SessionStore] Successfully created user_prompts table with FTS5 support")}catch(t){throw this.db.exec("ROLLBACK"),t}}catch(e){console.error("[SessionStore] Migration error (create user_prompts table):",e.message)}}ensureDiscoveryTokensColumn(){try{if(this.db.prepare("SELECT version FROM schema_versions WHERE version = ?").get(11))return;this.db.pragma("table_info(observations)").some(a=>a.name==="discovery_tokens")||(this.db.exec("ALTER TABLE observations ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to observations table")),this.db.pragma("table_info(session_summaries)").some(a=>a.name==="discovery_tokens")||(this.db.exec("ALTER TABLE session_summaries ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to session_summaries table")),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(11,new Date().toISOString())}catch(e){throw console.error("[SessionStore] Discovery tokens migration error:",e.message),e}}getRecentSummaries(e,s=10){return this.db.prepare(`
|
||||||
SELECT
|
SELECT
|
||||||
request, investigated, learned, completed, next_steps,
|
request, investigated, learned, completed, next_steps,
|
||||||
files_read, files_edited, notes, prompt_number, created_at
|
files_read, files_edited, notes, prompt_number, created_at
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let s=Obje
|
|||||||
INSERT INTO user_prompts_fts(rowid, prompt_text)
|
INSERT INTO user_prompts_fts(rowid, prompt_text)
|
||||||
VALUES (new.id, new.prompt_text);
|
VALUES (new.id, new.prompt_text);
|
||||||
END;
|
END;
|
||||||
`),this.db.exec("COMMIT"),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(10,new Date().toISOString()),console.error("[SessionStore] Successfully created user_prompts table with FTS5 support")}catch(t){throw this.db.exec("ROLLBACK"),t}}catch(e){console.error("[SessionStore] Migration error (create user_prompts table):",e.message)}}ensureDiscoveryTokensColumn(){try{if(this.db.prepare("SELECT version FROM schema_versions WHERE version = ?").get(7))return;this.db.pragma("table_info(observations)").some(o=>o.name==="discovery_tokens")||(this.db.exec("ALTER TABLE observations ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to observations table")),this.db.pragma("table_info(session_summaries)").some(o=>o.name==="discovery_tokens")||(this.db.exec("ALTER TABLE session_summaries ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to session_summaries table")),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(7,new Date().toISOString())}catch(e){console.error("[SessionStore] Discovery tokens migration error:",e.message)}}getRecentSummaries(e,s=10){return this.db.prepare(`
|
`),this.db.exec("COMMIT"),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(10,new Date().toISOString()),console.error("[SessionStore] Successfully created user_prompts table with FTS5 support")}catch(t){throw this.db.exec("ROLLBACK"),t}}catch(e){console.error("[SessionStore] Migration error (create user_prompts table):",e.message)}}ensureDiscoveryTokensColumn(){try{if(this.db.prepare("SELECT version FROM schema_versions WHERE version = ?").get(11))return;this.db.pragma("table_info(observations)").some(o=>o.name==="discovery_tokens")||(this.db.exec("ALTER TABLE observations ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to observations table")),this.db.pragma("table_info(session_summaries)").some(o=>o.name==="discovery_tokens")||(this.db.exec("ALTER TABLE session_summaries ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to session_summaries table")),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(11,new Date().toISOString())}catch(e){throw console.error("[SessionStore] Discovery tokens migration error:",e.message),e}}getRecentSummaries(e,s=10){return this.db.prepare(`
|
||||||
SELECT
|
SELECT
|
||||||
request, investigated, learned, completed, next_steps,
|
request, investigated, learned, completed, next_steps,
|
||||||
files_read, files_edited, notes, prompt_number, created_at
|
files_read, files_edited, notes, prompt_number, created_at
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let s=Obje
|
|||||||
INSERT INTO user_prompts_fts(rowid, prompt_text)
|
INSERT INTO user_prompts_fts(rowid, prompt_text)
|
||||||
VALUES (new.id, new.prompt_text);
|
VALUES (new.id, new.prompt_text);
|
||||||
END;
|
END;
|
||||||
`),this.db.exec("COMMIT"),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(10,new Date().toISOString()),console.error("[SessionStore] Successfully created user_prompts table with FTS5 support")}catch(t){throw this.db.exec("ROLLBACK"),t}}catch(e){console.error("[SessionStore] Migration error (create user_prompts table):",e.message)}}ensureDiscoveryTokensColumn(){try{if(this.db.prepare("SELECT version FROM schema_versions WHERE version = ?").get(7))return;this.db.pragma("table_info(observations)").some(i=>i.name==="discovery_tokens")||(this.db.exec("ALTER TABLE observations ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to observations table")),this.db.pragma("table_info(session_summaries)").some(i=>i.name==="discovery_tokens")||(this.db.exec("ALTER TABLE session_summaries ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to session_summaries table")),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(7,new Date().toISOString())}catch(e){console.error("[SessionStore] Discovery tokens migration error:",e.message)}}getRecentSummaries(e,s=10){return this.db.prepare(`
|
`),this.db.exec("COMMIT"),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(10,new Date().toISOString()),console.error("[SessionStore] Successfully created user_prompts table with FTS5 support")}catch(t){throw this.db.exec("ROLLBACK"),t}}catch(e){console.error("[SessionStore] Migration error (create user_prompts table):",e.message)}}ensureDiscoveryTokensColumn(){try{if(this.db.prepare("SELECT version FROM schema_versions WHERE version = ?").get(11))return;this.db.pragma("table_info(observations)").some(i=>i.name==="discovery_tokens")||(this.db.exec("ALTER TABLE observations ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to observations table")),this.db.pragma("table_info(session_summaries)").some(i=>i.name==="discovery_tokens")||(this.db.exec("ALTER TABLE session_summaries ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to session_summaries table")),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(11,new Date().toISOString())}catch(e){throw console.error("[SessionStore] Discovery tokens migration error:",e.message),e}}getRecentSummaries(e,s=10){return this.db.prepare(`
|
||||||
SELECT
|
SELECT
|
||||||
request, investigated, learned, completed, next_steps,
|
request, investigated, learned, completed, next_steps,
|
||||||
files_read, files_edited, notes, prompt_number, created_at
|
files_read, files_edited, notes, prompt_number, created_at
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let s=Obje
|
|||||||
INSERT INTO user_prompts_fts(rowid, prompt_text)
|
INSERT INTO user_prompts_fts(rowid, prompt_text)
|
||||||
VALUES (new.id, new.prompt_text);
|
VALUES (new.id, new.prompt_text);
|
||||||
END;
|
END;
|
||||||
`),this.db.exec("COMMIT"),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(10,new Date().toISOString()),console.error("[SessionStore] Successfully created user_prompts table with FTS5 support")}catch(t){throw this.db.exec("ROLLBACK"),t}}catch(e){console.error("[SessionStore] Migration error (create user_prompts table):",e.message)}}ensureDiscoveryTokensColumn(){try{if(this.db.prepare("SELECT version FROM schema_versions WHERE version = ?").get(7))return;this.db.pragma("table_info(observations)").some(i=>i.name==="discovery_tokens")||(this.db.exec("ALTER TABLE observations ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to observations table")),this.db.pragma("table_info(session_summaries)").some(i=>i.name==="discovery_tokens")||(this.db.exec("ALTER TABLE session_summaries ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to session_summaries table")),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(7,new Date().toISOString())}catch(e){console.error("[SessionStore] Discovery tokens migration error:",e.message)}}getRecentSummaries(e,s=10){return this.db.prepare(`
|
`),this.db.exec("COMMIT"),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(10,new Date().toISOString()),console.error("[SessionStore] Successfully created user_prompts table with FTS5 support")}catch(t){throw this.db.exec("ROLLBACK"),t}}catch(e){console.error("[SessionStore] Migration error (create user_prompts table):",e.message)}}ensureDiscoveryTokensColumn(){try{if(this.db.prepare("SELECT version FROM schema_versions WHERE version = ?").get(11))return;this.db.pragma("table_info(observations)").some(i=>i.name==="discovery_tokens")||(this.db.exec("ALTER TABLE observations ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to observations table")),this.db.pragma("table_info(session_summaries)").some(i=>i.name==="discovery_tokens")||(this.db.exec("ALTER TABLE session_summaries ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to session_summaries table")),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(11,new Date().toISOString())}catch(e){throw console.error("[SessionStore] Discovery tokens migration error:",e.message),e}}getRecentSummaries(e,s=10){return this.db.prepare(`
|
||||||
SELECT
|
SELECT
|
||||||
request, investigated, learned, completed, next_steps,
|
request, investigated, learned, completed, next_steps,
|
||||||
files_read, files_edited, notes, prompt_number, created_at
|
files_read, files_edited, notes, prompt_number, created_at
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let a=Obje
|
|||||||
INSERT INTO user_prompts_fts(rowid, prompt_text)
|
INSERT INTO user_prompts_fts(rowid, prompt_text)
|
||||||
VALUES (new.id, new.prompt_text);
|
VALUES (new.id, new.prompt_text);
|
||||||
END;
|
END;
|
||||||
`),this.db.exec("COMMIT"),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(10,new Date().toISOString()),console.error("[SessionStore] Successfully created user_prompts table with FTS5 support")}catch(t){throw this.db.exec("ROLLBACK"),t}}catch(e){console.error("[SessionStore] Migration error (create user_prompts table):",e.message)}}ensureDiscoveryTokensColumn(){try{if(this.db.prepare("SELECT version FROM schema_versions WHERE version = ?").get(7))return;this.db.pragma("table_info(observations)").some(n=>n.name==="discovery_tokens")||(this.db.exec("ALTER TABLE observations ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to observations table")),this.db.pragma("table_info(session_summaries)").some(n=>n.name==="discovery_tokens")||(this.db.exec("ALTER TABLE session_summaries ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to session_summaries table")),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(7,new Date().toISOString())}catch(e){console.error("[SessionStore] Discovery tokens migration error:",e.message)}}getRecentSummaries(e,a=10){return this.db.prepare(`
|
`),this.db.exec("COMMIT"),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(10,new Date().toISOString()),console.error("[SessionStore] Successfully created user_prompts table with FTS5 support")}catch(t){throw this.db.exec("ROLLBACK"),t}}catch(e){console.error("[SessionStore] Migration error (create user_prompts table):",e.message)}}ensureDiscoveryTokensColumn(){try{if(this.db.prepare("SELECT version FROM schema_versions WHERE version = ?").get(11))return;this.db.pragma("table_info(observations)").some(n=>n.name==="discovery_tokens")||(this.db.exec("ALTER TABLE observations ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to observations table")),this.db.pragma("table_info(session_summaries)").some(n=>n.name==="discovery_tokens")||(this.db.exec("ALTER TABLE session_summaries ADD COLUMN discovery_tokens INTEGER DEFAULT 0"),console.error("[SessionStore] Added discovery_tokens column to session_summaries table")),this.db.prepare("INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)").run(11,new Date().toISOString())}catch(e){throw console.error("[SessionStore] Discovery tokens migration error:",e.message),e}}getRecentSummaries(e,a=10){return this.db.prepare(`
|
||||||
SELECT
|
SELECT
|
||||||
request, investigated, learned, completed, next_steps,
|
request, investigated, learned, completed, next_steps,
|
||||||
files_read, files_edited, notes, prompt_number, created_at
|
files_read, files_edited, notes, prompt_number, created_at
|
||||||
|
|||||||
@@ -494,12 +494,16 @@ export class SessionStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensure discovery_tokens column exists (migration 7)
|
* Ensure discovery_tokens column exists (migration 11)
|
||||||
* CRITICAL: Always verify column existence, don't trust schema_versions alone
|
* CRITICAL: This migration was incorrectly using version 7 (which was already taken by removeSessionSummariesUniqueConstraint)
|
||||||
* This prevents "no such column" errors when migrations were recorded but failed
|
* The duplicate version number may have caused migration tracking issues in some databases
|
||||||
*/
|
*/
|
||||||
private ensureDiscoveryTokensColumn(): void {
|
private ensureDiscoveryTokensColumn(): void {
|
||||||
try {
|
try {
|
||||||
|
// Check if migration already applied to avoid unnecessary re-runs
|
||||||
|
const applied = this.db.prepare('SELECT version FROM schema_versions WHERE version = ?').get(11) as {version: number} | undefined;
|
||||||
|
if (applied) return;
|
||||||
|
|
||||||
// Check if discovery_tokens column exists in observations table
|
// Check if discovery_tokens column exists in observations table
|
||||||
const observationsInfo = this.db.pragma('table_info(observations)');
|
const observationsInfo = this.db.pragma('table_info(observations)');
|
||||||
const obsHasDiscoveryTokens = (observationsInfo as any[]).some((col: any) => col.name === 'discovery_tokens');
|
const obsHasDiscoveryTokens = (observationsInfo as any[]).some((col: any) => col.name === 'discovery_tokens');
|
||||||
@@ -519,7 +523,7 @@ export class SessionStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Record migration only after successful column verification/addition
|
// Record migration only after successful column verification/addition
|
||||||
this.db.prepare('INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)').run(7, new Date().toISOString());
|
this.db.prepare('INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)').run(11, new Date().toISOString());
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error('[SessionStore] Discovery tokens migration error:', error.message);
|
console.error('[SessionStore] Discovery tokens migration error:', error.message);
|
||||||
throw error; // Re-throw to prevent silent failures
|
throw error; // Re-throw to prevent silent failures
|
||||||
|
|||||||
Reference in New Issue
Block a user