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:
@@ -223,7 +223,7 @@ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let s=Obje
|
||||
FROM observations
|
||||
WHERE sdk_session_id = ?
|
||||
`).all(e),r=new Set,o=new Set;for(let i of t){if(i.files_read)try{let a=JSON.parse(i.files_read);Array.isArray(a)&&a.forEach(d=>r.add(d))}catch{}if(i.files_modified)try{let a=JSON.parse(i.files_modified);Array.isArray(a)&&a.forEach(d=>o.add(d))}catch{}}return{filesRead:Array.from(r),filesModified:Array.from(o)}}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