Expand description
Split out of the single-file bootstrap module unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md §4.3).
Functions§
- emit_
estart - Step 6: Emit AGENTMUXSRV-ESTART on stderr (exact format from cmd/server/main-server.go:617) pending_migrations reflects any migrations that failed during the in-process run above. Non-zero causes the status-bar to show a “Migration failed — restart to retry” message. Zero is the expected steady-state.
- install_
shutdown_ handlers - Steps 8 & 9: spawn the stdin-watch thread (exit on EOF — matching Go’s stdinReadWatch) and the SIGINT/SIGTERM handler. Both cancel the returned token, which the WAL checkpoint loop and the final server select! also watch for graceful shutdown.
- spawn_
wal_ checkpoint_ loop - Periodic WAL checkpoint — prevents unbounded WAL file growth during long-running sessions. Runs every 30 minutes while the srv is up. busy_timeout=5000 (set at DB open) handles transient reader contention; partial truncate on contention is safe — the remainder is picked up on the next pass. (SPEC_WINDOWS_LIFECYCLE_ROBUSTNESS_2026_06_26 §4.E)