Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Upload 15 files
Browse files- src/version.py +2 -2
- src/worker_payload.py +16 -16
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.32"
|
| 4 |
+
ASF_RELEASE_NAME = "Agentic Space Factory v198.26.32"
|
| 5 |
|
| 6 |
|
| 7 |
def resolve_app_version(value: str | None = None) -> str:
|
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
|
|
@@ -4993,7 +4993,7 @@ def load_recipe_repair_context(workspace: Path | None, run_dir: Path | None) ->
|
|
| 4993 |
except Exception:
|
| 4994 |
runtime_contract = {}
|
| 4995 |
return {
|
| 4996 |
-
"schema_version": "recipe_repair_context.
|
| 4997 |
"model_recipe": recipe,
|
| 4998 |
"model_recipe_source": recipe_source,
|
| 4999 |
"app_runtime_contract": runtime_contract,
|
|
@@ -5047,7 +5047,7 @@ def match_recipe_known_failure_signature(error_text: str = "", recipe: dict | No
|
|
| 5047 |
marker_matches = marker_matches or ["CLIPTextModel.text_model"]
|
| 5048 |
if class_matches or marker_matches:
|
| 5049 |
return {
|
| 5050 |
-
"schema_version": "recipe_known_failure_match.
|
| 5051 |
"matched": True,
|
| 5052 |
"failure_class": failure_class or fallback_class,
|
| 5053 |
"matched_markers": marker_matches[:10],
|
|
@@ -5058,8 +5058,8 @@ def match_recipe_known_failure_signature(error_text: str = "", recipe: dict | No
|
|
| 5058 |
"expected_output_type": recipe.get("expected_output_type") or runtime_contract.get("expected_output_type") or "",
|
| 5059 |
}
|
| 5060 |
if fallback_class:
|
| 5061 |
-
return {"schema_version": "recipe_known_failure_match.
|
| 5062 |
-
return {"schema_version": "recipe_known_failure_match.
|
| 5063 |
|
| 5064 |
|
| 5065 |
def recipe_family_repair_directives(recipe: dict | None = None, runtime_contract: dict | None = None, signature_match: dict | None = None) -> list[str]:
|
|
@@ -5101,7 +5101,7 @@ def write_recipe_aware_repair_packet(workspace: Path, run_dir: Path, failure_rea
|
|
| 5101 |
category = str((classification or {}).get("category") or (classification or {}).get("failure_class") or (decision or {}).get("failure_class") or "")
|
| 5102 |
match = match_recipe_known_failure_signature(failure_reason, recipe, runtime_contract, fallback_class=category)
|
| 5103 |
packet = {
|
| 5104 |
-
"schema_version": "recipe_aware_repair_packet.
|
| 5105 |
"authority": "MODEL_RECIPE.json + APP_RUNTIME_CONTRACT.json",
|
| 5106 |
**ctx,
|
| 5107 |
"known_failure_match": match,
|
|
@@ -5137,7 +5137,7 @@ def should_relaunch_after_no_patch(run_dir: Path, terminal_status: str, remainin
|
|
| 5137 |
result = str(latest.get("post_repair_result") or "")
|
| 5138 |
result_is_no_patch = result in {"repair_noop", "expected_file_not_modified", "diff_gate_failed", "sanity_failed"}
|
| 5139 |
can_retry = remaining_patch_budget > 0 and (terminal_status in no_patch_statuses or result_is_no_patch)
|
| 5140 |
-
return {"schema_version": "recipe_repair_retry_decision.
|
| 5141 |
|
| 5142 |
def write_smoke_repair_primary_error_packet(run_dir: Path, workspace: Path, generation_smoke: dict | None, *, failure_class: str = "") -> dict:
|
| 5143 |
smoke = generation_smoke if isinstance(generation_smoke, dict) else {}
|
|
@@ -10092,7 +10092,7 @@ def build_repair_task_packet(classification: dict, failure_reason: str = "", bui
|
|
| 10092 |
allowed_files = ["app.py", "INFERENCE_CONTRACT.json", "APP_RUNTIME_CONTRACT.json"]
|
| 10093 |
expected_fix = "Align the published Gradio schema and canonical smoke payload without changing model semantics; do not patch if this is validator-owned."
|
| 10094 |
packet = {
|
| 10095 |
-
"schema_version": "repair_task_packet.
|
| 10096 |
"task_type": task_type,
|
| 10097 |
"repair_mode": "deep_repair_reanalysis" if is_deep_repair_category(category) else "surgical_repair",
|
| 10098 |
"patch_mode": patch_mode,
|
|
@@ -15049,7 +15049,7 @@ def load_recipe_repair_context(workspace: Path | None, run_dir: Path | None) ->
|
|
| 15049 |
except Exception:
|
| 15050 |
runtime_contract = {}
|
| 15051 |
return {
|
| 15052 |
-
"schema_version": "recipe_repair_context.
|
| 15053 |
"model_recipe": recipe,
|
| 15054 |
"model_recipe_source": recipe_source,
|
| 15055 |
"app_runtime_contract": runtime_contract,
|
|
@@ -15103,7 +15103,7 @@ def match_recipe_known_failure_signature(error_text: str = "", recipe: dict | No
|
|
| 15103 |
marker_matches = marker_matches or ["CLIPTextModel.text_model"]
|
| 15104 |
if class_matches or marker_matches:
|
| 15105 |
return {
|
| 15106 |
-
"schema_version": "recipe_known_failure_match.
|
| 15107 |
"matched": True,
|
| 15108 |
"failure_class": failure_class or fallback_class,
|
| 15109 |
"matched_markers": marker_matches[:10],
|
|
@@ -15114,8 +15114,8 @@ def match_recipe_known_failure_signature(error_text: str = "", recipe: dict | No
|
|
| 15114 |
"expected_output_type": recipe.get("expected_output_type") or runtime_contract.get("expected_output_type") or "",
|
| 15115 |
}
|
| 15116 |
if fallback_class:
|
| 15117 |
-
return {"schema_version": "recipe_known_failure_match.
|
| 15118 |
-
return {"schema_version": "recipe_known_failure_match.
|
| 15119 |
|
| 15120 |
|
| 15121 |
def recipe_family_repair_directives(recipe: dict | None = None, runtime_contract: dict | None = None, signature_match: dict | None = None) -> list[str]:
|
|
@@ -15157,7 +15157,7 @@ def write_recipe_aware_repair_packet(workspace: Path, run_dir: Path, failure_rea
|
|
| 15157 |
category = str((classification or {}).get("category") or (classification or {}).get("failure_class") or (decision or {}).get("failure_class") or "")
|
| 15158 |
match = match_recipe_known_failure_signature(failure_reason, recipe, runtime_contract, fallback_class=category)
|
| 15159 |
packet = {
|
| 15160 |
-
"schema_version": "recipe_aware_repair_packet.
|
| 15161 |
"authority": "MODEL_RECIPE.json + APP_RUNTIME_CONTRACT.json",
|
| 15162 |
**ctx,
|
| 15163 |
"known_failure_match": match,
|
|
@@ -15193,7 +15193,7 @@ def should_relaunch_after_no_patch(run_dir: Path, terminal_status: str, remainin
|
|
| 15193 |
result = str(latest.get("post_repair_result") or "")
|
| 15194 |
result_is_no_patch = result in {"repair_noop", "expected_file_not_modified", "diff_gate_failed", "sanity_failed"}
|
| 15195 |
can_retry = remaining_patch_budget > 0 and (terminal_status in no_patch_statuses or result_is_no_patch)
|
| 15196 |
-
return {"schema_version": "recipe_repair_retry_decision.
|
| 15197 |
|
| 15198 |
def write_smoke_repair_primary_error_packet(run_dir: Path, workspace: Path, generation_smoke: dict | None, *, failure_class: str = "") -> dict:
|
| 15199 |
smoke = generation_smoke if isinstance(generation_smoke, dict) else {}
|
|
@@ -16670,7 +16670,7 @@ def smoke_generate(target_space_id: str, token: str, run_dir: Path, events_path:
|
|
| 16670 |
# write_json(run_dir / "tests" / "payload_source.json", payload_source_record)
|
| 16671 |
# write_json(run_dir / "tests" / "replay_source.json", replay_source)
|
| 16672 |
# write_json(run_dir / "tests" / "validation_preflight.json", validation_preflight)
|
| 16673 |
-
app_version = "v198.26.
|
| 16674 |
engine_version = "unified_gradio_validation_harness_v198_25_3"
|
| 16675 |
parent_build_run_id = os.environ.get("PARENT_BUILD_RUN_ID", "").strip()
|
| 16676 |
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.32"
|
| 39 |
+
app_version = "v198.26.32"
|
| 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
|
|
|
|
| 4993 |
except Exception:
|
| 4994 |
runtime_contract = {}
|
| 4995 |
return {
|
| 4996 |
+
"schema_version": "recipe_repair_context.v198_26_32",
|
| 4997 |
"model_recipe": recipe,
|
| 4998 |
"model_recipe_source": recipe_source,
|
| 4999 |
"app_runtime_contract": runtime_contract,
|
|
|
|
| 5047 |
marker_matches = marker_matches or ["CLIPTextModel.text_model"]
|
| 5048 |
if class_matches or marker_matches:
|
| 5049 |
return {
|
| 5050 |
+
"schema_version": "recipe_known_failure_match.v198_26_32",
|
| 5051 |
"matched": True,
|
| 5052 |
"failure_class": failure_class or fallback_class,
|
| 5053 |
"matched_markers": marker_matches[:10],
|
|
|
|
| 5058 |
"expected_output_type": recipe.get("expected_output_type") or runtime_contract.get("expected_output_type") or "",
|
| 5059 |
}
|
| 5060 |
if fallback_class:
|
| 5061 |
+
return {"schema_version": "recipe_known_failure_match.v198_26_32", "matched": False, "failure_class": fallback_class, "matched_markers": [], "repair_focus": "No catalog signature matched; still use MODEL_RECIPE.json and APP_RUNTIME_CONTRACT.json as authoritative repair context.", "source_signature": {}, "model_family": recipe.get("model_family") or runtime_contract.get("model_family") or "", "loader_strategy": recipe.get("loader_strategy") or runtime_contract.get("loader_strategy") or "", "expected_output_type": recipe.get("expected_output_type") or runtime_contract.get("expected_output_type") or ""}
|
| 5062 |
+
return {"schema_version": "recipe_known_failure_match.v198_26_32", "matched": False, "failure_class": "", "matched_markers": [], "repair_focus": ""}
|
| 5063 |
|
| 5064 |
|
| 5065 |
def recipe_family_repair_directives(recipe: dict | None = None, runtime_contract: dict | None = None, signature_match: dict | None = None) -> list[str]:
|
|
|
|
| 5101 |
category = str((classification or {}).get("category") or (classification or {}).get("failure_class") or (decision or {}).get("failure_class") or "")
|
| 5102 |
match = match_recipe_known_failure_signature(failure_reason, recipe, runtime_contract, fallback_class=category)
|
| 5103 |
packet = {
|
| 5104 |
+
"schema_version": "recipe_aware_repair_packet.v198_26_32",
|
| 5105 |
"authority": "MODEL_RECIPE.json + APP_RUNTIME_CONTRACT.json",
|
| 5106 |
**ctx,
|
| 5107 |
"known_failure_match": match,
|
|
|
|
| 5137 |
result = str(latest.get("post_repair_result") or "")
|
| 5138 |
result_is_no_patch = result in {"repair_noop", "expected_file_not_modified", "diff_gate_failed", "sanity_failed"}
|
| 5139 |
can_retry = remaining_patch_budget > 0 and (terminal_status in no_patch_statuses or result_is_no_patch)
|
| 5140 |
+
return {"schema_version": "recipe_repair_retry_decision.v198_26_32", "relaunch": bool(can_retry), "terminal_status": terminal_status, "remaining_patch_budget": int(remaining_patch_budget or 0), "latest_attempt": latest, "reason": "retry_with_more_direct_recipe_aware_brief" if can_retry else "repair_exhausted_or_not_retryable"}
|
| 5141 |
|
| 5142 |
def write_smoke_repair_primary_error_packet(run_dir: Path, workspace: Path, generation_smoke: dict | None, *, failure_class: str = "") -> dict:
|
| 5143 |
smoke = generation_smoke if isinstance(generation_smoke, dict) else {}
|
|
|
|
| 10092 |
allowed_files = ["app.py", "INFERENCE_CONTRACT.json", "APP_RUNTIME_CONTRACT.json"]
|
| 10093 |
expected_fix = "Align the published Gradio schema and canonical smoke payload without changing model semantics; do not patch if this is validator-owned."
|
| 10094 |
packet = {
|
| 10095 |
+
"schema_version": "repair_task_packet.v198_26_32",
|
| 10096 |
"task_type": task_type,
|
| 10097 |
"repair_mode": "deep_repair_reanalysis" if is_deep_repair_category(category) else "surgical_repair",
|
| 10098 |
"patch_mode": patch_mode,
|
|
|
|
| 15049 |
except Exception:
|
| 15050 |
runtime_contract = {}
|
| 15051 |
return {
|
| 15052 |
+
"schema_version": "recipe_repair_context.v198_26_32",
|
| 15053 |
"model_recipe": recipe,
|
| 15054 |
"model_recipe_source": recipe_source,
|
| 15055 |
"app_runtime_contract": runtime_contract,
|
|
|
|
| 15103 |
marker_matches = marker_matches or ["CLIPTextModel.text_model"]
|
| 15104 |
if class_matches or marker_matches:
|
| 15105 |
return {
|
| 15106 |
+
"schema_version": "recipe_known_failure_match.v198_26_32",
|
| 15107 |
"matched": True,
|
| 15108 |
"failure_class": failure_class or fallback_class,
|
| 15109 |
"matched_markers": marker_matches[:10],
|
|
|
|
| 15114 |
"expected_output_type": recipe.get("expected_output_type") or runtime_contract.get("expected_output_type") or "",
|
| 15115 |
}
|
| 15116 |
if fallback_class:
|
| 15117 |
+
return {"schema_version": "recipe_known_failure_match.v198_26_32", "matched": False, "failure_class": fallback_class, "matched_markers": [], "repair_focus": "No catalog signature matched; still use MODEL_RECIPE.json and APP_RUNTIME_CONTRACT.json as authoritative repair context.", "source_signature": {}, "model_family": recipe.get("model_family") or runtime_contract.get("model_family") or "", "loader_strategy": recipe.get("loader_strategy") or runtime_contract.get("loader_strategy") or "", "expected_output_type": recipe.get("expected_output_type") or runtime_contract.get("expected_output_type") or ""}
|
| 15118 |
+
return {"schema_version": "recipe_known_failure_match.v198_26_32", "matched": False, "failure_class": "", "matched_markers": [], "repair_focus": ""}
|
| 15119 |
|
| 15120 |
|
| 15121 |
def recipe_family_repair_directives(recipe: dict | None = None, runtime_contract: dict | None = None, signature_match: dict | None = None) -> list[str]:
|
|
|
|
| 15157 |
category = str((classification or {}).get("category") or (classification or {}).get("failure_class") or (decision or {}).get("failure_class") or "")
|
| 15158 |
match = match_recipe_known_failure_signature(failure_reason, recipe, runtime_contract, fallback_class=category)
|
| 15159 |
packet = {
|
| 15160 |
+
"schema_version": "recipe_aware_repair_packet.v198_26_32",
|
| 15161 |
"authority": "MODEL_RECIPE.json + APP_RUNTIME_CONTRACT.json",
|
| 15162 |
**ctx,
|
| 15163 |
"known_failure_match": match,
|
|
|
|
| 15193 |
result = str(latest.get("post_repair_result") or "")
|
| 15194 |
result_is_no_patch = result in {"repair_noop", "expected_file_not_modified", "diff_gate_failed", "sanity_failed"}
|
| 15195 |
can_retry = remaining_patch_budget > 0 and (terminal_status in no_patch_statuses or result_is_no_patch)
|
| 15196 |
+
return {"schema_version": "recipe_repair_retry_decision.v198_26_32", "relaunch": bool(can_retry), "terminal_status": terminal_status, "remaining_patch_budget": int(remaining_patch_budget or 0), "latest_attempt": latest, "reason": "retry_with_more_direct_recipe_aware_brief" if can_retry else "repair_exhausted_or_not_retryable"}
|
| 15197 |
|
| 15198 |
def write_smoke_repair_primary_error_packet(run_dir: Path, workspace: Path, generation_smoke: dict | None, *, failure_class: str = "") -> dict:
|
| 15199 |
smoke = generation_smoke if isinstance(generation_smoke, dict) else {}
|
|
|
|
| 16670 |
# write_json(run_dir / "tests" / "payload_source.json", payload_source_record)
|
| 16671 |
# write_json(run_dir / "tests" / "replay_source.json", replay_source)
|
| 16672 |
# write_json(run_dir / "tests" / "validation_preflight.json", validation_preflight)
|
| 16673 |
+
app_version = "v198.26.32"
|
| 16674 |
engine_version = "unified_gradio_validation_harness_v198_25_3"
|
| 16675 |
parent_build_run_id = os.environ.get("PARENT_BUILD_RUN_ID", "").strip()
|
| 16676 |
validation_mode = os.environ.get("VALIDATION_MODE") or os.environ.get("SPACE_TEST_POLICY_MODE") or "linked"
|