Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Format hook code and diagnostics tests
  • Loading branch information
Alanxtl committed Aug 27, 2026
commit 59b091b279a38beae290f8fe9f554a379efb7958
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,7 @@ class _ServerUnavailableError(RuntimeError):
def _http_failure_outcome(error: _HttpStatusError, *, operation: str) -> str | None:
if error.status == 401:
return "authentication_failed"
if (
error.status == 404
and error.path in _COMPATIBILITY_OR_AVAILABILITY_PATHS
and error.code is None
):
if error.status == 404 and error.path in _COMPATIBILITY_OR_AVAILABILITY_PATHS and error.code is None:
return "version_mismatch"
if error.status == 503:
return "server_unavailable"
Expand Down
6 changes: 1 addition & 5 deletions integrations/codex/plugins/powercontext/hooks/recall.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,7 @@ class _ServerUnavailableError(RuntimeError):
def _http_failure_outcome(error: _HttpStatusError, *, operation: str) -> str | None:
if error.status == 401:
return "authentication_failed"
if (
error.status == 404
and error.path in _COMPATIBILITY_OR_AVAILABILITY_PATHS
and error.code is None
):
if error.status == 404 and error.path in _COMPATIBILITY_OR_AVAILABILITY_PATHS and error.code is None:
return "version_mismatch"
if error.status == 503:
return "server_unavailable"
Expand Down
12 changes: 7 additions & 5 deletions tests/codex_plugin/test_recall.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,11 +686,13 @@ def test_flush_domain_error_remains_visible_as_an_automatic_failure(
monkeypatch.setattr(
sys,
"stdin",
io.StringIO(json.dumps({
"hook_event_name": "UserPromptSubmit",
"cwd": "/workspace/project",
"prompt": "Recall before flushing",
})),
io.StringIO(
json.dumps({
"hook_event_name": "UserPromptSubmit",
"cwd": "/workspace/project",
"prompt": "Recall before flushing",
})
),
)
monkeypatch.setattr(sys, "stdout", output)
monkeypatch.setattr(sys, "stderr", errors)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_hook_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _load_diagnostics(name: str, path: Path) -> ModuleType:


def _lock_holder_code() -> str:
return r'''
return r"""
import os
import sys
from pathlib import Path
Expand Down Expand Up @@ -67,7 +67,7 @@ def _lock_holder_code() -> str:
import fcntl

fcntl.flock(lock_file.fileno(), fcntl.LOCK_UN)
'''
"""


@pytest.mark.parametrize(
Expand Down
Loading