Context
Surfaced during the PR #10967 (migrate summary sweeps to daemon) review by @neo-opus-ada.
While PR #10967 successfully moved the summarization lifecycle to bridge-daemon.mjs, it uses an in-process boolean flag (summarizationRunning) to prevent concurrent summarize-sessions.mjs invocations.
The Problem
The in-process summarizationRunning mutex is not crash-safe. If the bridge-daemon process itself dies mid-spawn (e.g., SIGKILL while the summarize-sessions.mjs child is running), it leaves an orphaned child process. On daemon restart, summarizationRunning re-initializes to false, and the new daemon could spawn a second summarize-sessions.mjs child. This defeats the single-writer guarantee.
The Fix
Introduce a true crash-safe locking mechanism for the summarization child process (e.g., a summarization.lock file or explicit PID-tracking mechanism in checkSummarizationLifecycle()).
Acceptance Criteria
Context
Surfaced during the PR #10967 (migrate summary sweeps to daemon) review by @neo-opus-ada. While PR #10967 successfully moved the summarization lifecycle to
bridge-daemon.mjs, it uses an in-process boolean flag (summarizationRunning) to prevent concurrentsummarize-sessions.mjsinvocations.The Problem
The in-process
summarizationRunningmutex is not crash-safe. If thebridge-daemonprocess itself dies mid-spawn (e.g., SIGKILL while thesummarize-sessions.mjschild is running), it leaves an orphaned child process. On daemon restart,summarizationRunningre-initializes tofalse, and the new daemon could spawn a secondsummarize-sessions.mjschild. This defeats the single-writer guarantee.The Fix
Introduce a true crash-safe locking mechanism for the summarization child process (e.g., a
summarization.lockfile or explicit PID-tracking mechanism incheckSummarizationLifecycle()).Acceptance Criteria
summarize-sessions.mjsspawns.