Skip to content

fix: resolve lint and test failures from new endpoints - #360

Merged
declan-scale merged 3 commits into
nextfrom
declan-scale/fix-lint
May 19, 2026
Merged

fix: resolve lint and test failures from new endpoints#360
declan-scale merged 3 commits into
nextfrom
declan-scale/fix-lint

Conversation

@declan-scale

@declan-scaledeclan-scale commented May 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add NOT_GIVEN to the _types import in src/agentex/resources/agents/agents.py to fix NameError: name 'NOT_GIVEN' is not defined raised by the custom create_task/cancel_task helpers (which surfaced in tests/test_client.py::test_retrying_timeout_errors_doesnt_leak).
  • Convert from tests.utils import assert_matches_type to 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 skipped
  • rye run lint — All checks passed
  • rye 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_GIVEN sentinel import and expands the agent_rpc_response import block in agents.py, and converts three test files from absolute tests.utils imports to relative imports matching the project convention.

  • NOT_GIVEN import fix: The custom helpers (create_task, cancel_task, send_message, etc.) already used NOT_GIVEN as a default value, but it was never imported — causing a NameError at module load time. Adding it to the _types import line resolves this.
  • agent_rpc_response expansion: 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 relative imports: test_checkpoints.py, test_deployments.py, and test_schedules.py are 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

FilenameOverview
src/agentex/resources/agents/agents.pyAdds NOT_GIVEN to the _types import (fixing NameError) and expands the agent_rpc_response import to pull in the five typed helper response classes used by the custom RPC methods.
src/agentex/types/agent_rpc_response.pyExtends all to expose the five new response type aliases (CreateTaskResponse, CancelTaskResponse, SendMessageResponse, SendMessageStreamResponse, SendEventResponse) alongside the existing AgentRpcResponse.
tests/api_resources/test_checkpoints.pySwitches assert_matches_type import from absolute (tests.utils) to relative (..utils) to match project convention and fix pyright resolution.
tests/api_resources/agents/test_deployments.pySwitches assert_matches_type import from absolute to relative (...utils) to match project convention and fix pyright resolution.
tests/api_resources/agents/test_schedules.pySwitches assert_matches_type import from absolute to relative (...utils) to match project convention and fix pyright resolution.

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: SendMessageResponse
Loading

Reviews (3): Last reviewed commit: "fix: sort imports in agents resource" | Re-trigger Greptile

declan-scaleand others added 3 commits May 18, 2026 19:00
- 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>
@declan-scale
declan-scale merged commit bdf129c into nextMay 19, 2026
34 checks passed
@declan-scale
declan-scale deleted the declan-scale/fix-lint branch May 19, 2026 16:07
@stainless-appstainless-appBot mentioned this pull request May 19, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@declan-scale