Merged
Conversation
Issue #4 — Single-task timeout (40min default): - Add MAX_EXECUTION_SECONDS (2400s) constant in config.py - Add timeout check in PTY select loop and PIPE readline loop - On timeout: SIGTERM → 5s wait → SIGKILL → mark failed (reason: timeout) - Task execution continues to the next task after timeout - Add --timeout CLI flag to override default per-run - Pass timeout through run_cmd.py → executor Issue #5a — argparse import fix: - Add 'import argparse' at top of executor.py Issue #5b — Subprocess cleanup enhancement: - Add _ensure_child_cleaned_up() finally-block safety net in execute_task() Issue #5c — Atomic write audit: - Convert save_run_metadata() and save_run_summary() in runtime.py to use tmp+rename pattern Issue #5d — Signal handler documentation: - Document GIL atomicity guarantee for _ctrl_c_count Issue #5e — PTY/PIPE fallback logging: - Improved warning with exception type and colour-loss note
- 新增 task_runner/notify.py:抽象 Notifier 基类 + WeComNotifier 实现 - 使用 urllib.request 零外部依赖 - markdown_v2 消息格式,4096 字节 UTF-8 自动截断 - 环境变量 TASK_RUNNER_WECOM_WEBHOOK / TASK_RUNNER_NOTIFY_ENABLED 配置 - 预留 ABC 接口支持未来扩展钉钉/飞书 - executor.py 集成通知触发点: - 批次完成时发送汇总统计 - 任务失败时发送失败详情(超时/exit code/执行过快) - Ctrl+C 中断时发送中断进度 - --notify-each 可选每个任务成功也通知 - cli.py 新增 CLI 参数: - --notify / --no-notify 开关 - --notify-each 每任务通知 - --wecom-webhook URL 覆盖环境变量 - 新增 tests/test_notify.py:38 个测试用例含真实 webhook 集成测试 - 顺带修复 executor.py 已有 lint 问题 (B904/E741/E402) Made-with: Cursor
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.
This pull request introduces a per-task execution timeout and adds support for flexible webhook notification controls to the task runner. The timeout ensures that tasks exceeding a specified duration are automatically killed and marked as failed, while the notification enhancements allow users to enable, disable, or customize webhook notifications via CLI flags or configuration. Several internal improvements and refactorings are also included to support these features.
Execution Timeout Feature:
--timeoutCLI flag and corresponding logic to set a maximum execution time per task (default: 2400 seconds/40 minutes). Tasks exceeding this limit are forcefully terminated and marked as failed, with graceful escalation from SIGTERM to SIGKILL. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]Notification System Enhancements:
--notify,--no-notify,--notify-each, and--wecom-webhookto control webhook notification behavior, including per-task notifications and webhook URL overrides. Notification settings are now resolved and passed to the executor. [1] [2] [3] [4] [5]Internal Refactoring and Safety Improvements:
executor.pyfor clarity and maintainability. Improved process cleanup to ensure no zombie processes remain, especially after timeouts or exceptions. [1] [2] [3] [4]Minor Fixes and Cleanups:
certifito development requirements for improved SSL handling.