feat: enable StuckDetector for running task auto-recovery#1067
Open
sh1nj1 wants to merge 2 commits into
Open
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Enable StuckDetector by default (was disabled) to auto-recover stuck tasks and prevent resource accumulation. Changes: - Enable stuck_detection in PolicyResolver defaults (enabled: true) - Add approval_timeout_minutes config (default: 60 min) - Detect pending_approval tasks exceeding timeout threshold - Auto-recover: running→failed, pending_approval→cancelled - Release ResourceTracker and dequeue topic on recovery - Add i18n for approval_timeout notifications (en, ko) - Add 3 tests for pending_approval detection and recovery
pending_approval was not the root cause of the resource tracker leak. Keep StuckDetector enabled for running tasks only.
sh1nj1
force-pushed
the
feat/enable-stuck-detector
branch
from
April 15, 2026 07:01
2e18954 to
86e4513
Compare
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.
Problem
StuckDetector was implemented but disabled by default (
enabled: false). This meant stuck tasks inrunningstate were never auto-recovered, requiring manual intervention via Kamal console.Additionally,
pending_approvaltasks had no timeout — they could remain stuck indefinitely.Solution
1. Enable StuckDetector by default
The StuckDetectorJob already runs every 10 minutes in production (configured in
recurring.yml). It just wasn't doing anything because the policy was disabled.2. Add
pending_approvaltimeout detectionNew config:
approval_timeout_minutes(default: 60)pending_approvaltasks older than thresholdcancelled(vsfailedfor running tasks)Changes
policy_resolver.rb: Enable stuck_detection, addapproval_timeout_minutesstuck_detector.rb: Detect + auto-recover pending_approval tasksai_agent.en.yml/ai_agent.ko.yml: Addapproval_timeouti18nstuck_detector_test.rb: 3 new tests (detect, auto-recover, skip recent)Tests