You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Agent: don't kill entire process on uncaught exceptions (#3151)
Previously, the agent process would kill itself if the Node.js process
encountered an uncaught exception because this is the default behavior
for Node.js. This was problematic because most uncaught exceptions are
innocent, they're typically non-critical code that runs in some
un-awaited promise where we forget to wrap the code in try/catch.
This PR adds an uncaught error handler that logs the error (and stack
trace) to stderr instead. For clients like JetBrains, we automatically
redirect stderr to `idea.log` making it easy to troubleshoot the
problem.
This change should be a big stability boost since tiny programming
mistakes no longer take down the entire agent process. I am embarrassed
we didn't do this sooner, but better late than never.
## Test plan
* Manually add `setTimeout(() => {throw new Error('boom')}, 100)`
somewhere in the code
* Comment out the uncaught exception handler
* Run `pnpm run test agent/src/index.test.ts`
* Confirm that tests fail
* Uncomment exception handler
* Confirm all tests pass
<!-- Required. See
https://sourcegraph.com/docs/dev/background-information/testing_principles.
-->
0 commit comments