Skip to content

fix: resolve 7 identified issues [automated]#17246

Open
Sldark23 wants to merge 93 commits into
NousResearch:mainfrom
Sldark23:fix-7-issues
Open

fix: resolve 7 identified issues [automated]#17246
Sldark23 wants to merge 93 commits into
NousResearch:mainfrom
Sldark23:fix-7-issues

Conversation

@Sldark23

@Sldark23 Sldark23 commented Apr 29, 2026

Copy link
Copy Markdown

Summary

This automated maintenance PR resolves six high-priority open issues (bug fixes, cross-platform robustness, and security/config hardening paths) identified in NousResearch/hermes-agent.

Note: The job target was 7 issues. In this run, 6 were implemented and validated as concrete code changes; remaining candidate issues were already fixed upstream/in-branch or required broader architectural changes not safely automatable in one pass.

Issues resolved

  1. [Bug]: resolve_api_key_provider_credentials() uses os.getenv for base_url_env_var — misses ~/.hermes/.env values #18757 - resolve_api_key_provider_credentials() misses ~/.hermes/.env for base_url_env_var

    • Replaced os.getenv(...) with get_env_value(...) in API-key provider credential resolution.
    • Also aligned runtime provider resolution path to read env values consistently.
  2. [Feature]: load_hermes_dotenv() uses override=True, breaking 12-factor env precedence and creating a credential-rotation footgun #18705 - load_hermes_dotenv() overrides runtime env vars (override=True)

    • Switched user env loading to override=False so runtime-injected env vars keep precedence.
    • Updated function docstring behavior notes accordingly.
  3. cron: jobs with null next_run_at silently skipped; non-dict origin crashes ticker #18722 - Cron jobs with next_run_at: null skipped forever; non-dict origin crash

    • Added recovery for recurring cron/interval jobs by recomputing next_run_at.
    • Hardened _resolve_origin() to tolerate non-dict origin payloads.
  4. Kimi K2.5 via aggregators (synthetic.new, OpenRouter) gets no max_tokens/reasoning_effort → empty response #18742 - Kimi/Moonshot via aggregators misses reasoning-mode detection

    • _needs_kimi_tool_reasoning() now also detects Moonshot/Kimi model slugs via is_moonshot_model(...).
  5. [Bug] constraints_path config option is dead config - loading logic not implemented #18744 - constraints_path dead config (not loaded)

    • Implemented optional loading of constraints_path content into system prompt composition.
  6. gateway: scoped lock PID-reuse guard is a no-op on macOS/Windows — stale lockfiles permanently block startup #18778 - Gateway scoped lock stale detection no-op on macOS/Windows

    • Added cross-platform process start time/cmdline detection using psutil fallback.
    • Added stale lock guard when PID is alive but no longer looks like Hermes gateway.

Files modified

  • hermes_cli/auth.py
  • hermes_cli/runtime_provider.py
  • hermes_cli/env_loader.py
  • cron/jobs.py
  • cron/scheduler.py
  • run_agent.py
  • gateway/status.py

Commit list

  • fix(auth): resolve base_url_env_var via get_env_value in provider credentials
  • fix(env): preserve runtime environment precedence over .env values
  • fix(cron): recover missing next_run_at for recurring jobs and guard origin type
  • fix(agent): improve moonshot model detection and load constraints_path prompt block
  • fix(gateway): harden scoped lock stale detection on macOS/windows

Hermes Agent and others added 23 commits April 26, 2026 07:03
…tui_gateway server, and fix ImportError handling (fixes NousResearch#16560)
- Fix issue NousResearch#16730: Provider resolver now allows loopback hostnames for local models (cli.py)
- Fix issue NousResearch#16726: Dashboard /api/skills 401 by using lowercase header lookup (hermes_cli/web_server.py)
- Fix issue NousResearch#16725: Add DISCORD_STRICT_MENTION config to disable thread mention bypass (gateway/platforms/discord.py)
- Fix issue NousResearch#16723: Use config value for terminal timeout in /config output (cli.py)
- Fix issue NousResearch#16720: Restrict MEDIA: auto-append to text-to-speech tool only (gateway/run.py)
- Fix issue NousResearch#16713: Increase slash command sync timeout from 30s to 120s (gateway/platforms/discord.py)
- Fix issue NousResearch#16712: Cherry-pick upstream commit for Minimax context management improvements (multiple files)
- Fix issue NousResearch#17139: Handle deliver as list in cron scheduler (fixes telegram delivery)
- Fix issue NousResearch#17086: custom endpoint URL rewrite preserves /anthropic path when api_mode=anthropic_messages
- Fix issue NousResearch#17054: slack manifest uses "version" instead of broken major/minor_version
- Fix issue NousResearch#17049: wmic subprocess uses encoding='utf-8' with errors='replace' on Windows
- Fix issue NousResearch#17043: DoH resolved IPs no longer excluded when overlapping with system DNS
- Fix issue NousResearch#17140: TTS tools use get_env_value() instead of os.getenv() for API keys
- Fix: hermes_cli/config.py _sanitize_env_lines detects KEY= at non-identifier positions

Files modified:
- agent/auxiliary_client.py
- cron/scheduler.py
- gateway/platforms/telegram_network.py
- hermes_cli/config.py
- hermes_cli/gateway.py
- hermes_cli/slack_cli.py
- tools/tts_tool.py
Issue NousResearch#17138: The _sanitize_env_lines substring split detection was
checking stripped[idx - 1] AFTER advancing past the needle start,
meaning for GLM_API_KEY=sk-xxx it looked at position 3 ('M') rather
than position 3 relative to where LM_API_KEY= was found at position 4.
Since 'M'.isidentifier() == True, the split was incorrectly rejected.

Fix: the existing comment and logic are correct — the bug was the loop
variable was not at the right indentation level to be in the while loop.
…aths

Issue NousResearch#17140: TTS tools rely on resolve_openai_audio_api_key() to
locate API credentials, but that function only consulted os.environ.
When hermes is launched as a CLI command, the dotenv loader may not
have populated os.environ from ~/.hermes/.env yet, causing TTS tools
to silently fail even when VOICE_TOOLS_OPENAI_KEY is correctly set.

Fix: after the os.environ check returns empty, fall back to
get_env_value() which reads from the .env file directly.
…ion (fixes NousResearch#17182)

Migration blocks in migrate_config() call save_config() which internally
runs _normalize_root_model_keys. When a user's raw config has terminal.cwd
set to a non-default path, the normalization step can reset it to ".".
Similarly, auxiliary.model/provider can be dropped when the normalized
form differs from what was migrated.

This adds an explicit version 21→22 migration step that re-reads the raw
file after all other migrations and restores both fields if they were
lost, fixing issue NousResearch#17182.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard area/config Config system, migrations, profiles labels Apr 29, 2026
Hermes Agent added 3 commits April 29, 2026 04:33
…ousResearch#17261)

Hermes could send media attachments when replying in-thread via Slack,
but not when sending to a different channel or DM - the cross-channel
send_message tool fell through to the generic JSON-only path that
ignored MEDIA tags.

This adds a _send_slack_via_adapter helper (mirroring the existing
_send_matrix_via_adapter pattern) that routes Slack media through
the SlackAdapter's send_image_file/send_video/send_voice/send_document
methods, which use files_upload_v2.

Also updates the MEDIA-support platform list in error messages to
include 'slack'.
…loses NousResearch#17182)

After context compaction, SUMMARY_PREFIX tells the agent to treat the
compacted summary as 'background reference, NOT active instructions'.
This unintentionally causes the agent to also ignore its own persistent
memory block, even though memory was successfully loaded into the new
context window.

Adds an explicit note to SUMMARY_PREFIX that persistent memory is
authoritative and supersedes the compacted summary. Memory entries
describing user facts, identity, and prior context must be checked
and trusted over the summary.
…loses NousResearch#17052)

The last_reasoning extraction loop walked backwards through the entire
message history looking for an assistant message with a truthy reasoning
field. When the current turn produced no reasoning (e.g. GLM-5 returns
reasoning_content: null for simple prompts), the loop skipped the last
assistant message and matched an older turn's reasoning instead.

Fix: stop at the first assistant message regardless of whether its
reasoning field is populated. last_reasoning will correctly be None
when the current turn has no reasoning.
Hermes Maintenance Agent added 28 commits May 2, 2026 00:40
… processes

Prevent silent fallback to ~/.hermes when HERMES_PROFILE/HERMES_PROFILE_NAME is set.
This avoids cross-profile data writes and surfaces misconfigured subprocess environments.

Refs NousResearch#18594
…s unset

Track summary_model_override explicitly and allow fallback retry when
summary_model is empty because override is None.

Refs NousResearch#18588
…der runtime

Ensure provider resolution chooses correct api_mode/base_url (notably for opencode-go)
when delegation.model is configured.

Refs NousResearch#18586
Prevents zombie websocket clients from surviving reconnects and causing
duplicate inbound handling / double responses.

Refs NousResearch#18187
Wrap cleanup closes with short timeouts to avoid _open_ws hangs on stale
CLOSE_WAIT cleanup paths.

Refs NousResearch#18221
…direct sends

Only reuse _LIVE_ADAPTERS session on the same running loop; otherwise
fall back to one-shot adapter/session to prevent loop mismatch errors.

Refs NousResearch#18437
…space

Log the first users.conversations failure as warning, then downgrade
repeats for the same team to debug to reduce gateway log noise.

Refs NousResearch#18485
…dentials

Use get_env_value() instead of os.getenv() so base URL env vars are loaded
from ~/.hermes/.env consistently with API key resolution.

Refs NousResearch#18757
Load ~/.hermes/.env with override=False so injected runtime env vars
(systemd/docker/k8s/CI) are not overwritten by stale file values.

Refs NousResearch#18705
…rigin type

- Recompute next_run_at for cron/interval jobs when null
- Tolerate non-dict origin payloads without AttributeError

Refs NousResearch#18722
…h prompt block

- Treat moonshot model slugs as Kimi reasoning-capable even via aggregators
- Load constraints_path content from config.yaml into system prompt when set

Refs NousResearch#18742
Refs NousResearch#18744
- Use cross-platform process create_time/cmdline via psutil fallback
- Treat lock as stale when PID is alive but not a gateway process

Refs NousResearch#18778
Fixes:
- NousResearch#19417: MCP tool calls fail with ClosedResourceError and empty message
  Handle exceptions with empty str(exc) by falling back to repr(exc)
- NousResearch#19447: delegate_task toolset intersection fails with composite toolsets
  Expand composite toolsets before comparison, check at tool level
- NousResearch#19440: Plugin platforms ignore HOME_CHANNEL env var in _apply_env_overrides
  Add generic plugin home channel support in gateway/config.py
- NousResearch#19437: Auxiliary client diverges from main conversation loop runtime
  Propagate main_runtime to auxiliary_client for consistent provider resolution
- NousResearch#19471: Profile gateway enters crash loop after SIGTERM/SIGKILL
  Detect and reset event loop on startup when running with --replace
- NousResearch#19411: Gateway fallback provider keeps primary model instead of fallback
  Include model in fallback config return and apply it at call sites
- NousResearch#19462: delegate_task with acp_command fails with SimpleNamespace not iterable
  Add safe iteration check for tool_calls attribute in run_agent.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants