The best way to control Claude Code, Codex and more from any computer or phone
cleanup
Julius Marminge committed
Feb 26, 2026 at 08:47 UTC
6cf03d987c28af7fdc7867d63f791720a0464a27
2 files changed
+9
-11
.plans/16c-pr89-remediation-checklist.md
+2
-11
@@ -333,15 +333,6 @@ Counts: active `51` (`valid=33`, `partially-valid=18`), closed-invalid `6`
333
334
### Phase 6
335
336
-- [ ] `C024` In `executeUnprepared`, preparing outside an effect and not closing the statement can cause uncaught errors and leaks. Suggest wrapping with `Effect.acquireUseRelease`: prepare in acquire (error-safe) and `finalize` in release.
337
- - Status: `TODO`
338
- - Verdict: `partially-valid`
339
- - Severity: `Medium`
340
- - Area: `Other`
341
- - File: `apps/server/src/persistence/NodeSqliteClient.ts:145`
342
- - Threads: PRRT_kwDORLtfbc5whxX9
343
- - Audit note: prepare() still outside managed effect boundary; failure handling risk remains.
344
-
336
- [ ] `C028` Branch sync dispatches both server and stale local update
337
- Status: `TODO`
338
- Verdict: `partially-valid`
@@ -351,8 +342,8 @@ Counts: active `51` (`valid=33`, `partially-valid=18`), closed-invalid `6`
342
- Threads: PRRT_kwDORLtfbc5v-XCu
343
- Audit note: Optimistic local+server dual update is intentional but can temporarily diverge.
344
354
-- [ ] `C037` `Effect.callback` should return a cleanup function to close the server(s) on fiber interruption. Without it, the `Net.Server` handles keep the process alive and leak the port if the effect is cancelled. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
355
- - Status: `TODO`
345
+- [x] `C037` `Effect.callback` should return a cleanup function to close the server(s) on fiber interruption. Without it, the `Net.Server` handles keep the process alive and leak the port if the effect is cancelled. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
346
+ - Status: `DONE`
347
- Verdict: `partially-valid`
348
- Severity: `Low`
349
- Area: `Other`
apps/server/src/config.ts
+7
@@ -66,6 +66,7 @@ export class NetService extends ServiceMap.Service<NetService, NetServiceShape>(
66
static readonly layer = Layer.succeed(NetService, {
67
findAvailablePort: (preferred) =>
68
Effect.callback<number, NetError>((resume) => {
69
+ let fallbackServer: Net.Server | null = null;
70
const server = Net.createServer();
71
server.listen(preferred, () => {
72
server.close(() => resume(Effect.succeed(preferred)));
@@ -88,6 +89,12 @@ export class NetService extends ServiceMap.Service<NetService, NetServiceShape>(
89
Effect.fail(new NetError({ message: "Failed to find an available port", cause })),
90
);
91
});
92
+ fallbackServer = fallback;
93
+ });
94
+
95
+ return Effect.sync(() => {
96
+ server.close();
97
+ fallbackServer?.close();
98
});
99
}),
100
});