← Back to task

Commit 9663f402

commit 9663f40229c4a131506eb4cd71f11f375b9d7428
Author: Coder Agent <coder@agents.omni>
Date:   Wed Feb 11 22:42:35 2026

    Omni/Ide: release claimed statuses on all pre-run failures
    
    - add release_claim_if_needed helper for review/integrator claims
    - release claims on dry-run, dirty-workspace, prep-failure, run-failure
    - ensure retry-circuit skip paths also release claimed statuses
    - prevent tasks from getting stuck in review-in-progress/integrating
    
    Task-Id: t-598

diff --git a/Omni/Ide/dev-review-release.sh b/Omni/Ide/dev-review-release.sh
index 9b76a426..0ac8497d 100755
--- a/Omni/Ide/dev-review-release.sh
+++ b/Omni/Ide/dev-review-release.sh
@@ -498,6 +498,28 @@ record_retry_attempt() {
   task comment "$tid" "$comment_msg" --json >/dev/null || true
 }
 
+release_claim_if_needed() {
+  local tid="$1"
+  local role="$2"
+  local reason="$3"
+
+  if [[ "$role" == "review" && "$(current_task_status "$tid")" == "ReviewInProgress" ]]; then
+    task update "$tid" review --json >/dev/null || true
+    if [[ -n "$reason" ]]; then
+      task comment "$tid" "Automation ($role) released claim after $reason; status restored to review." --json >/dev/null || true
+    fi
+    return 0
+  fi
+
+  if [[ "$role" == "integrator" && "$(current_task_status "$tid")" == "Integrating" ]]; then
+    task update "$tid" approved --json >/dev/null || true
+    if [[ -n "$reason" ]]; then
+      task comment "$tid" "Automation ($role) released claim after $reason; status restored to approved." --json >/dev/null || true
+    fi
+    return 0
+  fi
+}
+
 prepare_workspace_for_task() {
   local role="$1"
   local workspace="$2"
@@ -630,6 +652,7 @@ run_single_task() {
     if ! retry_exceeded_comment_exists "$tid" "$role" "$patchset_count"; then
       task comment "$tid" "Automation ($role) patchset $patchset_count exceeded max retries, needs human attention." --json >/dev/null || true
     fi
+    release_claim_if_needed "$tid" "$role" "retry circuit open"
     if [[ -n "$task_filter" && "$task_filter" == "$tid" ]]; then
       return 3
     fi
@@ -651,6 +674,7 @@ run_single_task() {
 
   if [[ "$dry_run" == "true" ]]; then
     log "DRY RUN: would execute agentd run for $run_name in $workspace"
+    release_claim_if_needed "$tid" "$role" "dry-run"
     return 0
   fi
 
@@ -665,26 +689,21 @@ run_single_task() {
         log "Recovered dirty workspace by auto-stashing ($workspace)"
       else
         log "Auto-stash recovery failed for dirty workspace ($workspace)"
+        release_claim_if_needed "$tid" "$role" "dirty-workspace recovery failure"
         return 1
       fi
     else
       if [[ "$role" == "dev" && "$has_tracked_changes" == "true" ]]; then
         log "Workspace has tracked changes for $tid; continuing to allow recovery"
       else
+        release_claim_if_needed "$tid" "$role" "dirty workspace"
         return 1
       fi
     fi
   fi
 
   if ! prepare_workspace_for_task "$role" "$workspace" "$tid" "$base_branch"; then
-    # Release role claims when workspace preparation fails.
-    if [[ "$role" == "review" && "$(current_task_status "$tid")" == "ReviewInProgress" ]]; then
-      task update "$tid" review --json >/dev/null || true
-    fi
-    if [[ "$role" == "integrator" && "$(current_task_status "$tid")" == "Integrating" ]]; then
-      task update "$tid" approved --json >/dev/null || true
-      task comment "$tid" "Automation ($role) could not prepare integration workspace for base branch '$base_branch'; status restored to approved." --json >/dev/null || true
-    fi
+    release_claim_if_needed "$tid" "$role" "workspace preparation failure for base '$base_branch'"
     return 1
   fi
 
@@ -733,13 +752,7 @@ run_single_task() {
     log "Run failed for $tid (run=$run_name)"
     record_retry_attempt "$tid" "$role" "$patchset_count" "$run_name" "$max_retries" "true"
 
-    # Release role claims on failure so work can be retried.
-    if [[ "$role" == "review" && "$(current_task_status "$tid")" == "ReviewInProgress" ]]; then
-      task update "$tid" review --json >/dev/null || true
-    fi
-    if [[ "$role" == "integrator" && "$(current_task_status "$tid")" == "Integrating" ]]; then
-      task update "$tid" approved --json >/dev/null || true
-    fi
+    release_claim_if_needed "$tid" "$role" "run failure"
 
     return $rc
   fi