worker: auto-resume falls back to fresh goal for never-started tasks
2026-10-29 live test: task A was interrupted 61s after claim but had never written anything (no host-state entry, no worktree, no trace, no checkpoint); auto-resume ran goal-resume, which host rightly refused, and the task failed. Refusal only makes sense for tasks with progress but a lost breakpoint (those go through the P0 checkpoint rebuild); for a never-started task the only meaningful outcome is a fresh run, identical to its first attempt (same task id, same goal, worktree does not exist yet so nothing is overwritten). Change (claim path only, via _resolve_breakpoint_resume): - rebuild from checkpoint first, unchanged; - if rebuild fails AND _task_never_started holds (state entry, checkpoint row, worktree dir, trace file all absent), clear the breakpoint flag so the run takes the fresh goal path, with a worker_fresh_restart audit event; - any evidence of prior execution, or any check failure, keeps the old refusal path (fail-closed); the auto-resume count cap and no-progress stall guard still bound retries. Tests: cloud/tests/test_neverstart_fresh.py, 10 items (fallback holds, entry/checkpoint/worktree/trace presence each block it, corrupt state blocks it, rebuild still wins when a checkpoint exists); test_goal_resume's breakpoint-routing test now sets up a task with a checkpoint so it still exercises goal-resume. Full suites: cloud 1178 (skipped 4), host 104, deploy 39, green.
This commit is contained in:
1 parent
9e444eca38
commit
e74f20608b
3 files changed
+235
-6
No files matched your search
@@ -170,6 +170,20 @@ class GoalResumeTestCase(unittest.TestCase):
|
||||
"POST", "/tasks/%s/goal-resume" % task["id"],
|
||||
{}, self.owner_key)
|
||||
self.assertEqual(status, 200, body)
|
||||
# 本测试测的是“有断点的任务走 goal-resume”:先给任务补
|
||||
# 一行库断点(模拟跑过一轮),否则按从未启动回落规则,
|
||||
# 它会被当成从未启动而走全新 goal(见
|
||||
# test_neverstart_fresh.py)。
|
||||
conn = sqlite3.connect(self.db_path)
|
||||
try:
|
||||
conn.execute(
|
||||
"INSERT INTO task_checkpoints(task_id, round_no,"
|
||||
" thread_id, goal_status, state_sha, verify_out,"
|
||||
" created_at) VALUES(?, ?, ?, ?, ?, ?, ?)",
|
||||
(task["id"], 1, "th-test", "goal-running", "sha", "", 0))
|
||||
conn.commit()
|
||||
finally:
|
||||
conn.close()
|
||||
seen = []
|
||||
|
||||
def fake(cmd):
|
||||
|
||||
Reference in new issue
Block a user