fix: third-audit gate findings (explicit split, shadow explicit failures, N2-N5, N1 note)

Explicit gateway capability now splits known/unknown: known-missing
explicit models fail-fast under active (same shape as the gateway
default gate), unknown explicit models stay audit-only, shadow never
blocks; explicit priority now protects which model the user chose,
not that the chosen model must run. Shadow report reads
worker_capability_gateway_explicit rows as explicit_capability_failures
with a field note distinguishing the three explicit counts.
N2: coordinator requeue CAS rowcount=0 branch covered via a proxy
connection test (no refactor needed). N3: shadow endpoint test on
the create_server + real HTTP skeleton (capability, truncated, and
explicit-failure fields). N4: creation-layer rejection tests for
tools/instructions/tool_approvals on goal/coordinator tasks.
N5: model writeback failure logs a warning (best-effort kept).
N1: writeback capability-recheck trade-off documented in comment
only; recheck itself is a later batch.
This commit is contained in:
host committed 2026-11-04 18:02:21 +00:00
1 parent 621c08d10f
commit 18e3f1c82d
5 files changed
+660 -21

No files matched your search

+11 -7
View File
@@ -113,7 +113,11 @@ class B1ExplicitGatewayTestCase(unittest.TestCase):
def tearDown(self):
self.tmp.cleanup()
def test_explicit_model_is_audited_not_blocked(self):
def test_explicit_model_known_missing_is_blocked(self):
# Audit fix 4: known-missing explicit models are now blocked
# (split from unknown, which stays audit-only). The old
# audit-only expectation for tool_calling=False moved to
# test_audit_fixes4's unknown case.
_insert_task(self.db_path, "E1", model="explicit-model")
worker = _worker(self.db_path, {
"mode": "active",
@@ -124,16 +128,16 @@ class B1ExplicitGatewayTestCase(unittest.TestCase):
},
}, gateway=("sub2api", {}))
result = worker.run_one()
self.assertEqual(result["status"], "completed")
self.assertTrue(worker._calls)
self.assertEqual(result["status"], "failed")
self.assertFalse(worker._calls)
self.assertIn("tool_calling", result["error"])
actions = _audit_actions(self.db_path)
explicit = [d for a, d in actions
if a == "worker_capability_gateway_explicit"]
self.assertTrue(explicit)
self.assertIn("explicit-model", explicit[0])
self.assertIn("tool_calling", explicit[0])
self.assertFalse([a for a, _ in actions
if a == "worker_capability_gate_rejected"])
self.assertIn("blocked=True", explicit[0])
self.assertTrue([a for a, _ in actions
if a == "worker_capability_gate_rejected"])
def test_gateway_default_active_still_blocks(self):
_insert_task(self.db_path, "G1")