Skip to content

fix: session reset + custom provider model switch + honcho base_url#2110

Merged
teknium1 merged 5 commits into
mainfrom
hermes/hermes-5d6932ba
Mar 20, 2026
Merged

fix: session reset + custom provider model switch + honcho base_url#2110
teknium1 merged 5 commits into
mainfrom
hermes/hermes-5d6932ba

Conversation

@teknium1

@teknium1 teknium1 commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Changes

1. Complete session reset — missing compressor counters + test

Follow-up to PR #2101 by @InB4DevOps. Adds missing context compressor resets in reset_session_state(): compression_count, last_total_tokens, _context_probed. Fixes test stubs and adds regression test for #2099.

2. Skip model auto-detection for custom/local providers

When the user is on a custom provider, /model <name> no longer auto-detects provider switches. Requires explicit provider:model syntax to switch away. Prints endpoint URL and tip.

3. Honcho base_url for local/self-hosted instances (PR #2120 by @unclebumpy)

HONCHO_BASE_URL was silently ignored. Now from_env() and from_global_config() read it, and get_honcho_client() allows base_url without api_key for local instances. Added to OPTIONAL_ENV_VARS registry.

Test plan

python -m pytest tests/test_cli_new_session.py tests/test_cli_init.py tests/honcho_integration/ -n0 -q
# 125 passed

Closes #2099

@InB4DevOps

Copy link
Copy Markdown
Contributor

lgtm

@teknium1 teknium1 changed the title fix: complete session reset — missing compressor counters + test fix: session reset completeness + custom provider model switching Mar 20, 2026
Test added 3 commits March 20, 2026 04:35
Follow-up to PR #2101 (InB4DevOps). Adds three missing context compressor
resets in reset_session_state():
- compression_count (displayed in status bar)
- last_total_tokens
- _context_probed (stale context-error flag)

Also fixes the test_cli_new_session.py prompt_toolkit mock (missing
auto_suggest stub) and adds a regression test for #2099 that verifies
all token counters and compressor state are zeroed on /new.
When the user is on a custom provider (provider=custom, localhost, or
127.0.0.1 endpoint), /model <name> no longer tries to auto-detect a
provider switch. The model name changes on the current endpoint as-is.

To switch away from a custom endpoint, users must use explicit
provider:model syntax (e.g. /model openai-codex:gpt-5.2-codex).
A helpful tip is printed when changing models on a custom endpoint.

This prevents the confusing case where someone on LM Studio types
/model gpt-5.2-codex, the auto-detection tries to switch providers,
fails or partially succeeds, and requests still go to the old endpoint.

Also fixes the missing prompt_toolkit.auto_suggest mock stub in
test_cli_init.py (same issue already fixed in test_cli_new_session.py).
Cherry-picked from PR #2120 by @unclebumpy.

- from_env() now reads HONCHO_BASE_URL and enables Honcho when base_url
  is set, even without an API key
- from_global_config() reads baseUrl from config root with
  HONCHO_BASE_URL env var as fallback
- get_honcho_client() guard relaxed to allow base_url without api_key
  for no-auth local instances
- Added HONCHO_BASE_URL to OPTIONAL_ENV_VARS registry

Result: Setting HONCHO_BASE_URL=http://localhost:8000 in ~/.hermes/.env
now correctly routes the Honcho client to a local instance.
@teknium1 teknium1 force-pushed the hermes/hermes-5d6932ba branch from 308bbd8 to 4ad0083 Compare March 20, 2026 11:36
@teknium1 teknium1 changed the title fix: session reset completeness + custom provider model switching fix: session reset + custom provider model switch + honcho base_url Mar 20, 2026
Based on PR #1859 by @magi-morph (too stale to cherry-pick, reimplemented).

GPT-5.x models reject tool calls + reasoning_effort on
/v1/chat/completions with a 400 error directing to /v1/responses.
This auto-detects api.openai.com in the base URL and switches to
codex_responses mode in three places:

- AIAgent.__init__: upgrades chat_completions → codex_responses
- _try_activate_fallback(): same routing for fallback model
- runtime_provider.py: _detect_api_mode_for_url() for both custom
  provider and openrouter runtime resolution paths

Also extracts _is_direct_openai_url() helper to replace the inline
check in _max_tokens_param().
…prompt

Cron jobs run unattended with no user present. Previously the agent had
send_message and clarify tools available, which makes no sense — the
final response is auto-delivered, and there's nobody to ask questions to.

Changes:
- Disable messaging and clarify toolsets for cron agent sessions
- Update cron platform hint to emphasize autonomous execution: no user
  present, cannot ask questions, must execute fully and make decisions
- Update cronjob tool schema description to match (remove stale
  send_message guidance)
@teknium1 teknium1 merged commit b7b5856 into main Mar 20, 2026
1 check passed
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…5d6932ba

fix: session reset + custom provider model switch + honcho base_url
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…5d6932ba

fix: session reset + custom provider model switch + honcho base_url
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
…5d6932ba

fix: session reset + custom provider model switch + honcho base_url
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…5d6932ba

fix: session reset + custom provider model switch + honcho base_url
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…5d6932ba

fix: session reset + custom provider model switch + honcho base_url
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.

[Bug]: when calling /new or /clear the status bar still shows old values

2 participants