Skip to content

fix(agent-engines): runnable Docker image, reachable WebSocket server, remove stale build/ - #1451

Open
feyishola wants to merge 1 commit into
OpenKnight-Foundation:mainfrom
feyishola:fix/agent-engines-docker-ws
Open

feyishola wants to merge 1 commit into
OpenKnight-Foundation:mainfrom
feyishola:fix/agent-engines-docker-ws

Conversation

@feyishola

Copy link
Copy Markdown
Contributor

Summary

Closes #1421, closes #1424, closes #1425, closes #1426

#1421: WebSocket server bound to localhost

  • main.py reads AGENT_WS_HOST and AGENT_WS_PORT (default 0.0.0.0:8765). The Dockerfile has EXPOSE 8765.
  • shutdown() now closes the WebSocket server.

#1424: Legacy (websocket, path) handler

  • The handler takes one argument and reads the path from websocket.request.path.
  • websockets was not declared as a dependency. It is now pinned to >=13.0,<16.

#1425: Docker image couldn't run

  • The builder copies pyproject.toml, README.md and gpu_worker/ before pip install, and installs into /opt/venv, owned by appuser.
  • The runtime image installs Stockfish and sets STOCKFISH_PATH=/usr/games/stockfish and ENGINE_BACKEND=stockfish.
  • Added .dockerignore.
  • New docker-build CI job:
    • builds the image
    • runs import gpu_worker
    • checks that the Stockfish binary responds to uci
    • does a real WebSocket round-trip into the running container. A plain TCP connect isn't enough because docker-proxy accepts connections even when the app has crashed.

#1426: Stale build/ directory

  • Removed the 18 tracked files under agent-engines/build/.
  • Added build/, dist/ and *.egg-info/ to agent-engines/.gitignore. I scoped this to agent-engines/ so the rules don't affect other packages in the monorepo.

Two other fixes needed for the container to start

  • main() registered signal handlers with getattr(asyncio, 'SIGINT'), which doesn't exist, so the process crashed at startup. It now uses the signal module.
  • The default worker backend is lc0, which isn't installed in the image, so the container exited at startup. The backend can now be chosen with ENGINE_BACKEND. Without it, the default is still lc0.

Test plan

  • docker build succeeds. import gpu_worker works, websockets is 15.0.1, and Stockfish 17.1 responds to uci.
  • Ran the container with -p. A client on the host sent messages and got the expected replies, and the server logged the request path.
  • docker stop (SIGTERM) shuts down cleanly.
  • pytest tests: 503 passed and 6 skipped, the same as main. test_orchestrator.py: 3 passed.

🤖 Generated with Claude Code

…server reachable

- Bind the WebSocket server to AGENT_WS_HOST/AGENT_WS_PORT (default 0.0.0.0:8765),
  EXPOSE the port, and close the server on shutdown (OpenKnight-Foundation#1421)
- Switch to the single-argument websockets handler, read the path from
  websocket.request.path, and pin websockets>=13,<16 (OpenKnight-Foundation#1424)
- Rebuild the Dockerfile: copy source before install, install into a venv owned
  by appuser, install Stockfish, select it via ENGINE_BACKEND; add .dockerignore
  and a CI job that builds the image and does a WebSocket round-trip (OpenKnight-Foundation#1425)
- Remove the stale tracked build/ directory and ignore build/ and dist/ (OpenKnight-Foundation#1426)
- Fix signal handler registration (asyncio.SIGINT -> signal.SIGINT) that crashed main()

Closes OpenKnight-Foundation#1421, closes OpenKnight-Foundation#1424, closes OpenKnight-Foundation#1425, closes OpenKnight-Foundation#1426

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@drips-wave

drips-wave Bot commented Oct 17, 2026

Copy link
Copy Markdown

@feyishola Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment