Fix critical session persistence bug in new-hook (#224)

* Fix critical session persistence bug in new-hook

Restores the second POST call to /sessions/:sessionDbId/init that was
incorrectly removed as "duplicate" in the hooks refactor.

The two POST calls serve different purposes:
- POST /api/sessions/init: Creates DB session, saves prompt (no SDK agent)
- POST /sessions/:sessionDbId/init: Starts the SDK agent session

Without the second call, the SDK agent never started, causing:
- First prompts saved to DB but never processed
- Subsequent prompts queued but no agent running to consume them
- Each new prompt creating orphaned sessions instead of continuing

This fix restores proper session continuation across multiple prompts.

Fixes conversation fragmentation reported in production.

* updated agent-sdk

* Skip meta-observations for session-memory file operations

Added a check to skip meta-observations when file operations (Edit, Write, Read, NotebookEdit) are performed on session-memory files. If the file path includes 'session-memory', a debug log is generated and the response indicates that the observation was skipped.
This commit is contained in:
Alex Newman
2025-12-10 14:24:19 -05:00
committed by GitHub
parent 41fbb87aa0
commit 8bdec6abc0
6 changed files with 218 additions and 91 deletions
+1 -1
View File
@@ -47,7 +47,7 @@
"usage:today": "node scripts/analyze-usage.js $(date +%Y-%m-%d)"
},
"dependencies": {
"@anthropic-ai/claude-agent-sdk": "^0.1.27",
"@anthropic-ai/claude-agent-sdk": "^0.1.62",
"@modelcontextprotocol/sdk": "^1.20.1",
"ansi-to-html": "^0.7.2",
"better-sqlite3": "^12.5.0",