Skip to content
Merged
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 .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.0
rev: v0.15.12
hooks:
- id: ruff
args: [--fix]
Expand Down
2 changes: 1 addition & 1 deletion gateway/checkpoint_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ def capture_session_end_checkpoint(
# Apply redaction
transcript = self._redact_transcript(transcript)
tool_calls = self._redact_tool_calls(tool_calls)
except (TranscriptExtractError, ValueError):
except TranscriptExtractError, ValueError:
logger.debug(
"No transcript available for session-end checkpoint",
container_id=container_id,
Expand Down
2 changes: 1 addition & 1 deletion gateway/commit_registry_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def _post(
try:
raw = exc.read().decode("utf-8")
parsed = json.loads(raw) if raw else None
except (json.JSONDecodeError, Exception):
except json.JSONDecodeError, Exception:
parsed = None
return exc.code, parsed, f"HTTPError {exc.code}"
except (URLError, TimeoutError) as exc:
Expand Down
2 changes: 1 addition & 1 deletion gateway/confluence_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ def _parse_retry_after(value: str | None) -> int:
return _DEFAULT_RETRY_AFTER_SECONDS
try:
parsed = int(str(value).strip())
except (TypeError, ValueError):
except TypeError, ValueError:
return _DEFAULT_RETRY_AFTER_SECONDS
if parsed <= 0:
return _DEFAULT_RETRY_AFTER_SECONDS
Expand Down
16 changes: 8 additions & 8 deletions gateway/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ def _detached_head_hint(
timeout=2,
check=False,
)
except (OSError, subprocess.TimeoutExpired):
except OSError, subprocess.TimeoutExpired:
return ""
# Tight check: returncode 1 with no stdout and no stderr is unambiguously
# detached HEAD. Anything else (corrupt repo, missing .git, EAGAIN) gets
Expand Down Expand Up @@ -925,7 +925,7 @@ def _check_squid_health() -> dict[str, Any]:
timeout=5,
)
result["running"] = proc.returncode == 0
except (subprocess.TimeoutExpired, FileNotFoundError):
except subprocess.TimeoutExpired, FileNotFoundError:
pass

# Check if squid is actually accepting connections on port 3129.
Expand Down Expand Up @@ -2865,7 +2865,7 @@ def _int_param(name: str) -> int | None:
return None
try:
return int(val)
except (ValueError, TypeError):
except ValueError, TypeError:
return None


Expand Down Expand Up @@ -4834,7 +4834,7 @@ def jira_search() -> tuple[Response, int] | Response:
if max_results is not None:
try:
effective_max = max(1, min(int(max_results), 100))
except (TypeError, ValueError):
except TypeError, ValueError:
audit_log(
"jira_search_rejected",
"jira_search",
Expand Down Expand Up @@ -6213,7 +6213,7 @@ def _confluence_clamp_limit(value: Any) -> int | None:
return None
try:
parsed = int(value)
except (TypeError, ValueError):
except TypeError, ValueError:
raise ValueError("limit must be an integer") from None
if parsed <= 0:
raise ValueError("limit must be positive")
Expand Down Expand Up @@ -8759,7 +8759,7 @@ def _is_streaming_request(request_body: bytes) -> bool:
try:
body_json = json.loads(request_body)
return body_json.get("stream", False) is True
except (json.JSONDecodeError, TypeError):
except json.JSONDecodeError, TypeError:
return False


Expand All @@ -8784,7 +8784,7 @@ def _capture_non_streaming_response(

try:
response_json = json.loads(response_body)
except (json.JSONDecodeError, TypeError):
except json.JSONDecodeError, TypeError:
# For non-JSON responses (error pages, malformed responses), capture basic info
# This is important for debugging failed API calls
if status_code >= 400:
Expand Down Expand Up @@ -9074,7 +9074,7 @@ def proxy_anthropic_messages() -> tuple[Response, int] | Response:
# Parse request body for transcript capture
try:
request_json = json.loads(request_body)
except (json.JSONDecodeError, TypeError):
except json.JSONDecodeError, TypeError:
request_json = {}

client = get_anthropic_client()
Expand Down
2 changes: 1 addition & 1 deletion gateway/jira_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ def _parse_retry_after(value: str | None) -> int:
return _DEFAULT_RETRY_AFTER_SECONDS
try:
parsed = int(str(value).strip())
except (TypeError, ValueError):
except TypeError, ValueError:
return _DEFAULT_RETRY_AFTER_SECONDS
if parsed <= 0:
return _DEFAULT_RETRY_AFTER_SECONDS
Expand Down
2 changes: 1 addition & 1 deletion gateway/mem_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _read_rss_mb() -> float | None:
if line.startswith("VmRSS:"):
kb = int(line.split()[1])
return kb / 1024
except (OSError, ValueError):
except OSError, ValueError:
return None
return None

Expand Down
2 changes: 1 addition & 1 deletion gateway/phase_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def validate_repo_path(repo_path: Path) -> tuple[bool, str]:
resolved_base = base.resolve()
if resolved_base.exists() and resolved.is_relative_to(resolved_base):
return True, ""
except (OSError, ValueError):
except OSError, ValueError:
continue

return False, f"Path '{repo_path}' is not within allowed directories"
Expand Down
2 changes: 1 addition & 1 deletion gateway/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def _get_configured_user(self) -> str | None:

config = get_user_mode_config()
return config.get("github_user", "").lower() or None
except (ImportError, FileNotFoundError):
except ImportError, FileNotFoundError:
return None

def _is_configured_user_author(
Expand Down
2 changes: 1 addition & 1 deletion gateway/tests/test_edge_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def test_none_input(self):
try:
result = extract_branch_from_refspec(None)
assert result is None
except (TypeError, AttributeError):
except TypeError, AttributeError:
# Expected if function doesn't handle None
pass

Expand Down
2 changes: 1 addition & 1 deletion gateway/worktree_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2032,7 +2032,7 @@ def get_active_docker_containers() -> set[str]:
)
if result.returncode == 0:
return set(result.stdout.strip().split("\n")) - {""}
except (subprocess.TimeoutExpired, FileNotFoundError):
except subprocess.TimeoutExpired, FileNotFoundError:
pass
return set()

Expand Down
2 changes: 1 addition & 1 deletion integration_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def _kubectl_available() -> bool:
check=False,
)
return result.returncode == 0
except (FileNotFoundError, subprocess.TimeoutExpired):
except FileNotFoundError, subprocess.TimeoutExpired:
return False


Expand Down
2 changes: 1 addition & 1 deletion integration_tests/local_pipeline/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def _kubectl_available() -> bool:
check=False,
)
return result.returncode == 0
except (FileNotFoundError, subprocess.TimeoutExpired):
except FileNotFoundError, subprocess.TimeoutExpired:
return False


Expand Down
10 changes: 5 additions & 5 deletions integration_tests/local_pipeline/test_hitl_edge_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test_custom_input_recorded_in_decision(self, orchestrator_url: str) -> None:
pending = status_data["data"].get("pending_decision")
if pending:
resolve_decision(orchestrator_url, pipeline_id, pending["id"])
except (TimeoutError, AssertionError):
except TimeoutError, AssertionError:
break
except requests.RequestException:
pass
Expand Down Expand Up @@ -183,7 +183,7 @@ def test_resolve_nonexistent_decision_returns_404(self, orchestrator_url: str) -
pending = status_data["data"].get("pending_decision")
if pending:
resolve_decision(orchestrator_url, pipeline_id, pending["id"])
except (TimeoutError, AssertionError):
except TimeoutError, AssertionError:
break
except requests.RequestException:
pass
Expand Down Expand Up @@ -237,7 +237,7 @@ def test_resolve_already_resolved_returns_409(self, orchestrator_url: str) -> No
pending = status_data["data"].get("pending_decision")
if pending:
resolve_decision(orchestrator_url, pipeline_id, pending["id"])
except (TimeoutError, AssertionError):
except TimeoutError, AssertionError:
break
except requests.RequestException:
pass
Expand Down Expand Up @@ -315,7 +315,7 @@ def resolve_once() -> tuple[dict, int]:
pending = status_data["data"].get("pending_decision")
if pending:
resolve_decision(orchestrator_url, pipeline_id, pending["id"])
except (TimeoutError, AssertionError):
except TimeoutError, AssertionError:
break
except requests.RequestException:
pass
Expand Down Expand Up @@ -376,7 +376,7 @@ def test_invalid_resolution_value_returns_400(self, orchestrator_url: str) -> No
pending = status_data["data"].get("pending_decision")
if pending:
resolve_decision(orchestrator_url, pipeline_id, pending["id"])
except (TimeoutError, AssertionError):
except TimeoutError, AssertionError:
break
except requests.RequestException:
pass
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/test_error_recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_session_creation_with_invalid_mode(self, egg_stack):
)
# Either fails or returns error
assert not result.get("success", True) or "error" in str(result).lower()
except (requests.exceptions.HTTPError, ValueError):
except requests.exceptions.HTTPError, ValueError:
# Error is acceptable
pass

Expand Down
2 changes: 1 addition & 1 deletion orchestrator/commit_authorship_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ def _iter_all_shards(self) -> list[dict[str, Any]]:
data = json.loads(raw)
if isinstance(data, dict):
shards.append(data)
except (json.JSONDecodeError, OSError):
except json.JSONDecodeError, OSError:
logger.warning(
"Ignoring corrupt authorship shard: %s",
path,
Expand Down
2 changes: 1 addition & 1 deletion orchestrator/dag_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def _compute_wave_order(
for target_wave in sorted(target_groups, reverse=True):
insert_at = min(target_wave, len(non_reviewer_waves))
non_reviewer_waves.insert(insert_at, target_groups[target_wave])
except (ImportError, KeyError, ValueError):
except ImportError, KeyError, ValueError:
# Fallback: append at the end before reviewers
non_reviewer_waves.append(non_reviewer_rem)

Expand Down
12 changes: 6 additions & 6 deletions orchestrator/env_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get_message_poll_max_wait() -> int:
return DEFAULT_MESSAGE_POLL_MAX_WAIT_SECONDS
try:
val = int(raw)
except (TypeError, ValueError):
except TypeError, ValueError:
logger.warning(
"EGG_MESSAGE_POLL_MAX_WAIT=%r is not an integer; falling back to %ds",
raw,
Expand Down Expand Up @@ -124,7 +124,7 @@ def get_waitress_threads() -> int:
return DEFAULT_WAITRESS_THREADS
try:
val = int(raw)
except (TypeError, ValueError):
except TypeError, ValueError:
logger.warning(
"EGG_ORCH_WAITRESS_THREADS=%r is not an integer; falling back to %d",
raw,
Expand Down Expand Up @@ -160,7 +160,7 @@ def get_heartbeat_rate_limit() -> int:
return DEFAULT_HEARTBEAT_RATE_LIMIT_PER_MIN
try:
val = int(raw)
except (TypeError, ValueError):
except TypeError, ValueError:
logger.warning(
"EGG_HEARTBEAT_RATE_LIMIT=%r not an integer; falling back to %d/min",
raw,
Expand Down Expand Up @@ -214,7 +214,7 @@ def _coerce_positive_int(env_name: str, default: int) -> int:
return default
try:
val = int(raw)
except (TypeError, ValueError):
except TypeError, ValueError:
logger.warning(
"%s=%r is not an integer; falling back to %d",
env_name,
Expand All @@ -240,7 +240,7 @@ def _coerce_positive_float(env_name: str, default: float) -> float:
return default
try:
val = float(raw)
except (TypeError, ValueError):
except TypeError, ValueError:
logger.warning(
"%s=%r is not a number; falling back to %.1f",
env_name,
Expand Down Expand Up @@ -315,7 +315,7 @@ def get_state_store_probe_interval() -> float:
return DEFAULT_STATE_STORE_PROBE_INTERVAL_SECONDS
try:
val = float(raw)
except (TypeError, ValueError):
except TypeError, ValueError:
logger.warning(
"EGG_ORCH_STATE_STORE_PROBE_INTERVAL=%r is not a number; falling back to %.1fs",
raw,
Expand Down
2 changes: 1 addition & 1 deletion orchestrator/gateway_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1634,7 +1634,7 @@ def list_open_prs(
stdout = (result.get("data", {}) or {}).get("stdout", "") or ""
try:
items = json.loads(stdout) if stdout.strip() else []
except (ValueError, TypeError):
except ValueError, TypeError:
logger.debug(
"list_open_prs: gh stdout not JSON",
pipeline_id=pipeline_id,
Expand Down
2 changes: 1 addition & 1 deletion orchestrator/health_checks/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def _read_contract(self) -> dict[str, object]:
try:
raw = contract_path.read_text(errors="replace")
return json.loads(raw) # type: ignore[no-any-return]
except (json.JSONDecodeError, OSError):
except json.JSONDecodeError, OSError:
continue
return {}

Expand Down
2 changes: 1 addition & 1 deletion orchestrator/health_checks/tier1/state_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def _check_contract_consistency(

try:
contract = json.loads(contract_content)
except (json.JSONDecodeError, TypeError):
except json.JSONDecodeError, TypeError:
return None

# Look for tasks with status=pending in the contract
Expand Down
6 changes: 3 additions & 3 deletions orchestrator/health_checks/tier2/agent_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def _parse_verdict(text: str) -> tuple[HealthStatus, str]:

try:
data = json.loads(cleaned)
except (json.JSONDecodeError, ValueError):
except json.JSONDecodeError, ValueError:
return HealthStatus.HEALTHY, f"Could not parse verdict JSON: {text[:200]}"

raw_status = str(data.get("status", "")).upper()
Expand Down Expand Up @@ -184,7 +184,7 @@ def _run_inspector_container(
force=True,
cleanup_session=True,
)
except (DockerClientError, ContainerSpawnError):
except DockerClientError, ContainerSpawnError:
pass # Best effort cleanup


Expand Down Expand Up @@ -214,7 +214,7 @@ def _parse_container_output(logs: str) -> str:
try:
data = json.loads(stripped)
return str(data.get("raw_response", ""))
except (json.JSONDecodeError, ValueError):
except json.JSONDecodeError, ValueError:
continue

raise ValueError(f"No valid JSON found in container output: {logs[-300:]}")
Expand Down
4 changes: 2 additions & 2 deletions orchestrator/kubernetes_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def _parse_k8s_datetime(ts: Any) -> datetime | None:
return ts
try:
return datetime.fromisoformat(str(ts).replace("Z", "+00:00"))
except (ValueError, TypeError):
except ValueError, TypeError:
return None


Expand Down Expand Up @@ -954,7 +954,7 @@ def get_pod_status(
raise ImagePullError(f"Image pull failed for pod {pod_name}: {reason}")

return _pod_phase_to_status(phase)
except (PodNotFoundError, ImagePullError):
except PodNotFoundError, ImagePullError:
raise
except Exception as exc:
error_msg = str(exc).lower()
Expand Down
2 changes: 1 addition & 1 deletion orchestrator/kubernetes_spawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ def cleanup_pipeline(
if isinstance(job.agent_role, AgentRole)
else str(job.agent_role)
)
except (AttributeError, TypeError):
except AttributeError, TypeError:
pass
if role_label and isinstance(role_label, str):
worktree_ids_to_clean.add(f"{pipeline_id}-{role_label}")
Expand Down
Loading
Loading