Compare completed resume steps against the needed count and turn the pending count into a release, wait, or escalate remediation action.

Coroutine Resume Remediation Report

coroutine_resume.lua
local resumes = 
local needed = 3
local done = resumes
if done > needed then
  done = needed
end
local pending = needed - done

local action = "release"
if pending == 1 then
  action = "wait"
elseif pending >= 2 then
  action = "escalate"
end

print("needed=" .. needed .. " done=" .. done .. " pending=" .. pending .. " " .. action)
local resumes = 
local needed = 3
local done = resumes
if done > needed then
  done = needed
end
local pending = needed - done

local action = "release"
if pending == 1 then
  action = "wait"
elseif pending >= 2 then
  action = "escalate"
end

print("needed=" .. needed .. " done=" .. done .. " pending=" .. pending .. " " .. action)
local resumes = 
local needed = 3
local done = resumes
if done > needed then
  done = needed
end
local pending = needed - done

local action = "release"
if pending == 1 then
  action = "wait"
elseif pending >= 2 then
  action = "escalate"
end

print("needed=" .. needed .. " done=" .. done .. " pending=" .. pending .. " " .. action)
resume pending The needed count and completed resumes are scalars, so the pending work that drives the remediation action stays deterministic without resuming a live coroutine.