Files
hope-voice-api/tests
snowspeeder d4ea4fc984
Rebuild & Deploy / rebuild (push) Successful in 58s
fix: background tasks now fetch real page content; add task-status tools
Background research tasks were producing garbage or failing because the
self-hosted Firecrawl /v1/scrape defaults to a ~30s timeout that's too short
for heavy news/research sites, and the small LLM won't reliably chain a
second scrape call after a search that only returns snippets.

task_worker.py:
- web_search now auto-fetches the top results directly from the container
  (which has working outbound internet) and returns their real text, so the
  model gets actual page content in one call instead of snippet echoes.
- web_scrape requests timeout: 90000 (Firecrawl renders heavy sites but needs
  >30s), and falls back to a direct container fetch with tag-stripping if
  Firecrawl times out or returns nothing.

task_registry.py / dispatch_mcp.py:
- Add task_status(id) and list_tasks() tools so Hope can check the live state
  of any dispatched task (pending / running / completed / failed / STALLED).
- Track last_activity per task and surface a stall heuristic.
- Move the status summary into task_registry (no mcp dependency) so it's
  unit-testable.

agent.py: prompt tells Hope about task_status / list_tasks.
tests: add task-status summary and last-activity regression tests.
2026-08-30 06:54:57 -04:00
..

Hope test suite

End-to-end tests that drive the actual running container — no mocks. They run on the host and hit the live web UI, token endpoint, LLM API, MCP tool servers, and agent process.

Prerequisites

  • The container is up: docker compose up -d (and healthy)
  • Host deps installed: pip install -r tests/requirements.txt (or uv pip install -r tests/requirements.txt)
  • The LLM at LLM_BASE_URL (default http://192.168.86.2:3005/api, OpenWebUI) is reachable
  • Internet access for the weather tool tests (wttr.in)

Run

cd /home/shane/dev/voice
python -m pytest tests/ -v            # everything
python -m pytest tests/ -v -m "not slow"   # skip LLM/network-heavy tests

What each file covers

File Target Notes
test_web_ui.py nginx HTTPS UI (:9178) + token endpoint (:8091) static assets, /token (direct + via nginx), /livekit/ proxy
test_llm_api.py LLM API directly completion, tool calling, enable_thinking=false latency, streaming
test_mcp_tools.py MCP servers via docker exec weather/time, authenticated remote memory save/recall/delete, and local skills — probes are cleaned up
test_media.py media server API + player UI + media MCP library/player state flow, Range proxy, static mp3 Range, live YT Music search (-m slow), gated full download (HOPE_RUN_YTDLP_DOWNLOAD=1)
test_agent_integration.py running container agent process alive, worker registered with LiveKit, all 4 supervised processes up, container health, LiveKit HTTP API
test_compaction.py HopeLLM._compact_context in-container compaction triggers >24 items, system prompt preserved, short context untouched

Notes

  • LLM and MCP tests are marked @pytest.mark.slow (1–30s each).
  • The token endpoint is POST /token → {"token": "<JWT>"}.
  • Process checks use /proc/*/cmdline because the container image has no ps, and the supervisorctl unix socket is not exposed in this build.