Skip to content

fix(agents): protect interactive REPL from external termination - #179

Merged
FluffyAIcode merged 1 commit into
mainfrom
AgentMemory/repl-signal-protection-0717
Jul 16, 2026
Merged

fix(agents): protect interactive REPL from external termination#179
FluffyAIcode merged 1 commit into
mainfrom
AgentMemory/repl-signal-protection-0717

Conversation

@FluffyAIcode

Copy link
Copy Markdown
Owner

Summary

  • install a Python SIGTERM handler that logs and ignores external termination
  • add a shell supervisor that traps TERM/HUP and restarts signal-based exits (129/137/143)
  • preserve explicit clean shutdown through /quit, /exit, or EOF
  • document the shutdown contract

Root cause evidence

The Terminal process disappeared with zsh: terminated and no Python traceback, which means an external signal killed the REPL rather than model/gRPC logic returning an error. Memory pressure remained healthy enough and the inference services stayed online.

Tests

  • verifies SIGTERM handler is installed and reports ignored termination
  • verifies supervisor traps TERM/HUP and restarts signal exit codes
  • focused suite — 4 passed
  • full platform-neutral suite — 854 passed, 1 skipped
  • Python compile, shell syntax and diff checks pass

Made with Cursor

Ignore external SIGTERM inside the REPL and supervise signal-based process exits with automatic restart, while reserving clean shutdown for explicit /quit, /exit, or EOF.

Co-authored-by: Cursor <cursoragent@cursor.com>
@cursor

cursor Bot commented Jul 16, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@FluffyAIcode
FluffyAIcode merged commit 1bf0397 into main Jul 16, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant