Skip to content

[OPIK-5452] [SDK] feat: warn when runner process exits without blocking#6021

Merged
petrotiurin merged 2 commits intomainfrom
petrotiurin/OPIK-5452-runner-no-blocking-warning
Apr 1, 2026
Merged

[OPIK-5452] [SDK] feat: warn when runner process exits without blocking#6021
petrotiurin merged 2 commits intomainfrom
petrotiurin/OPIK-5452-runner-no-blocking-warning

Conversation

@petrotiurin
Copy link
Copy Markdown
Contributor

Details

When a user's script exits without a blocking call (e.g., no server framework like uvicorn or express), the runner process terminates before it can process any jobs. This change adds detection by tracking whether shutdown was triggered by a signal (SIGTERM/SIGINT). If the process exits cleanly without a signal, a warning is printed advising the user to use a server framework.

Implemented in both Python and TypeScript SDKs with matching unit tests.

Change checklist

  • User facing
  • Documentation update

Issues

  • OPIK-5452

AI-WATERMARK

AI-WATERMARK: yes

  • If yes:
    • Tools: Claude Code
    • Model(s): Claude Opus 4.6
    • Scope: full implementation
    • Human verification: code review + iterative feedback during implementation

Testing

  • Python unit tests: python -m pytest tests/unit/runner/test_activate.py -v (6 tests pass)
  • TypeScript unit tests: npx vitest run tests/unit/runner/activate.test.ts (6 tests pass)
  • Scenarios validated:
    • Signal handler sets _shutdown_by_signal flag on SIGTERM
    • Warning prints to stderr when process exits without signal
    • No warning when shutdown is signal-triggered
    • Full flow: install handlers → signal → no warning
    • Full flow: install handlers → no signal → warning printed

Documentation

N/A

When a user's script exits without a blocking call (e.g., no server framework),
the runner never processes jobs. This adds detection via signal tracking — if the
process exits cleanly (no SIGTERM/SIGINT), a warning is printed advising the user
to use a server framework like uvicorn/Flask (Python) or express/fastify (TypeScript).

Implements OPIK-5452

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot added python Pull requests that update Python code tests Including test files, or tests related like configuration. typescript *.ts *.tsx Python SDK TypeScript SDK labels Apr 1, 2026
- Consolidate test imports to use only module-level import
- Make install_signal_handlers return bool; skip atexit when handlers fail

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@petrotiurin petrotiurin marked this pull request as ready for review April 1, 2026 12:03
@petrotiurin petrotiurin requested a review from a team as a code owner April 1, 2026 12:03
@petrotiurin
Copy link
Copy Markdown
Contributor Author

langchain issues unrelated

@petrotiurin petrotiurin merged commit 074544f into main Apr 1, 2026
146 of 151 checks passed
@petrotiurin petrotiurin deleted the petrotiurin/OPIK-5452-runner-no-blocking-warning branch April 1, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Python SDK python Pull requests that update Python code tests Including test files, or tests related like configuration. TypeScript SDK typescript *.ts *.tsx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants