OpenHands / OpenHands/software-agent-sdk
Add unit tests for Remote* classes and LocalConversation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 539
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 137
Description
Problem
The following major classes have no unit tests — they're only covered by integration tests that require a running agent-server:
RemoteConversation(338 lines) — conversation lifecycle, message sending, WebSocket managementRemoteWorkspace(318 lines) — command execution, file upload/download, git operationsRemoteState(238 lines) — state caching, locking, event-driven updatesHttpClient(207 lines) — request building, error handling, URL constructionWebSocketCallbackClient(140 lines) — reconnection, message parsing, backoffLocalConversation(953 lines) — agent loop, tool execution, all state managementRemoteEventsList(162 lines) — pagination, caching, mergingConversationManager(166 lines) — multi-conversation CRUD
Furthermore, there are no tests for factory functions: createConversation, createWorkspace, createConversationAuto, createWorkspaceAuto.
The existing 157 unit tests cover hooks, events/types, security, stuck-detector, and secret-registry — which are pure logic modules. The core client functionality that actually talks to servers is untested at the unit level.
Proposed Fix
Add unit tests using a mock/stub HttpClient (or a lightweight fake that records calls):
- HttpClient: Test URL construction, query param handling, error parsing, timeout behavior
- RemoteConversation: Test
start()creates correct request,sendMessage()formats messages,close()cleans up - RemoteState: Test caching TTL,
updateStateFromEvent(),unwrapState()normalization - RemoteWorkspace: Test
executeCommand()request format,fileUpload()FormData construction - LocalConversation: Test agent loop iteration, tool dispatch, pause/resume, stuck detection integration
- Factory functions: Test type detection and error cases
Use a simple request-recording fake rather than heavy mocking frameworks. Assert on actual request shapes and response handling.
Impact
Medium — catches regressions in the most critical code paths without requiring a running server.
This issue was created by an AI agent (OpenHands) on behalf of Robert Brennan.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the named RemoteConversation, RemoteWorkspace, RemoteState, HttpClient, WebSocketCallbackClient, LocalConversation, RemoteEventsList, ConversationManager, and factory functions. Review the existing unit tests and integration coverage, then use a request-recording fake to test the listed request, state, lifecycle, factory, and agent-loop behaviors without a running server. Done means the proposed core paths have focused unit coverage and the tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100