agent-orchestrator/backend
harshitsinghbhandari 7b9a9f5962 fix(backend): drain reaper + cdc poller when startSession fails
If startSession returned an error, run() returned immediately and the
reaper + cdc poller goroutines kept running while defer store.Close()
fired — a data race against the SQLite handle. Mirror the bottom-of-run
shutdown sequence on the error path (cancel ctx, drain reaper, drain
poller) so both goroutines have exited before the store is closed. The
explicit-not-defer ordering is the same the existing
post-srv.Run shutdown block uses; piling on more defers would hit the
LIFO trap the same comment already warns about.

Reported by Greptile on PR #52.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-31 20:25:56 +05:30
..
internal feat(backend): wire Session Manager into the daemon (real tmux + gitworktree, stub Agent) 2026-05-31 20:12:38 +05:30
cdc_wiring.go feat(backend): port lifecycle lane onto the new storage+CDC model 2026-05-31 07:16:06 +05:30
go.mod feat(backend): SQLite storage layer + CDC pipeline, LCM/reaper wiring 2026-05-30 16:02:07 +05:30
go.sum feat(backend): SQLite storage layer + CDC pipeline, LCM/reaper wiring 2026-05-30 16:02:07 +05:30
lifecycle_wiring.go chore(backend): name startSession's ctx param for forward use 2026-05-31 20:15:46 +05:30
main.go fix(backend): drain reaper + cdc poller when startSession fails 2026-05-31 20:25:56 +05:30
sqlc.yaml feat(backend): SQLite storage layer + CDC pipeline, LCM/reaper wiring 2026-05-30 16:02:07 +05:30
wiring_test.go feat(backend): wire Session Manager into the daemon (real tmux + gitworktree, stub Agent) 2026-05-31 20:12:38 +05:30