Upload 15 files
Browse files- src/version.py +2 -2
- src/view_models.py +17 -3
- src/worker_payload.py +66 -6
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.10"
|
| 4 |
+
ASF_RELEASE_NAME = "Agentic Space Factory v198.26.10"
|
| 5 |
|
| 6 |
|
| 7 |
def resolve_app_version(value: str | None = None) -> str:
|
src/view_models.py
CHANGED
|
@@ -189,17 +189,27 @@ def _first_authoritative_terminal_status(bundle: dict[str, Any]) -> tuple[str, s
|
|
| 189 |
("generation_smoke", bundle.get("generation_smoke") or {}),
|
| 190 |
("live_status", bundle.get("live_status") or {}),
|
| 191 |
])
|
|
|
|
| 192 |
for source_name, source in ordered_sources:
|
| 193 |
if not isinstance(source, dict):
|
| 194 |
continue
|
| 195 |
for key in AUTHORITATIVE_TERMINAL_SOURCE_KEYS:
|
| 196 |
normalized = _normalize_terminal_status(source.get(key))
|
| 197 |
if normalized:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
return normalized, f"{source_name}.{key}"
|
| 199 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 200 |
return "full_inference_success", f"{source_name}.generation_smoke_passed"
|
| 201 |
signals = source.get("implementation_signals") if isinstance(source.get("implementation_signals"), dict) else {}
|
| 202 |
-
if signals.get("generation_smoke_passed") is True:
|
| 203 |
return "full_inference_success", f"{source_name}.implementation_signals.generation_smoke_passed"
|
| 204 |
return "", ""
|
| 205 |
|
|
@@ -868,11 +878,15 @@ def build_space_test_model(bundle: dict[str, Any], status_model: dict[str, Any])
|
|
| 868 |
endpoint = ""
|
| 869 |
else:
|
| 870 |
endpoint = policy.get("endpoint") or smoke.get("api_name") or smoke.get("endpoint") or "/generate"
|
|
|
|
|
|
|
|
|
|
| 871 |
return {
|
| 872 |
"target_space": policy.get("target_space") or summary.get("target_space") or "",
|
| 873 |
"target_space_url": policy.get("target_space_url") or summary.get("target_space_url") or "",
|
| 874 |
"endpoint": endpoint,
|
| 875 |
-
"status":
|
|
|
|
| 876 |
"latency_seconds": metrics.get("latency_seconds") or smoke.get("latency_seconds") or summary.get("latency_seconds"),
|
| 877 |
"observed_latency_seconds": metrics.get("observed_latency_seconds"),
|
| 878 |
"recommended_zero_gpu_duration_seconds": metrics.get("recommended_zero_gpu_duration_seconds"),
|
|
|
|
| 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:
|
| 194 |
if not isinstance(source, dict):
|
| 195 |
continue
|
| 196 |
for key in AUTHORITATIVE_TERMINAL_SOURCE_KEYS:
|
| 197 |
normalized = _normalize_terminal_status(source.get(key))
|
| 198 |
if normalized:
|
| 199 |
+
if normalized in BLOCKED_RAW_STATUSES | FAILED_RAW_STATUSES | MANUAL_RAW_STATUSES | AUTH_RAW_STATUSES | CANCELLED_RAW_STATUSES | {"stopped", "stale"}:
|
| 200 |
+
return normalized, f"{source_name}.{key}"
|
| 201 |
+
if normalized == "full_inference_success" and blocking_seen:
|
| 202 |
+
continue
|
| 203 |
return normalized, f"{source_name}.{key}"
|
| 204 |
+
raw_text = " ".join(_lower(source.get(k)) for k in AUTHORITATIVE_TERMINAL_SOURCE_KEYS if isinstance(source.get(k), (str, int, float, bool)))
|
| 205 |
+
if any(token in raw_text for token in ("technical_blocker", "technical blocker", "blocked", "failed", "manual_hardware_required", "auth_refresh_required", "stopped")):
|
| 206 |
+
blocking_seen = True
|
| 207 |
+
# Metrics/smoke are evidence, not a verdict. They may confirm success
|
| 208 |
+
# only when no authoritative blocking source has appeared earlier.
|
| 209 |
+
if not blocking_seen and (source.get("ok") is True or source.get("generation_smoke_passed") is True):
|
| 210 |
return "full_inference_success", f"{source_name}.generation_smoke_passed"
|
| 211 |
signals = source.get("implementation_signals") if isinstance(source.get("implementation_signals"), dict) else {}
|
| 212 |
+
if not blocking_seen and signals.get("generation_smoke_passed") is True:
|
| 213 |
return "full_inference_success", f"{source_name}.implementation_signals.generation_smoke_passed"
|
| 214 |
return "", ""
|
| 215 |
|
|
|
|
| 878 |
endpoint = ""
|
| 879 |
else:
|
| 880 |
endpoint = policy.get("endpoint") or smoke.get("api_name") or smoke.get("endpoint") or "/generate"
|
| 881 |
+
parent_blocked = _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"}
|
| 882 |
+
smoke_evidence_passed = bool(metrics.get("generation_smoke_passed") or smoke.get("ok") or smoke.get("status") == "success")
|
| 883 |
+
preview_status = "blocked" if parent_blocked else "passed" if smoke_evidence_passed else "pending"
|
| 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 "",
|
| 887 |
"endpoint": endpoint,
|
| 888 |
+
"status": preview_status,
|
| 889 |
+
"smoke_evidence_passed": smoke_evidence_passed,
|
| 890 |
"latency_seconds": metrics.get("latency_seconds") or smoke.get("latency_seconds") or summary.get("latency_seconds"),
|
| 891 |
"observed_latency_seconds": metrics.get("observed_latency_seconds"),
|
| 892 |
"recommended_zero_gpu_duration_seconds": metrics.get("recommended_zero_gpu_duration_seconds"),
|
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
|
|
@@ -3255,14 +3255,44 @@ def build_promise_validation_status(workspace: Path | None, validation: dict | N
|
|
| 3255 |
str(demo_contract.get("promise_fulfillment_risk") or ""),
|
| 3256 |
str(blockers.get("reason") or ""),
|
| 3257 |
]).lower()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3258 |
official_only = any(marker in official_only_text for marker in (
|
| 3259 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3260 |
))
|
| 3261 |
|
| 3262 |
health_passed = validation_health_passed(validation) or bool(generation_smoke.get("health_passed"))
|
| 3263 |
smoke_status_lower = str(generation_smoke.get("status") or "").lower()
|
| 3264 |
smoke_passed = smoke_status_lower == "success" or _as_bool_true(generation_smoke.get("ok"))
|
| 3265 |
demo_usable_smoke = smoke_status_lower == "demo_usable_smoke_passed" or _as_bool_true(generation_smoke.get("demo_usable_smoke_passed"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3266 |
no_full_reason = contract_no_full.get("declared") or fallback_only or real_inference_false or full_inference_false or diagnostic_level or official_only or manual_required
|
| 3267 |
|
| 3268 |
if manual_required:
|
|
@@ -9732,8 +9762,14 @@ def infer_generation_gate(workspace: Path, implementation_mode: str, validation:
|
|
| 9732 |
"returns a detailed diagnostic",
|
| 9733 |
"diagnostic report instead",
|
| 9734 |
"diagnostic demo",
|
| 9735 |
-
"
|
| 9736 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9737 |
"does not generate real",
|
| 9738 |
"does not load model weights",
|
| 9739 |
"does not generate real audio",
|
|
@@ -9752,6 +9788,30 @@ def infer_generation_gate(workspace: Path, implementation_mode: str, validation:
|
|
| 9752 |
minimal_smoke_ok = isinstance(generation_smoke, dict) and (generation_smoke.get("status") == "demo_usable_smoke_passed" or generation_smoke.get("demo_usable_smoke_passed") is True)
|
| 9753 |
full_inference_requested = implementation_mode in {"full-inference-gated", "full-inference-attempt"}
|
| 9754 |
promise_fulfilled = bool(promise_validation.get("promise_fulfilled"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9755 |
heuristic_marker_detected = any(m in combined for m in blocked_markers)
|
| 9756 |
scaffold_detected = bool(scaffold_detection.get("detected"))
|
| 9757 |
blocker_source = str(blockers.get("source") or "") if isinstance(blockers, dict) else ""
|
|
@@ -12503,7 +12563,7 @@ def smoke_generate(target_space_id: str, token: str, run_dir: Path, events_path:
|
|
| 12503 |
# write_json(run_dir / "tests" / "payload_source.json", payload_source_record)
|
| 12504 |
# write_json(run_dir / "tests" / "replay_source.json", replay_source)
|
| 12505 |
# write_json(run_dir / "tests" / "validation_preflight.json", validation_preflight)
|
| 12506 |
-
app_version = "v198.26.
|
| 12507 |
engine_version = "unified_gradio_validation_harness_v198_25_3"
|
| 12508 |
parent_build_run_id = os.environ.get("PARENT_BUILD_RUN_ID", "").strip()
|
| 12509 |
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.10"
|
| 39 |
+
app_version = "v198.26.10"
|
| 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
|
|
|
|
| 3255 |
str(demo_contract.get("promise_fulfillment_risk") or ""),
|
| 3256 |
str(blockers.get("reason") or ""),
|
| 3257 |
]).lower()
|
| 3258 |
+
# v198.26.10: "official Space" by itself is not a blocker. Pi often
|
| 3259 |
+
# mentions the upstream official Space as provenance or comparison even when
|
| 3260 |
+
# the generated Space implements real inference. Treat only explicit
|
| 3261 |
+
# redirect/only/not-implemented formulations as official-only blockers.
|
| 3262 |
official_only = any(marker in official_only_text for marker in (
|
| 3263 |
+
"only available in the official",
|
| 3264 |
+
"available only in the official",
|
| 3265 |
+
"use the official demo instead",
|
| 3266 |
+
"use the official space instead",
|
| 3267 |
+
"redirects to the official",
|
| 3268 |
+
"redirect to the official",
|
| 3269 |
+
"this space does not run inference",
|
| 3270 |
+
"this demo does not run inference",
|
| 3271 |
+
"does not generate real",
|
| 3272 |
+
"does not load model",
|
| 3273 |
+
"not generate real",
|
| 3274 |
+
"real inference is not implemented",
|
| 3275 |
+
"full inference is not implemented",
|
| 3276 |
+
"full inference deferred",
|
| 3277 |
))
|
| 3278 |
|
| 3279 |
health_passed = validation_health_passed(validation) or bool(generation_smoke.get("health_passed"))
|
| 3280 |
smoke_status_lower = str(generation_smoke.get("status") or "").lower()
|
| 3281 |
smoke_passed = smoke_status_lower == "success" or _as_bool_true(generation_smoke.get("ok"))
|
| 3282 |
demo_usable_smoke = smoke_status_lower == "demo_usable_smoke_passed" or _as_bool_true(generation_smoke.get("demo_usable_smoke_passed"))
|
| 3283 |
+
# A live canonical smoke with positive contracts is runtime proof. It must
|
| 3284 |
+
# override advisory/heuristic text such as a benign "official Space" mention.
|
| 3285 |
+
runtime_full_inference_proof = bool(
|
| 3286 |
+
smoke_passed
|
| 3287 |
+
and not contract_no_full.get("declared")
|
| 3288 |
+
and not fallback_only
|
| 3289 |
+
and not real_inference_false
|
| 3290 |
+
and not full_inference_false
|
| 3291 |
+
and not diagnostic_level
|
| 3292 |
+
and not manual_required
|
| 3293 |
+
)
|
| 3294 |
+
if runtime_full_inference_proof:
|
| 3295 |
+
official_only = False
|
| 3296 |
no_full_reason = contract_no_full.get("declared") or fallback_only or real_inference_false or full_inference_false or diagnostic_level or official_only or manual_required
|
| 3297 |
|
| 3298 |
if manual_required:
|
|
|
|
| 9762 |
"returns a detailed diagnostic",
|
| 9763 |
"diagnostic report instead",
|
| 9764 |
"diagnostic demo",
|
| 9765 |
+
"only available in the official",
|
| 9766 |
+
"available only in the official",
|
| 9767 |
+
"use the official demo instead",
|
| 9768 |
+
"use the official space instead",
|
| 9769 |
+
"redirects to the official",
|
| 9770 |
+
"redirect to the official",
|
| 9771 |
+
"this space does not run inference",
|
| 9772 |
+
"this demo does not run inference",
|
| 9773 |
"does not generate real",
|
| 9774 |
"does not load model weights",
|
| 9775 |
"does not generate real audio",
|
|
|
|
| 9788 |
minimal_smoke_ok = isinstance(generation_smoke, dict) and (generation_smoke.get("status") == "demo_usable_smoke_passed" or generation_smoke.get("demo_usable_smoke_passed") is True)
|
| 9789 |
full_inference_requested = implementation_mode in {"full-inference-gated", "full-inference-attempt"}
|
| 9790 |
promise_fulfilled = bool(promise_validation.get("promise_fulfilled"))
|
| 9791 |
+
# v198.26.10 contradiction guard: when a canonical live generation smoke
|
| 9792 |
+
# succeeds and the machine-readable contract does not declare no-full
|
| 9793 |
+
# inference, a broad/heuristic diagnostic promise must not manufacture a
|
| 9794 |
+
# blocker. This keeps metrics as evidence while preserving real explicit
|
| 9795 |
+
# blockers (contract_no_full/manual/scaffold).
|
| 9796 |
+
runtime_smoke_contract_positive = bool(
|
| 9797 |
+
full_inference_requested
|
| 9798 |
+
and smoke_ok
|
| 9799 |
+
and not contract_no_full
|
| 9800 |
+
and not promise_validation.get("manual_hardware_required")
|
| 9801 |
+
)
|
| 9802 |
+
if runtime_smoke_contract_positive and diagnostic_contract and not blockers:
|
| 9803 |
+
promise_validation = {
|
| 9804 |
+
**promise_validation,
|
| 9805 |
+
"promise_validation_status": "fulfilled",
|
| 9806 |
+
"promise_fulfilled": True,
|
| 9807 |
+
"ui_status": "full_inference_success",
|
| 9808 |
+
"ui_badge": "Full inference",
|
| 9809 |
+
"diagnostic_only": False,
|
| 9810 |
+
"reason": "A canonical live generation smoke test passed; heuristic diagnostic wording was downgraded.",
|
| 9811 |
+
"v198_26_10_runtime_smoke_overrode_diagnostic": True,
|
| 9812 |
+
}
|
| 9813 |
+
diagnostic_contract = False
|
| 9814 |
+
promise_fulfilled = True
|
| 9815 |
heuristic_marker_detected = any(m in combined for m in blocked_markers)
|
| 9816 |
scaffold_detected = bool(scaffold_detection.get("detected"))
|
| 9817 |
blocker_source = str(blockers.get("source") or "") if isinstance(blockers, dict) else ""
|
|
|
|
| 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.10"
|
| 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"
|