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
1 change: 1 addition & 0 deletions proofline/_mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def _decode(response: httpx2.Response, identity: int | None) -> dict[str, Any]:
if (
not isinstance(value, dict)
or value.get("jsonrpc") != "2.0"
or isinstance(value.get("id"), bool)
or value.get("id") != identity
or "error" in value
or not isinstance(value.get("result"), dict)
Expand Down
43 changes: 43 additions & 0 deletions tests/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -2235,6 +2235,49 @@ async def invoke() -> Any:
assert len(server.requests) == 9


@MODES
async def test_knowledge_rejects_boolean_initialize_response_id(mode: str) -> None:
def respond(request: Request, index: int) -> Reply:
body = json.loads(request.body)
assert request.path == "/mcp"
assert request.headers["Authorization"] == f"Bearer {TOKEN}"

if body["method"] == "initialize":
return Reply(
body={
"jsonrpc": "2.0",
"id": True,
"result": {"protocolVersion": "2025-11-25"},
}
)

if body["method"] == "notifications/initialized":
return Reply(status=202, body=b"")

assert body["method"] == "tools/call"
return Reply(
body={
"jsonrpc": "2.0",
"id": 2,
"result": {
"content": [{"type": "text", "text": "ok"}],
},
}
)

with Server(respond) as server:
async with session(mode, server.url) as client:

async def invoke() -> Any:
result = client.knowledge.get_wiki_page("owner/name", "index")
return await result if inspect.isawaitable(result) else result

with pytest.raises(ProoflineError):
await invoke()

assert len(server.requests) == 1


@MODES
async def test_fixes_preserve_unavailable_context_and_never_retry(mode: str) -> None:
observed: list[dict[str, Any]] = []
Expand Down