fix: critical MCP server bugs for Hermes Agent compatibility#2
Closed
htafolla wants to merge 4 commits into
Closed
fix: critical MCP server bugs for Hermes Agent compatibility#2htafolla wants to merge 4 commits into
htafolla wants to merge 4 commits into
Conversation
Comprehensive bug fixes across all 10 MCP servers identified through deep testing with Hermes Agent. Fixes ensure proper function when tools are invoked by AI agents. ## Critical Fixes - **Command injection**: Replaced execSync string interpolation with execFileSync args arrays in auto-format, lint, and security-scan - **Division by zero**: Guarded all division operations in architect-tools (file counts, dependency averages) - **Unhandled sync stat crashes**: Wrapped fs.statSync in try/catch to handle race conditions (file deleted between readdir and stat) - **MCP connection crashes**: Added top-level try/catch in CallToolRequest handlers across 7 servers to prevent unhandled exceptions from killing the MCP connection ## High Priority Fixes - **Infinite recursion**: Renamed enforcer-tools import to avoid method name collision causing stack overflow - **stdio:inherit corrupting MCP protocol**: Changed auto-format Prettier to always use stdio:'pipe' - **npm audit data loss**: Parse error.stdout for JSON vulnerability data when npm audit exits non-zero - **Hardcoded quality scores**: Compute enforcer overallScore from actual sub-check results instead of constant 85 - **Duplicate signal handlers**: Removed duplicate SIGINT/SIGTERM registrations in architect-tools, enforcer, researcher ## Medium Priority Fixes - **execSync timeouts**: Added 30s timeout to all execFileSync calls - **ESLint 9 flat config**: Added eslint.config.js/mjs detection - **Researcher search scope**: Now searches all project dirs, not just src/ - **Package manager auto-detection**: security-scan now detects pnpm/yarn/npm based on lockfile presence - **Security scan false positives**: Exclude test files and comments from vulnerability pattern matching - **State manager error propagation**: saveState now throws on write failure instead of silently succeeding - **Framework-help inconsistencies**: Fixed agent count (8->26), codex term count, added default case for unknown command types - **Orchestrator version**: Updated 1.10.0->1.14.1, fixed stop() to actually close the server - **Estimation null safety**: Added null guard for args parameter ## Low Priority Fixes - Removed void keyword from frameworkLogger.log calls - Double JSON.stringify in state-manager validation - findDependentKeys now matches quoted keys only - Unbounded timer cleanup in researcher checkParent - File scan depth limit (10) in security-scan Tested: 54 functional tests across all 10 servers, all passing. 10 files changed, 614 insertions(+), 290 deletions(-)
Use optional chaining (?.[1]) instead of truthy check on match array before indexing. TypeScript strict mode does not narrow RegExpMatchArray index access even after null check.
htafolla
added a commit
that referenced
this pull request
Mar 27, 2026
- Add Hermes Agent skill (src/skills/hermes-agent/SKILL.md) - 257-line skill covering all CLI commands - MCP server integration guide with config.yaml - Quick decision matrix and pitfalls - Add standalone mode (--standalone flag) - Install MCP servers without OpenCode dependency - For use with Hermes Agent without OpenCode - MCP server security fixes (from PR #2) - execSync → execFileSync (command injection prevention) - Add try/catch around tool handlers - Add timeouts (30s) to exec calls - Remove SIGINT/SIGTERM handlers (Hermes manages) - fs.statSync error handling - Update codex term counts (43→55, 46→60) - Update agent counts (8→26) - Add processor pipeline MCP server test - Remove invalid routing pipeline test
Also synced version to 1.15.1 to match published npm.
Owner
Author
|
Closing in favor of a fresh PR with the same fix |
htafolla
added a commit
that referenced
this pull request
Mar 28, 2026
Bug #1: Test logs not being deleted - Added afterEach cleanup to remove test-activity-*.log files - Added afterEach cleanup to remove test-calibration-*.log files - These test artifacts were created by unit tests but never cleaned up - Located in src/__tests__/setup.ts Bug #2: activity.log not being archived - Removed 'logs/framework/activity.log' from cleanupLogFiles excludePatterns - This was preventing proper log rotation and archival - Located in src/postprocessor/triggers/GitHookTrigger.ts line 474 Impact: - Test files will now be properly cleaned after tests run - activity.log will now be properly rotated and archived instead of truncated - Prevents future data loss from log rotation bugs
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.
Summary
Comprehensive bug fixes across all 10 MCP servers identified through deep testing with Hermes Agent (54 functional tests). These fixes ensure proper function when tools are invoked by AI agents.
Testing
Critical Fixes
execSyncstring interpolationcalculateStructureMetricsandmapDependenciesNaNon empty projects, breaking agent analysisfs.statSynccrash on race conditionHigh Priority Fixes
rule_validationcallstdio: "inherit"corrupts MCP protocol streamoverallScore: 85Medium Priority Fixes
execFileSynctimeouts (30s) on all shell commandseslint.config.js/mjs)src/)stop()now actually closes the serverFiles Changed