feat: driver resilience — auto-recovery, PID tracking, and /restart endpoint#617
Open
AL-ZiLLA wants to merge 3 commits intoRightNow-AI:mainfrom
Open
feat: driver resilience — auto-recovery, PID tracking, and /restart endpoint#617AL-ZiLLA wants to merge 3 commits intoRightNow-AI:mainfrom
AL-ZiLLA wants to merge 3 commits intoRightNow-AI:mainfrom
Conversation
Extend the heartbeat monitor to detect and automatically recover crashed agents, reducing operator intervention for 24/7 autonomous deployments: - Add RecoveryTracker: per-agent failure count with configurable cooldown - Heartbeat now monitors both Running and Crashed agents - Crashed agents auto-recover up to max_recovery_attempts (default 3) - After exhausting attempts, agents are marked Terminated - Unresponsive Running agents marked Crashed for next-cycle recovery - Increase default timeout from 60s to 180s (browser/LLM tasks need time) - Add HeartbeatStatus.state field for downstream consumers Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add subprocess lifecycle management to prevent hung CLI processes from blocking agents indefinitely: - Track active subprocess PIDs in a concurrent DashMap for external monitoring - Enforce configurable message timeout (default 300s) with automatic process kill - Return proper LlmError::Api on non-zero exit in streaming mode (was silently ignored) - Add with_timeout(), active_pids(), pid_map() public methods Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…unce
POST /api/agents/{id}/restart and /api/agents/{id}/start both:
- Cancel any active task via stop_agent_run()
- Reset agent state to Running (updates last_active)
- Return JSON with previous state and whether a task was cancelled
Enables operators to recover individual crashed/stuck agents through the
API without restarting the entire daemon.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Adds resilience features for 24/7 autonomous agent deployments where crashed or hung agents need to recover without operator intervention:
LlmError::Apion non-zero exit (previously silently ignored)./restartendpoint:POST /api/agents/{id}/restart(and/startalias) cancels any active task, resets agent state to Running, and returns the previous state. Enables per-agent recovery through the API without bouncing the daemon.Changed files
heartbeat.rskernel.rsclaude_code.rsroutes.rsserver.rsTest plan
cargo build --release— clean, 0 warningscargo test --workspace— 2,131 tests pass, 0 failurescargo clippy -p openfang-{runtime,kernel,api} -- -D warnings— 0 warnings