Fix critical bug: getSessionById missing claude_session_id
Critical bugfix for NOT NULL constraint violation. Problem: - Worker service calls getSessionById(sessionDbId) to fetch session data - Worker then uses dbSession.claude_session_id to create ActiveSession - But getSessionById was NOT selecting claude_session_id from database - Result: claudeSessionId = undefined in worker - Caused: "NOT NULL constraint failed: sdk_sessions.claude_session_id" errors - Impact: Observations and summaries couldn't be stored Root cause: - SessionStore.getSessionById() SQL query missing claude_session_id column - Line 710-713: "SELECT id, sdk_session_id, project, user_prompt" - Should be: "SELECT id, claude_session_id, sdk_session_id, project, user_prompt" Fix: - Added claude_session_id to SELECT query in getSessionById - Updated return type to include claude_session_id: string - Now worker correctly receives claude_session_id from database - Session ID from hook flows properly through entire system Files changed: - src/services/sqlite/SessionStore.ts (getSessionById method) Testing: - Build succeeded - Ready for PM2 restart and live testing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -282,7 +282,7 @@ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let r=Obje
|
||||
FROM observations
|
||||
WHERE sdk_session_id = ?
|
||||
`).all(e),i=new Set,s=new Set;for(let n of t){if(n.files_read)try{let o=JSON.parse(n.files_read);Array.isArray(o)&&o.forEach(p=>i.add(p))}catch{}if(n.files_modified)try{let o=JSON.parse(n.files_modified);Array.isArray(o)&&o.forEach(p=>s.add(p))}catch{}}return{filesRead:Array.from(i),filesModified:Array.from(s)}}getSessionById(e){return this.db.prepare(`
|
||||
SELECT id, sdk_session_id, project, user_prompt
|
||||
SELECT id, claude_session_id, sdk_session_id, project, user_prompt
|
||||
FROM sdk_sessions
|
||||
WHERE id = ?
|
||||
LIMIT 1
|
||||
|
||||
Reference in New Issue
Block a user