Skip to content
Closed
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 agent/auxiliary_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1700,7 +1700,7 @@ def _read_nous_auth() -> Optional[dict]:
try:
if not _AUTH_JSON_PATH.is_file():
return None
data = json.loads(_AUTH_JSON_PATH.read_text())
data = json.loads(_AUTH_JSON_PATH.read_text(encoding="utf-8"))
if data.get("active_provider") != "nous":
return None
provider = data.get("providers", {}).get("nous", {})
Expand Down
2 changes: 1 addition & 1 deletion agent/nous_rate_guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def record_nous_rate_limit(
# Atomic write: write to temp file + rename
fd, tmp_path = tempfile.mkstemp(dir=state_dir, suffix=".tmp")
try:
with os.fdopen(fd, "w") as f:
with os.fdopen(fd, "w", encoding="utf-8") as f:
json.dump(state, f)
atomic_replace(tmp_path, path)
except Exception:
Expand Down
4 changes: 2 additions & 2 deletions agent/shell_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ def allowlist_path() -> Path:
def load_allowlist() -> Dict[str, Any]:
"""Return the parsed allowlist, or an empty skeleton if absent."""
try:
raw = json.loads(allowlist_path().read_text())
raw = json.loads(allowlist_path().read_text(encoding="utf-8"))
except (FileNotFoundError, json.JSONDecodeError, OSError):
return {"approvals": []}
if not isinstance(raw, dict):
Expand All @@ -656,7 +656,7 @@ def save_allowlist(data: Dict[str, Any]) -> None:
prefix=f"{p.name}.", suffix=".tmp", dir=str(p.parent),
)
try:
with os.fdopen(fd, "w") as fh:
with os.fdopen(fd, "w", encoding="utf-8") as fh:
fh.write(json.dumps(data, indent=2, sort_keys=True))
atomic_replace(tmp_path, p)
except Exception:
Expand Down
4 changes: 2 additions & 2 deletions cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1454,7 +1454,7 @@ def _setup_worktree(repo_root: str = None, sync_base: bool = True) -> Optional[D
gitignore = Path(repo_root) / ".gitignore"
_ignore_entry = ".worktrees/"
try:
existing = gitignore.read_text() if gitignore.exists() else ""
existing = gitignore.read_text(encoding="utf-8") if gitignore.exists() else ""
if _ignore_entry not in existing.splitlines():
with open(gitignore, "a", encoding="utf-8") as f:
if existing and not existing.endswith("\n"):
Expand Down Expand Up @@ -1504,7 +1504,7 @@ def _setup_worktree(repo_root: str = None, sync_base: bool = True) -> Optional[D
try:
repo_root_resolved = Path(repo_root).resolve()
wt_path_resolved = wt_path.resolve()
for line in include_file.read_text().splitlines():
for line in include_file.read_text(encoding="utf-8").splitlines():
entry = line.strip()
if not entry or entry.startswith("#"):
continue
Expand Down
2 changes: 1 addition & 1 deletion hermes_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def get_hermes_home() -> Path:
try:
fallback_home = _get_platform_default_hermes_home()
active_path = fallback_home / "active_profile"
active = active_path.read_text().strip() if active_path.exists() else ""
active = active_path.read_text(encoding="utf-8").strip() if active_path.exists() else ""
except (UnicodeDecodeError, OSError):
active = ""
if active and active != "default":
Expand Down
2 changes: 1 addition & 1 deletion tools/managed_tool_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def _read_nous_provider_state() -> Optional[dict]:
path = auth_json_path()
if not path.is_file():
return None
data = json.loads(path.read_text())
data = json.loads(path.read_text(encoding="utf-8"))
providers = data.get("providers", {})
if not isinstance(providers, dict):
return None
Expand Down
2 changes: 1 addition & 1 deletion tools/xai_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def has_xai_credentials() -> bool:
auth_path = get_hermes_home() / "auth.json"
if not auth_path.exists():
return False
store = json.loads(auth_path.read_text())
store = json.loads(auth_path.read_text(encoding="utf-8"))
providers = store.get("providers") if isinstance(store, dict) else None
xai_state = providers.get("xai-oauth") if isinstance(providers, dict) else None
tokens = xai_state.get("tokens") if isinstance(xai_state, dict) else None
Expand Down
Loading