Skip to content

Add comprehensive integration tests and fix WebSocket cancellation hang#8

Merged
vijit-lark merged 3 commits intomainfrom
vd-20260315-1619
Mar 16, 2026
Merged

Add comprehensive integration tests and fix WebSocket cancellation hang#8
vijit-lark merged 3 commits intomainfrom
vd-20260315-1619

Conversation

@vijit-lark
Copy link
Copy Markdown
Contributor

Summary

  • Add CLI integration tests for the runtimeuse TypeScript package covering --help, --port, --handler, and --agent flags, with a deterministic echo handler fixture for reproducible test runs
  • Add end-to-end tests for pre/post agent invocation commands in the Python client, covering output streaming, cwd support, and proper error propagation on command failure
  • Add E2B sandbox factory and LLM integration tests (Claude + OpenAI) for the Python client, gated behind sandbox and llm pytest markers to keep CI fast
  • Fix a cancellation hang in WebSocketTransport where task_done() was skipped if ws.send() raised, blocking send_queue.join() indefinitely

Changes

  • packages/runtimeuse/test/integration/ — new CLI integration test suite + echo handler fixture
  • packages/runtimeuse-client-python/test/e2e/test_e2e.py — 7 new tests for pre/post invocation commands
  • packages/runtimeuse-client-python/test/llm/ — Claude and OpenAI integration tests against E2B sandboxes
  • packages/runtimeuse-client-python/test/sandbox/ — E2B sandbox provider tests
  • packages/runtimeuse-client-python/test/sandbox_factories/ — reusable E2B sandbox factory
  • websocket_transport.py — wrap ws.send() in try/finally to guarantee task_done() call
  • CI workflow updated to exclude sandbox and llm marked tests

Test plan

  • npm run test:integration passes in packages/runtimeuse
  • pytest test/ -m "not sandbox and not llm" passes in packages/runtimeuse-client-python
  • pytest test/ -m sandbox passes locally with E2B_API_KEY set
  • pytest test/ -m llm passes locally with E2B_API_KEY + LLM API keys set
  • Verify cancellation no longer hangs by running cancellation e2e tests

- E2B sandbox smoke test and shared factory (with reuse support)
- OpenAI and Claude LLM tests: text, structured output, error propagation
- Exclude sandbox/llm markers from CI; load .env in test conftest

Made-with: Cursor
Add 7 E2E tests verifying pre_agent_invocation_commands and
post_agent_invocation_commands are executed by the server, including
cwd support and failure handling.

Change ws_url fixture to per-test scope so each test gets a fresh server.

Fix send_queue.task_done() not being called when ws.send() raises
ConnectionClosedOK, which caused send_queue.join() to hang forever
during cancellation.

Made-with: Cursor
@vijit-lark vijit-lark merged commit 1b8ffdf into main Mar 16, 2026
5 checks passed
Sign up for free to 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