Skip to content

Rl capabilities && File Operator Tools#15

Merged
teknium1 merged 6 commits into
mainfrom
rl-capabilities
Feb 5, 2026
Merged

Rl capabilities && File Operator Tools#15
teknium1 merged 6 commits into
mainfrom
rl-capabilities

Conversation

@teknium1

@teknium1 teknium1 commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

Initial RL training toolset and complete file operations toolset (to make it operate much more like a coding agent)

- Updated `.env.example` to include Tinker and WandB API keys for reinforcement learning training.
- Enhanced `model_tools.py` to clarify configuration options and streamline the RL training process.
- Expanded `README.md` with detailed instructions for setting up RL training using Tinker and WandB.
- Modified `hermes_cli` files to integrate RL training tools and ensure proper configuration checks.
- Improved `rl_training_tool.py` to reflect changes in training parameters and configuration management.
- Added the tinker-atropos submodule for enhanced RL training capabilities.
- Updated model_tools.py to reorder RL function definitions and improve descriptions.
- Modified rl_cli.py to include checks for the tinker-atropos setup and provide user guidance.
- Adjusted toolsets.py and __init__.py to reflect changes in RL function availability.
- Enhanced rl_training_tool.py to manage training processes directly without a separate API server.
- Modified `model_tools.py` to update default model IDs and add new RL function `rl_test_inference`.
- Enhanced `README.md` with installation instructions for submodules and updated API key usage.
- Improved `rl_cli.py` to load configuration from `~/.hermes/config.yaml` and set terminal working directory for RL tools.
- Updated `run_agent.py` to handle empty string arguments as empty objects for better JSON validation.
- Refined installation scripts to ensure submodules are cloned and installed correctly, enhancing setup experience.
… streaming

- Added unique run ID generation for WandB tracking during test inference.
- Enabled WandB usage for test tracking and updated command-line arguments accordingly.
- Implemented real-time output streaming for process execution, improving log visibility and debugging.
- Enhanced error handling to display last few lines of stderr for better troubleshooting.
- Introduced file manipulation capabilities in `model_tools.py`, including functions for reading, writing, patching, and searching files.
- Added a new `file` toolset in `toolsets.py` and updated distributions to include file tools.
- Enhanced `setup-hermes.sh` and `install.sh` scripts to check for and optionally install `ripgrep` for faster file searching.
- Implemented a new `file_operations.py` module to encapsulate file operations using shell commands.
- Updated `doctor.py` and `install.ps1` to check for `ripgrep` and provide installation guidance if not found.
- Added fuzzy matching and patch parsing capabilities to improve file manipulation accuracy and flexibility.
@teknium1
teknium1 merged commit 8dd3831 into main Feb 5, 2026
@taeyun16

Copy link
Copy Markdown

🔍 자동 분석 결과

이슈 요약

리더보드 시스템 — 주간/월간/지역별 순위로 경쟁 유도 + 보상 제공

기술 구현 고려사항

백엔드 (Phoenix/Ash)

  • 리더보드 스냅샷: weekly_leaderboards (period_start, period_end, category)
  • 순위 계산: (Oban, 매주 월요일 00:00 KST)
    • WeeklyVoteKing: 주간 투표 수 top 100
    • MonthlyCollector: 월간 신규 고양이 수집 top 100
    • StreakChampion: 연속 투표 최장 기간 top 100
    • RegionalRank: PostGIS ST_DWithin로 지역 필터링
  • 순위 변동 추적: leaderboard_changes (user_id, change_amount, direction)
  • 보상 지급: period结束时 자동 + 배지 발송

iOS (SwiftUI)

  • 리더보드 탭: (segmented: 주간/월간/지역)
  • 순위 Cell: (rank, avatar, name, score, change delta)
  • 내 순위 고정: sticky bottom bar — "내 순위: 15위 / 234명"
  • 변경 알림: 순위 진입/변동 시 토스트 + 햅틱

우선순위 제안

  1. Phase 1: 주간 투표왕 (가장 단순 — existing vote_count 활용)
  2. Phase 2: 지역별 순위 (PostGIS regional 쿼리 의존)
  3. Phase 3: 월간 수집왕 (고양이 도감 완료 후)
  4. Phase 4: 연속 기록왕 (Streak 시스템 통합)

관련existing 코드

  • — 아직 없으면 Streak worker 패턴 참고
  • Regional ranking: PostGIS queries

🤖 HanNyang Auto Resolver

h4x3rotab pushed a commit to Clawdi-AI/hermes-agent that referenced this pull request Apr 10, 2026
h4x3rotab pushed a commit to Clawdi-AI/hermes-agent that referenced this pull request Apr 10, 2026
* fix: cross-platform terminal/browser support and build fixes

- Use platform-aware default shell (zsh on macOS, bash on Linux/Windows)
  instead of hardcoding /bin/zsh everywhere
- Mark Playwright packages as external in Vite to fix chromium-bidi
  bundle errors during dev
- Copy pty-helper.py to dist/server/assets/ on build so production
  server can find it
- Fix browser launch guard to check `context` instead of `browser`
  (which is always null with launchPersistentContext)
- Exclude unused diagnostics.ts stub from route tree
- Update README with Playwright install step and Extra section

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* docs: add Ubuntu/Debian prerequisites for Tauri desktop build

Co-Authored-By: Claude Opus 4.6 <[email protected]>

---------

Co-authored-by: Claude Opus 4.6 <[email protected]>
h4x3rotab pushed a commit to Clawdi-AI/hermes-agent that referenced this pull request Apr 10, 2026
Previously hermes-api.ts helper functions (hermesGet, hermesPost,
hermesPatch, hermesDeleteReq, streamChat) sent no Authorization header,
causing 401 'Invalid API key' errors when the gateway has API_SERVER_KEY
configured.

Also exports BEARER_TOKEN from gateway-capabilities.ts so hermes-api.ts
can import and reuse it for auth headers.

Co-authored-by: mgnyc11 <[email protected]>
@zhangtobybot-a11y

Copy link
Copy Markdown

已合并到 PR #45

1 similar comment
@zhangtobybot-a11y

Copy link
Copy Markdown

已合并到 PR #45

malaiwah pushed a commit to malaiwah/hermes-agent that referenced this pull request Apr 11, 2026
…ameter + schema property' (NousResearch#15) from fix/terminal-notify-on-complete into main
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
difeizheng pushed a commit to difeizheng/zdf-hermes-agent that referenced this pull request Jun 3, 2026
Fixes 12 remaining MEDIUM issues from the deep audit (19 total, 7 fixed in Round 12):

design_agent:
- NousResearch#15: add asyncio.wait_for(300s) around LLM API call to prevent infinite hangs
- NousResearch#17: replace 2x hardcoded 'claude-opus-4-8' with shared DEFAULT_MODEL constant

qa_agent / validate_agent:
- NousResearch#20,NousResearch#22,NousResearch#23: already fixed in Round 12 (verified — dynamic timeout/threshold values used)

memory.py:
- NousResearch#24: frontmatter parser uses regex r'^---$' instead of str.split('---',2),
  preventing false splits on content containing '---' (SQL, markdown tables)
- NousResearch#25: parse and preserve 'description' field from frontmatter in metadata,
  fixing write→load roundtrip data loss

profiles.py:
- NousResearch#26: ProfileConfig now frozen=True (immutable dataclass per coding standards)

deploy_agent:
- NousResearch#31: replace 2x sync subprocess.run with asyncio.create_subprocess_exec
- fix 5x .decode() → .decode('utf-8', errors='replace') for Windows CJK safety
- remove unused import subprocess

db.py:
- NousResearch#27: add class docstring explaining RLock + _unlocked pattern
- NousResearch#28: FK constraints already in DDL (verified PRAGMA foreign_keys=ON active)
- NousResearch#29: add _ensure_connection() with PRAGMA integrity_check(1) + auto-reconnect
       on 4 critical methods (create_task, get_task, claim_task, submit_result)
- extract _create_connection() static method for reuse by reconnect

Tests: 79 passed, 0 failed
xzmzm added a commit to xzmzm/hermes-agent that referenced this pull request Jun 3, 2026
mcvayaaron6-commits referenced this pull request in mcvayaaron6-commits/hermes-agent Jun 10, 2026
Three remaining findings from the code review.

#12 — hermes_cli/superagent.py: _strip_fences only handled a SINGLE
      leading-and-trailing ``` envelope.  Common model failure mode
      is 'Here is the plan you asked for:\\n```yaml\\nfanout: 2\\n
      ...\\n```\\nLet me know.' — the leading prose means
      stripped.startswith('```') is False so the function returned
      the whole text unchanged, then yaml.safe_load choked → exit 2.

      Fix: regex-based extraction with _FENCE_BLOCK_RE that pulls
      the YAML body out of fenced blocks even when there's prose on
      either side.  Falls back to the simple-strip path for fence-
      only output (preserves existing behaviour).

#13 — hermes_cli/web_server.py: /ready was BOTH side-effecting AND
      racy.  (a) Called path.parent.mkdir(parents=True, exist_ok=
      True) on every probe — k8s polls every few seconds, so a
      read-only mount surfaced PermissionError every hit and a
      writeable mount got directories repeatedly recreated.  (b)
      The .readiness_probe storage check used a shared filename;
      two concurrent k8s probes (liveness + readiness simultaneous)
      could race, one's unlink raising FileNotFoundError → false
      'not_ready' on a healthy node.

      Fix: (a) audit_log probe just reports parent.exists(); never
      mutates.  (b) storage probe uses a per-PID + per-call unique
      filename and tolerates FileNotFoundError on cleanup.

#15 — hermes_cli/superagent.py + hermes_cli/orchestrate.py: parent
      AIAgent was constructed bare with model=... provider=...
      quiet_mode=True only — no api_key, no base_url, no api_mode,
      no credential_pool.  delegate_task then pulled effective_
      api_key=None from the parent, so child subagents failed to
      authenticate whenever credentials lived in config.yaml
      rather than env vars (the production case for serious users).

      Fix: mirror hermes_cli/oneshot.py's resolve_runtime_provider
      pattern in both _build_parent_agent and superagent.py's
      parent construction.  Threads api_key / base_url / provider /
      api_mode / credential_pool from the resolved runtime, exactly
      like oneshot does.

274 tests pass — no regressions.

All 15 code-review findings are now fixed across three commits
(f25ae81 showstoppers, 06e71bc critical correctness, this commit
lower-severity polish).

https://claude.ai/code/session_01PNyEMgrzVHtXnPGwUfotWw
lenardhuebner88-rgb pushed a commit to lenardhuebner88-rgb/hermes-agent that referenced this pull request Jun 18, 2026
…indings (one test each)

#7  release_gate_parked suggested_command now carries the FULL gate sequence
    (event payload.commands joined with &&, fallback to joined
    _RELEASE_GATE_COMMANDS) instead of next(iter(...)) -> the bare leading cd.
#8  freigabe/live_test_depth threaded into create_task's INSERT (new params)
    and the separate post-INSERT UPDATE removed from ingest_planspec -> root
    provenance is atomic with row creation, no NULL window / strand-on-raise.
NousResearch#10 drop the redundant planspec_id child-dict key (always == planspec_subtask_id)
    and the dead `or` fallback in plugin_api; use planspec_subtask_id exclusively.
NousResearch#11 add idempotent idx_events_kind on task_events(kind, task_id) (+ _REBUILD_SPECS)
    so the decision_queue kind='release_gate_parked' scan isn't full-table.
NousResearch#13 /planspecs/detail: resolve+read EXACTLY once (parse_binding_planspec only,
    no validate-then-re-resolve TOCTOU window) and genericise resolve_planspec_path
    findings so the server's absolute vault path is never disclosed.
NousResearch#14 lock the lossy AC body round-trip with a characterization test + explicit
    altitude-boundary docstring (structured fields live only in the .md; the
    full structured store is a Phase-4 follow-up).
NousResearch#15 D1 characterization: make the docstring/contract truthful (no bug found ->
    no xfail; assertions are verified-correct regression tripwires).

Gates: ruff clean; touched test files 643 passed; full scripts/run_tests.sh
re-run for the record. Adversarial tree_root_woke real-chain repro still PASS.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
madhaheri pushed a commit to madhaheri/hermes-agent that referenced this pull request Jun 20, 2026
NousResearch#2 registry.get() alias + __contains__ — dict-like API consistency
  - tools/registry.py: added get() as alias for get_entry()
  - added __contains__ so "tool_name" in registry works

NousResearch#3 _BUILTIN_SUBCOMMANDS guard test — catches missing entries
  - hermes_cli/main.py: added warning comment with test reference
  - tests/hermes_cli/test_main_integrity.py: 4 tests verifying
    the frozenset contains all core subcommands including reach

NousResearch#4 hermes doctor --functional — actually test if tools work
  - hermes_cli/subcommands/doctor.py: added --functional flag
  - hermes_cli/doctor.py: runs reach capability functional probes
    as a new doctor section, showing real API call results

NousResearch#6 proxy config in config.yaml — for restricted networks
  - hermes_cli/config.py: added proxy.url and proxy.apply_to_all
    to DEFAULT_CONFIG, added "proxy" to _KNOWN_ROOT_KEYS

NousResearch#10 web toolset error messages — point to free alternatives
  - tools/web_tools.py: WEB_SEARCH_SCHEMA and WEB_EXTRACT_SCHEMA
    descriptions now mention free alternatives (Jina Reader, Exa, DDG)
    and "hermes reach setup" command for auto-configuration

NousResearch#11 hermes mcp doctor — batch-test all MCP servers
  - hermes_cli/subcommands/mcp.py: added "doctor" subcommand
  - hermes_cli/main.py: _mcp_doctor() handler that tests all
    configured servers and reports status

NousResearch#13 test isolation — investigated, not reproducible (pre-existing)
  - test passes consistently across 135 tests in 3 modules

NousResearch#15 __tools__ list support — robust tool auto-discovery
  - tools/registry.py: _module_registers_tools() now also detects
    module-level __tools__ = [...] list declarations
  - tests/tools/test_registry.py: 3 new tests for __tools__ detection
@hutchutchutch

Copy link
Copy Markdown

Refactor progress on the PR #15 file-operations surface: extracted standalone file operation helpers into tools/file_operations_support.py while preserving the public tools.file_operations import surface. Commit: 44d016602 (refactor(file-ops): extract support helpers). Validation: py_compile for touched modules; focused file_operations suite 188 passed; standard gateway batches 265 passed and 115 passed; git diff --check clean. Note: broader file_tools/macOS temp-path tests still hit the existing /private/var sensitive-path guard and were not caused by this extraction.

@hutchutchutch

Copy link
Copy Markdown

Refactor progress on PR #15 file operations, second slice: extracted lint registries and in-process lint helpers into tools/file_operations_lint.py while preserving imports from tools.file_operations. Commit: a41161fc5 (refactor(file-ops): extract lint helpers). Validation: py_compile for touched modules; focused file-operation/LSP lint suite 220 passed; standard gateway batches 265 passed and 115 passed; git diff --check clean.

@hutchutchutch

Copy link
Copy Markdown

Refactor progress on PR #15 file operations, third slice: extracted search result types and shell search implementation into tools/file_operations_search.py while preserving ShellFileOperations.search and private wrapper method names used by tests. Commit: c342e24f1 (refactor(file-ops): extract search implementation). Validation: py_compile for touched modules; focused search/file-operation suite 200 passed; broader file-operation/LSP lint suite 229 passed; standard gateway batches 265 passed and 115 passed; git diff --check clean. Current line counts: tools/file_operations.py 1502, tools/file_operations_search.py 380, support 164, lint 110.

@hutchutchutch

Copy link
Copy Markdown

Refactor progress on PR #15 file operations, fourth slice: moved lint/LSP orchestration behind tools/file_operations_lint.py while preserving ShellFileOperations private wrapper methods used by tests. Commit: c90c097ce (refactor(file-ops): extract lint orchestration). Validation: py_compile for touched modules; focused file-operation/LSP suite 240 passed; standard gateway batches 265 passed and 115 passed; git diff --check clean. Current line counts: tools/file_operations.py 1189, search 380, lint 339, support 164.

@hutchutchutch

Copy link
Copy Markdown

Refactor progress on PR #15 file operations, fifth slice: extracted read/delete/move behavior into tools/file_operations_read.py and moved shared result dataclasses into tools/file_operations_results.py while preserving tools.file_operations exports and ShellFileOperations wrapper methods. Commit: a20c28974 (refactor(file-ops): extract read and file actions). Validation: py_compile for touched modules; focused file-operation/parser/live suite 241 passed; standard gateway batches 265 passed and 115 passed; git diff --check clean. Current line counts: tools/file_operations.py 879, read 221, results 82, search 380, lint 339, support 164.

@hutchutchutch

Copy link
Copy Markdown

Refactor progress on PR #15 file operations, sixth slice: extracted write/patch mutation behavior into tools/file_operations_write.py and moved the abstract FileOperations interface into tools/file_operations_interface.py. Commit: 80da36609 (refactor(file-ops): extract write and patch actions). Validation: py_compile for touched modules; focused mutation/read/parser/LSP suite 284 passed; standard gateway batches 265 passed and 115 passed; git diff --check clean. The original hotspot is now under target: tools/file_operations.py 476 lines; interface 75; write 222; read 221; results 82; search 380; lint 339; support 164.

@hutchutchutch

Copy link
Copy Markdown

Progress update for PRD #15:

Implemented the next file-tool refactor slice in e6683b654 (refactor(file-tools): extract tracker state).

What changed:

  • Added tools/file_tools_state.py for read dedup state, read timestamp/staleness helpers, read tracker cap enforcement, and patch failure tracking.
  • Kept tools.file_tools as the compatibility adapter: existing private names like _read_tracker, _read_tracker_lock, _patch_failure_tracker, _cap_read_tracker_data, _check_file_staleness, reset_file_dedup, and notify_other_tool_call remain importable from tools.file_tools.
  • Preserved legacy monkeypatch behavior for _READ_HISTORY_CAP, _DEDUP_CAP, and _READ_TIMESTAMPS_CAP by syncing patched adapter constants into the state module before cap enforcement.

Line counts after this slice:

  • tools/file_tools.py: 1435 lines, down from 1671 before this slice.
  • tools/file_tools_state.py: 249 lines.

Validation:

  • python -m py_compile tools/file_tools.py tools/file_tools_state.py
  • focused tracker/read/staleness suite with TMPDIR rooted under /Users/home/.hermes/tmp-pytest-hermes-agent-issue15 -> 89 passed
  • tests/tools/test_gateway_cwd_contract.py with the same non-sensitive temp root -> 4 passed
  • Standard gateway batch A -> 265 passed
  • Standard gateway batch B -> 115 passed
  • git diff --check / staged diff check clean

Notes:

  • A combined path/cwd batch hit existing test-state leakage where one test left live cwd cache state for a reused task id; tests/tools/test_gateway_cwd_contract.py passes in isolation.
  • tests/tools/test_file_tools.py still has the existing macOS /tmp vs /private/tmp expectation mismatch on three mocked write/patch assertions; this predates and is unrelated to the tracker-state extraction.

@hutchutchutch

Copy link
Copy Markdown

Progress update for PRD #15:

Implemented another file-tool refactor slice in 6c6ead02f (refactor(file-tools): extract path safety helpers).

What changed:

  • Added tools/file_tools_paths.py for cwd resolution, TERMINAL_CWD sentinel handling, live cwd lookup, path-resolution warnings, blocked-device checks, sensitive path checks, Hermes config path resolution, and cross-profile/container mirror guards.
  • Kept tools.file_tools as the compatibility adapter for existing private imports and monkeypatches, including _resolve_path_for_task, _path_resolution_warning, _is_blocked_device, _is_blocked_device_path, _check_sensitive_path, _check_cross_profile_path, and _hermes_config_resolved/_hermes_config_resolved_loaded.
  • Preserved live file-ops cache lookup through a small adapter so path helpers do not own the file-ops cache.

Line counts after this slice:

  • tools/file_tools.py: 1139 lines, down from 1435 after the previous slice and 1671 before today.
  • tools/file_tools_paths.py: 313 lines.
  • tools/file_tools_state.py: 249 lines.

Validation:

  • python -m py_compile tools/file_tools.py tools/file_tools_paths.py tools/file_tools_state.py
  • focused tracker/read/staleness suite with TMPDIR rooted under /Users/home/.hermes/tmp-pytest-hermes-agent-issue15 -> 89 passed
  • focused Hermes config sensitive-path compatibility class -> 5 passed
  • tests/tools/test_gateway_cwd_contract.py with the non-sensitive temp root -> 4 passed
  • Standard gateway batch A -> 265 passed
  • Standard gateway batch B -> 115 passed
  • git diff --check / staged diff check clean

Notes:

  • The combined path/cwd batch still hits the existing order-dependent live cwd cache leakage for a reused task id; the affected cwd contract file passes in isolation.
  • This slice keeps the upstream-facing tool function names and private test patch points intact to reduce nightly merge risk.

@hutchutchutch

Copy link
Copy Markdown

Progress update for PRD #15:

Implemented the third file-tools slice in 37c3bdd13 (refactor(file-tools): extract env cache helpers).

What changed:

  • Added tools/file_tools_env.py for terminal-environment-backed ShellFileOperations creation and cache population.
  • Kept tools.file_tools as the compatibility adapter for _get_file_ops, _file_ops_lock, _file_ops_cache, and clear_file_ops_cache so existing tests and monkeypatches continue to target the same module.
  • The new helper receives the existing cache, lock, ShellFileOperations factory, and logger as arguments; it does not own the public cache state.

Line counts after this slice:

  • tools/file_tools.py: 1031 lines, down from 1139 after the path slice and 1671 before today.
  • tools/file_tools_env.py: 129 lines.
  • tools/file_tools_paths.py: 313 lines.
  • tools/file_tools_state.py: 249 lines.

Validation:

  • python -m py_compile tools/file_tools.py tools/file_tools_env.py tools/file_tools_paths.py tools/file_tools_state.py
  • focused env/cache/read/staleness suite with TMPDIR rooted under /Users/home/.hermes/tmp-pytest-hermes-agent-issue15 -> 80 passed
  • focused cwd/container suite -> 32 passed
  • Standard gateway batch A -> 265 passed
  • Standard gateway batch B -> 115 passed
  • git diff --check / staged diff check clean

This continues the low-merge-risk pattern: move implementation behind small modules while preserving the old tools.file_tools import and patch surface.

@hutchutchutch

Copy link
Copy Markdown

Progress update for PRD #15:

Implemented the next file-tools slice in 9a3e19b4d (refactor(file-tools): extract read handler).

What changed:

  • Added tools/file_tools_read.py for the read_file_tool implementation: pagination normalization, device guard, extractable document handling, binary/read safety guards, dedup/stub-loop handling, max-character guard, redaction, large-file hinting, and file-state read registration.
  • Kept tools.file_tools.read_file_tool as the registered compatibility wrapper.
  • The wrapper injects existing adapter functions/state (_get_file_ops, _get_max_read_chars, _resolve_path_for_task, _cap_read_tracker_data, _read_tracker, _read_tracker_lock), so existing tests and monkeypatches keep targeting tools.file_tools.

Line counts after this slice:

  • tools/file_tools.py: 788 lines, down from 1031 before this slice and 1671 before today.
  • tools/file_tools_read.py: 246 lines.
  • Existing extracted helpers remain under target: env 129, paths 313, state 249.

Validation:

  • python -m py_compile tools/file_tools.py tools/file_tools_read.py tools/file_tools_env.py tools/file_tools_paths.py tools/file_tools_state.py
  • focused read guards / read loop / read_extract / file_state registry suite -> 98 passed
  • tests/tools/test_file_staleness.py -> 11 passed
  • tests/agent/test_file_safety_credentials.py -> 20 passed
  • tests/tools/test_file_tools.py::TestReadFileHandler -> 4 passed
  • Standard gateway batch A -> 265 passed
  • Standard gateway batch B -> 115 passed
  • git diff --check / staged diff check clean

Note:

  • One intentionally broad combined read/staleness batch still hit the known order-dependent live cwd cache leakage; the affected staleness test passes in isolation and the focused stale suite passes fully.

@hutchutchutch

Copy link
Copy Markdown

Progress update for PRD #15:

Implemented the next file-tools slice in 6138eaa1a (refactor(file-tools): extract search handler).

What changed:

  • Added tools/file_tools_search.py for the search_files implementation: pagination normalization, repeated-search loop guard, ShellFileOperations search dispatch, match redaction, warning/hint formatting, and structured error handling.
  • Kept tools.file_tools.search_tool as the compatibility wrapper.
  • The wrapper injects existing adapter functions/state (_get_file_ops, normalize_search_pagination, _read_tracker, _read_tracker_lock), so existing tests and monkeypatches keep targeting tools.file_tools.

Line counts after this slice:

  • tools/file_tools.py: 741 lines, down from 788 after the read slice and 1671 before today.
  • tools/file_tools_search.py: 95 lines.

Validation:

  • python -m py_compile tools/file_tools.py tools/file_tools_search.py
  • tests/tools/test_file_tools.py::TestSearchHandler + tests/tools/test_read_loop_detection.py::TestSearchLoopDetection -> 13 passed
  • Standard gateway batch A -> 265 passed
  • Standard gateway batch B -> 115 passed
  • git diff --check / staged diff check clean

Next remaining PR #15 seam is the write/patch mutation handler block; extracting that should bring tools/file_tools.py close to or under the 500-line target.

@hutchutchutch

Copy link
Copy Markdown

Progress update for PRD #15:

Implemented the mutation/schema slice in 50e42d119 (refactor(file-tools): extract mutation handlers).

What changed:

  • Added tools/file_tools_mutation.py for write_file_tool and patch_tool implementation: sensitive/cross-profile guards, stale warnings, file_state locks, read timestamp refresh, files_modified/resolved_path reporting, V4A traversal guard, and patch failure escalation hints.
  • Added tools/file_tools_schemas.py for static file tool schemas.
  • Kept tools.file_tools.write_file_tool, tools.file_tools.patch_tool, _handle_write_file, and _handle_patch as compatibility/registry wrappers.
  • Restored compatibility re-exports for _detect_line_ending and _normalize_line_endings from tools.file_operations after the earlier support-helper extraction.

Line counts after this slice:

  • tools/file_tools.py: 455 lines (under the ~500 target; down from 1671 before today).
  • tools/file_operations.py: 478 lines (still under target).
  • New helper modules remain small: mutation 235, schemas 103, search 95, read 246, env 129, paths 313, state 249.

Validation:

  • python -m py_compile tools/file_operations.py tools/file_tools.py tools/file_tools_mutation.py tools/file_tools_schemas.py and related helper modules
  • tests/tools/test_line_ending_preservation.py -> 12 passed
  • tests/tools/test_file_staleness.py -> 11 passed
  • tests/tools/test_patch_failure_tracking.py -> 5 passed
  • mutation handler unit subset excluding known macOS /tmp normalization assertions -> 22 passed
  • mutation state/cross-profile/cwd combined batch -> 72 passed, with the known order-dependent live-cwd cache case failing when combined but passing in isolation
  • Standard gateway batch A -> 265 passed
  • Standard gateway batch B -> 115 passed
  • git diff --check / staged diff check clean

Known existing caveats kept separate:

  • tests/tools/test_file_tools.py still has three macOS /tmp vs /private/tmp mocked-call expectation failures; production behavior was not changed for this refactor.
  • A broad combined cwd/staleness batch can still hit the existing live cwd cache order leak; the focused staleness suite passes.

jleechan2015 added a commit to jleechanorg/hermes-agent that referenced this pull request Jun 28, 2026
…ded for version bumps) (NousResearch#15)

* [agento] fix: green-gate Gate 3 — auto-PASS dependabot PRs (no CR needed for version bumps)

dependabot[bot] PRs are automated dependency bumps. Requiring a
CodeRabbit review blocks them indefinitely when CR hits rate limits.
Add PR_GATE3_AUTHOR check: if author == dependabot[bot], Gate 3
auto-PASSes. Human-authored PRs continue to require CR APPROVED.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* [agento] fix: set LATEST_CR=APPROVED for dependabot Gate 3 auto-PASS (Gate 5 fast-path)

BugBot caught that LATEST_CR was unset when dependabot PRs auto-PASS Gate 3,
making Gate 5's CR-approved non-blocking fast-path unreachable for those PRs.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* [agento] fix: skeptic-cron Gate 3 — dependabot PRs auto-PASS (no CR needed)

Mirrors green-gate Gate 3 dependabot exemption so dependabot version bumps
can be auto-merged by skeptic-cron without requiring a formal CR review.
Adds author field to PR JSON payload so dependabot detection works in the loop.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

---------

Co-authored-by: Claude Sonnet 4.6 <[email protected]>
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
kumanoko24 pushed a commit to galaxy-kuleon/hermes-agent that referenced this pull request Jul 2, 2026
…seat)

Rebase reconciliation for issue NousResearch#15 (v2026.6.19 merge). Commit 1's
multi-user-isolation change "ResponseStore JSON blob now carries user_id"
auto-merged its `"user_id": user_id` line into upstream v2026.6.19's NEW
`_write_sse_responses._persist_response_snapshot` (git matched the
`_response_store.put(...)` block), but `user_id` was not in that method's
scope -> NameError at runtime on the streaming /v1/responses path
(api_server.py:3261). py_compile/import don't catch undefined names in
nested closures; surfaced by the api_server regression suite.

Fix: add `user_id` param to `_write_sse_responses` and forward it from
`_handle_responses` (which holds `user_id = scope["user_id"]`). Belongs
logically in commit 166397c (multi-user isolation v1); kept separate so
the rebase replay stays auditable. Authoritative kg suites: 231 passed.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
kulikman pushed a commit to kulikman/hermes-agent that referenced this pull request Jul 16, 2026
feiguang50-hub pushed a commit to feiguang50-hub/hermes-agent that referenced this pull request Jul 19, 2026
…de changes)

Ran a read-only dry-run against a real exported skill library (76 SKILL.md,
25 candidates, nested category dirs + CJK) in an isolated HERMES_HOME. Pipeline
ran cleanly and safely (no mutation); LLM decisions were sensible (2
consolidations proposed, rest kept standalone). Two real gaps fixtures could
never expose:
- dry-run under-reports consolidation proposals (counts/arrays stay 0 while
  prose proposes merges) — asymmetric vs split/deprecate (KNOWN_ISSUES NousResearch#15)
- keyword-retention guard is near-inert on nested/CJK skills: _load_skill_keywords
  resolves only flat paths -> name-only fallback (KNOWN_ISSUES NousResearch#16)

Guards were not exercised (model used the YAML channel; 25 skill_view, 0
skill_manage). No code changed.

Co-Authored-By: Claude <[email protected]>
feiguang50-hub pushed a commit to feiguang50-hub/hermes-agent that referenced this pull request Jul 19, 2026
…n report (NousResearch#15 / P0)

In dry-run nothing is removed, so the removal-based classification left
consolidated/pruned empty even when the model proposed merges — while
splits/deprecations already surfaced their YAML proposals. A dry-run preview
therefore under-reported what a real run would do (REPORT.md printed
'consolidated: 0' above a prose body proposing merges). Surface the YAML-block
consolidation/pruning proposals into run.json counts/arrays + REPORT.md,
tagged source='model (proposed, dry-run)' and behind a DRY-RUN banner. The
fold runs AFTER the cron-rewrite block so a dry-run never mutates cron/jobs.json;
real-run classification is unchanged (guarded by a test).

Co-Authored-By: Claude <[email protected]>
feiguang50-hub pushed a commit to feiguang50-hub/hermes-agent that referenced this pull request Jul 19, 2026
…h-pass real-data re-verification

Co-Authored-By: Claude <[email protected]>
feiguang50-hub pushed a commit to feiguang50-hub/hermes-agent that referenced this pull request Jul 19, 2026
…o code changes)

Ran a read-only dry-run against a larger, deliberately uncleaned backup (130
usage records vs 123 files, path-prefixed keys, all-active-despite-archive,
external symlink). Result: no errors/exceptions handling the dirty data; LLM
emitted a well-formed empty structured block (keep all 27); guard not exercised
(YAML channel). NousResearch#15 fix makes the reported 0 trustworthy (matches empty block)
vs the 8th-pass ambiguous 0. One untested dimension noted: the
active-vs-archived usage mismatch's effect on the deterministic prune is not
covered by dry-run (prune is skipped). No code changed.

Co-Authored-By: Claude <[email protected]>
BarnsL added a commit to BarnsL/hermes-agent that referenced this pull request Jul 19, 2026
Anthropic bills any >200K-input request on a subscription (OAuth) account
to the EXTRA-USAGE budget, not plan limits — even without the context-1m
beta header (1M context is GA on Claude 4.6+). A 339K-token desktop session
got permanent 'You are out of extra usage' 400s while a small probe on the
same token returned 200.

Fix: _apply_subscription_context_cap() clamps the resolved context to 200K
when the token is an OAuth/setup token (sk-ant-oat*, eyJ*, cc-*). Metered
API keys (sk-ant-api*) are NOT capped. Escape hatch: anthropic.long_context.

Tests: test_critical26_subscription_context_capped_at_plan_lane,
       test_critical26_long_context_escape_hatch (both pass)

See CRITICAL NousResearch#15 in CRITICAL-ISSUES.md for full RCA.
waym0reom3ga added a commit to waym0reom3ga/autolycus-agent that referenced this pull request Jul 21, 2026
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.

4 participants