Skip to content

fix(cli): respect explicit --max-turns value even when it equals default - #87

Merged
teknium1 merged 1 commit into
NousResearch:mainfrom
0xbyt4:fix/cli-max-turns-sentinel
Feb 27, 2026
Merged

fix(cli): respect explicit --max-turns value even when it equals default#87
teknium1 merged 1 commit into
NousResearch:mainfrom
0xbyt4:fix/cli-max-turns-sentinel

Conversation

@0xbyt4

@0xbyt4 0xbyt4 commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • --max-turns used 60 as both the default value and the sentinel to detect whether the flag was passed (cli.py:795)
  • This contradicts the documented priority order at cli.py:794: CLI arg > env var > config file > default
  • Running --max-turns 60 was indistinguishable from not passing the flag, so HERMES_MAX_ITERATIONS env var would silently override the explicit CLI value
  • Changed the default to None so any user-supplied value always takes priority

Reproduction

  1. Set HERMES_MAX_ITERATIONS=30
  2. Run python cli.py --max-turns 60
  3. Before fix: max_turns is set to 30 (env var overrides explicit CLI arg)
  4. After fix: max_turns is set to 60 (CLI arg respected)

max_turns used 60 as both the default and the sentinel to detect
whether the user passed the flag. This meant `--max-turns 60` was
indistinguishable from "not passed", so the env var
HERMES_MAX_ITERATIONS would silently override the explicit CLI value.

Change the default to None so any user-supplied value takes priority.
@teknium1
teknium1 merged commit ae8d25f into NousResearch:main Feb 27, 2026
RUFFY-369 added a commit to RUFFY-369/hermes-agent that referenced this pull request Apr 12, 2026
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…inel

fix(cli): respect explicit --max-turns value even when it equals default
Brecht-H pushed a commit to Brecht-H/hermes-agent that referenced this pull request May 5, 2026
Adds a `skill_invocations` table to state.db and writes one row per
skill listed on a cron job at completion (success or failure paths).
Tokens, cost and duration are sourced from the existing session row.

Includes a `skill_stats_daily` view that buckets invocations by day and
(skill_name, model, provider), and a new `SessionDB.query_skill_ema()`
method that applies exponential weighting (default alpha=0.3, ~5d
half-life) so the dashboard can A/B local Qwen against external models
once analyzer crons start firing.

SCHEMA_VERSION 11 → 12. Pure additive: existing rows untouched, new
table created on next connection-open via the existing executescript()
path. No Alembic.

Slash-command and ad-hoc skill_view invocations are NOT tracked in v1.
Multi-skill crons over-account: each skill in `job["skills"]` gets the
full session cost. Both are acceptable for the analyzer-cron use case
(1 skill per cron) and can iterate later.

Constraint: no new external dependencies — uses sqlite3 + stdlib only.
Rejected: per-skill cost split (would require model attribution
inside a single agent run, which Hermes does not currently track) |
Reason: defer to v2 once NousResearch#87 surfaces real-world skew.
Confidence: high (smoke-tested end-to-end on tmp DB)
Scope-risk: narrow (additive table, no existing-row touchpoints)
Not-tested: live cron fire (validated by Step 3 — Pass 2 v2 handover)
Machine: orion-terminal

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
someaka pushed a commit to someaka/hermes-agent that referenced this pull request May 24, 2026
test_interrupt_during_child_api_call_detected was flaking on Python 3.11
CI runners taking 1.4-1.5s to detect interrupt. Bumped threshold to 2.0s
so the test passes under CI load.

Fork CI run: Tests NousResearch#87 on commit d2e76b1b28
someaka pushed a commit to someaka/hermes-agent that referenced this pull request May 30, 2026
test_interrupt_during_child_api_call_detected was flaking on Python 3.11
CI runners taking 1.4-1.5s to detect interrupt. Bumped threshold to 2.0s
so the test passes under CI load.

Fork CI run: Tests NousResearch#87 on commit d2e76b1b28
someaka pushed a commit to someaka/hermes-agent that referenced this pull request May 31, 2026
test_interrupt_during_child_api_call_detected was flaking on Python 3.11
CI runners taking 1.4-1.5s to detect interrupt. Bumped threshold to 2.0s
so the test passes under CI load.

Fork CI run: Tests NousResearch#87 on commit d2e76b1b28
someaka pushed a commit to someaka/hermes-agent that referenced this pull request Jun 9, 2026
test_interrupt_during_child_api_call_detected was flaking on Python 3.11
CI runners taking 1.4-1.5s to detect interrupt. Bumped threshold to 2.0s
so the test passes under CI load.

Fork CI run: Tests NousResearch#87 on commit d2e76b1b28
Meraniya pushed a commit to Meraniya/hermes-agent that referenced this pull request Aug 6, 2026
Companion piece to hermes-already-has-routines.md — documents how the
bundled llm-wiki skill implements Karpathy's LLM Wiki pattern
(gist.github.com/karpathy/442a6bf555914893e9891c11519de94f), element by
element, plus where Hermes extends it (provenance markers, source-drift
hashing, scheduled ingestion, multi-platform querying, headless Obsidian
sync).


Claude-Session: https://claude.ai/code/session_01Kk61nsX85RGno5HYGyFkQZ

Co-authored-by: Claude <noreply@anthropic.com>
sijav added a commit to sijav/sijav-agent that referenced this pull request Aug 7, 2026
…al-pool routing

tests/agent/test_credential_pool_routing.py::TestFailureAttribution::
test_unmatched_key_does_not_retry_only_pool_entry fails on this branch and is
NOT from my work — verified failing at the parent of my first commit today.
Filed with the mechanism and an explicit warning to determine whether the code
regressed or the test went stale before changing either.
sijav added a commit to sijav/sijav-agent that referenced this pull request Aug 7, 2026
…le-entry guard dead code

The credential-pool sole-entry guard's comment states exactly the failing test's
rationale, but instrumentation shows it never fires: _available_entries returns
2 entries for a 'single-entry' pool because the pool auto-seeds the agent's own
runtime key. That also explains why identity matching reports 'matched no entry'
while an entry holding the failing key exists. Recorded with the probe output
and a candidate fix, flagged as an auth-semantics decision rather than a
mechanical test fix.
sijav added a commit to sijav/sijav-agent that referenced this pull request Aug 7, 2026
…redentials (NousResearch#87)

conftest's autouse credential guard was half-built. read_claude_code_credentials
reconciles TWO sources — the macOS Keychain and ~/.claude/.credentials.json —
but the guard stubbed only the Keychain. That path is built from Path.home()
directly, so it sits outside the HERMES_HOME sandbox, and this conftest
deliberately does not redirect HOME ('that broke subprocesses'). On Linux/WSL,
where the Keychain never existed, the guard was therefore a complete no-op and
every anthropic test read the developer's live OAuth token.

Observed damage: a test building an isolated single-entry credential pool
actually loaded TWO entries — its own plus a real 'claude_code' one — so
credential_pool's sole-entry guard (whose comment states 'a single-entry pool
cannot rotate') could never fire. That silently broke pool routing and is why
test_unmatched_key_does_not_retry_only_pool_entry has been red since the commit
that introduced it: it is environment-dependent, green on CI where no such file
exists and red on any developer machine with Claude Code installed.

The write side was the bigger hazard: _write_claude_code_credentials targets the
same real path and is reachable from the pool's refresh path, so an unguarded
run could rewrite live credentials.

Guarded with a DENY-LIST rather than a stub — the pattern this conftest already
uses for kanban writes. The real reader/writer still run; they refuse only when
the resolved path is the developer's actual ~/.claude/.credentials.json,
captured at import before any fixture rewires the environment. A blanket stub
broke the 12 tests that legitimately redirect HOME and exercise the real reader;
the deny-list keeps them working.

tests/agent: 534 files, 7428 tests, 0 failed.
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