Conversation
plugins/communication_protocols/http/src/utcp_http/http_communication_protocol.py
Outdated
Show resolved
Hide resolved
| return await response.json() | ||
|
|
||
| content_type = response.headers.get('Content-Type', '') | ||
| if 'application/json' in content_type: |
Contributor
There was a problem hiding this comment.
JSON detection misses +json types (e.g., application/problem+json), causing JSON bodies to be returned as text instead of parsed objects.
Prompt for AI agents
Address the following comment on plugins/communication_protocols/http/src/utcp_http/http_communication_protocol.py at line 315:
<comment>JSON detection misses +json types (e.g., application/problem+json), causing JSON bodies to be returned as text instead of parsed objects.</comment>
<file context>
@@ -310,7 +310,11 @@ async def call_tool(self, caller, tool_name: str, tool_args: Dict[str, Any], too
- return await response.json()
+
+ content_type = response.headers.get('Content-Type', '')
+ if 'application/json' in content_type:
+ return await response.json()
+ return await response.text()
</file context>
| await session.close() | ||
|
|
||
| Deregister an SSE manual.""" | ||
| pass |
Contributor
There was a problem hiding this comment.
Required deregistration is unimplemented, leading to potential resource leaks (open ClientSession/response) and noncompliance with the interface expectations.
Prompt for AI agents
Address the following comment on plugins/communication_protocols/http/src/utcp_http/sse_communication_protocol.py at line 151:
<comment>Required deregistration is unimplemented, leading to potential resource leaks (open ClientSession/response) and noncompliance with the interface expectations.</comment>
<file context>
@@ -148,13 +147,9 @@ async def register_manual(self, caller, manual_call_template: CallTemplate) -> R
- await session.close()
-
+ Deregister an SSE manual."""
+ pass
+
async def call_tool(self, caller, tool_name: str, tool_args: Dict[str, Any], tool_call_template: CallTemplate) -> Any:
</file context>
…ication_protocol.py Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by cubic
Fix HTTP response parsing to respect Content-Type and bump utcp-http to 1.0.2. Also simplify SSE by removing active connection tracking and related teardown.
Bug Fixes
Refactors