Skip to content

refactor: remove 1,784 lines of dead code across 77 files#9180

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-ae87277c
Apr 13, 2026
Merged

refactor: remove 1,784 lines of dead code across 77 files#9180
teknium1 merged 1 commit into
mainfrom
hermes/hermes-ae87277c

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Deep scan for dead code using vulture, pyflakes, and manual cross-referencing of the entire codebase. Every removal was verified by searching for callers across all production and test code.

What was removed

Dead functions (41 with zero callers, 7 test-only):

  • Refactoring leftovers: _set_default_model, _setup_copilot_reasoning_selection, rebuild_lookups, clear_session_context, get_logs_dir, clear_session
  • Unused API surface: search_models_dev, get_pricing, skills_categories, get_read_files_summary, clear_read_tracker, menu_labels, get_spinner_list, get_tip_count
  • Dead compatibility wrappers: schedule_cronjob, list_cronjobs, remove_cronjob
  • Stale debug helpers: get_debug_session_info copies in 4 tool files (centralized version in debug_helpers.py already exists)
  • Dead gateway methods: send_emote/send_notice (matrix), send_reaction (bluebubbles), _normalize_inbound_text (feishu), fetch_room_history (matrix), _start_typing_indicator (signal), parse_feishu_post_content (feishu)
  • Superseded UI code: _interactive_provider_selection, _interactive_model_selection

Dead constants (5): NOUS_API_BASE_URL, SKILLS_TOOL_DESCRIPTION, FILE_TOOLS, VALID_ASPECT_RATIOS, MEMORY_DIR

Unused imports (~35): Cleaned across agent/, hermes_cli/, tools/, and gateway/ directories. Skipped intentional re-exports (noqa: F401) and try/except availability probes.

Test plan

  • 609 tests covering all affected files pass (1 pre-existing feishu SDK failure unrelated)
  • Tests for removed functions deleted
  • Tests using removed utilities (clear_read_tracker, MEMORY_DIR) updated to use internal APIs
  • Live smoke test: CLI chat with tool calling works correctly

Stats

77 files changed, 44 insertions(+), 1784 deletions(-)

Deep scan with vulture, pyflakes, and manual cross-referencing identified:
- 41 dead functions/methods (zero callers in production)
- 7 production-dead functions (only test callers, tests deleted)
- 5 dead constants/variables
- ~35 unused imports across agent/, hermes_cli/, tools/, gateway/

Categories of dead code removed:
- Refactoring leftovers: _set_default_model, _setup_copilot_reasoning_selection,
  rebuild_lookups, clear_session_context, get_logs_dir, clear_session
- Unused API surface: search_models_dev, get_pricing, skills_categories,
  get_read_files_summary, clear_read_tracker, menu_labels, get_spinner_list
- Dead compatibility wrappers: schedule_cronjob, list_cronjobs, remove_cronjob
- Stale debug helpers: get_debug_session_info copies in 4 tool files
  (centralized version in debug_helpers.py already exists)
- Dead gateway methods: send_emote, send_notice (matrix), send_reaction
  (bluebubbles), _normalize_inbound_text (feishu), fetch_room_history
  (matrix), _start_typing_indicator (signal), parse_feishu_post_content
- Dead constants: NOUS_API_BASE_URL, SKILLS_TOOL_DESCRIPTION,
  FILE_TOOLS, VALID_ASPECT_RATIOS, MEMORY_DIR
- Unused UI code: _interactive_provider_selection,
  _interactive_model_selection (superseded by prompt_toolkit picker)

Test suite verified: 609 tests covering affected files all pass.
Tests for removed functions deleted. Tests using removed utilities
(clear_read_tracker, MEMORY_DIR) updated to use internal APIs directly.
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Supply Chain Risk Detected

This PR contains patterns commonly associated with supply chain attacks. This does not mean the PR is malicious — but these patterns require careful human review before merging.

⚠️ WARNING: Install hook files modified

These files can execute code during package installation or interpreter startup.

Files:

hermes_cli/setup.py

Automated scan triggered by supply-chain-audit. If this is a false positive, a maintainer can approve after manual review.

@xeloxa

xeloxa commented Apr 13, 2026

Copy link
Copy Markdown

@teknium1 #9179

@teknium1 teknium1 merged commit 8d023e4 into main Apr 13, 2026
4 of 6 checks passed
@teknium1 teknium1 deleted the hermes/hermes-ae87277c branch April 13, 2026 23:32
ccross2 added a commit to ccross2/hermes-agent that referenced this pull request Apr 14, 2026
The /presentation toggle command (85b86fa) referenced
CLASSIC_PRESENTATION and normalize_presentation_mode() at the
call site without ever defining them. Any invocation raised
NameError before reaching the logic — the toggle was latent-broken
from introduction.

Exposed by rebase onto 0.9 upstream: the tests happened to import
fine but failed at assertion time. Dead-code cleanup (NousResearch#9180)
didn't cause this — the identifiers never existed anywhere in
upstream either.

Fix:
- Module-level constants: CLASSIC_PRESENTATION = "classic",
  CLAUDE_CODE_PRESENTATION = "claude_code", VALID_PRESENTATION_MODES
- normalize_presentation_mode() folds aliases (cc, claude-code,
  claudecode, case/dash variants) to canonical forms
- Validation check now uses the normalized value (previously
  checked unnormalized input against a set containing canonical
  forms — another latent bug where "Classic" would be rejected)

Verified: 3/3 tests in tests/cli/test_cli_presentation_command.py
pass; full 4-patch sweep 203 passed, 15 skipped.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ccross2 added a commit to ccross2/hermes-agent that referenced this pull request Apr 14, 2026
Brings ccross2/hermes-agent up to NousResearch/hermes-agent@ac80bd61
(v0.9.0 release "the everywhere release").

Merge highlights from upstream:
- Pluggable Context Engine slot (NousResearch#7464)
- Local web dashboard, Termux/Android, iMessage/WeChat platforms
- Fast Mode (/fast) for OpenAI/Anthropic priority queues
- Background process monitoring (watch_patterns, NousResearch#7635)
- Comprehensive security hardening (Twilio signature, SSRF, path
  traversal, git injection, shell injection in sandbox writes)
- Dead code cleanup (1,784 lines across 77 files, NousResearch#9180)
- CANONICAL_PROVIDERS consolidation (NousResearch#9237)
- gateway /stop no longer resets session (NousResearch#9224)

Conflict resolution summary (7 hunks across 3 files):

1-4. cli.py _build_compact_banner — took upstream.
   Upstream added skin-aware colors + version label + tiny_line for
   narrow terminals. ccross2 had added word-wrapping for narrow
   terminals (commit 5b32504). The skin engine integration is
   foundational (affects several other surfaces); the word-wrapping
   improvement can be re-added as a follow-up on top of skin-aware.

5. cli.py _reset_stream_state — kept BOTH.
   ccross2 added _stream_in_code_fence; upstream added
   _deferred_content. Different features in the same reset hook,
   both needed.

6. tools/transcription_tools.py get_stt_model_from_config — took ccross2.
   ccross2 added provider-aware model resolution (local/groq/openai
   with per-provider model overrides). Upstream restructured but
   didn't provide an equivalent; the function coexists with upstream's
   _load_stt_config() which returns the raw dict.

7. tests/tools/test_transcription_tools.py — took ccross2.
   Tests for the provider-aware function we kept in (6).

Post-merge state: 5 local ccross2 commits preserved on top of
upstream 0.9. Backup of pre-merge state at
ccross2/cc-fusion-09-rebase-backup (Claude Code's rebase attempt
with 4 of the 5 patches, before this proper merge).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ccross2 added a commit to ccross2/hermes-agent that referenced this pull request Apr 14, 2026
The /presentation toggle command (85b86fa) referenced
CLASSIC_PRESENTATION and normalize_presentation_mode() at the
call site without ever defining them. Any invocation raised
NameError before reaching the logic — the toggle was latent-broken
from introduction.

Exposed by rebase onto 0.9 upstream: the tests happened to import
fine but failed at assertion time. Dead-code cleanup (NousResearch#9180)
didn't cause this — the identifiers never existed anywhere in
upstream either.

Fix:
- Module-level constants: CLASSIC_PRESENTATION = "classic",
  CLAUDE_CODE_PRESENTATION = "claude_code", VALID_PRESENTATION_MODES
- normalize_presentation_mode() folds aliases (cc, claude-code,
  claudecode, case/dash variants) to canonical forms
- Validation check now uses the normalized value (previously
  checked unnormalized input against a set containing canonical
  forms — another latent bug where "Classic" would be rejected)

Verified: 3/3 tests in tests/cli/test_cli_presentation_command.py
pass; full 4-patch sweep 203 passed, 15 skipped.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
NicholasJacob1990 added a commit to NicholasJacob1990/hermes-agent-fusion that referenced this pull request Apr 19, 2026
Vanilla's dead-code cleanup (NousResearch#9180) removed skills_categories() from
tools/skills_tool.py, but the enhanced fork's /api/skills/categories
endpoint (gateway/platforms/api_server.py:1490) and webapi/routes/skills.py
still import and call it. The merge preserved both upstreams silently,
breaking gateway startup with ImportError at module load time.

Fix: re-add the exact pre-removal body (from 8d023e4^). All deps
(_parse_frontmatter, skill_matches_platform, _get_category_from_path,
_load_category_description, _EXCLUDED_SKILL_DIRS, tool_error) are
still present in the module — pure restoration, no new logic.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ulasbilgen pushed a commit to ulasbilgen/hermes-adhd-agent that referenced this pull request May 1, 2026
…h#9180)

Deep scan with vulture, pyflakes, and manual cross-referencing identified:
- 41 dead functions/methods (zero callers in production)
- 7 production-dead functions (only test callers, tests deleted)
- 5 dead constants/variables
- ~35 unused imports across agent/, hermes_cli/, tools/, gateway/

Categories of dead code removed:
- Refactoring leftovers: _set_default_model, _setup_copilot_reasoning_selection,
  rebuild_lookups, clear_session_context, get_logs_dir, clear_session
- Unused API surface: search_models_dev, get_pricing, skills_categories,
  get_read_files_summary, clear_read_tracker, menu_labels, get_spinner_list
- Dead compatibility wrappers: schedule_cronjob, list_cronjobs, remove_cronjob
- Stale debug helpers: get_debug_session_info copies in 4 tool files
  (centralized version in debug_helpers.py already exists)
- Dead gateway methods: send_emote, send_notice (matrix), send_reaction
  (bluebubbles), _normalize_inbound_text (feishu), fetch_room_history
  (matrix), _start_typing_indicator (signal), parse_feishu_post_content
- Dead constants: NOUS_API_BASE_URL, SKILLS_TOOL_DESCRIPTION,
  FILE_TOOLS, VALID_ASPECT_RATIOS, MEMORY_DIR
- Unused UI code: _interactive_provider_selection,
  _interactive_model_selection (superseded by prompt_toolkit picker)

Test suite verified: 609 tests covering affected files all pass.
Tests for removed functions deleted. Tests using removed utilities
(clear_read_tracker, MEMORY_DIR) updated to use internal APIs directly.
aj-nt pushed a commit to aj-nt/hermes-agent that referenced this pull request May 1, 2026
…h#9180)

Deep scan with vulture, pyflakes, and manual cross-referencing identified:
- 41 dead functions/methods (zero callers in production)
- 7 production-dead functions (only test callers, tests deleted)
- 5 dead constants/variables
- ~35 unused imports across agent/, hermes_cli/, tools/, gateway/

Categories of dead code removed:
- Refactoring leftovers: _set_default_model, _setup_copilot_reasoning_selection,
  rebuild_lookups, clear_session_context, get_logs_dir, clear_session
- Unused API surface: search_models_dev, get_pricing, skills_categories,
  get_read_files_summary, clear_read_tracker, menu_labels, get_spinner_list
- Dead compatibility wrappers: schedule_cronjob, list_cronjobs, remove_cronjob
- Stale debug helpers: get_debug_session_info copies in 4 tool files
  (centralized version in debug_helpers.py already exists)
- Dead gateway methods: send_emote, send_notice (matrix), send_reaction
  (bluebubbles), _normalize_inbound_text (feishu), fetch_room_history
  (matrix), _start_typing_indicator (signal), parse_feishu_post_content
- Dead constants: NOUS_API_BASE_URL, SKILLS_TOOL_DESCRIPTION,
  FILE_TOOLS, VALID_ASPECT_RATIOS, MEMORY_DIR
- Unused UI code: _interactive_provider_selection,
  _interactive_model_selection (superseded by prompt_toolkit picker)

Test suite verified: 609 tests covering affected files all pass.
Tests for removed functions deleted. Tests using removed utilities
(clear_read_tracker, MEMORY_DIR) updated to use internal APIs directly.
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…h#9180)

Deep scan with vulture, pyflakes, and manual cross-referencing identified:
- 41 dead functions/methods (zero callers in production)
- 7 production-dead functions (only test callers, tests deleted)
- 5 dead constants/variables
- ~35 unused imports across agent/, hermes_cli/, tools/, gateway/

Categories of dead code removed:
- Refactoring leftovers: _set_default_model, _setup_copilot_reasoning_selection,
  rebuild_lookups, clear_session_context, get_logs_dir, clear_session
- Unused API surface: search_models_dev, get_pricing, skills_categories,
  get_read_files_summary, clear_read_tracker, menu_labels, get_spinner_list
- Dead compatibility wrappers: schedule_cronjob, list_cronjobs, remove_cronjob
- Stale debug helpers: get_debug_session_info copies in 4 tool files
  (centralized version in debug_helpers.py already exists)
- Dead gateway methods: send_emote, send_notice (matrix), send_reaction
  (bluebubbles), _normalize_inbound_text (feishu), fetch_room_history
  (matrix), _start_typing_indicator (signal), parse_feishu_post_content
- Dead constants: NOUS_API_BASE_URL, SKILLS_TOOL_DESCRIPTION,
  FILE_TOOLS, VALID_ASPECT_RATIOS, MEMORY_DIR
- Unused UI code: _interactive_provider_selection,
  _interactive_model_selection (superseded by prompt_toolkit picker)

Test suite verified: 609 tests covering affected files all pass.
Tests for removed functions deleted. Tests using removed utilities
(clear_read_tracker, MEMORY_DIR) updated to use internal APIs directly.
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…h#9180)

Deep scan with vulture, pyflakes, and manual cross-referencing identified:
- 41 dead functions/methods (zero callers in production)
- 7 production-dead functions (only test callers, tests deleted)
- 5 dead constants/variables
- ~35 unused imports across agent/, hermes_cli/, tools/, gateway/

Categories of dead code removed:
- Refactoring leftovers: _set_default_model, _setup_copilot_reasoning_selection,
  rebuild_lookups, clear_session_context, get_logs_dir, clear_session
- Unused API surface: search_models_dev, get_pricing, skills_categories,
  get_read_files_summary, clear_read_tracker, menu_labels, get_spinner_list
- Dead compatibility wrappers: schedule_cronjob, list_cronjobs, remove_cronjob
- Stale debug helpers: get_debug_session_info copies in 4 tool files
  (centralized version in debug_helpers.py already exists)
- Dead gateway methods: send_emote, send_notice (matrix), send_reaction
  (bluebubbles), _normalize_inbound_text (feishu), fetch_room_history
  (matrix), _start_typing_indicator (signal), parse_feishu_post_content
- Dead constants: NOUS_API_BASE_URL, SKILLS_TOOL_DESCRIPTION,
  FILE_TOOLS, VALID_ASPECT_RATIOS, MEMORY_DIR
- Unused UI code: _interactive_provider_selection,
  _interactive_model_selection (superseded by prompt_toolkit picker)

Test suite verified: 609 tests covering affected files all pass.
Tests for removed functions deleted. Tests using removed utilities
(clear_read_tracker, MEMORY_DIR) updated to use internal APIs directly.
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…h#9180)

Deep scan with vulture, pyflakes, and manual cross-referencing identified:
- 41 dead functions/methods (zero callers in production)
- 7 production-dead functions (only test callers, tests deleted)
- 5 dead constants/variables
- ~35 unused imports across agent/, hermes_cli/, tools/, gateway/

Categories of dead code removed:
- Refactoring leftovers: _set_default_model, _setup_copilot_reasoning_selection,
  rebuild_lookups, clear_session_context, get_logs_dir, clear_session
- Unused API surface: search_models_dev, get_pricing, skills_categories,
  get_read_files_summary, clear_read_tracker, menu_labels, get_spinner_list
- Dead compatibility wrappers: schedule_cronjob, list_cronjobs, remove_cronjob
- Stale debug helpers: get_debug_session_info copies in 4 tool files
  (centralized version in debug_helpers.py already exists)
- Dead gateway methods: send_emote, send_notice (matrix), send_reaction
  (bluebubbles), _normalize_inbound_text (feishu), fetch_room_history
  (matrix), _start_typing_indicator (signal), parse_feishu_post_content
- Dead constants: NOUS_API_BASE_URL, SKILLS_TOOL_DESCRIPTION,
  FILE_TOOLS, VALID_ASPECT_RATIOS, MEMORY_DIR
- Unused UI code: _interactive_provider_selection,
  _interactive_model_selection (superseded by prompt_toolkit picker)

Test suite verified: 609 tests covering affected files all pass.
Tests for removed functions deleted. Tests using removed utilities
(clear_read_tracker, MEMORY_DIR) updated to use internal APIs directly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants