fix(api): fallback log dispatch ledger operation
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 23s
CD Pipeline / build-and-deploy (push) Successful in 8m52s
CD Pipeline / post-deploy-checks (push) Successful in 1m0s
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 23s
CD Pipeline / build-and-deploy (push) Successful in 8m52s
CD Pipeline / post-deploy-checks (push) Successful in 1m0s
This commit is contained in:
@@ -3541,24 +3541,35 @@ async def build_ai_agent_autonomous_runtime_control_with_live_readback(
|
||||
|
||||
_RUNTIME_OPERATION_COUNTS_SQL = """
|
||||
SELECT
|
||||
operation_type,
|
||||
CASE
|
||||
WHEN operation_type = 'km_linked'
|
||||
AND input ->> 'semantic_operation_type' = 'log_controlled_writeback_dispatched'
|
||||
THEN 'log_controlled_writeback_dispatched'
|
||||
ELSE operation_type
|
||||
END AS operation_type,
|
||||
status,
|
||||
count(*) AS total,
|
||||
count(*) FILTER (
|
||||
WHERE created_at >= NOW() - (:lookback_hours * INTERVAL '1 hour')
|
||||
) AS recent
|
||||
FROM automation_operation_log
|
||||
WHERE operation_type IN (
|
||||
'ansible_candidate_matched',
|
||||
'ansible_check_mode_executed',
|
||||
'ansible_apply_executed',
|
||||
'ansible_learning_writeback_recorded',
|
||||
'ansible_rollback_executed',
|
||||
'ansible_execution_skipped',
|
||||
'log_controlled_writeback_dispatched'
|
||||
WHERE (
|
||||
operation_type IN (
|
||||
'ansible_candidate_matched',
|
||||
'ansible_check_mode_executed',
|
||||
'ansible_apply_executed',
|
||||
'ansible_learning_writeback_recorded',
|
||||
'ansible_rollback_executed',
|
||||
'ansible_execution_skipped',
|
||||
'log_controlled_writeback_dispatched'
|
||||
)
|
||||
OR (
|
||||
operation_type = 'km_linked'
|
||||
AND input ->> 'semantic_operation_type' = 'log_controlled_writeback_dispatched'
|
||||
)
|
||||
)
|
||||
GROUP BY operation_type, status
|
||||
ORDER BY operation_type, status
|
||||
GROUP BY 1, status
|
||||
ORDER BY 1, status
|
||||
"""
|
||||
|
||||
|
||||
@@ -3566,7 +3577,12 @@ _RUNTIME_OPERATION_LATEST_SQL = """
|
||||
SELECT
|
||||
op_id::text AS op_id,
|
||||
parent_op_id::text AS parent_op_id,
|
||||
operation_type,
|
||||
CASE
|
||||
WHEN operation_type = 'km_linked'
|
||||
AND input ->> 'semantic_operation_type' = 'log_controlled_writeback_dispatched'
|
||||
THEN 'log_controlled_writeback_dispatched'
|
||||
ELSE operation_type
|
||||
END AS operation_type,
|
||||
status,
|
||||
actor,
|
||||
coalesce(incident_id::text, input ->> 'incident_id') AS incident_id,
|
||||
@@ -3581,14 +3597,20 @@ _RUNTIME_OPERATION_LATEST_SQL = """
|
||||
duration_ms,
|
||||
created_at
|
||||
FROM automation_operation_log
|
||||
WHERE operation_type IN (
|
||||
'ansible_candidate_matched',
|
||||
'ansible_check_mode_executed',
|
||||
'ansible_apply_executed',
|
||||
'ansible_learning_writeback_recorded',
|
||||
'ansible_rollback_executed',
|
||||
'ansible_execution_skipped',
|
||||
'log_controlled_writeback_dispatched'
|
||||
WHERE (
|
||||
operation_type IN (
|
||||
'ansible_candidate_matched',
|
||||
'ansible_check_mode_executed',
|
||||
'ansible_apply_executed',
|
||||
'ansible_learning_writeback_recorded',
|
||||
'ansible_rollback_executed',
|
||||
'ansible_execution_skipped',
|
||||
'log_controlled_writeback_dispatched'
|
||||
)
|
||||
OR (
|
||||
operation_type = 'km_linked'
|
||||
AND input ->> 'semantic_operation_type' = 'log_controlled_writeback_dispatched'
|
||||
)
|
||||
)
|
||||
ORDER BY created_at DESC
|
||||
LIMIT :limit
|
||||
|
||||
Reference in New Issue
Block a user