Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Upload 15 files
Browse files- src/bucket.py +137 -7
- src/effective_status.py +37 -0
- src/timeline_model.py +4 -1
- src/version.py +2 -2
- src/view_models.py +133 -16
- src/worker_payload.py +3 -3
src/bucket.py
CHANGED
|
@@ -670,14 +670,68 @@ def _run_document_links(run_id: str, *, bucket_source: str, bundle: dict[str, An
|
|
| 670 |
|
| 671 |
redacted_present = trace_folder_has_content("traces/redacted")
|
| 672 |
redacted_trace_url = _bucket_tree_url(bucket_source, run_id, "traces/redacted")
|
| 673 |
-
smoke_path = first_existing_path(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 674 |
blockers_path = first_existing_path("generated/TECHNICAL_BLOCKERS.json", "TECHNICAL_BLOCKERS.json")
|
| 675 |
-
smoke_present =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 676 |
report_present = bool(bundle.get("report")) or manifest_has("report.md") or "report.md" in file_paths or (bool(token) and _path_exists(paths.report, token=token))
|
| 677 |
blockers_present = bool(bundle.get("technical_blockers")) or manifest_has("generated/TECHNICAL_BLOCKERS.json") or manifest_has("TECHNICAL_BLOCKERS.json") or "generated/TECHNICAL_BLOCKERS.json" in file_paths or "TECHNICAL_BLOCKERS.json" in file_paths or blockers_path in file_paths
|
| 678 |
eval_publish_payload = bundle.get("eval_publish") if isinstance(bundle.get("eval_publish"), dict) else bundle.get("eval_publish_status") if isinstance(bundle.get("eval_publish_status"), dict) else {}
|
| 679 |
eval_publish_present = bool(eval_publish_payload) or manifest_has("eval_publish_status.json") or "eval_publish_status.json" in file_paths or (bool(token) and _path_exists(f"{paths.root}/eval_publish_status.json", token=token))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 680 |
space_logs_index_present = manifest_has("logs/space_logs_index.json") or "logs/space_logs_index.json" in file_paths or (bool(token) and _path_exists(f"{paths.root}/logs/space_logs_index.json", token=token))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 681 |
build_error_present = manifest_has("build_error_observation.json") or "build_error_observation.json" in file_paths or (bool(token) and _path_exists(f"{paths.root}/build_error_observation.json", token=token))
|
| 682 |
repair_decision_present = manifest_has("repair/REPAIR_DECISION.json") or "repair/REPAIR_DECISION.json" in file_paths or (bool(token) and _path_exists(f"{paths.root}/repair/REPAIR_DECISION.json", token=token))
|
| 683 |
blockage_present = manifest_has("repair/BLOCKAGE.json") or "repair/BLOCKAGE.json" in file_paths or (bool(token) and _path_exists(f"{paths.root}/repair/BLOCKAGE.json", token=token))
|
|
@@ -711,6 +765,14 @@ def _run_document_links(run_id: str, *, bucket_source: str, bundle: dict[str, An
|
|
| 711 |
"present": smoke_present,
|
| 712 |
"url": _bucket_file_url(bucket_source, run_id, smoke_path),
|
| 713 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 714 |
{
|
| 715 |
"id": "eval_publish",
|
| 716 |
"label": "Eval publish",
|
|
@@ -723,10 +785,10 @@ def _run_document_links(run_id: str, *, bucket_source: str, bundle: dict[str, An
|
|
| 723 |
{
|
| 724 |
"id": "space_logs",
|
| 725 |
"label": "Space logs",
|
| 726 |
-
"subtitle": "Build/runtime log index",
|
| 727 |
"icon": "▣",
|
| 728 |
-
"present":
|
| 729 |
-
"url": _bucket_file_url(bucket_source, run_id, "logs
|
| 730 |
"tone": "warn" if "failed" in status or "error" in status else "neutral",
|
| 731 |
},
|
| 732 |
{
|
|
@@ -788,7 +850,7 @@ def _run_document_links(run_id: str, *, bucket_source: str, bundle: dict[str, An
|
|
| 788 |
}
|
| 789 |
)
|
| 790 |
if "failed" in status or "error" in status:
|
| 791 |
-
priority = {"report": 0, "blockage": 1, "build_error": 2, "space_logs": 3, "repair_decision": 4, "repair": 5, "blockers": 6, "pi_redacted_trace": 7, "smoke": 8, "eval_publish": 10}
|
| 792 |
docs.sort(key=lambda item: priority.get(str(item.get("id") or ""), 50))
|
| 793 |
return docs
|
| 794 |
|
|
@@ -1114,6 +1176,64 @@ def _has_persisted_generation_success(*sources: dict[str, Any] | None) -> bool:
|
|
| 1114 |
return True
|
| 1115 |
return False
|
| 1116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1117 |
def _canonical_build_status_from_sources(
|
| 1118 |
*,
|
| 1119 |
state: dict[str, Any] | None = None,
|
|
@@ -1123,6 +1243,7 @@ def _canonical_build_status_from_sources(
|
|
| 1123 |
eval_record: dict[str, Any] | None = None,
|
| 1124 |
smoke: dict[str, Any] | None = None,
|
| 1125 |
gate: dict[str, Any] | None = None,
|
|
|
|
| 1126 |
repair: dict[str, Any] | None = None,
|
| 1127 |
manual_validation: dict[str, Any] | None = None,
|
| 1128 |
eval_publish_status: dict[str, Any] | None = None,
|
|
@@ -1138,7 +1259,15 @@ def _canonical_build_status_from_sources(
|
|
| 1138 |
status so Run Explorer and Run Stats match the Active Run snapshot after a
|
| 1139 |
page load. Intermediate incident events remain phase diagnostics only.
|
| 1140 |
"""
|
| 1141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1142 |
# v198.26.1: eval_publish_status is an archive annotation, not a primary
|
| 1143 |
# run verdict source. It must not make a terminal build appear running/success
|
| 1144 |
# or override final reconciliation after a simple UI read.
|
|
@@ -1365,6 +1494,7 @@ def summarize_run_bundle(run_id: str, bundle: dict[str, Any], *, bucket_source:
|
|
| 1365 |
eval_record=eval_record,
|
| 1366 |
smoke=smoke or bundle.get("test_result") or {},
|
| 1367 |
gate=gate,
|
|
|
|
| 1368 |
repair=bundle.get("repair_outcome") or {},
|
| 1369 |
manual_validation=manual_validation,
|
| 1370 |
eval_publish_status=bundle.get("eval_publish_status") or {},
|
|
|
|
| 670 |
|
| 671 |
redacted_present = trace_folder_has_content("traces/redacted")
|
| 672 |
redacted_trace_url = _bucket_tree_url(bucket_source, run_id, "traces/redacted")
|
| 673 |
+
smoke_path = first_existing_path(
|
| 674 |
+
"tests/generation_smoke.json",
|
| 675 |
+
"tests/generation_smoke_latest.json",
|
| 676 |
+
"generation_smoke.json",
|
| 677 |
+
"tests/test_result.json",
|
| 678 |
+
)
|
| 679 |
blockers_path = first_existing_path("generated/TECHNICAL_BLOCKERS.json", "TECHNICAL_BLOCKERS.json")
|
| 680 |
+
smoke_present = (
|
| 681 |
+
bool(bundle.get("generation_smoke"))
|
| 682 |
+
or manifest_has("tests/generation_smoke.json")
|
| 683 |
+
or manifest_has("tests/generation_smoke_latest.json")
|
| 684 |
+
or manifest_has("generation_smoke.json")
|
| 685 |
+
or "tests/generation_smoke.json" in file_paths
|
| 686 |
+
or "tests/generation_smoke_latest.json" in file_paths
|
| 687 |
+
or "generation_smoke.json" in file_paths
|
| 688 |
+
or smoke_path in file_paths
|
| 689 |
+
or smoke_path in manifest_paths
|
| 690 |
+
)
|
| 691 |
report_present = bool(bundle.get("report")) or manifest_has("report.md") or "report.md" in file_paths or (bool(token) and _path_exists(paths.report, token=token))
|
| 692 |
blockers_present = bool(bundle.get("technical_blockers")) or manifest_has("generated/TECHNICAL_BLOCKERS.json") or manifest_has("TECHNICAL_BLOCKERS.json") or "generated/TECHNICAL_BLOCKERS.json" in file_paths or "TECHNICAL_BLOCKERS.json" in file_paths or blockers_path in file_paths
|
| 693 |
eval_publish_payload = bundle.get("eval_publish") if isinstance(bundle.get("eval_publish"), dict) else bundle.get("eval_publish_status") if isinstance(bundle.get("eval_publish_status"), dict) else {}
|
| 694 |
eval_publish_present = bool(eval_publish_payload) or manifest_has("eval_publish_status.json") or "eval_publish_status.json" in file_paths or (bool(token) and _path_exists(f"{paths.root}/eval_publish_status.json", token=token))
|
| 695 |
+
useful_space_log_candidates = (
|
| 696 |
+
"logs/space_logs_index.json",
|
| 697 |
+
"logs/space_logs_build.txt",
|
| 698 |
+
"logs/space_logs_runtime.txt",
|
| 699 |
+
"logs/space_logs_run.txt",
|
| 700 |
+
"logs/space_logs_fetch_status.json",
|
| 701 |
+
"logs/space_log_diagnostics.json",
|
| 702 |
+
"logs/space_runtime_snapshot.json",
|
| 703 |
+
"logs/pi_live_output.txt",
|
| 704 |
+
"logs/pi_output.txt",
|
| 705 |
+
"logs/build_log_fast_probe_status.json",
|
| 706 |
+
)
|
| 707 |
+
space_logs_path = first_existing_path(*useful_space_log_candidates)
|
| 708 |
space_logs_index_present = manifest_has("logs/space_logs_index.json") or "logs/space_logs_index.json" in file_paths or (bool(token) and _path_exists(f"{paths.root}/logs/space_logs_index.json", token=token))
|
| 709 |
+
space_logs_present = (
|
| 710 |
+
space_logs_index_present
|
| 711 |
+
or manifest_has("logs")
|
| 712 |
+
or any(path in file_paths or path in manifest_paths for path in useful_space_log_candidates)
|
| 713 |
+
or any(path.startswith("logs/") and not path.endswith("/") for path in file_paths | manifest_paths)
|
| 714 |
+
or (bool(token) and _folder_has_content(f"{paths.root}/logs", token=token))
|
| 715 |
+
)
|
| 716 |
+
if not space_logs_index_present and space_logs_present and space_logs_path == "logs/space_logs_index.json":
|
| 717 |
+
space_logs_path = "logs"
|
| 718 |
+
output_artifact_candidates = (
|
| 719 |
+
"artifacts/image.webp",
|
| 720 |
+
"artifacts/image.png",
|
| 721 |
+
"artifacts/image.jpg",
|
| 722 |
+
"artifacts/image.jpeg",
|
| 723 |
+
"artifacts/output.png",
|
| 724 |
+
"artifacts/output.webp",
|
| 725 |
+
"artifacts/output.json",
|
| 726 |
+
)
|
| 727 |
+
output_artifact_path = first_existing_path(*output_artifact_candidates)
|
| 728 |
+
output_artifact_present = (
|
| 729 |
+
any(path in file_paths or path in manifest_paths for path in output_artifact_candidates)
|
| 730 |
+
or manifest_has("artifacts")
|
| 731 |
+
or (bool(token) and _folder_has_content(f"{paths.root}/artifacts", token=token))
|
| 732 |
+
)
|
| 733 |
+
if output_artifact_present and output_artifact_path == "artifacts/image.webp" and output_artifact_path not in file_paths and output_artifact_path not in manifest_paths and not manifest_has(output_artifact_path):
|
| 734 |
+
output_artifact_path = "artifacts"
|
| 735 |
build_error_present = manifest_has("build_error_observation.json") or "build_error_observation.json" in file_paths or (bool(token) and _path_exists(f"{paths.root}/build_error_observation.json", token=token))
|
| 736 |
repair_decision_present = manifest_has("repair/REPAIR_DECISION.json") or "repair/REPAIR_DECISION.json" in file_paths or (bool(token) and _path_exists(f"{paths.root}/repair/REPAIR_DECISION.json", token=token))
|
| 737 |
blockage_present = manifest_has("repair/BLOCKAGE.json") or "repair/BLOCKAGE.json" in file_paths or (bool(token) and _path_exists(f"{paths.root}/repair/BLOCKAGE.json", token=token))
|
|
|
|
| 765 |
"present": smoke_present,
|
| 766 |
"url": _bucket_file_url(bucket_source, run_id, smoke_path),
|
| 767 |
},
|
| 768 |
+
{
|
| 769 |
+
"id": "smoke_output",
|
| 770 |
+
"label": "Output",
|
| 771 |
+
"subtitle": "Generated artifact",
|
| 772 |
+
"icon": "🖼️",
|
| 773 |
+
"present": output_artifact_present,
|
| 774 |
+
"url": _bucket_file_url(bucket_source, run_id, output_artifact_path) if output_artifact_path != "artifacts" else _bucket_tree_url(bucket_source, run_id, "artifacts"),
|
| 775 |
+
},
|
| 776 |
{
|
| 777 |
"id": "eval_publish",
|
| 778 |
"label": "Eval publish",
|
|
|
|
| 785 |
{
|
| 786 |
"id": "space_logs",
|
| 787 |
"label": "Space logs",
|
| 788 |
+
"subtitle": "Build/runtime log index" if space_logs_index_present else "Build/runtime logs",
|
| 789 |
"icon": "▣",
|
| 790 |
+
"present": space_logs_present,
|
| 791 |
+
"url": _bucket_file_url(bucket_source, run_id, space_logs_path) if space_logs_path != "logs" else _bucket_tree_url(bucket_source, run_id, "logs"),
|
| 792 |
"tone": "warn" if "failed" in status or "error" in status else "neutral",
|
| 793 |
},
|
| 794 |
{
|
|
|
|
| 850 |
}
|
| 851 |
)
|
| 852 |
if "failed" in status or "error" in status:
|
| 853 |
+
priority = {"report": 0, "blockage": 1, "build_error": 2, "space_logs": 3, "repair_decision": 4, "repair": 5, "blockers": 6, "pi_redacted_trace": 7, "smoke": 8, "smoke_output": 9, "eval_publish": 10}
|
| 854 |
docs.sort(key=lambda item: priority.get(str(item.get("id") or ""), 50))
|
| 855 |
return docs
|
| 856 |
|
|
|
|
| 1176 |
return True
|
| 1177 |
return False
|
| 1178 |
|
| 1179 |
+
|
| 1180 |
+
def _has_authoritative_runtime_success(
|
| 1181 |
+
*,
|
| 1182 |
+
final_status_reconciliation: dict[str, Any] | None = None,
|
| 1183 |
+
summary_file: dict[str, Any] | None = None,
|
| 1184 |
+
state: dict[str, Any] | None = None,
|
| 1185 |
+
live_status: dict[str, Any] | None = None,
|
| 1186 |
+
gate: dict[str, Any] | None = None,
|
| 1187 |
+
smoke: dict[str, Any] | None = None,
|
| 1188 |
+
) -> bool:
|
| 1189 |
+
"""Return true when a final runtime proof supersedes stale Pi/contract blockers.
|
| 1190 |
+
|
| 1191 |
+
v198.26.15: contract and Pi diagnostic signals are pre-runtime safety rails.
|
| 1192 |
+
They must still protect diagnostic-only demos, but they must not downgrade a
|
| 1193 |
+
run after the worker has published a final reconciliation/summary/state/live
|
| 1194 |
+
proof of ``full_inference_success`` or a strong inference gate.
|
| 1195 |
+
"""
|
| 1196 |
+
def explicit_full_status(source: dict[str, Any]) -> bool:
|
| 1197 |
+
for key in ("status", "final_status", "ui_status", "display_status", "effective_status", "effective_verdict", "verdict"):
|
| 1198 |
+
if str(source.get(key) or "").strip().lower() == "full_inference_success":
|
| 1199 |
+
return True
|
| 1200 |
+
return False
|
| 1201 |
+
|
| 1202 |
+
for source in (final_status_reconciliation or {}, summary_file or {}, state or {}):
|
| 1203 |
+
if not isinstance(source, dict):
|
| 1204 |
+
continue
|
| 1205 |
+
if explicit_full_status(source):
|
| 1206 |
+
return True
|
| 1207 |
+
if _truthy(source.get("generation_smoke_passed")) and _truthy(source.get("promise_fulfilled")):
|
| 1208 |
+
return True
|
| 1209 |
+
|
| 1210 |
+
live = live_status or {}
|
| 1211 |
+
if isinstance(live, dict):
|
| 1212 |
+
live_status_text = _classify_build_status_text(_source_status_text(live))
|
| 1213 |
+
live_stage = str(live.get("stage") or "").strip().lower()
|
| 1214 |
+
if live_stage == "done" and live_status_text == "full_inference_success":
|
| 1215 |
+
return True
|
| 1216 |
+
if live_stage == "done" and _truthy(live.get("generation_smoke_passed")):
|
| 1217 |
+
return True
|
| 1218 |
+
|
| 1219 |
+
gate_src = gate or {}
|
| 1220 |
+
if isinstance(gate_src, dict):
|
| 1221 |
+
if _truthy(gate_src.get("strong_full_inference_success")):
|
| 1222 |
+
return True
|
| 1223 |
+
if _classify_build_status_text(_source_status_text(gate_src)) == "full_inference_success" and _truthy(_nested_get(gate_src, "implementation_signals", "generation_smoke_passed")):
|
| 1224 |
+
return True
|
| 1225 |
+
|
| 1226 |
+
smoke_src = smoke or {}
|
| 1227 |
+
if isinstance(smoke_src, dict):
|
| 1228 |
+
# A lone smoke success is not enough: v198.18 diagnostic-only demos can
|
| 1229 |
+
# produce metrics. Only treat smoke as authoritative when paired with a
|
| 1230 |
+
# known generation endpoint and an explicit fulfilled promise marker.
|
| 1231 |
+
endpoint = smoke_src.get("api_name") or smoke_src.get("endpoint") or smoke_src.get("primary_api_name")
|
| 1232 |
+
if str(smoke_src.get("status") or "").strip().lower() == "success" and endpoint and _truthy(smoke_src.get("promise_fulfilled")):
|
| 1233 |
+
return True
|
| 1234 |
+
|
| 1235 |
+
return False
|
| 1236 |
+
|
| 1237 |
def _canonical_build_status_from_sources(
|
| 1238 |
*,
|
| 1239 |
state: dict[str, Any] | None = None,
|
|
|
|
| 1243 |
eval_record: dict[str, Any] | None = None,
|
| 1244 |
smoke: dict[str, Any] | None = None,
|
| 1245 |
gate: dict[str, Any] | None = None,
|
| 1246 |
+
live_status: dict[str, Any] | None = None,
|
| 1247 |
repair: dict[str, Any] | None = None,
|
| 1248 |
manual_validation: dict[str, Any] | None = None,
|
| 1249 |
eval_publish_status: dict[str, Any] | None = None,
|
|
|
|
| 1259 |
status so Run Explorer and Run Stats match the Active Run snapshot after a
|
| 1260 |
page load. Intermediate incident events remain phase diagnostics only.
|
| 1261 |
"""
|
| 1262 |
+
runtime_success_authoritative = _has_authoritative_runtime_success(
|
| 1263 |
+
final_status_reconciliation=final_status_reconciliation,
|
| 1264 |
+
summary_file=summary_file,
|
| 1265 |
+
state=state,
|
| 1266 |
+
live_status=live_status,
|
| 1267 |
+
gate=gate,
|
| 1268 |
+
smoke=smoke,
|
| 1269 |
+
)
|
| 1270 |
+
contract_blocks_success = False if runtime_success_authoritative else _contract_blocks_success(summary_file, state, gate, inference_contract, demo_quality_contract)
|
| 1271 |
# v198.26.1: eval_publish_status is an archive annotation, not a primary
|
| 1272 |
# run verdict source. It must not make a terminal build appear running/success
|
| 1273 |
# or override final reconciliation after a simple UI read.
|
|
|
|
| 1494 |
eval_record=eval_record,
|
| 1495 |
smoke=smoke or bundle.get("test_result") or {},
|
| 1496 |
gate=gate,
|
| 1497 |
+
live_status=bundle.get("live_status") or {},
|
| 1498 |
repair=bundle.get("repair_outcome") or {},
|
| 1499 |
manual_validation=manual_validation,
|
| 1500 |
eval_publish_status=bundle.get("eval_publish_status") or {},
|
src/effective_status.py
CHANGED
|
@@ -68,6 +68,8 @@ def _target_space_from_bundle(bundle: dict[str, Any]) -> str:
|
|
| 68 |
|
| 69 |
|
| 70 |
def _contract_declares_no_full_inference(bundle: dict[str, Any]) -> bool:
|
|
|
|
|
|
|
| 71 |
contract = bundle.get("inference_contract") or {}
|
| 72 |
quality = bundle.get("demo_quality_contract") or {}
|
| 73 |
gate = bundle.get("inference_gate") or {}
|
|
@@ -94,6 +96,39 @@ def _contract_declares_no_full_inference(bundle: dict[str, Any]) -> bool:
|
|
| 94 |
return False
|
| 95 |
|
| 96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
def _linked_rows(bundle: dict[str, Any]) -> list[dict[str, Any]]:
|
| 98 |
linked = bundle.get("linked_validations") or {}
|
| 99 |
rows = linked.get("validations") if isinstance(linked, dict) else linked
|
|
@@ -178,6 +213,8 @@ def compute_effective_run_status(
|
|
| 178 |
launch.get("status"),
|
| 179 |
"unknown",
|
| 180 |
)
|
|
|
|
|
|
|
| 181 |
normalized_build = _normalize_build_status(raw_build_status)
|
| 182 |
normalized_verdict = _normalize_build_status(build_verdict or normalized_build)
|
| 183 |
post = _successful_post_build_validation(bundle)
|
|
|
|
| 68 |
|
| 69 |
|
| 70 |
def _contract_declares_no_full_inference(bundle: dict[str, Any]) -> bool:
|
| 71 |
+
if _has_authoritative_runtime_success(bundle):
|
| 72 |
+
return False
|
| 73 |
contract = bundle.get("inference_contract") or {}
|
| 74 |
quality = bundle.get("demo_quality_contract") or {}
|
| 75 |
gate = bundle.get("inference_gate") or {}
|
|
|
|
| 96 |
return False
|
| 97 |
|
| 98 |
|
| 99 |
+
def _has_authoritative_runtime_success(bundle: dict[str, Any]) -> bool:
|
| 100 |
+
"""Return true when final runtime proof invalidates stale contract blockers."""
|
| 101 |
+
def explicit_full_status(source: dict[str, Any]) -> bool:
|
| 102 |
+
for key in ("status", "final_status", "ui_status", "display_status", "effective_status", "effective_verdict", "verdict"):
|
| 103 |
+
if _lower(source.get(key)) == "full_inference_success":
|
| 104 |
+
return True
|
| 105 |
+
return False
|
| 106 |
+
|
| 107 |
+
for source in (
|
| 108 |
+
bundle.get("final_status_reconciliation") or {},
|
| 109 |
+
bundle.get("summary") or bundle.get("summary_file") or {},
|
| 110 |
+
bundle.get("state") or {},
|
| 111 |
+
):
|
| 112 |
+
if not isinstance(source, dict):
|
| 113 |
+
continue
|
| 114 |
+
if explicit_full_status(source):
|
| 115 |
+
return True
|
| 116 |
+
if source.get("generation_smoke_passed") is True and source.get("promise_fulfilled") is True:
|
| 117 |
+
return True
|
| 118 |
+
|
| 119 |
+
live = bundle.get("live_status") or {}
|
| 120 |
+
if isinstance(live, dict):
|
| 121 |
+
if _lower(live.get("stage")) == "done" and _normalize_build_status(live.get("status")) == "full_inference_success":
|
| 122 |
+
return True
|
| 123 |
+
if _lower(live.get("stage")) == "done" and live.get("generation_smoke_passed") is True:
|
| 124 |
+
return True
|
| 125 |
+
|
| 126 |
+
gate = bundle.get("inference_gate") or {}
|
| 127 |
+
if isinstance(gate, dict) and gate.get("strong_full_inference_success") is True:
|
| 128 |
+
return True
|
| 129 |
+
return False
|
| 130 |
+
|
| 131 |
+
|
| 132 |
def _linked_rows(bundle: dict[str, Any]) -> list[dict[str, Any]]:
|
| 133 |
linked = bundle.get("linked_validations") or {}
|
| 134 |
rows = linked.get("validations") if isinstance(linked, dict) else linked
|
|
|
|
| 213 |
launch.get("status"),
|
| 214 |
"unknown",
|
| 215 |
)
|
| 216 |
+
if _has_authoritative_runtime_success(bundle):
|
| 217 |
+
raw_build_status = "full_inference_success"
|
| 218 |
normalized_build = _normalize_build_status(raw_build_status)
|
| 219 |
normalized_verdict = _normalize_build_status(build_verdict or normalized_build)
|
| 220 |
post = _successful_post_build_validation(bundle)
|
src/timeline_model.py
CHANGED
|
@@ -759,6 +759,8 @@ def _first_terminal_verdict_from_sources(bundle: dict[str, Any]) -> str:
|
|
| 759 |
bundle.get("effective_run_status") or {},
|
| 760 |
(bundle.get("summary") or {}).get("effective_run_status") if isinstance((bundle.get("summary") or {}).get("effective_run_status"), dict) else {},
|
| 761 |
bundle.get("eval_record") or {},
|
|
|
|
|
|
|
| 762 |
):
|
| 763 |
if isinstance(src, dict):
|
| 764 |
sources.append(src)
|
|
@@ -778,8 +780,9 @@ def _verdict(bundle: dict[str, Any]) -> str:
|
|
| 778 |
return terminal
|
| 779 |
gate = _gate(bundle)
|
| 780 |
state = bundle.get("state") or {}
|
|
|
|
| 781 |
repair = bundle.get("repair_outcome") or {}
|
| 782 |
-
for value in (
|
| 783 |
normalized = _normalize_verdict_token(value)
|
| 784 |
if normalized:
|
| 785 |
return normalized
|
|
|
|
| 759 |
bundle.get("effective_run_status") or {},
|
| 760 |
(bundle.get("summary") or {}).get("effective_run_status") if isinstance((bundle.get("summary") or {}).get("effective_run_status"), dict) else {},
|
| 761 |
bundle.get("eval_record") or {},
|
| 762 |
+
bundle.get("state") or {},
|
| 763 |
+
bundle.get("live_status") or {},
|
| 764 |
):
|
| 765 |
if isinstance(src, dict):
|
| 766 |
sources.append(src)
|
|
|
|
| 780 |
return terminal
|
| 781 |
gate = _gate(bundle)
|
| 782 |
state = bundle.get("state") or {}
|
| 783 |
+
live = bundle.get("live_status") or {}
|
| 784 |
repair = bundle.get("repair_outcome") or {}
|
| 785 |
+
for value in (state.get("status"), live.get("status") if _lower(live.get("stage")) == "done" else "", gate.get("status"), state.get("gate_status"), repair.get("post_repair_validation"), repair.get("failure_type")):
|
| 786 |
normalized = _normalize_verdict_token(value)
|
| 787 |
if normalized:
|
| 788 |
return normalized
|
src/version.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
| 3 |
-
ASF_APP_VERSION = "v198.26.
|
| 4 |
-
ASF_RELEASE_NAME = "Agentic Space Factory v198.26.
|
| 5 |
|
| 6 |
|
| 7 |
def resolve_app_version(value: str | None = None) -> str:
|
|
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
| 3 |
+
ASF_APP_VERSION = "v198.26.17"
|
| 4 |
+
ASF_RELEASE_NAME = "Agentic Space Factory v198.26.17"
|
| 5 |
|
| 6 |
|
| 7 |
def resolve_app_version(value: str | None = None) -> str:
|
src/view_models.py
CHANGED
|
@@ -182,12 +182,15 @@ def _first_authoritative_terminal_status(bundle: dict[str, Any]) -> tuple[str, s
|
|
| 182 |
summary = bundle.get("summary") or {}
|
| 183 |
if isinstance(summary.get("effective_run_status"), dict):
|
| 184 |
ordered_sources.append(("summary.effective_run_status", summary.get("effective_run_status") or {}))
|
| 185 |
-
#
|
| 186 |
-
#
|
|
|
|
|
|
|
| 187 |
ordered_sources.extend([
|
|
|
|
|
|
|
| 188 |
("inference_gate", bundle.get("inference_gate") or {}),
|
| 189 |
("generation_smoke", bundle.get("generation_smoke") or {}),
|
| 190 |
-
("live_status", bundle.get("live_status") or {}),
|
| 191 |
])
|
| 192 |
blocking_seen = False
|
| 193 |
for source_name, source in ordered_sources:
|
|
@@ -214,6 +217,22 @@ def _first_authoritative_terminal_status(bundle: dict[str, Any]) -> tuple[str, s
|
|
| 214 |
return "", ""
|
| 215 |
|
| 216 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 217 |
def _status_model_from_terminal_status(status: str, *, source: str = "") -> dict[str, str | bool]:
|
| 218 |
normalized = _normalize_terminal_status(status) or "unknown"
|
| 219 |
if normalized == "full_inference_success":
|
|
@@ -251,6 +270,8 @@ def requires_manual_action(bundle: dict[str, Any]) -> bool:
|
|
| 251 |
|
| 252 |
|
| 253 |
def has_technical_blocker(bundle: dict[str, Any]) -> bool:
|
|
|
|
|
|
|
| 254 |
blockers = bundle.get("technical_blockers") or {}
|
| 255 |
blocker_items = blockers.get("blockers") if isinstance(blockers, dict) else None
|
| 256 |
return bool(blocker_items or _raw_statuses(bundle).intersection(BLOCKED_RAW_STATUSES))
|
|
@@ -733,26 +754,104 @@ def build_validation_metrics(bundle: dict[str, Any]) -> dict[str, Any]:
|
|
| 733 |
}
|
| 734 |
return metrics
|
| 735 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 736 |
def _known_gradio_endpoint_info(bundle: dict[str, Any]) -> dict[str, Any]:
|
| 737 |
smoke = bundle.get("generation_smoke") or {}
|
| 738 |
gate = bundle.get("inference_gate") or {}
|
| 739 |
live = bundle.get("live_status") or {}
|
| 740 |
schema = bundle.get("api_schema") or bundle.get("gradio_schema") or {}
|
| 741 |
-
|
| 742 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 743 |
if not isinstance(source, dict):
|
| 744 |
continue
|
| 745 |
-
for key in ("discovered_api_names", "api_names", "endpoints", "api_endpoints", "named_endpoints"):
|
| 746 |
value = source.get(key)
|
| 747 |
if isinstance(value, list):
|
| 748 |
-
endpoints.extend(value)
|
| 749 |
-
|
| 750 |
-
|
| 751 |
-
|
| 752 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 753 |
|
| 754 |
|
| 755 |
def _contract_declares_no_full_inference(bundle: dict[str, Any]) -> bool:
|
|
|
|
|
|
|
| 756 |
contract = bundle.get("inference_contract") or bundle.get("INFERENCE_CONTRACT") or {}
|
| 757 |
if not isinstance(contract, dict):
|
| 758 |
contract = {}
|
|
@@ -803,6 +902,8 @@ def build_space_test_policy(bundle: dict[str, Any], status_model: dict[str, Any]
|
|
| 803 |
global_status = _lower(status_model.get("global_status"))
|
| 804 |
verdict = _lower(status_model.get("verdict"))
|
| 805 |
endpoint_info = _known_gradio_endpoint_info(bundle)
|
|
|
|
|
|
|
| 806 |
requires_discovery = bool(target and not endpoint_info.get("endpoint_known"))
|
| 807 |
runtime_stage = _lower(runtime.get("stage") or runtime.get("status")) if isinstance(runtime, dict) else ""
|
| 808 |
health_passed = bool((bundle.get("inference_gate") or {}).get("implementation_signals", {}).get("health_passed") or smoke.get("health_passed"))
|
|
@@ -831,6 +932,17 @@ def build_space_test_policy(bundle: dict[str, Any], status_model: dict[str, Any]
|
|
| 831 |
|
| 832 |
if not target:
|
| 833 |
return policy("unavailable", False, "no_target_space", "Space Test unavailable", "No generated Space is available to validate.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 834 |
if _repair_auth_context(bundle, status_model):
|
| 835 |
return policy("recover", True, "auth_refresh_required", "Retry after sign-in refresh", "Repair patch may have been uploaded, but validation could not continue because HF OAuth expired. Sign in again, then retry linked validation.", on_success="recovered_by_manual_validation", allow_recovery=True)
|
| 836 |
if _contract_declares_no_full_inference(bundle):
|
|
@@ -848,8 +960,12 @@ def build_space_test_policy(bundle: dict[str, Any], status_model: dict[str, Any]
|
|
| 848 |
return policy("replay", True, "manual_validation_already_passed", "Replay linked validation", "This Build Run already has a successful linked Space Test. You can replay the validation.", allow_replay=True)
|
| 849 |
if raw_status in {"completed_with_warnings", "success_with_warnings"}:
|
| 850 |
return policy("replay", True, "completed_with_warnings", "Replay validation", "Build completed with warnings. Space Test can replay or confirm the validated endpoint.", allow_replay=True)
|
| 851 |
-
if global_status == "succeeded" or verdict in {"passed", "success"}:
|
| 852 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 853 |
if global_status == "partial" or verdict == "partial_validation" or raw_status in PARTIAL_RAW_STATUSES:
|
| 854 |
return policy("complete", True, "partial_generation_not_verified", "Complete validation", "Automatic smoke did not verify generation. Run linked Space Test to complete validation.", on_success="validated_after_manual_space_test")
|
| 855 |
if global_status == "waiting_manual_action" or status_model.get("requires_manual_action"):
|
|
@@ -878,9 +994,10 @@ def build_space_test_model(bundle: dict[str, Any], status_model: dict[str, Any])
|
|
| 878 |
endpoint = ""
|
| 879 |
else:
|
| 880 |
endpoint = policy.get("endpoint") or smoke.get("api_name") or smoke.get("endpoint") or "/generate"
|
| 881 |
-
|
| 882 |
-
|
| 883 |
-
|
|
|
|
| 884 |
return {
|
| 885 |
"target_space": policy.get("target_space") or summary.get("target_space") or "",
|
| 886 |
"target_space_url": policy.get("target_space_url") or summary.get("target_space_url") or "",
|
|
|
|
| 182 |
summary = bundle.get("summary") or {}
|
| 183 |
if isinstance(summary.get("effective_run_status"), dict):
|
| 184 |
ordered_sources.append(("summary.effective_run_status", summary.get("effective_run_status") or {}))
|
| 185 |
+
# State/live_status are runtime artifacts written after the worker has seen
|
| 186 |
+
# the generated Space. They are stronger than stale Pi/contract/gate
|
| 187 |
+
# diagnostic blockers, but still lower priority than final reconciliation and
|
| 188 |
+
# summary.
|
| 189 |
ordered_sources.extend([
|
| 190 |
+
("state", bundle.get("state") or {}),
|
| 191 |
+
("live_status", bundle.get("live_status") or {}),
|
| 192 |
("inference_gate", bundle.get("inference_gate") or {}),
|
| 193 |
("generation_smoke", bundle.get("generation_smoke") or {}),
|
|
|
|
| 194 |
])
|
| 195 |
blocking_seen = False
|
| 196 |
for source_name, source in ordered_sources:
|
|
|
|
| 217 |
return "", ""
|
| 218 |
|
| 219 |
|
| 220 |
+
def _has_authoritative_runtime_success(bundle: dict[str, Any]) -> bool:
|
| 221 |
+
status, _source = _first_authoritative_terminal_status(bundle)
|
| 222 |
+
if status == "full_inference_success":
|
| 223 |
+
return True
|
| 224 |
+
live = bundle.get("live_status") or {}
|
| 225 |
+
if isinstance(live, dict):
|
| 226 |
+
if _lower(live.get("stage")) == "done" and _normalize_terminal_status(live.get("status")) == "full_inference_success":
|
| 227 |
+
return True
|
| 228 |
+
if _lower(live.get("stage")) == "done" and live.get("generation_smoke_passed") is True:
|
| 229 |
+
return True
|
| 230 |
+
gate = bundle.get("inference_gate") or {}
|
| 231 |
+
if isinstance(gate, dict) and gate.get("strong_full_inference_success") is True:
|
| 232 |
+
return True
|
| 233 |
+
return False
|
| 234 |
+
|
| 235 |
+
|
| 236 |
def _status_model_from_terminal_status(status: str, *, source: str = "") -> dict[str, str | bool]:
|
| 237 |
normalized = _normalize_terminal_status(status) or "unknown"
|
| 238 |
if normalized == "full_inference_success":
|
|
|
|
| 270 |
|
| 271 |
|
| 272 |
def has_technical_blocker(bundle: dict[str, Any]) -> bool:
|
| 273 |
+
if _has_authoritative_runtime_success(bundle):
|
| 274 |
+
return False
|
| 275 |
blockers = bundle.get("technical_blockers") or {}
|
| 276 |
blocker_items = blockers.get("blockers") if isinstance(blockers, dict) else None
|
| 277 |
return bool(blocker_items or _raw_statuses(bundle).intersection(BLOCKED_RAW_STATUSES))
|
|
|
|
| 754 |
}
|
| 755 |
return metrics
|
| 756 |
|
| 757 |
+
def _normalize_gradio_api_name(value: Any) -> str:
|
| 758 |
+
text = str(value or "").strip()
|
| 759 |
+
if not text:
|
| 760 |
+
return ""
|
| 761 |
+
if text.lower() in {"none", "null", "false"}:
|
| 762 |
+
return ""
|
| 763 |
+
if text.startswith("/"):
|
| 764 |
+
return text
|
| 765 |
+
return f"/{text}"
|
| 766 |
+
|
| 767 |
+
|
| 768 |
+
def _automatic_smoke_passed(bundle: dict[str, Any]) -> bool:
|
| 769 |
+
smoke = bundle.get("generation_smoke") or {}
|
| 770 |
+
state = bundle.get("state") or {}
|
| 771 |
+
summary = bundle.get("summary") or {}
|
| 772 |
+
summary_file = bundle.get("summary_file") or {}
|
| 773 |
+
gate = bundle.get("inference_gate") or {}
|
| 774 |
+
gate_smoke = gate.get("generation_smoke") if isinstance(gate.get("generation_smoke"), dict) else {}
|
| 775 |
+
final = bundle.get("final_status_reconciliation") or {}
|
| 776 |
+
test_result = bundle.get("test_result") or {}
|
| 777 |
+
sources = (smoke, gate_smoke, final, summary, summary_file, state, test_result)
|
| 778 |
+
for source in sources:
|
| 779 |
+
if not isinstance(source, dict):
|
| 780 |
+
continue
|
| 781 |
+
if source.get("ok") is True:
|
| 782 |
+
return True
|
| 783 |
+
if _lower(source.get("status")) == "success" and (
|
| 784 |
+
source is smoke
|
| 785 |
+
or source is gate_smoke
|
| 786 |
+
or source.get("latency_seconds") is not None
|
| 787 |
+
or source.get("output_artifact")
|
| 788 |
+
or source.get("artifact_url")
|
| 789 |
+
):
|
| 790 |
+
return True
|
| 791 |
+
if source.get("generation_smoke_passed") is True or source.get("smoke_test_passed") is True:
|
| 792 |
+
return True
|
| 793 |
+
signals = gate.get("implementation_signals") if isinstance(gate.get("implementation_signals"), dict) else {}
|
| 794 |
+
return bool(signals.get("generation_smoke_passed") is True or gate.get("strong_full_inference_success") is True)
|
| 795 |
+
|
| 796 |
+
|
| 797 |
+
def _smoke_payload_available(bundle: dict[str, Any]) -> bool:
|
| 798 |
+
for key in ("generation_smoke_payload", "generation_smoke_payload_retry", "resolved_validation_request", "validation_payload"):
|
| 799 |
+
payload = bundle.get(key)
|
| 800 |
+
if not isinstance(payload, dict):
|
| 801 |
+
continue
|
| 802 |
+
for payload_key in ("effective_args", "test_args", "args"):
|
| 803 |
+
if isinstance(payload.get(payload_key), list):
|
| 804 |
+
return True
|
| 805 |
+
for payload_key in ("effective_kwargs", "test_kwargs", "kwargs"):
|
| 806 |
+
if isinstance(payload.get(payload_key), dict):
|
| 807 |
+
return True
|
| 808 |
+
if payload.get("api_name") or payload.get("endpoint"):
|
| 809 |
+
return True
|
| 810 |
+
return False
|
| 811 |
+
|
| 812 |
+
|
| 813 |
def _known_gradio_endpoint_info(bundle: dict[str, Any]) -> dict[str, Any]:
|
| 814 |
smoke = bundle.get("generation_smoke") or {}
|
| 815 |
gate = bundle.get("inference_gate") or {}
|
| 816 |
live = bundle.get("live_status") or {}
|
| 817 |
schema = bundle.get("api_schema") or bundle.get("gradio_schema") or {}
|
| 818 |
+
state = bundle.get("state") or {}
|
| 819 |
+
summary = bundle.get("summary") or {}
|
| 820 |
+
summary_file = bundle.get("summary_file") or {}
|
| 821 |
+
final = bundle.get("final_status_reconciliation") or {}
|
| 822 |
+
launch = bundle.get("launch") or {}
|
| 823 |
+
payload = bundle.get("generation_smoke_payload") or {}
|
| 824 |
+
payload_retry = bundle.get("generation_smoke_payload_retry") or {}
|
| 825 |
+
resolved = bundle.get("resolved_validation_request") or {}
|
| 826 |
+
promise = state.get("promise_validation") if isinstance(state.get("promise_validation"), dict) else {}
|
| 827 |
+
gate_smoke = gate.get("generation_smoke") if isinstance(gate.get("generation_smoke"), dict) else {}
|
| 828 |
+
state_smoke = state.get("generation_smoke") if isinstance(state.get("generation_smoke"), dict) else {}
|
| 829 |
+
summary_smoke = summary.get("generation_smoke") if isinstance(summary.get("generation_smoke"), dict) else {}
|
| 830 |
+
|
| 831 |
+
endpoints: list[str] = []
|
| 832 |
+
for source in (smoke, gate_smoke, state_smoke, summary_smoke, gate, schema, live, state, summary, summary_file, final, launch, payload, payload_retry, resolved, promise):
|
| 833 |
if not isinstance(source, dict):
|
| 834 |
continue
|
| 835 |
+
for key in ("discovered_api_names", "api_names", "endpoints", "api_endpoints", "named_endpoints", "available_api_names"):
|
| 836 |
value = source.get(key)
|
| 837 |
if isinstance(value, list):
|
| 838 |
+
endpoints.extend(_normalize_gradio_api_name(item) for item in value if _normalize_gradio_api_name(item))
|
| 839 |
+
for key in ("api_name", "endpoint", "selected_api_name", "selected_endpoint", "primary_api_name", "api_endpoint", "generation_endpoint"):
|
| 840 |
+
endpoint_candidate = _normalize_gradio_api_name(source.get(key))
|
| 841 |
+
if endpoint_candidate:
|
| 842 |
+
endpoints.append(endpoint_candidate)
|
| 843 |
+
# Deduplicate while preserving discovery order.
|
| 844 |
+
endpoints = list(dict.fromkeys(e for e in endpoints if e))
|
| 845 |
+
endpoint = _first_nonempty(*endpoints)
|
| 846 |
+
runtime_success = _has_authoritative_runtime_success(bundle)
|
| 847 |
+
smoke_passed = _automatic_smoke_passed(bundle)
|
| 848 |
+
endpoint_known = bool(endpoint) or smoke_passed or runtime_success or _smoke_payload_available(bundle)
|
| 849 |
+
return {"endpoint": endpoint or "/generate", "endpoint_count": len(endpoints), "endpoint_known": endpoint_known, "endpoints": endpoints[:20]}
|
| 850 |
|
| 851 |
|
| 852 |
def _contract_declares_no_full_inference(bundle: dict[str, Any]) -> bool:
|
| 853 |
+
if _has_authoritative_runtime_success(bundle):
|
| 854 |
+
return False
|
| 855 |
contract = bundle.get("inference_contract") or bundle.get("INFERENCE_CONTRACT") or {}
|
| 856 |
if not isinstance(contract, dict):
|
| 857 |
contract = {}
|
|
|
|
| 902 |
global_status = _lower(status_model.get("global_status"))
|
| 903 |
verdict = _lower(status_model.get("verdict"))
|
| 904 |
endpoint_info = _known_gradio_endpoint_info(bundle)
|
| 905 |
+
runtime_success = _has_authoritative_runtime_success(bundle)
|
| 906 |
+
smoke_passed = _automatic_smoke_passed(bundle)
|
| 907 |
requires_discovery = bool(target and not endpoint_info.get("endpoint_known"))
|
| 908 |
runtime_stage = _lower(runtime.get("stage") or runtime.get("status")) if isinstance(runtime, dict) else ""
|
| 909 |
health_passed = bool((bundle.get("inference_gate") or {}).get("implementation_signals", {}).get("health_passed") or smoke.get("health_passed"))
|
|
|
|
| 932 |
|
| 933 |
if not target:
|
| 934 |
return policy("unavailable", False, "no_target_space", "Space Test unavailable", "No generated Space is available to validate.")
|
| 935 |
+
# v198.26.16: runtime proof beats stale Pi/contract policy blockers. If the
|
| 936 |
+
# build has a terminal full-inference proof or a successful automatic smoke
|
| 937 |
+
# replay source, the Space Test panel must expose a replayable validation
|
| 938 |
+
# context instead of resurrecting "no generation endpoint".
|
| 939 |
+
if runtime_success or (smoke_passed and (global_status == "succeeded" or verdict in {"passed", "success", "full_inference_success"})):
|
| 940 |
+
replay = policy("replay", True, "automatic_smoke_passed", "Replay automatic smoke", "Automatic smoke test passed. You can replay the validated request.", allow_replay=True)
|
| 941 |
+
replay["runtime_proof_authoritative"] = bool(runtime_success)
|
| 942 |
+
replay["automatic_smoke_passed"] = bool(smoke_passed)
|
| 943 |
+
replay["no_generation_endpoint"] = False
|
| 944 |
+
replay["can_retry_schema"] = True
|
| 945 |
+
return replay
|
| 946 |
if _repair_auth_context(bundle, status_model):
|
| 947 |
return policy("recover", True, "auth_refresh_required", "Retry after sign-in refresh", "Repair patch may have been uploaded, but validation could not continue because HF OAuth expired. Sign in again, then retry linked validation.", on_success="recovered_by_manual_validation", allow_recovery=True)
|
| 948 |
if _contract_declares_no_full_inference(bundle):
|
|
|
|
| 960 |
return policy("replay", True, "manual_validation_already_passed", "Replay linked validation", "This Build Run already has a successful linked Space Test. You can replay the validation.", allow_replay=True)
|
| 961 |
if raw_status in {"completed_with_warnings", "success_with_warnings"}:
|
| 962 |
return policy("replay", True, "completed_with_warnings", "Replay validation", "Build completed with warnings. Space Test can replay or confirm the validated endpoint.", allow_replay=True)
|
| 963 |
+
if global_status == "succeeded" or verdict in {"passed", "success", "full_inference_success"}:
|
| 964 |
+
replay = policy("replay", True, "automatic_smoke_passed", "Replay automatic smoke", "Automatic smoke test passed. You can replay the validated request.", allow_replay=True)
|
| 965 |
+
replay["automatic_smoke_passed"] = bool(smoke_passed)
|
| 966 |
+
replay["no_generation_endpoint"] = False
|
| 967 |
+
replay["can_retry_schema"] = True
|
| 968 |
+
return replay
|
| 969 |
if global_status == "partial" or verdict == "partial_validation" or raw_status in PARTIAL_RAW_STATUSES:
|
| 970 |
return policy("complete", True, "partial_generation_not_verified", "Complete validation", "Automatic smoke did not verify generation. Run linked Space Test to complete validation.", on_success="validated_after_manual_space_test")
|
| 971 |
if global_status == "waiting_manual_action" or status_model.get("requires_manual_action"):
|
|
|
|
| 994 |
endpoint = ""
|
| 995 |
else:
|
| 996 |
endpoint = policy.get("endpoint") or smoke.get("api_name") or smoke.get("endpoint") or "/generate"
|
| 997 |
+
policy_blocks = policy.get("enabled") is False and policy.get("mode") in {"blocked", "unavailable"}
|
| 998 |
+
parent_blocked = bool(policy_blocks and (_lower(status_model.get("global_status")) in {"blocked", "failed", "auth_refresh_required", "cancelled"} or _lower(status_model.get("verdict")) in BLOCKED_RAW_STATUSES | FAILED_RAW_STATUSES | AUTH_RAW_STATUSES | {"cancelled", "stopped"}))
|
| 999 |
+
smoke_evidence_passed = bool(metrics.get("generation_smoke_passed") or smoke.get("ok") or smoke.get("status") == "success" or policy.get("automatic_smoke_passed") is True)
|
| 1000 |
+
preview_status = "blocked" if parent_blocked else "passed" if smoke_evidence_passed or policy.get("mode") == "replay" else "pending"
|
| 1001 |
return {
|
| 1002 |
"target_space": policy.get("target_space") or summary.get("target_space") or "",
|
| 1003 |
"target_space_url": policy.get("target_space_url") or summary.get("target_space_url") or "",
|
src/worker_payload.py
CHANGED
|
@@ -35,8 +35,8 @@ DEFAULT_PREFERRED_SPACE_HARDWARE = "zero-a10g"
|
|
| 35 |
DEFAULT_FALLBACK_SPACE_HARDWARE = "a10g-large"
|
| 36 |
DEFAULT_MODEL_ID = "sshleifer/tiny-gpt2"
|
| 37 |
MAX_PI_REPAIR_ATTEMPTS = 3
|
| 38 |
-
APP_VERSION = "v198.26.
|
| 39 |
-
app_version = "v198.26.
|
| 40 |
|
| 41 |
# Internal agent/recovery files may be needed inside the transient Pi
|
| 42 |
# workspace, but they should not be published to the generated Space or shown
|
|
@@ -12563,7 +12563,7 @@ def smoke_generate(target_space_id: str, token: str, run_dir: Path, events_path:
|
|
| 12563 |
# write_json(run_dir / "tests" / "payload_source.json", payload_source_record)
|
| 12564 |
# write_json(run_dir / "tests" / "replay_source.json", replay_source)
|
| 12565 |
# write_json(run_dir / "tests" / "validation_preflight.json", validation_preflight)
|
| 12566 |
-
app_version = "v198.26.
|
| 12567 |
engine_version = "unified_gradio_validation_harness_v198_25_3"
|
| 12568 |
parent_build_run_id = os.environ.get("PARENT_BUILD_RUN_ID", "").strip()
|
| 12569 |
validation_mode = os.environ.get("VALIDATION_MODE") or os.environ.get("SPACE_TEST_POLICY_MODE") or "linked"
|
|
|
|
| 35 |
DEFAULT_FALLBACK_SPACE_HARDWARE = "a10g-large"
|
| 36 |
DEFAULT_MODEL_ID = "sshleifer/tiny-gpt2"
|
| 37 |
MAX_PI_REPAIR_ATTEMPTS = 3
|
| 38 |
+
APP_VERSION = "v198.26.17"
|
| 39 |
+
app_version = "v198.26.17"
|
| 40 |
|
| 41 |
# Internal agent/recovery files may be needed inside the transient Pi
|
| 42 |
# workspace, but they should not be published to the generated Space or shown
|
|
|
|
| 12563 |
# write_json(run_dir / "tests" / "payload_source.json", payload_source_record)
|
| 12564 |
# write_json(run_dir / "tests" / "replay_source.json", replay_source)
|
| 12565 |
# write_json(run_dir / "tests" / "validation_preflight.json", validation_preflight)
|
| 12566 |
+
app_version = "v198.26.17"
|
| 12567 |
engine_version = "unified_gradio_validation_harness_v198_25_3"
|
| 12568 |
parent_build_run_id = os.environ.get("PARENT_BUILD_RUN_ID", "").strip()
|
| 12569 |
validation_mode = os.environ.get("VALIDATION_MODE") or os.environ.get("SPACE_TEST_POLICY_MODE") or "linked"
|