常见故障自愈有上限,超限收敛终态且可见:任务 attempts 上限、会话过期、 planning 双闸、executing 超窗兜底、触发失败计数判死、孤儿 agent 双管、 fire-and-forget 触发;open_session 预算硬闸门、settle 按终态区分、报告 scores 归一化;cron 池遗留面全删。
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
"""add attempts to intelligent eval task queue
|
|
|
|
ADR-0011: stale-assigned requeue gets an attempt cap (3) so a deterministically
|
|
failing task no longer requeues forever; the counter lives on the task row.
|
|
|
|
Revision ID: e1a2b3c4d5f6
|
|
Revises: c8f3e9a2b4d1
|
|
Create Date: 2026-08-19
|
|
"""
|
|
|
|
from typing import Sequence, Union
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision: str = "e1a2b3c4d5f6"
|
|
down_revision: Union[str, Sequence[str], None] = "c8f3e9a2b4d1"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
inspector = sa.inspect(op.get_bind())
|
|
columns = {column["name"] for column in inspector.get_columns("intelligent_eval_task_queue")}
|
|
if "attempts" not in columns:
|
|
op.add_column(
|
|
"intelligent_eval_task_queue",
|
|
sa.Column("attempts", sa.Integer(), nullable=False, server_default="0"),
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
inspector = sa.inspect(op.get_bind())
|
|
columns = {column["name"] for column in inspector.get_columns("intelligent_eval_task_queue")}
|
|
if "attempts" in columns:
|
|
with op.batch_alter_table("intelligent_eval_task_queue") as batch_op:
|
|
batch_op.drop_column("attempts")
|