fix: resolve lint and test failures from new endpoints#360
Open
declan-scale wants to merge 3 commits into
Open
fix: resolve lint and test failures from new endpoints#360declan-scale wants to merge 3 commits into
declan-scale wants to merge 3 commits into
Conversation
- Import NOT_GIVEN in agents.py to fix NameError in custom create_task/cancel_task helpers - Convert tests.utils imports to relative imports so pyright can resolve them Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The custom create_task/cancel_task/send_message/send_event helpers reference CreateTaskResponse, CancelTaskResponse, SendMessageResponse, SendMessageStreamResponse, and SendEventResponse but only AgentRpcResponse was imported, causing NameError at runtime. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.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
NOT_GIVENto the_typesimport insrc/agentex/resources/agents/agents.pyto fixNameError: name 'NOT_GIVEN' is not definedraised by the customcreate_task/cancel_taskhelpers (which surfaced intests/test_client.py::test_retrying_timeout_errors_doesnt_leak).from tests.utils import assert_matches_typeto relative imports in the new test files for checkpoints, deployments, and schedules so pyright can resolve them (matches the convention used by every other generated test).Test plan
rye run pytest tests/test_client.py tests/api_resources/test_checkpoints.py tests/api_resources/agents/— 145 passed, 392 skippedrye run lint— All checks passedrye run pyright tests/api_resources/test_checkpoints.py tests/api_resources/agents/test_deployments.py tests/api_resources/agents/test_schedules.py— 0 errors🤖 Generated with Claude Code
Greptile Summary
This PR resolves two categories of lint/test failures introduced by recently added custom RPC helper endpoints. It adds the missing
NOT_GIVENsentinel import and expands theagent_rpc_responseimport block inagents.py, and converts three test files from absolutetests.utilsimports to relative imports matching the project convention.NOT_GIVENimport fix: The custom helpers (create_task,cancel_task,send_message, etc.) already usedNOT_GIVENas a default value, but it was never imported — causing aNameErrorat module load time. Adding it to the_typesimport line resolves this.agent_rpc_responseexpansion: The six specific response type aliases (CreateTaskResponse,CancelTaskResponse, etc.) are now imported by name and added to__all__so they are properly accessible and re-exportable.test_checkpoints.py,test_deployments.py, andtest_schedules.pyare each updated to use the correct relative import path that matches every other generated test in the repo and satisfies pyright's module resolution.Confidence Score: 5/5
All changes are targeted import fixes with no logic changes; the custom RPC helper methods themselves are untouched and tests pass.
The diff is entirely mechanical: one missing sentinel is added to an import line, six names are added to an all list, and three test files switch from absolute to relative imports. No behaviour changes are introduced, the test suite and pyright both pass per the PR description, and the patterns used match the rest of the codebase.
No files require special attention.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Caller participant AgentsResource participant rpc / rpc_by_name participant agent_rpc_response Caller->>AgentsResource: create_task(agent_id, params) AgentsResource->>rpc / rpc_by_name: method="task/create", id=NOT_GIVEN, jsonrpc=NOT_GIVEN rpc / rpc_by_name-->>AgentsResource: AgentRpcResponse AgentsResource->>agent_rpc_response: CreateTaskResponse.model_validate(...) agent_rpc_response-->>Caller: CreateTaskResponse Caller->>AgentsResource: cancel_task(agent_name, params) AgentsResource->>rpc / rpc_by_name: method="task/cancel" rpc / rpc_by_name-->>AgentsResource: AgentRpcResponse AgentsResource->>agent_rpc_response: CancelTaskResponse.model_validate(...) agent_rpc_response-->>Caller: CancelTaskResponse Caller->>AgentsResource: send_message(agent_id, params) AgentsResource->>rpc / rpc_by_name: method="message/send" (streaming) rpc / rpc_by_name-->>AgentsResource: SSE stream AgentsResource->>agent_rpc_response: SendMessageResponse / SendMessageStreamResponse agent_rpc_response-->>Caller: SendMessageResponseReviews (3): Last reviewed commit: "fix: sort imports in agents resource" | Re-trigger Greptile