fix: second-audit gate findings (B1, I1-I8, M1-M10)
B1: gateway capability check now triggers on walking the sub2api gateway, not on the gateway having filled a model; task-level explicit models are audited (worker_capability_gateway_explicit) but never blocked, preserving explicit priority; gateway-default models still fail-fast under active. I1: dry-run adds a gateway-model section, sourced only from CLOUD_SUB2API_DEFAULT_MODEL (never queries the relay); an active tier whose requires the gateway model fails or cannot verify blocks, shadow only warns. I2: shadow review gate now counts completed samples (completed >= 20), same basis for sample_shortfall; the endpoint attaches per-tier capability status (read-only policy load) and flags capability-failing tiers in the recommendation. I3: configured-but-broken routing policy logs a warning in load_routing_policy (unconfigured stays silent); the worker sets routing_policy_load_failed and audits worker_routing_policy_load_failed per task. I4: resume preamble wraps prior output/error as data with an explicit do-not-execute constraint; position verified in run_one (tree -> preamble -> project -> original) and the docs corrected from the false 'closest to the original prompt' claim. I5: decided model is written back with a CAS UPDATE (model IS NULL OR model=''), so later attempts reuse it; explicit models are never overwritten. I6: agent_* columns added to worker._ensure_result_columns and db.init_postgres_schema backfill; migrations backfills them for tasks before insert (sender_task_id pattern); column-level tests for agent_tool_approvals and task_attempts. I7: coordinator requeue adds AND status=<snapshot> (rowcount 0 skips requeue/audit) and filters paused_by_user / user_cancel / user_pause children, which are never revived or cleared. I8: explicit-model tasks (including coordinator children that inherited a parent model) audit a source=explicit worker_routing row; evaluate_shadow counts it as per-tier explicit_n only, never routed_n, never a dedup slot. M1/M2/M3/M5/M6/M8/M10: dedup slot moved after tier validation, shadow sort doc fixed, truncated recommendation notes truncation, seed cleanup on gateway/quota/goal-cap early returns, tools-only coordinator definitions rejected, preamble goal branch marked effectively unreachable, DESIGN.md drift corrected (outside repo). M4/M7/M9: documentation/new-field only (pass_rate_fully_measured, whitespace-model shadow-drop note, bound-note race note); old field semantics unchanged.
This commit is contained in:
1 parent
f9a77577c5
commit
621c08d10f
13 files changed
+907
-44
No files matched your search
@@ -206,6 +206,29 @@ def migrate_sqlite_to_postgres(sqlite_path, pg_conn=None, tables=None):
|
||||
continue
|
||||
columns = [d[0] for d in src.execute(
|
||||
'SELECT * FROM "%s" LIMIT 0' % table).description]
|
||||
if table == "tasks":
|
||||
# Audit fix 3(I6):task_followups.sender_task_id
|
||||
# 同款特殊回填。SQLite 侧 tasks 已有 agent 列,
|
||||
# POSTGRES_SCHEMA 新库建表时一次建齐,但老
|
||||
# PG 库的回填清单此前没有这 5 列;直插前先
|
||||
# 查现有列、缺了再 ALTER 补列,已有列是
|
||||
# no-op。补列失败不吞掉迁移:INSERT 时若列
|
||||
# 仍缺失会直接报错(大声失败,绝不静默丢列)。
|
||||
try:
|
||||
_existing = {row[1] for row in pg_conn.execute(
|
||||
"PRAGMA table_info(tasks)").fetchall()}
|
||||
except Exception:
|
||||
_existing = set()
|
||||
for _col in ("agent_name", "agent_version",
|
||||
"agent_instructions", "agent_tools",
|
||||
"agent_tool_approvals"):
|
||||
if _col not in _existing:
|
||||
try:
|
||||
pg_conn.execute(
|
||||
"ALTER TABLE tasks ADD COLUMN %s TEXT"
|
||||
% _col)
|
||||
except Exception:
|
||||
pass
|
||||
if table == "task_followups" and "sender_task_id" in columns:
|
||||
# SQLite 侧有、POSTGRES_SCHEMA 里没有的列:
|
||||
# 与 peer_messages.ensure_followups_table 同款,
|
||||
|
||||
Reference in new issue
Block a user