fix: wire audit loop into worker completion path (pushback delivery, escalate, packet preamble)
Audit-loop wiring, worker completion path only: after the final write-back (and only when the final is completed/failed, not quota, not cancelled, not goal-converted, and the task carries audit_loop), collect this attempt's deterministic gate results (execution, goal_verify only when host reported goal_met, capability / required_tools / gateway as passed-or-inapplicable markers, since a pre-dispatch gate rejection early-returns before any runner round and requeueing it would deterministically re-fail the same gate) and call audit_loop_evaluate. Pushback stores the packet JSON in tasks.audit_loop_packet and CAS-requeues the task; the next claim prepends the packet preamble to prompt (and goal) with a data-only separator, DB prompt untouched. Pass clears the packet. Escalate sets failed (VALID_STATUSES has no needs_review, never invented) with an escalation error and clears the packet; subjective needs_review leaves the outcome untouched and only audits. New tasks.audit_loop / audit_loop_packet columns follow the attempts DDL pattern in worker ensure, server migrate, PG schema, PG backfill, migrations backfill, and POST /tasks accepts audit_loop (True/1 only, coordinator tasks rejected like v9). Coordinator parent tasks return via _run_coordinator before the attempt loop and coordinator children never inherit audit_loop, so coordinator wiring is left as legacy, unchanged.
This commit is contained in:
1 parent
37b1aadc02
commit
f2005689fd
6 files changed
+764
-8
No files matched your search
+2
-1
@@ -223,7 +223,8 @@ def migrate_sqlite_to_postgres(sqlite_path, pg_conn=None, tables=None):
|
||||
_existing = set()
|
||||
for _col in ("agent_name", "agent_version",
|
||||
"agent_instructions", "agent_tools",
|
||||
"agent_tool_approvals"):
|
||||
"agent_tool_approvals", "audit_loop",
|
||||
"audit_loop_packet"):
|
||||
if _col not in _existing:
|
||||
try:
|
||||
pg_conn.execute(
|
||||
|
||||
Reference in new issue
Block a user