fix: resolve Sentry issues — JSONC config, ENOENT guard, Node.js port fallback, transient error filtering#443
Merged
Merged
Conversation
… fallback, transient error filtering - Support JSONC (.lore.json with // comments) and add try-catch to config parser so malformed configs fall through to defaults (GATEWAY-Y) - Silently handle ENOENT in exportLoreFile() when project directory is deleted mid-session, instead of erroring every 30s (GATEWAY-K) - Fix Node.js polyfill server.listen() async behavior: add ready promise so EADDRINUSE is caught by startGateway() and the port fallback chain (3207 → 5673 → random) works correctly under Node.js (GATEWAY-6) - Add Sentry beforeSend filter to drop transient network errors (EPIPE, socket closed, ZlibError, timeout, worker retry exhaustion) that are not actionable bugs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Triages and resolves all 15 unresolved Sentry issues in LOREAI-GATEWAY. Fixes 3 real bugs and filters transient network noise.
Bug Fixes
GATEWAY-Y:
.lore.jsonparse crash (Critical)config.ts:260— bareJSON.parsewith no error handling. Users adding//comments to.lore.json(starting with/) crash the process.Fix: Add inline
stripJsonComments()for JSONC support (handles//,/* */, trailing commas) + wrap in try-catch to fall through to defaults on any parse failure.GATEWAY-K:
.lore.mdENOENT on every idle tick (Medium, 6472 events)agents-file.ts:543—exportLoreFile()callswriteFileSyncwithout handling missing directories. When a project dir is deleted/renamed mid-session, the idle worker fires ENOENT every 30 seconds.Fix: Wrap write+stat in try-catch, silently return on ENOENT. Other FS errors (EACCES, EIO) still propagate.
GATEWAY-6: Node.js EADDRINUSE bypass (Critical, 10 events, regressed)
node-polyfills.ts:88— the Node.jsserve()polyfill callsserver.listen()which is async, but returns synchronously. EADDRINUSE is emitted as an'error'event that nobody catches, completely bypassing the port fallback chain (3207 → 5673 → random).Fix: Add a
readypromise (listening/errorevents) to the polyfill, propagate throughstartServer()return type, andawait server.readyinstartGateway()so the existing catch block handles port conflicts correctly under Node.js. Includes:ready.catch(() => {})) for callers that don't awaitserver.stop()) in the catch block to prevent FD leaks in multi-host configsSentry Noise Filtering
Added
beforeSendtoSentry.init()to drop transient network errors that are expected in a long-running LLM proxy and not actionable:EPIPE/ECONNRESET/ECONNREFUSEDZlibErrorTimeoutError: The operation timed outWorker upstream exhausted N retries(429, 502)Each exception in the chain is tested independently so a real bug wrapping a transient cause isn't accidentally silenced.
Files Changed
packages/core/src/config.tspackages/core/src/agents-file.tspackages/gateway/script/node-polyfills.tsreadypromise onserve()+ unhandled rejection guardpackages/gateway/src/server.tsready?in return typepackages/gateway/src/cli/start.tsawait server.ready+ server cleanup in catchpackages/gateway/script/bundle.tspackages/gateway/instrument.tsbeforeSendtransient error filterSentry Resolution
All 15 unresolved issues resolved: