Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
d186bd7 to
25c673b
Compare
|
Addressed review findings in the squashed commit (25c673b):
|
Defilan
left a comment
There was a problem hiding this comment.
The pinning holds: genai at the pinned commit fetches oatpp with fetchcontent_declare(oatpp ...), so FETCHCONTENT_SOURCE_DIR_OATPP and ..._OATPP-OPENSSL do take effect. Mirroring isn't needed for an unpublished test image.
One change: the PR body and the commit say the probe calls "every route the agent's Ollama executor and ingress use", but pkg/agent/ingress/paths.go also allows POST /api/embed and POST /api/embeddings for Ollama, and GET /health, GET /metrics, POST /v1/completions, POST /v1/embeddings and POST /v1/responses for every runtime. The probe calls none of them. Since #2523 forwards whatever the ingress allows, could you add those seven to hack/hailo-probe.sh (statuses only, no assertions)? Or, if you'd rather keep it to chat, narrow the claim in the body and commit message.
Nit: a sentence in the README saying the library server on 8001 is for the agent's --hailo-library-url size check (hailo-ollama itself still points at dev-public.hailo.ai) would save the next reader a search.
test/hailosim builds Hailo's hailo-ollama 5.1.1 server against HailoRT 5.1.1's public headers and links it to fake_hailort.cpp, a stand-in libhailort that emulates a Hailo-10H. The HTTP layer is hailo-ollama's own code, so its quirks (404 on GET /v1/models, created in nanoseconds, 500 without a JSON Content-Type) carry over. Fake HEFs of exactly HAILO_SIM_HEF_SIZE bytes are seeded under the digests written into the manifests, so /api/pull is an offline cache hit; a small server answers HEAD /blob/sha256_<digest> like dev-public.hailo.ai. The entrypoint validates HAILO_SIM_LISTEN and HAILO_SIM_LIBRARY_LISTEN, exits if the library server cannot bind, and writes an edited config under its own XDG_CONFIG_HOME, so the image runs as any user. make docker-build-hailo-sim builds the image (HAILO_SIM_PLATFORM, default the host's arch). It is not published. hack/hailo-probe.sh checks every route the agent's Ollama executor and ingress allow for the ollama runtime against a hailo-ollama server, real or simulated, and prints each status. hailo-ollama 5.1.1 answers 404 on the embedding, /health, /metrics, /v1/models, /v1/completions and /v1/responses routes; the simulator matches it. Fixes defilantech#2521 Signed-off-by: Christian Nuss <cnuss@users.noreply.github.com>
25c673b to
3dd771e
Compare
|
Done in 3dd771e (still one commit, rebased on main).
Commit message and description updated to match. |
What
Adds
test/hailosim, an image that runs Hailo's own hailo-ollama 5.1.1 server against a fakelibhailortthat emulates a Hailo-10H. It also addshack/hailo-probe.sh, which calls every route the agent's Ollama executor uses and the ingress allows for theollamaruntime (pkg/agent/ingress/paths.go) against a hailo-ollama server and prints each status, and amake docker-build-hailo-simtarget (HAILO_SIM_PLATFORM, default the host's arch). The image is not published. This PR has no Go, workflow or docs/site changes.Why
CI has no AI HAT+ 2. A hand-written mock would miss hailo-ollama's quirks: on a real Pi 5 it returns 404 for
GET /v1/models, reportscreatedin nanoseconds, returns 500 when the request has noContent-Type: application/json, and generates for an emptyprompt. The simulator's HTTP layer is hailo-ollama's own code, so it keeps all of these. 5.1.1 is the version Raspberry Pi's apt repository ships for the AI HAT+ 2, the Hailo-10H board this was tested against. #2523 builds the host-agent e2e on top of this.Fixes #2521
How
hailo-ai/hailo_model_zoo_genai, thehailortpublic headers (sparse checkout), andoatpp/oatpp-openssl. It compilesfake_hailort.cppintolibhailort.so.5.1.1, which the CMake package config incmake/exposes asHailoRT::libhailort, and then builds thehailo-ollamatarget. Files are laid out the wayhailo_gen_ai_model_zoo_5.1.1_arm64.deblays them out.HAILO_SIM_HEF_SIZEbytes (a header line naming the manifest, then zeros), points the manifest'shef_h10hat that HEF's digest and seeds it in the blob cache, so/api/pullhits the cache and never downloads. The entrypoint starts a small HTTP server that answers HEAD/blob/sha256_<digest>the waydev-public.hailo.aidoes.HAILO_SIM_LISTENandHAILO_SIM_LIBRARY_LISTENarehost:portwith a port from 1 to 65535, and exits 1 naming the variable otherwise. The library server signals ready only after its own bind succeeds (noSO_REUSEPORT), and the container exits 1 if it dies first; its stderr goes to the container log.HAILO_SIM_LISTENwrites an edited copy ofhailo-ollama.jsonunder a newXDG_CONFIG_HOME, which hailo-ollama 5.1.1 searches before/etc/xdg, so the image runs as any user. The model cache isa+rwX.hack/hailo-probe.shcovers the executor's routes, the Ollama routes the ingress allows (/,/api/chat,/api/generate,/api/embed,/api/embeddings,/api/tags,/api/show,/api/version,/api/ps), and the routes it allows for every runtime (/health,/metrics,/v1/models,/v1/models/{id},/v1/chat/completions,/v1/completions,/v1/embeddings,/v1/responses). It reports statuses only and asserts nothing. It keeps curl's stderr out of the status column: with no response it shows000and puts curl's error where the body would go.HAILO_SIM_DEVICE,HAILO_SIM_DEVICE_MEMORY,HAILO_SIM_TOKEN_DELAY_MS,HAILO_SIM_LISTEN,HAILO_SIM_LIBRARY_LISTEN. They are documented intest/hailosim/README.md.Open question from the issue: the build compiles third-party sources at pinned commits fetched from GitHub. hailo-ollama 5.1.1 itself fetches oatpp's default branch, so
OATPP_REF/OATPP_OPENSSL_REFpin the current heads of those branches. If you would rather mirror these sources, I can change it.What I ran (macOS arm64, Docker Desktop):
make docker-build-hailo-simbuilt. A separatedocker build --no-cacheoftest/hailosimalso built from scratch, so the pinned fetches still resolve.docker run --rm -d -p 18000:8000 localhost/llmkube-hailo-sim:dev, thenhack/hailo-probe.sh http://127.0.0.1:18000, and the same script against the real hailo-ollama 5.1.1 on a Raspberry Pi 5 with an AI HAT+ 2. Both gave the same status on every route. 200:/,/api/pull,/api/generate,/api/ps,/api/version,/api/tags,/api/show,/api/chat,/v1/chat/completionsand/hailo/v1/list. 404 (No mapping for HTTP-method):/api/embed,/api/embeddings,/health,/metrics,/v1/models,/v1/models/{id},/v1/completions,/v1/embeddingsand/v1/responses. So hailo-ollama serves chat and generate only./v1/chat/completionsreportedcreatedin nanoseconds./api/chaton the simulator answeredhailo-sim: Say hi./blob/sha256_<digest>returnsContent-Length: 67108864.--user 65534:65534, each withHAILO_SIM_LISTEN=0.0.0.0:9000: the server came up, and every probed route answered as above.HAILO_SIM_LIBRARY_LISTEN=8001exits 1 withwant host:port;HAILO_SIM_LISTEN=0.0.0.0:httpexits 1 withbad port 'http'; with 127.0.0.1:8001 already taken, the container logs python'sAddress already in useand exits 1.000 curl: (7) Failed to connect ...for each route.HAILO_SIM_DEVICE=0:/api/chatreturns 500 withFailed to create VDevice.HAILO_SIM_DEVICE_MEMORY=1000: 500 withFailed to create LLM.HAILO_SIM_TOKEN_DELAY_MS=200: a warm/api/chattakes 0.61s, against 0.008s with no delay.HAILO_SIM_LISTEN=0.0.0.0:9000: the server answers on 9000.HAILO_SIM_LIBRARY_LISTEN=(empty): nothing listens on 8001./blob/sha256_<digest>returns 200 with the HEF'sContent-Length.Content-Type: application/jsongets a 500 (No suitable mapper found to deserialize the request body).shellcheck hack/hailo-probe.sh test/hailosim/entrypoint.sh: clean.make gate BASE_REF=origin/mainon the final commit: every step passed.GOOS=linux bin/golangci-lint run ./...,GOOS=darwin bin/golangci-lint run ./...andmake lint-deadcode: 0 issues each.The README now says the library server on 8001 is for the agent's
--hailo-library-urlsize check, and that hailo-ollama itself still points atdev-public.hailo.ai.Assisted-by: Claude Code (Claude Opus 5.5) split this out of #2482, wrote the description and ran the checks above in my session.
Checklist
make testpasses locallymake lintpasses locallygit commit -s) per DCO