fix: audit batch 1 (B-A migration audit_loop INTEGER, B-C gateway failure clears running slot)

- B-A: migrations.py tasks backfill loop now types audit_loop as
  INTEGER (other 6 columns stay TEXT), matching db.py backfill,
  server/worker ensure lists; TEXT readback '0' is truthy and
  would silently enable the audit loop for audit_loop=0 rows.
- B-C: gateway preparation failure early-return now calls
  _running_clear(task_id) next to _cleanup_task_seed, matching
  missing-key/repo/capability/tool gates; previously the capacity
  slot leaked until worker exit (default capacity 1 blocks reclaim).
- Tests: cloud/tests/test_audit_batch1.py (3 tests): migration
  ALTER types, INTEGER 0 readback not enabled via real worker
  row mapping, gateway failure clears slot and capacity reclaim.
  _claim doc 'three gates' list left unchanged (full early-return
  gate enumeration not verified this batch; residual wording).
- No other audit items touched (I-1..I-14, N-1..N-12).
This commit is contained in:
host committed 2026-11-04 18:02:22 +00:00
1 parent e3423865aa
commit 44e0f4f1d6
3 files changed
+265 -6

No files matched your search

+3
View File
@@ -7330,6 +7330,9 @@ class Worker:
# Audit fix 3(M5):网关失败早返回也要清暂存,
# 与缺 key 门、仓库门同款,否则 bundle 目录残留。
self._cleanup_task_seed(task)
# Audit batch 1(B-C):网关失败早返回也要清认领占位,
# 与缺 key 门、仓库门同款,否则容量槽位漏到 worker 退出。
self._running_clear(task_id)
return {"dispatched": True, "task_id": task_id,
"host_name": self.executor._host_name(task)
if hasattr(self.executor, "_host_name") else task_id,