Skip to content

Fix SystemExit traceback during atexit cleanup on Ctrl+C#55

Merged
teknium1 merged 1 commit intoNousResearch:mainfrom
bierlingm:fix/atexit-signal-handler-race
Feb 27, 2026
Merged

Fix SystemExit traceback during atexit cleanup on Ctrl+C#55
teknium1 merged 1 commit intoNousResearch:mainfrom
bierlingm:fix/atexit-signal-handler-race

Conversation

@bierlingm
Copy link
Copy Markdown

Summary

  • Fixes unhandled SystemExit traceback when pressing Ctrl+C during shutdown
  • The browser_tool signal handler calls sys.exit(130) which can fire during terminal_tool._stop_cleanup_thread()_cleanup_thread.join(), producing a noisy traceback
  • Wraps the join() in a try/except for SystemExit/KeyboardInterrupt to suppress the race

Test plan

  • Press Ctrl+C during an active agent session — should exit cleanly without traceback
  • Verify normal shutdown (no Ctrl+C) still cleans up sandboxes properly

🤖 Generated with Claude Code

The browser_tool signal handler calls sys.exit(130) which raises
SystemExit. When this fires during terminal_tool's atexit cleanup
(specifically during _cleanup_thread.join()), it produces an unhandled
traceback. Wrapping the join in a try/except suppresses the race
without changing shutdown behavior.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@teknium1 teknium1 merged commit 2972f98 into NousResearch:main Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants