mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-25 17:18:11 +00:00
Adds a new rule to scripts/check-windows-footguns.py that flags subprocess.run/Popen/call/check_output/check_call(..., text=True, ...) calls missing an explicit encoding= kwarg. On Chinese Windows (cp936/GBK) and other non-UTF-8 default codepages, text=True without encoding= decodes child output with locale.getpreferredencoding(False), crashing _readerthread with UnicodeDecodeError on non-default-codepage bytes (issues #47939, #53428, rule prevents future regressions. Rule design: - Pattern matches 'text=True' / 'text = True' - post_filter skips lines that: - already pass encoding= on the same line - are method definitions (def text) - contain text=True inside string literals - are not subprocess-shaped calls (heuristic via _is_likely_subprocess_call) - Two helper functions: _is_likely_subprocess_call, _looks_like_string_literal - Multi-line calls where subprocess.X( and text=True are on different lines are not flagged (acceptable false negative for a line-based scanner) Also fixes the linter's own footgun: get_staged_files() and get_diff_files() used subprocess.check_output(text=True) without encoding= — now fixed. Suppresses 4 false positives on non-Windows platform-exclusive calls: - tools/voice_mode.py (Termux/Android) - tools/environments/singularity.py (Linux HPC) - plugins/google_meet/cli.py (macOS system_profiler) Test plan: - 21 unit tests in tests/scripts/test_footgun_subprocess_encoding.py - TestDetection: 6 cases verifying the rule flags real subprocess calls - TestSuppression: 7 cases verifying false-positive avoidance - TestHelpers: 7 cases for the two helper functions - TestFullRepoScan: scans the whole tree and asserts the new rule finds only the 7 call sites that PR #60741 fixes (or zero, once #60741 merges) Verified: full-repo scan reports 7 matches on main (the #60741 sites), 4 platform-exclusive calls correctly suppressed, zero false positives. |
||
|---|---|---|
| .. | ||
| ci | ||
| lib | ||
| tests | ||
| whatsapp-bridge | ||
| add_contributor.py | ||
| analyze_livetest.py | ||
| benchmark_browser_eval.py | ||
| build_model_catalog.py | ||
| build_skills_index.py | ||
| capture-cage-terminal.sh | ||
| check-windows-footguns.py | ||
| check_subprocess_stdin.py | ||
| contributor_audit.py | ||
| dev-sandbox.sh | ||
| discord-voice-doctor.py | ||
| docker_config_migrate.py | ||
| docker_rebootstrap_nous_session.py | ||
| hermes-gateway | ||
| install.cmd | ||
| install.ps1 | ||
| install.sh | ||
| install_psutil_android.py | ||
| iso-certify.py | ||
| keystroke_diagnostic.py | ||
| kill_modal.sh | ||
| lint_diff.py | ||
| LIVETEST_README.md | ||
| profile-tui.py | ||
| release.py | ||
| run_tests.sh | ||
| run_tests_parallel.py | ||
| sample_and_compress.py | ||
| tool_search_livetest.py | ||