Merge remote-tracking branch 'gitea-ssh/main' into codex/github-redacted-evidence-validator-20260627
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from src.services.ai_agent_autonomous_runtime_control import (
|
||||
build_ai_agent_autonomous_runtime_control,
|
||||
build_runtime_receipt_readback_from_rows,
|
||||
classify_deploy_control_plane_observation,
|
||||
)
|
||||
|
||||
|
||||
@@ -58,6 +59,57 @@ def test_ai_agent_autonomous_runtime_control_exposes_reports_and_executor_receip
|
||||
assert data["runtime_receipt_readback"]["db_read_status"] == "not_queried"
|
||||
|
||||
|
||||
def test_ai_agent_autonomous_runtime_control_exposes_internal_control_loop():
|
||||
data = build_ai_agent_autonomous_runtime_control()
|
||||
|
||||
integration = data["control_plane_integration"]
|
||||
assert integration["schema_version"] == "ai_agent_autonomous_runtime_internal_loop_v1"
|
||||
assert integration["status"] == "mcp_rag_km_playbook_log_control_loop_declared"
|
||||
assert {sensor["normalized_event"] for sensor in integration["mcp_sensors"]} == {
|
||||
"RunObservation",
|
||||
"RunnerLaneState",
|
||||
"ProductionTruthSnapshot",
|
||||
"FrontendTruthSnapshot",
|
||||
}
|
||||
assert "controlled_cd_lane_capacity_label_guardrails" in integration["rag_context_queries"]
|
||||
assert "running_no_container_stale_ui" in integration["playbook_decision_classes"]
|
||||
assert integration["km_writeback_contract"]["stores_raw_logs"] is False
|
||||
assert integration["km_writeback_contract"]["stores_secret_values"] is False
|
||||
assert integration["log_projection_contract"]["raw_html_or_long_log_allowed"] is False
|
||||
assert data["rollups"]["mcp_sensor_count"] == 4
|
||||
assert data["rollups"]["playbook_decision_class_count"] == 7
|
||||
|
||||
|
||||
def test_deploy_control_plane_classifier_separates_stale_spinner_from_real_failure():
|
||||
stale = classify_deploy_control_plane_observation(
|
||||
run_status="running",
|
||||
is_latest_deploy_intent=True,
|
||||
active_task_container_count=0,
|
||||
production_marker_hit=True,
|
||||
latest_flow_closed=True,
|
||||
runner_capacity_ok=True,
|
||||
runner_forbidden_label_count=0,
|
||||
)
|
||||
assert stale["classification"] == "running_no_container_stale_ui"
|
||||
assert stale["action"] == "treat_gitea_spinner_as_stale_and_keep_production_truth"
|
||||
assert stale["safety_boundary"]["writes_runtime_state"] is False
|
||||
assert stale["internal_writeback"]["km_writeback_required"] is True
|
||||
|
||||
failure = classify_deploy_control_plane_observation(
|
||||
run_status="failure",
|
||||
is_latest_deploy_intent=True,
|
||||
active_task_container_count=0,
|
||||
production_marker_hit=False,
|
||||
latest_flow_closed=False,
|
||||
runner_capacity_ok=True,
|
||||
runner_forbidden_label_count=0,
|
||||
)
|
||||
assert failure["classification"] == "real_failure_requires_playbook_repair"
|
||||
assert failure["action"] == "open_cd_repair_playbook_with_target_selector_and_verifier"
|
||||
assert failure["safety_boundary"]["opens_legacy_runner"] is False
|
||||
assert failure["internal_writeback"]["playbook_route_required"] is True
|
||||
|
||||
|
||||
def test_ai_agent_autonomous_runtime_control_keeps_hard_blockers_and_redaction():
|
||||
data = build_ai_agent_autonomous_runtime_control()
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ from src.services.ai_agent_autonomous_runtime_control import (
|
||||
build_ai_agent_autonomous_runtime_control,
|
||||
)
|
||||
|
||||
|
||||
_PUBLIC_FORBIDDEN_TERMS = [
|
||||
"工作視窗",
|
||||
"對話內容",
|
||||
@@ -77,6 +76,11 @@ def test_get_ai_agent_autonomous_runtime_control_api(monkeypatch):
|
||||
"ai_agent_autonomous_runtime_receipt_readback_v1"
|
||||
)
|
||||
assert data["runtime_receipt_readback"]["db_read_status"] == "not_queried"
|
||||
assert data["control_plane_integration"]["status"] == (
|
||||
"mcp_rag_km_playbook_log_control_loop_declared"
|
||||
)
|
||||
assert data["rollups"]["mcp_sensor_count"] == 4
|
||||
assert data["rollups"]["deploy_control_classifier_example_count"] == 3
|
||||
|
||||
|
||||
def test_get_ai_agent_autonomous_runtime_control_api_redacts_public_terms(monkeypatch):
|
||||
|
||||
Reference in New Issue
Block a user