合入 W2-a 的复核修复(nr8/a:导入的 NOT NULL 补值与孤儿行、收尾 dispose、sslmode 换算、PostgreSQL 写入去 NUL、不分大小写搜索 contains_ci、json_eq 两库同语义、JSON 守卫、用户可见列表补决胜键、bubblewrap --clearenv、部署脚本与原子写的几处、README 连接数预算)

# Conflicts:
#	backend/app/api/schedules.py
#	backend/app/main.py
This commit is contained in:
ThearchyHelios
2026-10-19 12:21:38 +08:00
80 changed files with 995 additions and 201 deletions
+3
View File
@@ -32,6 +32,9 @@ def _pool_size() -> int:
async def open_postgres_saver(conninfo: str, *, max_size: int | None = None,
application_name: str = "agentlab") -> AsyncIterator[BaseCheckpointSaver]:
"""PostgreSQL 的断点库:开连接池、建表(幂等),退出时关池子。application_name 同应用库(db/base.APPLICATION_NAME)。"""
from app.db.base import _require_postgres_driver
_require_postgres_driver("psycopg", "psycopg_pool", "langgraph.checkpoint.postgres")
from langgraph.checkpoint.postgres.aio import AsyncPostgresSaver
from psycopg.rows import dict_row
from psycopg_pool import AsyncConnectionPool
+1 -1
View File
@@ -345,7 +345,7 @@ async def _confirmed_by(run_id: str, node_id: str) -> str | None:
async with SessionLocal() as session:
return await session.scalar(select(Task.resolved_by).where(
Task.run_id == run_id, Task.node_id == node_id, Task.kind == "action_confirm",
Task.status == "resolved").order_by(Task.created_at.desc()).limit(1))
Task.status == "resolved").order_by(Task.created_at.desc(), Task.id.desc()).limit(1))
def _write_updates(ctx: NodeContext, result: dict[str, Any]) -> dict[str, Any]:
+1 -2
View File
@@ -51,8 +51,7 @@ async def _locked(session: Any, key: str) -> Any:
"""占住设置表里 key 这一行再读它(见模块说明「多进程」):没有这一行交回 None。updated_at 不动。"""
from sqlalchemy import update
await session.execute(update(Setting).where(Setting.key == key).values(value=Setting.value,
updated_at=Setting.updated_at)
await session.execute(update(Setting).where(Setting.key == key).values(updated_at=Setting.updated_at)
.execution_options(synchronize_session=False))
return await session.get(Setting, key, populate_existing=True)