windows-hermes-code-verification
Verify Hermes Python changes on Windows with focused tests.
- License 许可
- MIT
- 所属仓库
- zapabob/Skills
- 最近更新
- 2026-10-26
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- windows-hermes-code-verification
- author
- Hermes Agent
- license
- MIT
- version
- 1.1.0
- metadata
- { "hermes": { "tags": [ "windows", "pytest", "verification", "debugging", "hermes", "providers", "file-operations" ], "related_skills": [ "systematic-debugging", "requesting-code-review", "test-driven-development" ] } }
- platforms
- [ "windows" ]
- description
- Verify Hermes Python changes on Windows with focused tests.
03 SKILL.md 正文
Windows Hermes Code Verification
Use this class-level workflow after modifying or investigating Hermes Python code on a Windows checkout, especially ACP adapters, file operations, provider routing, optional extras, and cross-platform path handling.
Goals
- Reproduce the reported failure with the narrowest test first.
- Distinguish environment/setup failures from regressions in edited code.
- Verify Windows-specific semantics such as CRLF/BOM preservation and path handling.
- Separate host-native path interpretation from target-platform path formatting.
- Report focused green tests separately from full-suite status.
Workflow
- Inventory first. Read
AGENTS.md, inspectgit status, and identify the project interpreter and dependency declarations. Never treat the start-of-session workspace snapshot as current. - Reproduce narrowly — and confirm it still fails. Run the exact named test(s) with the project interpreter and capture the full assertion/stack trace before changing code. A task brief that enumerates "N failing tests" can be stale relative to the current checkout: run each named test and only patch the ones that genuinely fail. In one session 3 of 6 "failures" already passed on the checkout — blind patching of already-green tests wastes effort and risks regressions.
- Trace the data flow. For path failures, inspect values inside Python before blaming MSYS: native Windows
pathlibandos.pathcan turn POSIX-looking paths into backslash or mixed-separator paths. For byte-count failures, follow the value from caller input through normalization and disk write. For provider failures, follow explicit runtime configuration through fallback order and check for ambient credentials/configuration. - Classify production versus test assumptions. Unconditional WSL conversion and host-native formatting of promised Linux/Termux strings are production defects. Tests that mock only POSIX
HOMEsemantics or hardcode/while passing a WindowsPathare test portability defects. - Check dependency state. If an optional package is declared in
pyproject.tomland pinned inuv.lock, install that pinned package into the active development venv. Hermes intentionally rejects wheel/sdist builds of the project itself, sopip install '.[extra]'may fail at the project build step; in that case install only the declared package directly and rerun the focused tests. - Make one root-cause fix. Avoid broad fallback changes or platform-specific test hacks. For target-platform examples or commands, use target-specific formatting (
posixpath/PurePosixPathfor Linux, WSL, and Termux) while keeping genuine filesystem probing native. For text writes, preserve the API's established logical payload-size contract independently from physical CRLF/BOM bytes. For provider routing, incomplete explicit configuration must not silently select an unrelated globally configured provider. - Verify in layers. Run changed-path
py_compile,git diff --check, focused regression tests, and related subsystem tests. For a single test or small set, do not usescripts/run_tests.sh— it is too slow for focused verification. Invoke the venv interpreter directly:
Then attempt the standard full runner with a Windows interpreter override only for full-suite status:cd '/c/Users/<user>/Documents/New project/hermes-agent' && \ .venv/Scripts/python.exe -m pytest tests/plugins/<file>::<test> -xvs 2>&1 | tail -20HERMES_PYTHON='/c/Users/<user>/.../.venv/Scripts/python.exe' \ HERMES_TEST_WORKERS=1 bash scripts/run_tests.sh - Report honestly. Give exact pass counts and commands. State full-suite failures, timeouts, missing optional dependencies, and unrelated Desktop/UI failures separately; focused passing tests do not make the whole repository green.
Loading a plugin module standalone (importlib)
When you must invoke a plugin's Python directly from a shell — debugging,
cron, or because the hermes <plugin> CLI is not registered — load its
core.py as a module. Four Windows-specific traps block the naive pattern:
- Register the module in
sys.modulesbeforeexec_module. Plugincore.pyusually declares@dataclassclasses at module top level. Loading withspec_from_file_location(name, path)+module_from_spec+exec_modulewithout first settingsys.modules[name] = modraisesAttributeError: 'NoneType' object has no attribute '__dict__'(the dataclass decorator cannot find its own module). Fix: assign tosys.modulesimmediately aftermodule_from_spec. - MSYS rewrites forward-slash path arguments. Under Git Bash / MSYS a
path passed as a Python string like
/c/Users/downl/...is silently converted by the shell toC:\c\Users\downl\...before Python sees it, causingFileNotFoundError: 'C:\\c/Users/.../core.py'. Fix: prefix the command withexport MSYS_NO_PATHCONV=1, or pass native Windows paths (e.g.%USERPROFILE%/...— no leading slash — orC:\Users\...). - Use the venv interpreter, not bare
python. On Windowspythonis the Microsoft Store stub: it printsPythonand exits non-zero (49) without running your script. Use the Hermes venv interpreter explicitly (<repo>/.venv/Scripts/python.exe) and verify the plugin's deps (twitter_openapi_python,tweepy_authlib, etc.) import there.py -3works for general scripts but may lack plugin packages. - Put the repo root on
sys.path. Plugincore.pyoften importshermes_constants; insert the Hermes repo root before loading or imports fail even though the plugin file itself is healthy.
See references/standalone-plugin-module-loading.md for a copy-paste template
that discovers the plugin path (it may be under ~/.hermes/plugins/<name>/,
not <repo>/plugins/<name>/) and applies all four fixes.
Windows-specific checks
- CRLF preservation can make physical file bytes larger than the logical UTF-8 input. Test both the returned API value and actual file contents.
Path.as_uri()and POSIX/MSYS path translation can expose separate ACP resource-link failures. Do not conflate these with dependency installation or provider failures.- A
file:///C:/...URI should remain a native drive path on Windows; translate it to/mnt/<drive>/...only in WSL. - Python 3.8+ Windows
os.path.expanduser()usesUSERPROFILEorHOMEDRIVE/HOMEPATH, notHOME; when a Git Bash/Termux-facing contract explicitly usesHOME, expand~against that variable before falling back toexpanduser(). - Windows asyncio pipe tests may fail with
WinError 6; retain protocol coverage by usingsocket.socketpair()plusasyncio.open_connection()instead of anonymousos.pipe()handles. - For Python-launched shell snippets and
.shhooks, resolve Git-for-Windows Bash with the existingtools.environments.local._find_bash()logic and use--noprofile --norc; barebashcan resolve a WSL stub or leave capture pipes open. Quote test-generated Windows paths and pass forward-slash forms inside Bash scripts. shlex.split(posix=True)silently strips backslashes from Windows paths. Any slash-command / CLI argument parser built onshlex.split(Hermes'srun_slashdoes this) turnsattach 123 C:\Users\...\file.txtinto the tokenC:Users...file.txt, producing "no such file". Path-extraction heuristics that only match/or~/Unix prefixes (e.g. a terminal-result regex(?:^|\s)(/[^\s'"]+|\~/[^\s'"]+)) likewise never catchC:\...drive paths. Fixes: (1) pass forward-slash path forms into slash-command strings — Windowspathlib/open()accept/natively — i.e.run_slash(f"attach {task_id} {str(src).replace(chr(92), '/')}"); or quote the path if the parser honors quotes. (2) Extend Unix-only path regexes with a Windows drive alternative:[A-Za-z]:[\\/][^\s'"]+. Seereferences/windows-shlex-and-path-extraction.md` for copy-paste snippets and the reproduction recipe.prompt_toolkitcan raiseNoConsoleScreenBufferErrorin services and captured tests. Fall back to plain output only for that exception; do not suppress unrelated renderer errors.- Symlink tests must preserve coverage when creation succeeds and only skip the specific privilege failure (
WinError 1314fromos.symlink/Path.symlink_towithout Developer Mode or admin on Windows), never weakening production path guards. Use a probe helper, not a baresys.platform == "win32"check — some Windows builds (Developer Mode, admin, CI runners) can create symlinks, so a platform-only guard wrongly drops coverage there. The probe tries a real symlink in a throwaway temp dir and returnsFalseonOSError/NotImplementedError:
Then decorate the test:def _can_symlink() -> bool: try: with tempfile.TemporaryDirectory() as td: (Path(td) / "real").mkdir() (Path(td) / "link").symlink_to(Path(td) / "real") return True except (OSError, NotImplementedError): return False@pytest.mark.skipif(not _can_symlink(), reason="symlinks not available on this platform"). Seereferences/symlink-test-skip-pattern.mdfor the full ready-to-paste helper, decorator, and the keep-production-guards pitfall. pytest-randomlycan manufacture setup/teardown ERRORs that are not your bug. On this Windows box the repo's default addopts loadpytest-randomly, whose reseed hook callsthinc.util.fix_random_seed→numpy.random.seed, raisingValueError: Seed must be between 0 and 2**32 - 1at setup and teardown of arbitrary tests. Symptom: a run reports e.g.109 passed ... 13 errorswhere every error traceback is insidepytest_randomly/__init__.py, never in your code. Do not chase it. Re-run with the plugin disabled to get a clean signal:py -3 -m pytest tests/<file>.py -q -o addopts= -p no:randomly-o addopts=drops repo default flags;-p no:randomlyis the part that removes the false errors. Read the traceback before concluding the errors are environmental — if the frames are in your module, they are real.- Bare
pythonon this host is the Microsoft Store stub: it printsPythonand exits 0 without running anything, sopython -m pytest ... | tailsilently produces no test output and looks like a pass. Usepy -3(or the repo venv's.venv/Scripts/python.exe) and confirm the output contains an actual pass/fail count before reporting success. - Ambient
.env/Hermes config credentials can make provider fallback tests nondeterministic. Tests for explicit provider selection must exercise partial runtime configuration while ambient credentials exist.
Reusable references
- See
references/windows-verification-and-provider-fallbacks.mdfor the concrete ACP installation, byte-count reproduction, provider fallback reproduction, and verification commands from a representative Hermes Windows session. - See
references/cross-platform-path-test-triage.mdfor probes and decision rules covering native Windows paths, MSYS, WSL, file URIs, Termux hints, and platform-neutral fixtures. - See
references/windows-shlex-and-path-extraction.mdfor theshlex.split(posix=True)backslash-stripping gotcha and the Windows drive-path regex fix (slash-command arg parsing and terminal path extraction). - See
references/symlink-test-skip-pattern.mdfor the copy-paste_can_symlink()probe helper, skipif decorator, and the WindowsWinError 1314gotcha (skip the test, keep the production path guard). - See
references/standalone-plugin-module-loading.mdfor a copy-paste template that loads any Hermes plugin module standalone on Windows (sys.modules registration, MSYS path fix, venv interpreter, plugin-path discovery). - See
references/semantic-graph-live-smoke-and-commit-bound-evidence.mdfor isolated Semantic Graph runtime smoke gates, metadata redaction, bilingual recall, provenance, run-scoped export, correction history, and commit-bound review evidence. - See
references/llama-server-hf-live-embedding-probe-windows.mdfor Windows llama-server HF resolution, TLS build gates, model-loading lifecycle, embedding endpoint verification, stability interpretation, and public-diff hygiene. - See
references/ssrf-safe-client-remediation.mdfor fixing SSRF review findings in gateway adapters (create_ssrf_safe_async_client+await async_is_safe_url) and the autouse fixture that keeps the affected tests resolver-free.
Commit-bound evidence and runner post-processing
When verification uses a Windows/MSYS canonical runner, bind every claim to an exact commit SHA and working-tree state. A green run on HEAD + uncommitted changes is not evidence for HEAD alone. If a runner fix is uncommitted, report that boundary, commit the runner fix separately when practical, and rerun the identical canonical commands at the new HEAD before treating the evidence as commit-bound. Keep targeted tests, canonical-runner results, static checks, full-suite results, live integration, CI/review, merge, and production-readiness claims separate.
Treat test-worker exit codes and failure counts as authoritative. Duration metadata such as test_durations.json is optional scheduling data: normalize its path, create the parent directory, catch filesystem errors, emit a warning with path plus exception type/message, and never let cache persistence override the primary test result. After changing runner post-processing, use scripts/run_tests.sh rather than direct pytest alone and record pass/fail counts, RUNNER_EXIT, warnings, interpreter, shell, worker count, and timestamp. Update the implementation log with the final SHA and any failed patch attempt; a hunk mismatch is not a code change unless the working tree confirms one. See references/canonical-runner-commit-bound-evidence.md, references/msys-doubled-separator-fix.md, and references/semantic-graph-hardening.md.
Runner Failure Triage
When the canonical per-file runner exits non-zero after test execution, first separate test assertions from runner teardown or aggregation failures. Re-run the same test selection with the project interpreter directly, disabling unrelated pytest plugins or cache providers when the traceback implicates teardown noise. Report the direct pytest result separately from the canonical-runner result; never call a runner-level failure a test pass, and never promote focused green tests to a full-suite claim.
For the verified Windows/MSYS worktree case where all tests pass but _save_durations() fails while writing the ignored test_durations.json, see references/semantic-graph-hardening.md, references/canonical-runner-post-processing-failures.md, and references/test-runner-duration-cache-worktree.md. Treat duration-cache persistence as best-effort: normalize the path, create the parent, catch OSError, and preserve the primary test result.
Semantic retrieval / embedding verification
For incremental Semantic Graph lexical/dense retrieval work, preserve commit-scoped evidence rather than validating only the final branch. Record the base SHA and clean status before editing; write contract tests first and confirm a meaningful RED failure; keep each logical commit's boundary explicit; run the canonical runner after implementation and again after documentation or metric changes; and finish with lint, compile, diff/secret/path inspection, HEAD, and clean status.
Report per-class Recall@k/MRR and latency separately for identifiers, English/Japanese paraphrases, history/correction, and negatives. Distinguish candidate generation from final LLM context injection with negative_wrong_memory_hit_rate and negative_context_injection_rate. A candidate returned for a negative query is not itself proof that memory was injected.
For every hybrid retrieval increment, require zero rejected/superseded leakage in normal mode, zero cross-run leakage, zero secret-bearing recall, and zero retrieval-induced state mutation. Verify embedding-disabled and backend-failure paths preserve the lexical result. Keep targeted, CI, full-suite, live-provider, deployment, and production-readiness claims separate.
See references/semantic-retrieval-verification.md for the reusable evidence checklist and metric definitions.
Release-diff adoption on Windows
When a user supplies a semantic adoption plan as an attachment, read the explicitly named file directly even if automatic @file context injection warns that it is outside the workspace. Treat the warning as an injection boundary, not proof the file is unreadable. Check for any companion candidate ledger separately; reading the plan does not establish that the ledger was attached. Keep repository writes confined to the approved worktree.
For large upstream release comparisons, pin both release commits and the downstream base, run inventory helpers in report-only mode, and distinguish their candidate classifications from reviewed behavioral-equivalence decisions. A green focused test on a dirty worktree is evidence for that worktree only, not for its HEAD, complete adoption, release readiness, or merge. Preserve historical provenance and defer version metadata changes until the selected contracts and required gates are verified.
For bounded asynchronous discovery, test the peak number of active connects with an event/barrier rather than inferring concurrency from elapsed sleep. Exercise the configured limit, explicit unlimited setting, invalid values, and the timeout budget for successive waves; then separately probe failure, cancellation/re-entry, and profile scope. A timing-free peak assertion should fail when the cap is deliberately bypassed. Keep all these results distinct from the full subsystem and native-Windows suite.
Completion criteria
- The requested package is installed or a precise blocker is reported.
- The reported regression has a focused test that passes, or an investigation-only task has a grounded production-versus-test classification.
- Related subsystem tests pass.
- Static checks pass when files were changed.
- Full-suite status is reported without overstating it.
For SQLite-backed Semantic Graph schema evolution and derived-embedding invalidation, see references/semantic-graph-v2-migration-pattern.md.
For float32-le embedding vector math, underflow-safe validation, two-stage normalization, model-identity boundaries, and exact cosine search isolation, see references/semantic-graph-embedding-vector-math.md.
04 同仓库更多 Skills
xurl
X/Twitter via xurl CLI: post, search, DM, media, v2 API.
writing-plans
Write implementation plans: bite-sized tasks, paths, code.
whisper
OpenAI's general-purpose speech recognition model. Supports 99 languages, transcription, translation to English, and language identification. Six model sizes from tiny (39M params) to large (1550M params). Use for speech-to-text, podcast transcription, or multilingual audio processing. Best for robust, multilingual ASR.
weights-and-biases
W&B: log ML experiments, sweeps, model registry, dashboards.
watchers
Poll RSS, JSON APIs, and GitHub with watermark dedup.
serving-llms-vllm
vLLM: high-throughput LLM serving, OpenAI API, quantization.