feat: Workspace filesystem cleanup #391
1 issue
code-review: Found 1 issue (1 medium)
Medium
Startup registry lock leaks if setup throws before server.listen - `src/daemon.ts:186-197`
The startup registry lock is acquired at line 186 but is only released inside the server.listen callback (line 433) or via server.on('error') (line 412). If any code between acquisition and server.listen—such as buildDaemonToolCatalogFromManifest (line 270), setSentryRuntimeContext, recordDaemonGaugeMetric, or startDaemonServer—throws, control falls through to the top-level main().catch which exits without releasing the lock. Depending on the lock implementation, this can leave a stale lock that blocks subsequent daemon startups for the workspace.
Duration: 13m 59s · Tokens: 942.1k in / 8.7k out · Cost: $2.74
Annotations
Check warning on line 197 in src/daemon.ts
sentry-warden / warden: code-review
Startup registry lock leaks if setup throws before server.listen
The startup registry lock is acquired at line 186 but is only released inside the `server.listen` callback (line 433) or via `server.on('error')` (line 412). If any code between acquisition and `server.listen`—such as `buildDaemonToolCatalogFromManifest` (line 270), `setSentryRuntimeContext`, `recordDaemonGaugeMetric`, or `startDaemonServer`—throws, control falls through to the top-level `main().catch` which exits without releasing the lock. Depending on the lock implementation, this can leave a stale lock that blocks subsequent daemon startups for the workspace.