feat(agents): schedule mainstream agent version governance
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / build-and-deploy (push) Has been cancelled
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / tests (push) Has been cancelled

This commit is contained in:
ogt
2026-07-10 10:51:18 +08:00
parent fa68f35e5b
commit 210d7db338
16 changed files with 1519 additions and 239 deletions

View File

@@ -225,7 +225,7 @@ def test_docs_hash_ignores_dynamic_script_noise():
assert second_report["candidates"][0]["sources"][0]["changed_since_reference"] is False
def test_market_watch_parses_github_tags_for_projects_without_releases():
def test_market_watch_policy_skips_github_tags_without_fetching():
registry = {
"schema_version": "agent_market_watch_sources_v1",
"policy": {"replacement_decision_allowed": False},
@@ -247,11 +247,7 @@ def test_market_watch_parses_github_tags_for_projects_without_releases():
}
def fetcher(_url: str, _timeout: int) -> FetchedSource:
return FetchedSource(
status="ok",
http_status=200,
body=json.dumps([{"name": "v0.8.0"}]).encode(),
)
raise AssertionError("GitHub sources must be skipped by policy")
report = run_agent_market_watch(
registry,
@@ -262,9 +258,11 @@ def test_market_watch_parses_github_tags_for_projects_without_releases():
)
source = report["candidates"][0]["sources"][0]
assert source["status"] == "ok"
assert source["version"] == "v0.8.0"
assert source["status"] == "skipped_by_policy"
assert source["version"] is None
assert source["policy_blocker"] == "github_global_freeze_no_github_api_or_github_web_reads"
assert report["summary"]["failure_count"] == 0
assert report["summary"]["policy_skipped_source_count"] == 1
def test_versioned_source_ignores_metadata_hash_noise_when_version_is_unchanged():
@@ -335,7 +333,7 @@ def test_versioned_source_ignores_metadata_hash_noise_when_version_is_unchanged(
assert report["candidates"][0]["sources"][0]["changed_since_reference"] is False
def test_github_rate_limit_carries_forward_previous_source_without_failure():
def test_github_release_source_is_policy_skipped_before_rate_limit_handling():
registry = {
"schema_version": "agent_market_watch_sources_v1",
"policy": {"replacement_decision_allowed": False},
@@ -370,12 +368,7 @@ def test_github_rate_limit_carries_forward_previous_source_without_failure():
}
def fetcher(_url: str, _timeout: int) -> FetchedSource:
return FetchedSource(
status="error",
http_status=403,
body=b'{"message":"API rate limit exceeded"}',
error="http_403",
)
raise AssertionError("GitHub sources must be skipped by policy")
report = run_agent_market_watch(
registry,
@@ -389,8 +382,9 @@ def test_github_rate_limit_carries_forward_previous_source_without_failure():
source = report["candidates"][0]["sources"][0]
assert report["summary"]["failure_count"] == 0
assert report["summary"]["changed_candidates"] == 0
assert source["status"] == "carried_forward_rate_limited"
assert source["version"] == "v1.2.3"
assert report["summary"]["policy_skipped_source_count"] == 1
assert source["status"] == "skipped_by_policy"
assert source["version"] is None
assert source["changed_since_reference"] is False
assert source["error"] is None
assert source["carried_forward_from_previous"] is True
assert source["policy_blocker"] == "github_global_freeze_no_github_api_or_github_web_reads"

View File

@@ -13,9 +13,11 @@ def test_load_latest_ai_agent_version_lifecycle_update_proposal_reads_committed_
data = load_latest_ai_agent_version_lifecycle_update_proposal()
assert data["schema_version"] == "ai_agent_version_lifecycle_update_proposal_v1"
assert data["program_status"]["overall_completion_percent"] == 78
assert data["program_status"]["current_task_id"] == "P2-413"
assert data["program_status"]["next_task_id"] == "P2-414"
assert data["program_status"]["overall_completion_percent"] == 80
assert data["program_status"]["current_task_id"] == "CIR-P1-AI-002"
assert data["program_status"]["next_task_id"] == (
"P1-006-agent-market-version-lifecycle-readback"
)
assert data["program_status"]["read_only_mode"] is True
assert data["program_status"]["runtime_authority"] == (
"version_lifecycle_update_proposal_only_no_write_or_upgrade"
@@ -31,8 +33,8 @@ def test_load_latest_ai_agent_version_lifecycle_update_proposal_reads_committed_
assert data["telegram_digest_contract"]["gateway_queue_write_allowed"] is False
assert data["telegram_digest_contract"]["bot_api_call_allowed"] is False
assert data["rollups"]["domain_count"] == len(data["lifecycle_domains"]) == 12
assert data["rollups"]["proposal_count"] == len(data["update_proposals"]) == 12
assert data["rollups"]["cadence_count"] == len(data["cadence_matrix"]) == 6
assert data["rollups"]["proposal_count"] == len(data["update_proposals"]) == 13
assert data["rollups"]["cadence_count"] == len(data["cadence_matrix"]) == 7
assert data["rollups"]["approval_gate_count"] == len(data["approval_gate_matrix"]) == 9
assert data["rollups"]["false_runtime_boundary_count"] == 29
assert data["rollups"]["auto_execution_allowed_count"] == 0
@@ -43,6 +45,10 @@ def test_load_latest_ai_agent_version_lifecycle_update_proposal_reads_committed_
proposal["proposal_id"] == "openclaw_challenger_replay_bench"
for proposal in data["update_proposals"]
)
assert any(
proposal["proposal_id"] == "mainstream_agent_framework_version_lifecycle_review"
for proposal in data["update_proposals"]
)
assert all(proposal["requires_owner_approval"] is True for proposal in data["update_proposals"])
assert all(proposal["direct_update_allowed"] is False for proposal in data["update_proposals"])
@@ -68,7 +74,7 @@ def test_ai_agent_version_lifecycle_update_proposal_rejects_rollup_mismatch(tmp_
def test_ai_agent_version_lifecycle_update_proposal_rejects_direct_update(tmp_path):
snapshot = _snapshot()
snapshot["update_proposals"][0]["direct_update_allowed"] = True
snapshot["rollups"]["read_only_proposal_count"] = 11
snapshot["rollups"]["read_only_proposal_count"] = 12
_write_snapshot(tmp_path, snapshot)
with pytest.raises(ValueError, match="direct update"):

View File

@@ -16,9 +16,11 @@ def test_ai_agent_version_lifecycle_update_proposal_endpoint_returns_committed_s
assert response.status_code == 200
data = response.json()
assert data["schema_version"] == "ai_agent_version_lifecycle_update_proposal_v1"
assert data["program_status"]["overall_completion_percent"] == 78
assert data["program_status"]["current_task_id"] == "P2-413"
assert data["program_status"]["next_task_id"] == "P2-414"
assert data["program_status"]["overall_completion_percent"] == 80
assert data["program_status"]["current_task_id"] == "CIR-P1-AI-002"
assert data["program_status"]["next_task_id"] == (
"P1-006-agent-market-version-lifecycle-readback"
)
assert data["program_status"]["read_only_mode"] is True
assert data["runtime_boundaries"]["package_upgrade_allowed"] is False
assert data["runtime_boundaries"]["k3s_upgrade_allowed"] is False
@@ -26,8 +28,8 @@ def test_ai_agent_version_lifecycle_update_proposal_endpoint_returns_committed_s
assert data["runtime_boundaries"]["production_write_allowed"] is False
assert data["runtime_boundaries"]["openclaw_replacement_allowed"] is False
assert data["rollups"]["domain_count"] == 12
assert data["rollups"]["proposal_count"] == 12
assert data["rollups"]["approval_required_count"] == 12
assert data["rollups"]["proposal_count"] == 13
assert data["rollups"]["approval_required_count"] == 13
assert data["rollups"]["auto_execution_allowed_count"] == 0
assert data["rollups"]["telegram_direct_send_count"] == 0
assert data["rollups"]["production_write_count"] == 0
@@ -35,3 +37,11 @@ def test_ai_agent_version_lifecycle_update_proposal_endpoint_returns_committed_s
proposal["proposal_id"] == "telegram_bot_gateway_policy_refresh"
for proposal in data["update_proposals"]
)
assert any(
proposal["proposal_id"] == "mainstream_agent_framework_version_lifecycle_review"
for proposal in data["update_proposals"]
)
assert any(
binding["binding_id"] == "agent_version_lifecycle_weekly_tuesday_0900_taipei"
for binding in data["periodic_schedule_bindings"]
)