#129 AUDIT: Find all SQL-path bypasses that skip Python layer updates

closed high Created 2025-11-27 06:45 · Updated 2025-11-27 06:48

Description

Edit
During disruption testing, we discovered that when absurd.fail_run() is called directly from SQL (e.g., claim_task detecting expired claims at lines 367-378 in a_absurd.sql), the Python orchestrator's _fail_run() method is bypassed. This caused workflow_run.status to remain 'pending' while tasks were 'failed'. FIXED BY: Migration 0.0.40 added a trigger to sync workflow_run.status when task state changes to failed/cancelled. CONCERN: There may be OTHER similar cases where SQL-level operations bypass Python layer logic. AUDIT SCOPE: 1. All absurd.* SQL functions that modify state (fail_run, complete_run, schedule_run, cancel operations) 2. Check if each has corresponding Python-layer side effects that could be missed 3. Look for any UPDATE statements in a_absurd.sql that change state columns KNOWN SQL FUNCTIONS THAT MODIFY STATE: - absurd.fail_run() - marks run/task as failed, creates retry runs - absurd.complete_run() - marks run/task as completed - absurd.schedule_run() - marks run/task as sleeping - absurd.spawn_task() - creates new task/run - absurd.claim_task() - cancellation rules, expired claim handling (CALLS fail_run!) - absurd.emit_event() - wakes sleeping tasks, updates checkpoints - absurd.await_event() - suspends tasks, creates wait registrations TABLES THAT MIGHT NEED SYNC: - workflow_run (status, completed_at, error, result) - absurd_event_log (audit trail) - task_runtime_status (telemetry) QUESTIONS TO ANSWER: 1. Does complete_run via SQL update workflow_run.status to 'completed'? 2. Does schedule_run via SQL log sleep events? 3. Are there other callers of fail_run besides claim_task? 4. Does emit_event properly log event emissions to absurd_event_log? PATTERN TO WATCH FOR: Any place where absurd.* function is called that would normally trigger Python-layer side effects (logging, status updates, notifications). CONTEXT FILES: - engine/migrations/sql/a_absurd.sql (lines 283-456 for claim_task, 561-706 for fail_run) - engine/migrations/sql/highway_0.0.40_fail_run_update_workflow.sql (the fix) - engine/orchestrator.py (_fail_run, _complete_run methods) - engine/absurd_client.py (Python wrappers)

Comments

Loading comments...

Context

Loading context...

Audit History

View All
Loading audit history...