MAESTRO: Merge PR #932 - prevent duplicate generator spawns in handleSessionInit

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Alex Newman
2026-02-05 23:49:23 -05:00
parent 5d1ee20076
commit 20333e6214
+2 -1
View File
@@ -15,7 +15,8 @@ These PRs all touch `src/cli/handlers/session-init.ts` — review together to av
- [x] Review PR #928 (`Fix: Allow image-only prompts in session-init handler` by @iammike). File: `src/cli/handlers/session-init.ts`. Image-only prompts have no text content, causing the handler to reject them. Steps: (1) `gh pr checkout 928` (2) Review — should check for content blocks (images) not just text (3) Run `npm run build` (4) If clean: `gh pr merge 928 --rebase --delete-branch`
- **CLOSED — FIX APPLIED ON MAIN** (2026-02-05): PR was based on outdated code (pre-#828 refactor) and would have merge conflicts. The concept was valid: image-only prompts had empty text causing session init to be skipped entirely, losing memory tracking. Applied the fix directly on main at `src/cli/handlers/session-init.ts` lines 22-26: empty/undefined prompts now use `[media prompt]` placeholder instead of returning early, so sessions are still created and tracked. Build passes. Credit to @iammike for identifying the issue (#927).
- [ ] Review PR #932 (`fix: prevent duplicate generator spawns in handleSessionInit` by @jayvenn21). File: `src/services/worker/http/routes/SessionRoutes.ts`. Steps: (1) `gh pr checkout 932` (2) Review idempotency guard — should check if generator already exists before spawning (3) Run `npm run build` (4) If clean: `gh pr merge 932 --rebase --delete-branch`
- [x] Review PR #932 (`fix: prevent duplicate generator spawns in handleSessionInit` by @jayvenn21). File: `src/services/worker/http/routes/SessionRoutes.ts`. Steps: (1) `gh pr checkout 932` (2) Review idempotency guard — should check if generator already exists before spawning (3) Run `npm run build` (4) If clean: `gh pr merge 932 --rebase --delete-branch`
- **MERGED** (2026-02-05): Clean 2-line fix replacing `startGeneratorWithProvider(session, ...)` with `ensureGeneratorRunning(sessionDbId, 'init')` on the legacy `handleSessionInit` endpoint (`/sessions/:sessionDbId/init`). This aligns it with `handleObservations` and `handleSummarize` which already use the idempotent helper. The `ensureGeneratorRunning` method checks `session.generatorPromise` before spawning, preventing duplicate generators from rapid-fire or retried init calls. Build passes, no conflicts. Note: the newer `/api/sessions/init` endpoint doesn't start generators (they're started on first observation), so this only affects the legacy path.
## CLAUDE.md Path & Generation Fixes