Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion skillopt/engine/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ def _extract_failure_patterns(
ft = fs.get("failure_type", "")
sd = fs.get("description", "")
analyst_descs.append(f"{ft}: {sd}" if sd else ft)
except Exception:
except (json.JSONDecodeError, OSError, AttributeError, TypeError):
pass

patterns = []
Expand Down
2 changes: 1 addition & 1 deletion skillopt/envs/spreadsheetbench/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def rollout(
for line in f:
try:
existing.append(json.loads(line))
except Exception:
except (json.JSONDecodeError, TypeError):
pass
if existing:
return existing
Expand Down
4 changes: 2 additions & 2 deletions skillopt/envs/spreadsheetbench/rollout.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ def run_spreadsheet_batch(
r = json.loads(line)
done_ids.add(str(r["id"]))
existing.append(r)
except Exception:
except (json.JSONDecodeError, KeyError, TypeError):
pass

pending = [it for it in items if str(it["id"]) not in done_ids]
Expand Down Expand Up @@ -875,7 +875,7 @@ def run_spreadsheet_batch_codegen(
r = json.loads(line)
done_ids.add(str(r["id"]))
existing.append(r)
except Exception:
except (json.JSONDecodeError, KeyError, TypeError):
pass

pending = [it for it in items if str(it["id"]) not in done_ids]
Expand Down
4 changes: 2 additions & 2 deletions skillopt/gradient/aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _merge_batch(
for e in merged.get(key, []):
e["merge_level"] = level
return merged
except Exception: # noqa: BLE001
except (ValueError, TypeError, KeyError, AttributeError, json.JSONDecodeError):
pass
# Fallback: concatenate all edits
all_edits = []
Expand Down Expand Up @@ -248,7 +248,7 @@ def merge_patches(
f"{len(f_edits)}+{len(s_edits)} → {len(final[key])} {payload_label(update_mode)}"
)
return final
except Exception: # noqa: BLE001
except (ValueError, TypeError, KeyError, AttributeError, json.JSONDecodeError):
pass

return {
Expand Down
22 changes: 11 additions & 11 deletions skillopt_sleep/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def judge(self, task: TaskRecord, response: str) -> Tuple[float, float, str]:
try:
soft = float(obj.get("score", 0.0))
return (1.0 if soft >= 0.8 else 0.0), soft, str(obj.get("reason", ""))[:200]
except Exception:
except (ValueError, TypeError):
pass
return 0.0, 0.0, "judge-parse-failed"

Expand Down Expand Up @@ -786,7 +786,7 @@ def _call(self, prompt: str, *, max_tokens: int = 1024) -> str:
try:
import shutil
shutil.rmtree(clean_cwd, ignore_errors=True)
except Exception:
except OSError:
pass
out = (proc.stdout or "").strip()
self._detect_cli_error(out, proc.stderr or "")
Expand Down Expand Up @@ -861,7 +861,7 @@ def attempt_with_tools(self, task, skill, memory, tools):
finally:
try:
shutil.rmtree(work, ignore_errors=True)
except Exception:
except OSError:
pass

def resolve_codex_path(explicit: str = "") -> str:
Expand Down Expand Up @@ -914,7 +914,7 @@ def resolve_codex_path(explicit: str = "") -> str:
# skip the bash shim that execs hermes
if head.startswith(b"#!") and b"bash" in head:
continue
except Exception:
except OSError:
pass
return c
return "codex"
Expand Down Expand Up @@ -1001,7 +1001,7 @@ def _call_once(self, prompt: str, *, max_tokens: int = 1024) -> str:
finally:
try:
os.unlink(out_path)
except Exception:
except OSError:
pass

# Fatal codex failures that will NOT recover on retry — fail fast + loud so a
Expand Down Expand Up @@ -1129,7 +1129,7 @@ def attempt_with_tools(self, task, skill, memory, tools):
try:
with open(out_path, encoding="utf-8") as f:
resp = f.read().strip()
except Exception:
except OSError:
resp = ""
# Surface a failed tool-rollout the SAME way _call does: an auth/model/version
# failure on this path must show up in diagnostics (call_error), not vanish as a
Expand All @@ -1148,7 +1148,7 @@ def attempt_with_tools(self, task, skill, memory, tools):
finally:
try:
shutil.rmtree(work, ignore_errors=True)
except Exception:
except OSError:
pass

def resolve_copilot_path(explicit: str = "") -> str:
Expand Down Expand Up @@ -1225,7 +1225,7 @@ def __init__(self, model: str = "", copilot_path: str = "", timeout: int = 240)
)
try:
os.makedirs(self.copilot_home, exist_ok=True)
except Exception:
except OSError:
self.copilot_home = ""

def _call(self, prompt: str, *, max_tokens: int = 1024) -> str:
Expand Down Expand Up @@ -1260,7 +1260,7 @@ def _call(self, prompt: str, *, max_tokens: int = 1024) -> str:
try:
import shutil
shutil.rmtree(clean_cwd, ignore_errors=True)
except Exception:
except OSError:
pass
return self._parse_jsonl_response(proc.stdout or "")

Expand All @@ -1273,7 +1273,7 @@ def _parse_jsonl_response(raw: str) -> str:
continue
try:
obj = json.loads(line)
except Exception:
except (json.JSONDecodeError, TypeError):
continue
if obj.get("type") == "assistant.message":
content = (obj.get("data") or {}).get("content")
Expand Down Expand Up @@ -1380,7 +1380,7 @@ def attempt_with_tools(self, task, skill, memory, tools):
finally:
try:
shutil.rmtree(work, ignore_errors=True)
except Exception:
except OSError:
pass


Expand Down