Repository navigation
fix: build hed-suggest into the image so suggest_hed_tags works - #599
Merged
neuromechanist merged 7 commits intoOct 8, 2026
Merged
neuromechanist merged 7 commits into
neuromechanist merged 7 commits into
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The stage asserted "Button", which is not a tag in HED 8.4.0 (hed-lsp's keyword map is not filtered against the schema). Assert "Press", which the pinned commit returns for "button press" and the schema defines. Ran the pinned CLI locally (macOS, Node 26): "button press" returns Press at --top 10. The Linux image build is tested by CI only.
Comment only. With --semantic the program prints status lines to stdout ahead of the JSON (seen locally), onnxruntime is stripped from the image, and the model would download into a non-volume path. Also notes why the Node tag floats. Not built; no code change.
onnxruntime-node's postinstall downloads a GPU package from nuget.org on amd64 (seen in the CI log), and the result is deleted afterwards, so a NuGet outage would fail every image build. tsc and the program need no install scripts. Tested locally: a --frozen-lockfile install with and without --prod and --ignore-scripts compiles with tsc and the CLI returns suggestions, also with onnxruntime and sharp removed (macOS, Node 26, pnpm 10.33.4). The Linux image build is tested by CI only; drop this commit if CI shows the stage needs scripts.
suggest_hed_tags put every search term on the program's command line, and hed-suggest reads an argument that starts with "-" as an option, so a term of "--semantic" switched its mode. Such terms are no longer forwarded and map to an empty list in the answer. The program also inherited the server's whole environment, including the model provider keys; it now gets PATH only. Adds tests/test_tools/test_hed_suggest.py: a real executable named hed-suggest on PATH records what it receives, plus a test of the real program when a built hed-lsp checkout exists (skipped otherwise). No mocks. 3 of the 6 tests fail on the previous tools.py; all 6 pass now, with the real program run from a local checkout under a PATH-only environment (macOS).
The tool description and two module docstrings called hed-suggest a semantic search. The program runs a keyword map and a schema substring match; the embedding mode is off and not in the image. The model-facing description now says so, asks for short concrete terms, and says suggestions are candidates that can include names HED 8.4.0 does not define (Button, Flash), so validate_hed_string still decides. Docstrings only. tests/test_assistants, tests/test_tools and tests/test_agents/test_hed.py pass (614 passed, 5 skipped, not network).
Nothing exercised the final image stage, so a bad COPY, PATH or HED_LSP_PATH would ship and suggest_hed_tags would answer "not available" on every call (issue OpenScience-Collective#595). The new step runs the real tool in osa-test:ci with --network none and asserts no error key and the 8.4.0 tag Press for "button press". Tested here: the workflow YAML parses, and the embedded script passes against a locally built hed-lsp (macOS). The docker run itself can only be tested by CI.
neuromechanist
merged commit Oct 8, 2026
e69ffc2
into
OpenScience-Collective:develop
7 checks passed
neuromechanist
pushed a commit
that referenced
this pull request
Oct 10, 2026
Retitles [Unreleased] to [0.8.18], as for earlier releases. Adds the entries that were missing for #599 (hed-suggest in the image), #600 (HED prompt), #601 (widget host styles) and #605 (live tests by hand), and one for the DEFAULT_MODEL check at startup. Names the three classes that are accepted (the other five are refused), and fixes a reference that pointed the wrong way. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_019MtQNfPzMpGxEJFUciXbTN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #595.
Summary
suggest_hed_tagsreturns "Tag suggestion tool is not available" on every call in production, because the image has neither Node nor thehed-suggestprogram the tool runs.This adds a build stage that builds hed-lsp's
serverpackage at a pinned commit, then copies it and the Node binary into the image and setsHED_LSP_PATH, which the tool already reads. There is no Python change.Button.onnxruntime-node,onnxruntime-webandsharpare removed after a production-only install. They serve only--semantic, which the tool does not pass, and are about 340 MB of the 450 MB install..git, the VS Code client, docs and TypeScript sources are removed before the copy.Tests
docker build -f deploy/Dockerfile .succeeds (linux/arm64, Docker under Colima).--network none,suggest_hed_tags.invoke({"search_terms": ["select object", "retention delay", "mouse click"], "top_n": 5})returns tags in 0.24 s. Without the change it returns the error./opt/hed-lspis 118 MB; the rest is the Node binary).The measurements of what the working lookup changes for HED answers are in #595.
Review follow-up
Commits added to this branch after review (
9d5ab0btod682f49):Pressfrom--top 10 "button press", a tag HED 8.4.0 defines. It asked forButton, which the schema does not define: hed-lsp's keyword map is not filtered against the schema, so some suggestions are not valid tags.pnpm installruns with--ignore-scriptsin both steps, so no dependency runs code during the build.--semanticcannot work in this image (onnxruntime-*is removed) and that the Node tag floats.suggest_hed_tagsdrops a term that starts with-, so it cannot be read as an option, and runs the program with onlyPATHin its environment, so the server's secrets are not visible to it. The tool and module text now describe what the program does without--semantic, a keyword and schema-substring lookup, not "semantic search".tests/test_tools/test_hed_suggest.py(new, 6 tests): five against a real executable onPATH, one against the real program, skipped when no build exists.suggest_hed_tagsinside the built image with--network none.Additional tests:
d682f49, including the newsuggest_hed_tagsstep. Test (3.11), Test (3.12), Lint and Frontend Tests are green too.python:3.12-slim-bookwormon the deployment host (x86_64).neuromechanist/Qwen3-Embedding-0.6B-ONNX-Q8exists on Hugging Face and can be pulled; the tool does not need it, because--semanticis off.Not covered:
Button,Mouse). The prompt requiresvalidate_hed_stringon every tag, which catches them; filtering the map would be a change in hed-lsp.