feat(roundtable): 会商诊断日志 + 后台挂起卡死兜底(idle 超时)
- 新增会商全流程诊断日志:新表 roundtable_diagnostics + 仓储 + admin API (/api/roundtable-diagnostics) + 管理员诊断页(会商页右上角设置按钮入口), 覆盖第一/二/三步及后台执行器/进程内网关各处报错与关键事件,支持按 范围/阶段/级别/事件/关键词筛选 + 分页。诊断写入全程 best-effort,绝不打断会商。 - 修复后台挂起「执行完第一个席位后永久卡死」:进程内网关每轮 agent run 改为 idle(无活动)超时(默认 20min)——只要还在持续产出 token/工具事件就一直等, 仅当连续无任何输出才判卡死并取消+报错+落 seat_turn_timeout 诊断;慢但活着的 生成绝不打断。可经 ROUNDTABLE_SEAT_IDLE_TIMEOUT_SECONDS 调整。 - 一并提交进行中的会商 seat-skill 注入 / 业务链条编辑器相关改动。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
8ca16c74bc
commit
4a403c95c5
27 files changed
+1873
-61
No files matched your search
+70
@@ -0,0 +1,70 @@
|
||||
"""Create roundtable_diagnostics table.
|
||||
|
||||
会商全流程诊断日志(第一/二/三步 + 后台执行器 + 进程内网关各处报错与关键事件),
|
||||
管理员诊断页的数据源。全局/共享,不按 user 分权。
|
||||
|
||||
On a brand-new DB the table is created by ``create_all``; this revision patches
|
||||
existing DBs (alembic auto-upgrade is disabled at runtime — see
|
||||
``persistence/engine.py`` — so operators run this / the column_additions SQL).
|
||||
|
||||
Revision ID: 20260619_01
|
||||
Revises: 20260618_01
|
||||
Create Date: 2026-06-19
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy.dialects.mysql import LONGTEXT
|
||||
|
||||
|
||||
revision = "20260619_01"
|
||||
down_revision = "20260618_01"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def _has_table(table_name: str) -> bool:
|
||||
inspector = inspect(op.get_bind())
|
||||
return table_name in inspector.get_table_names()
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
if _has_table("roundtable_diagnostics"):
|
||||
return
|
||||
|
||||
long_text = LONGTEXT() if op.get_bind().dialect.name == "mysql" else sa.Text()
|
||||
|
||||
op.create_table(
|
||||
"roundtable_diagnostics",
|
||||
sa.Column("id", sa.String(64), primary_key=True),
|
||||
sa.Column("scope", sa.String(16), nullable=False, server_default="background"),
|
||||
sa.Column("stage", sa.String(32), nullable=False, server_default="job"),
|
||||
sa.Column("level", sa.String(16), nullable=False, server_default="info"),
|
||||
sa.Column("event", sa.String(64), nullable=False, server_default=""),
|
||||
sa.Column("message", sa.Text(), nullable=True),
|
||||
sa.Column("detail", long_text, nullable=True),
|
||||
sa.Column("job_id", sa.String(64), nullable=True),
|
||||
sa.Column("draft_id", sa.String(64), nullable=True),
|
||||
sa.Column("task_id", sa.String(128), nullable=True),
|
||||
sa.Column("user_id", sa.String(64), nullable=True),
|
||||
sa.Column("agent_id", sa.String(128), nullable=True),
|
||||
sa.Column("agent_name", sa.String(255), nullable=True),
|
||||
sa.Column("cycle", sa.Integer(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
)
|
||||
op.create_index("ix_roundtable_diagnostics_scope", "roundtable_diagnostics", ["scope"])
|
||||
op.create_index("ix_roundtable_diagnostics_stage", "roundtable_diagnostics", ["stage"])
|
||||
op.create_index("ix_roundtable_diagnostics_level", "roundtable_diagnostics", ["level"])
|
||||
op.create_index("ix_roundtable_diagnostics_job_id", "roundtable_diagnostics", ["job_id"])
|
||||
op.create_index("ix_roundtable_diagnostics_draft_id", "roundtable_diagnostics", ["draft_id"])
|
||||
op.create_index("ix_roundtable_diagnostics_task_id", "roundtable_diagnostics", ["task_id"])
|
||||
op.create_index("ix_roundtable_diagnostics_user_id", "roundtable_diagnostics", ["user_id"])
|
||||
op.create_index("ix_roundtable_diagnostics_created_at", "roundtable_diagnostics", ["created_at"])
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
if _has_table("roundtable_diagnostics"):
|
||||
op.drop_table("roundtable_diagnostics")
|
||||
Reference in new issue
Block a user