close() called flush() but never awaited it. Since flush() does async appendFile, the process could exit before the final batch wrote to disk — silently losing the tail of the session log.
close()now returnsPromise<void>and awaitsflush()- Added
closeSync()usingwriteFileSyncfor signal handler paths (SIGTERM/SIGINT) where async isn't possible - Updated all callers in
proxy.tsto awaitclose()or usecloseSync()as appropriate
The hallucination heuristic used single scalar variables (lastResponseWasError, lastErrorMethod, lastErrorToolName). If the client sent requests A and B concurrently, interleaved responses would corrupt the state — the next client request could falsely trigger a hallucination hint.
- Replaced scalar state with an ordered list of recent server responses (
recentResponses[]) - When a client request arrives, checks only the most recent server response for the error-then-different-tool pattern
- Correctly handles interleaved responses without false positives
createSessionLogger used execSync('df ...') to check available disk space. On slow disks or network mounts this could add visible latency to proxy startup.
- Replaced
execSync+ shelldfcommand withfs.statfs()(async, native Node.js API) - Cross-platform: works on Windows unlike the previous
df-based approach - No shell spawning overhead