Spaces:
Sleeping
Sleeping
fix: cast fallback action_type to Literal for Pylance compliance and remove image from repo root
Browse files- local_agent.py +6 -2
local_agent.py
CHANGED
|
@@ -87,7 +87,11 @@ def get_action(step: int, prompt: str) -> WhyDidItFailAction:
|
|
| 87 |
except Exception as exc:
|
| 88 |
print(f" [LOCAL] parse failed (step {step}): {exc} | raw: {text!r}", flush=True)
|
| 89 |
# Step-based progression: avoid re-inspecting the same source.
|
|
|
|
| 90 |
_fallback = ["inspect_logs", "inspect_config", "inspect_gradients", "submit_diagnosis"]
|
| 91 |
-
action_type =
|
|
|
|
|
|
|
|
|
|
| 92 |
diagnosis = "unknown" if action_type == "submit_diagnosis" else None
|
| 93 |
-
return WhyDidItFailAction(action_type=action_type, diagnosis=diagnosis, suggested_fix=None,reasoning=None)
|
|
|
|
| 87 |
except Exception as exc:
|
| 88 |
print(f" [LOCAL] parse failed (step {step}): {exc} | raw: {text!r}", flush=True)
|
| 89 |
# Step-based progression: avoid re-inspecting the same source.
|
| 90 |
+
from typing import cast, Literal
|
| 91 |
_fallback = ["inspect_logs", "inspect_config", "inspect_gradients", "submit_diagnosis"]
|
| 92 |
+
action_type = cast(
|
| 93 |
+
Literal["inspect_logs", "inspect_config", "inspect_gradients", "submit_diagnosis"],
|
| 94 |
+
_fallback[min(step - 1, len(_fallback) - 1)],
|
| 95 |
+
)
|
| 96 |
diagnosis = "unknown" if action_type == "submit_diagnosis" else None
|
| 97 |
+
return WhyDidItFailAction(action_type=action_type, diagnosis=diagnosis, suggested_fix=None, reasoning=None)
|