Repository navigation
Conversation
…odel log, fix dead test ref
Merge review/harden-ci-post-review
…xclusion test_chat_dispatch.py had been rewritten from real dispatch tests into mocked unit tests, which removed the only coverage of the chain CI exists to protect: hermes_cli.plugins discovery -> tools.registry registration -> registry.get_entry(name).handler(args). A rename in _TOOLS, a slug mismatch, or plugin.yaml drift would all have shipped green. - Restore TestDiscoveryAndRegistry: drive _ensure_plugins_discovered() and assert all 7 tools resolve in the global registry under toolset "builder", that the models catalog is the plugin.yaml override (Claude variants present, claude-opus-* never advertised), that models/tags agree on the tag set, and that no secret fields leak into handler output. - Fix the port assertions. The old tests hardcoded 8077 on both sides, so they passed without the adapter binding anything and could not see the port register() forwards. The fake adapter now mirrors the real (server, actual_port) contract, so the test asserts register() forwards the configured port (AWS_BUILD_ADAPTER_PORT or default) and reports the port start() returned. - Collapse the duplicated fake-adapter setup into _install_fake_adapter(). ci.yml: drop `-k "not adapter"`. register() already swallows adapter start failures (verified: OSError "address already in use" -> warning, all 7 tools still register) and no test binds the default port, so the exclusion bought nothing and deselected 18 tests. The PR template command is updated to match. Verified locally: 93 passed, 1 skipped (was 88 passed); verify.py green; no :8077 listener left bound. Mutation-tested the new assertions -- renaming a tool, adding claude-opus-4 to plugin.yaml, offsetting the forwarded port, and hardcoding the printed port each fail the suite. The local .venv is the pinned hermes-agent SHA (a88512b), so this run is representative of CI.
|
Closing as obsolete: this branch is based on
Nothing to merge here. Branch kept for reference; will delete on request. |
| for name in sorted(EXPECTED_TOOLS): | ||
| blob = json.dumps(json.loads(registry.get_entry(name).handler({}, task_id="t"))) |
There was a problem hiding this comment.
Tests delete saved login files
Calling every registered handler now runs bid_login and bid_logout, not just read-only catalog tools. bid_login makes live AWS requests and starts a polling thread. conftest.py symlinks the temporary profile's plugin directory to the checkout, so bid_logout can delete existing auth/bid_*.json files there. Keep real discovery and dispatch, but stub the auth operations and give them a separate temporary store.
| # If no providers: block exists, insert one first. | ||
| if not any(l.strip() == "providers:" for l in lines): | ||
| lines.append("providers:") |
There was a problem hiding this comment.
The new missing-providers fallback appends providers: as the last line, but the loop checks in_prov before setting it for that line. The builder block is never written, so the final check restores the backup and exits with an error. Insert the block together with the new section, and test a config without providers.
| PYTHON="$(command -v python3 || true)" | ||
| if [[ -z "$PYTHON" ]]; then |
There was a problem hiding this comment.
Setup picks Python without PyYAML
If system Python is on PATH but PyYAML is installed only in the Hermes virtual environment, the new unconditional import yaml fails before setup edits the config. Interpreter selection only checks whether python3 exists, so it never tries the Hermes environment. Check that each candidate can import yaml before selecting it.
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] |
There was a problem hiding this comment.
For normal fork PRs, pull_request supplies a read-only token. Requesting pull-requests: write does not override that restriction. A fork branch named fix/... or feature/... therefore reaches addLabels and fails with a permission error. Use pull_request_target for this metadata-only job, without checking out or running PR code.
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| on: | |
| pull_request_target: | |
| types: [opened, synchronize, reopened] |
| en = (c.get("plugins") or {}).get("enabled") or [] | ||
| if "builder" not in [str(x) for x in en]: | ||
| c.setdefault("plugins", {})["enabled"] = [str(x) for x in en] + ["builder"] | ||
| yaml.safe_dump(c, open(cfg, "w"), sort_keys=False, default_flow_style=False) |
There was a problem hiding this comment.
Adding builder to plugins.enabled now rewrites all of config.yaml with yaml.safe_dump. On a normal first setup, this removes every existing YAML comment, including notes beside unrelated providers. Update only the enabled list, or use a YAML editor that preserves comments.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| def test_register_starts_adapter_on_configured_port(self, mod, monkeypatch, capsys): | ||
| _install_fake_adapter(monkeypatch) | ||
| FakeAdapter.started = False | ||
| FakeAdapter.requested_port = None | ||
| FakeAdapter.actual_port = None | ||
| captured = {} | ||
|
|
||
| mod.register(_ctx(captured)) |
There was a problem hiding this comment.
Custom port coverage is missing
The port test reads AWS_BUILD_ADAPTER_PORT but never sets a non-default value. In ordinary CI, a regression that hardcodes the requested port to 8077 still passes. Parameterize the test with the variable absent and with a different value, setting it before register() runs.
What kind of change is this?
Summary
tests/test_chat_dispatch.pyhad been rewritten from real dispatch tests into mocked unit tests, which removed the only coverage of the chain CI exists to protect:A rename in
_TOOLS, a slug mismatch, orplugin.yamldrift would all have shipped green.Restored (
TestDiscoveryAndRegistry, 5 tests): drive_ensure_plugins_discovered()and assert all 7 tools resolve in the global registry under toolsetbuilder; the models catalog is theplugin.yamloverride (Claude variants present,claude-opus-*never advertised);modelsandtagsagree on the tag set; no secret fields leak into handler output.Fixed the port assertions. The old tests hardcoded
8077on both sides, so they passed without the adapter binding anything and could not observe the portregister()forwards. The fake adapter now mirrors the real(server, actual_port)contract, so the test assertsregister()forwards the configured port (AWS_BUILD_ADAPTER_PORTor default) and reports the portstart()returned.ci.yml: dropped
-k "not adapter".register()already swallows adapter start failures (verified:OSError: address already in use-> warning, all 7 tools still register) and no test binds the default port, so the exclusion bought nothing and deselected 18 tests. PR template command updated to match.Branch
This PR was opened from a branch using one of:
fix/…Checklist
python -m pytest -qverify.pyis greenVerification
python -m pytest -q: 93 passed, 1 skipped (was 88 passed)python verify.py: all checks passed:8077listener left bound after the run_TOOLS-> 5 failuresclaude-opus-4toplugin.yaml-> catalog test failsport + 1) -> port test fails.venvis the pinned hermes-agent SHA (a88512b, confirmed viadirect_url.json), so this run is representative of CI.Notes for review
sys.modules["hermes_plugins.builder.adapter"], not the top-leveladaptermodule — discovery imports it as a submodule, soadapter.stop()alone would leave the listener up.conftest.py:33comment namesmodel_tools(nothing imports it now),conftest.py:22'sHERMES_AGENT_DIRresolves to a path that does not exist under the CI mount layout (guarded byexists()), and__init__.py:37'sfrom registry import ...fallback is unreachable here. Happy to fold them in if you want them tracked.Fix the real auth calls in tests, setup failures, and fork PR labeling before merging.
Summary
The PR expands real discovery coverage to all seven tools, adds adapter lifecycle tests, and removes CI's adapter exclusion. It also changes setup, dependency requirements, and PR labeling.
Acknowledged scope: iap explicitly deferred the
model_toolscomment,HERMES_AGENT_DIRlayout, and fallback registry import as outside this change, stating they have no behavior impact.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A["Discovery tests"] --> B["Hermes plugin discovery"] B --> C["Global tool registry"] C --> D["Call every handler"] D --> E["Real AWS login"] D --> F["Logout deletes auth files"] G["Temporary profile plugin symlink"] --> H["Plugin checkout"] F --> HReviews (1) · Last reviewed commit: "fix(tests): restore real plugin discover..." · Reviewed by Greptile