Rtop 73 create runtime manager from python side#8
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. Note 🎁 Summarized by CodeRabbit FreeYour organization has reached its limit of developer seats under the Pro Plan. For new users, CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please add seats to your subscription by visiting https://app.coderabbit.ai/login.If you believe this is a mistake and have available seats, please assign one to the pull request author through the subscription management page using the link above. Comment |
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a RuntimeManager class to control the runtime C core execution from the Python side, simplifying runtime management by eliminating the need to track the plc_main app separately.
- Replaces direct UnixClient and UnixLogServer usage with a unified RuntimeManager
- Adds process monitoring and automatic restart capabilities
- Consolidates runtime control methods (ping, start_plc, stop_plc) into the manager
Reviewed Changes
Copilot reviewed 3 out of 6 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| webserver/runtimemanager.py | New RuntimeManager class with process lifecycle management and monitoring |
| webserver/unixclient.py | Removes PLC control methods (ping, start_plc, stop_plc) now handled by RuntimeManager |
| webserver/app.py | Replaces direct client/server usage with RuntimeManager integration |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
- Fix #2: Guard buffer mutex release after crash with a volatile flag (holding_buffer_mutex) to avoid undefined behavior when unlocking a mutex not owned by the calling thread - Fix #3: Reset plc_crash_signal to 0 at the start of plc_cycle_thread so stale values don't persist after successful recovery - Fix #4: Add plc_force_error_state() function for the watchdog to transition to ERROR state through the mutex instead of writing plc_state directly. Remove extern PLCState from watchdog.c - Fix #5: Skip watchdog heartbeat check when already in ERROR state to prevent repeated error log spam every 2 seconds. Move heartbeat reset to the non-RUNNING branch so it happens once on ERROR entry - Fix #6: Add trailing newline to plc_state_manager.h - Fix #8: Add threading.Lock to protect _crash_times and _safe_mode in RuntimeManager against concurrent access from the monitor and compilation threads - Fix #9: Rename _should_enter_safe_mode to _record_crash_and_check_safe_mode to make the side effect explicit Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This PR adds a RuntimeManager class that controls the runtime C core execution from the Python side. The user only needs to keep track of the main Python application. There is no need to keep track of the plc_main app anymore.