Skip to content

fix: cross-platform stat command for macOS compatibility - #58

Closed
deankerr wants to merge 1 commit into
NousResearch:mainfrom
deankerr:fix/macos-stat-compat
Closed

fix: cross-platform stat command for macOS compatibility#58
deankerr wants to merge 1 commit into
NousResearch:mainfrom
deankerr:fix/macos-stat-compat

Conversation

@deankerr

Copy link
Copy Markdown
Contributor

Summary

  • stat -c '%s' is GNU coreutils only — fails on macOS/BSD where the equivalent is stat -f '%z'
  • Adds _stat_size_cmd() helper to ShellFileOperations that tries GNU stat first, falls back to BSD stat
  • Replaces 3 hardcoded stat -c calls in read_file, _read_image, and write_file

Context

The read_file and write_file tools use stat to get file sizes. On macOS with TERMINAL_ENV=local, these tools silently fail because macOS ships BSD stat which doesn't support the -c format flag.

Test plan

  • Verified read_file works on macOS local backend (reads /etc/hosts correctly)
  • Verified write_file works on macOS local backend (reports correct byte count)
  • Confirmed no other reachable stat -c calls remain in codebase
  • Linux behavior unchanged — GNU stat is tried first

🤖 Generated with Claude Code

GNU stat uses -c '%s' but macOS/BSD stat uses -f '%z'. The file tools
were silently failing on macOS, causing read_file to always report
"file not found" even when the file exists.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@deankerr
deankerr marked this pull request as ready for review February 26, 2026 09:37
@teknium1

Copy link
Copy Markdown
Contributor

0cce536

Opus suggested a cleaner fix that doesn't require fallbacks and works identically on both OS' - lmk if you find any other issue with this but credited you in the commit!

@teknium1 teknium1 closed this Feb 27, 2026
@deankerr
deankerr deleted the fix/macos-stat-compat branch April 1, 2026 08:11
linxule added a commit to linxule/hermes-agent that referenced this pull request Apr 27, 2026
…k variant

Parity port from linxule/hermes-kimi-plugin@93476f5 — same four fixes plus
the NousResearch#60 fold-in:

1. connect# off-by-one: counter + ts now bumped pre-dispatch in
   _group_subscribe_once so the gap log inside _on_group_event reads the
   correct connect# (matches the subscribe-stream-live log emitted moments
   later). Subscribe-live log + backoff clamp stay post-dispatch as the
   operator-visible recovery announcement.

2. Monotonic clock: arrival-time tracking + since-reconnect correlation
   now use time.monotonic() (immune to NTP/leap-second/VM-suspend).

3. _BoundedLRU shared cap: _last_arrival_time_per_room gets its own
   _ARRIVAL_TIME_CACHE_DEFAULT_MAX (10000), so eviction can't blind
   Phase 0 gap detection under cardinality pressure.

4. Anchor-only-on-first-page in list_group_messages: pageToken and
   start_message_id/end_message_id are now mutually-exclusive cursoring
   modes.

Fold-in (NousResearch#60): _fetch_group_message uses max_pages=2 for tight-range
pagination resilience.

Tests: 200 passing on fork (194 unit + 6 plugin-integration). Same +10/-1
delta as standalone. Existing handler-exception test updated to reflect
new pre-dispatch state semantic.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
NikolayGusev-astra pushed a commit to NikolayGusev-astra/autolycus that referenced this pull request May 15, 2026
…gs, 31/31 tests pass

New architecture (4 layers):
- store.py — persist full result to ~/.autolycus/rtk-cache/<uuid>.txt
- compressor.py — type-aware dispatcher (terminal/read_file/search_files)
- strategies/* — per-tool compression (tail-first for terminal, offset-aware for read_file, compact for search_files)
- monitor.py — per-tool aggregated metrics w/ JSON export
- __init__.py — transform_tool_result hook + rtk_recover tool

Benchmark on production-like data:
- systemctl: 57.6% savings (525 tokens/call)
- MOEX scanner: 57.0% savings (513 tokens/call)
- search_files: 96.1% savings (1,319 tokens/call)
- read_file: 91.5% savings (4,180 tokens/call)
- Global: 84.4% savings, ALL data recoverable

Closes: NousResearch#58
sahilm-ti referenced this pull request in sahilm-ti/hermes-agent Jun 3, 2026
…a dirty live tree

The hourly ~/.hermes auto-pull silently DEBUG-skipped on a dirty working
tree. The live tree is almost always dirty (continuous skill-edit churn),
so incoming merges piled up undelivered on disk with zero alerting (PRs
#54-#58, ~5 merges, only noticed when a cron broke).

- _pull_once now counts commits-behind BEFORE the clean check so it can
  distinguish the WEDGED state (on main, behind>0, dirty) from up-to-date.
  Wedged invokes an optional notify callback; clean+behind still
  fast-forwards; up-to-date and feature-branch stay silent DEBUG.
- HermesHomePuller takes a notifier + throttles wedged alerts (default 6h,
  tracked via _last_alert_ts) so the operator isn't paged hourly. The
  throttle clock only advances once the notifier actually accepts the
  message, so a failed send retries next tick.
- GatewayRunner gains _send_operator_alert (reuses the home-channel
  adapter.send surface used by shutdown/startup notifications) and
  make_operator_alert_callback (thread-safe sink via safe_schedule_threadsafe).
  start_gateway threads the callback into start_hermes_home_puller.
- Tests: wedged fires once then suppressed in-window then again after the
  window elapses; clean+behind fast-forwards no alert; up-to-date no alert
  no pull; feature branch no alert; notifier-exception non-fatal + no
  throttle advance. 30 -> 39 tests.
fabiosiqueira added a commit to fabiosiqueira/hermes-engine that referenced this pull request Jun 3, 2026
…mes#62)

Expõe action=edit na tool send_message, espelhando o caminho send mas
enxuto (texto-only, Telegram-only). _handle_edit valida message_ref
({channel,chat_id,message_id}) e despacha para _edit_telegram, que usa
bot.edit_message_text com HTML auto-detect, fallback de parse para plain
e trata 'message is not modified' como sucesso. Outras plataformas
retornam erro claro.

Desdobrado da NousResearch#58 (critério #2: editar mensagem anterior in-place).
TDD: TestEditTelegram + TestHandleEditDispatch (mock só em telegram.Bot).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sahilm-ti referenced this pull request in sahilm-ti/hermes-agent Jun 5, 2026
…a dirty live tree (#45)

The hourly ~/.hermes auto-pull silently DEBUG-skipped on a dirty working
tree. The live tree is almost always dirty (continuous skill-edit churn),
so incoming merges piled up undelivered on disk with zero alerting (PRs
#54-#58, ~5 merges, only noticed when a cron broke).

- _pull_once now counts commits-behind BEFORE the clean check so it can
  distinguish the WEDGED state (on main, behind>0, dirty) from up-to-date.
  Wedged invokes an optional notify callback; clean+behind still
  fast-forwards; up-to-date and feature-branch stay silent DEBUG.
- HermesHomePuller takes a notifier + throttles wedged alerts (default 6h,
  tracked via _last_alert_ts) so the operator isn't paged hourly. The
  throttle clock only advances once the notifier actually accepts the
  message, so a failed send retries next tick.
- GatewayRunner gains _send_operator_alert (reuses the home-channel
  adapter.send surface used by shutdown/startup notifications) and
  make_operator_alert_callback (thread-safe sink via safe_schedule_threadsafe).
  start_gateway threads the callback into start_hermes_home_puller.
- Tests: wedged fires once then suppressed in-window then again after the
  window elapses; clean+behind fast-forwards no alert; up-to-date no alert
  no pull; feature branch no alert; notifier-exception non-fatal + no
  throttle advance. 30 -> 39 tests.

Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
sahilm-ti referenced this pull request in sahilm-ti/hermes-agent Jun 15, 2026
…a dirty live tree (#45)

The hourly ~/.hermes auto-pull silently DEBUG-skipped on a dirty working
tree. The live tree is almost always dirty (continuous skill-edit churn),
so incoming merges piled up undelivered on disk with zero alerting (PRs
#54-#58, ~5 merges, only noticed when a cron broke).

- _pull_once now counts commits-behind BEFORE the clean check so it can
  distinguish the WEDGED state (on main, behind>0, dirty) from up-to-date.
  Wedged invokes an optional notify callback; clean+behind still
  fast-forwards; up-to-date and feature-branch stay silent DEBUG.
- HermesHomePuller takes a notifier + throttles wedged alerts (default 6h,
  tracked via _last_alert_ts) so the operator isn't paged hourly. The
  throttle clock only advances once the notifier actually accepts the
  message, so a failed send retries next tick.
- GatewayRunner gains _send_operator_alert (reuses the home-channel
  adapter.send surface used by shutdown/startup notifications) and
  make_operator_alert_callback (thread-safe sink via safe_schedule_threadsafe).
  start_gateway threads the callback into start_hermes_home_puller.
- Tests: wedged fires once then suppressed in-window then again after the
  window elapses; clean+behind fast-forwards no alert; up-to-date no alert
  no pull; feature branch no alert; notifier-exception non-fatal + no
  throttle advance. 30 -> 39 tests.

Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
sahilm-ti referenced this pull request in sahilm-ti/hermes-agent Jun 17, 2026
…a dirty live tree (#45)

The hourly ~/.hermes auto-pull silently DEBUG-skipped on a dirty working
tree. The live tree is almost always dirty (continuous skill-edit churn),
so incoming merges piled up undelivered on disk with zero alerting (PRs
#54-#58, ~5 merges, only noticed when a cron broke).

- _pull_once now counts commits-behind BEFORE the clean check so it can
  distinguish the WEDGED state (on main, behind>0, dirty) from up-to-date.
  Wedged invokes an optional notify callback; clean+behind still
  fast-forwards; up-to-date and feature-branch stay silent DEBUG.
- HermesHomePuller takes a notifier + throttles wedged alerts (default 6h,
  tracked via _last_alert_ts) so the operator isn't paged hourly. The
  throttle clock only advances once the notifier actually accepts the
  message, so a failed send retries next tick.
- GatewayRunner gains _send_operator_alert (reuses the home-channel
  adapter.send surface used by shutdown/startup notifications) and
  make_operator_alert_callback (thread-safe sink via safe_schedule_threadsafe).
  start_gateway threads the callback into start_hermes_home_puller.
- Tests: wedged fires once then suppressed in-window then again after the
  window elapses; clean+behind fast-forwards no alert; up-to-date no alert
  no pull; feature branch no alert; notifier-exception non-fatal + no
  throttle advance. 30 -> 39 tests.

Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
sahilm-ti referenced this pull request in sahilm-ti/hermes-agent Jun 22, 2026
…a dirty live tree (#45)

The hourly ~/.hermes auto-pull silently DEBUG-skipped on a dirty working
tree. The live tree is almost always dirty (continuous skill-edit churn),
so incoming merges piled up undelivered on disk with zero alerting (PRs
#54-#58, ~5 merges, only noticed when a cron broke).

- _pull_once now counts commits-behind BEFORE the clean check so it can
  distinguish the WEDGED state (on main, behind>0, dirty) from up-to-date.
  Wedged invokes an optional notify callback; clean+behind still
  fast-forwards; up-to-date and feature-branch stay silent DEBUG.
- HermesHomePuller takes a notifier + throttles wedged alerts (default 6h,
  tracked via _last_alert_ts) so the operator isn't paged hourly. The
  throttle clock only advances once the notifier actually accepts the
  message, so a failed send retries next tick.
- GatewayRunner gains _send_operator_alert (reuses the home-channel
  adapter.send surface used by shutdown/startup notifications) and
  make_operator_alert_callback (thread-safe sink via safe_schedule_threadsafe).
  start_gateway threads the callback into start_hermes_home_puller.
- Tests: wedged fires once then suppressed in-window then again after the
  window elapses; clean+behind fast-forwards no alert; up-to-date no alert
  no pull; feature branch no alert; notifier-exception non-fatal + no
  throttle advance. 30 -> 39 tests.

Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
dizhaky referenced this pull request in dizhaky/hermes-agent Jun 23, 2026
…AN-1385) (#26)

baileys 7.0.0-rc.9->rc13 (clears #43 critical) + protobufjs 7.6.4 (#59,#58) in whatsapp-bridge; esbuild+tsx (#46,#61) in ui-tui; @babel/core (#84) in web; joi+http-proxy-middleware (#51,#89) in website. js-yaml #86 accepted (no in-range fix via gray-matter). Bridge startup verified. #93/#94 (code fixes) separate.

Co-Authored-By: Claude <noreply@anthropic.com>
sahilm-ti referenced this pull request in sahilm-ti/hermes-agent Jul 3, 2026
…a dirty live tree (#45)

The hourly ~/.hermes auto-pull silently DEBUG-skipped on a dirty working
tree. The live tree is almost always dirty (continuous skill-edit churn),
so incoming merges piled up undelivered on disk with zero alerting (PRs
#54-#58, ~5 merges, only noticed when a cron broke).

- _pull_once now counts commits-behind BEFORE the clean check so it can
  distinguish the WEDGED state (on main, behind>0, dirty) from up-to-date.
  Wedged invokes an optional notify callback; clean+behind still
  fast-forwards; up-to-date and feature-branch stay silent DEBUG.
- HermesHomePuller takes a notifier + throttles wedged alerts (default 6h,
  tracked via _last_alert_ts) so the operator isn't paged hourly. The
  throttle clock only advances once the notifier actually accepts the
  message, so a failed send retries next tick.
- GatewayRunner gains _send_operator_alert (reuses the home-channel
  adapter.send surface used by shutdown/startup notifications) and
  make_operator_alert_callback (thread-safe sink via safe_schedule_threadsafe).
  start_gateway threads the callback into start_hermes_home_puller.
- Tests: wedged fires once then suppressed in-window then again after the
  window elapses; clean+behind fast-forwards no alert; up-to-date no alert
  no pull; feature branch no alert; notifier-exception non-fatal + no
  throttle advance. 30 -> 39 tests.

Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
sahilm-ti referenced this pull request in sahilm-ti/hermes-agent Jul 9, 2026
…a dirty live tree (#45)

The hourly ~/.hermes auto-pull silently DEBUG-skipped on a dirty working
tree. The live tree is almost always dirty (continuous skill-edit churn),
so incoming merges piled up undelivered on disk with zero alerting (PRs
#54-#58, ~5 merges, only noticed when a cron broke).

- _pull_once now counts commits-behind BEFORE the clean check so it can
  distinguish the WEDGED state (on main, behind>0, dirty) from up-to-date.
  Wedged invokes an optional notify callback; clean+behind still
  fast-forwards; up-to-date and feature-branch stay silent DEBUG.
- HermesHomePuller takes a notifier + throttles wedged alerts (default 6h,
  tracked via _last_alert_ts) so the operator isn't paged hourly. The
  throttle clock only advances once the notifier actually accepts the
  message, so a failed send retries next tick.
- GatewayRunner gains _send_operator_alert (reuses the home-channel
  adapter.send surface used by shutdown/startup notifications) and
  make_operator_alert_callback (thread-safe sink via safe_schedule_threadsafe).
  start_gateway threads the callback into start_hermes_home_puller.
- Tests: wedged fires once then suppressed in-window then again after the
  window elapses; clean+behind fast-forwards no alert; up-to-date no alert
  no pull; feature branch no alert; notifier-exception non-fatal + no
  throttle advance. 30 -> 39 tests.

Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
sahilm-ti referenced this pull request in sahilm-ti/hermes-agent Jul 10, 2026
…a dirty live tree (#45)

The hourly ~/.hermes auto-pull silently DEBUG-skipped on a dirty working
tree. The live tree is almost always dirty (continuous skill-edit churn),
so incoming merges piled up undelivered on disk with zero alerting (PRs
#54-#58, ~5 merges, only noticed when a cron broke).

- _pull_once now counts commits-behind BEFORE the clean check so it can
  distinguish the WEDGED state (on main, behind>0, dirty) from up-to-date.
  Wedged invokes an optional notify callback; clean+behind still
  fast-forwards; up-to-date and feature-branch stay silent DEBUG.
- HermesHomePuller takes a notifier + throttles wedged alerts (default 6h,
  tracked via _last_alert_ts) so the operator isn't paged hourly. The
  throttle clock only advances once the notifier actually accepts the
  message, so a failed send retries next tick.
- GatewayRunner gains _send_operator_alert (reuses the home-channel
  adapter.send surface used by shutdown/startup notifications) and
  make_operator_alert_callback (thread-safe sink via safe_schedule_threadsafe).
  start_gateway threads the callback into start_hermes_home_puller.
- Tests: wedged fires once then suppressed in-window then again after the
  window elapses; clean+behind fast-forwards no alert; up-to-date no alert
  no pull; feature branch no alert; notifier-exception non-fatal + no
  throttle advance. 30 -> 39 tests.

Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
sahilm-ti referenced this pull request in sahilm-ti/hermes-agent Jul 11, 2026
…a dirty live tree (#45)

The hourly ~/.hermes auto-pull silently DEBUG-skipped on a dirty working
tree. The live tree is almost always dirty (continuous skill-edit churn),
so incoming merges piled up undelivered on disk with zero alerting (PRs
#54-#58, ~5 merges, only noticed when a cron broke).

- _pull_once now counts commits-behind BEFORE the clean check so it can
  distinguish the WEDGED state (on main, behind>0, dirty) from up-to-date.
  Wedged invokes an optional notify callback; clean+behind still
  fast-forwards; up-to-date and feature-branch stay silent DEBUG.
- HermesHomePuller takes a notifier + throttles wedged alerts (default 6h,
  tracked via _last_alert_ts) so the operator isn't paged hourly. The
  throttle clock only advances once the notifier actually accepts the
  message, so a failed send retries next tick.
- GatewayRunner gains _send_operator_alert (reuses the home-channel
  adapter.send surface used by shutdown/startup notifications) and
  make_operator_alert_callback (thread-safe sink via safe_schedule_threadsafe).
  start_gateway threads the callback into start_hermes_home_puller.
- Tests: wedged fires once then suppressed in-window then again after the
  window elapses; clean+behind fast-forwards no alert; up-to-date no alert
  no pull; feature branch no alert; notifier-exception non-fatal + no
  throttle advance. 30 -> 39 tests.

Co-authored-by: Sahil (AI) <266772320+sahilm-ai@users.noreply.github.com>
Meraniya pushed a commit to Meraniya/hermes-agent that referenced this pull request Aug 6, 2026
…ch#58)

The MAX_RERUNS=3 counter was local to each healer invocation, so a
deterministically failing workflow run would be rerun every 30 minutes
indefinitely. Add a gh api call to read run_attempt before rerunning;
skip any run that has already reached the retry ceiling across prior
healer invocations. Addresses Codex PR NousResearch#50 P2 finding.
bri12afdsarker96-lgtm pushed a commit to bri12afdsarker96-lgtm/hermes-agent-mercury that referenced this pull request Aug 19, 2026
…gin; cache key gains authority_epoch (contract v3)

Brain-side orchestration stage, fork half (Hermes_AI half: PR NousResearch#58 in
bri12afdsarker96-lgtm/Hermes_AI):

- plugins/orchestration_p3_m2 (new, default OFF, strict-bool enable,
  fail-open — optimisation guards, not security gates; zero fork-core
  changes):
  * L0 search-query rewrite: tool_request middleware intercepting only
    search_business_knowledge (incl. mcp__*__ prefixed form), rewrites
    the query via agent.auxiliary_client.call_llm
    (task=l0_query_rewrite, model picked by auxiliary.* config);
    replaces the query value only — never adds keys
    (additionalProperties: false); any failure keeps the original query
  * long-chain verifier: llm_execution middleware counting steps per
    session_id; on a final response (finish=stop, no tool_calls) past
    verifier.max_steps (default 30) asks an independent judge
    (task=task_verifier); verdict whitelist pass/fail (off-list =
    skipped, anti-prompt-manipulation); fail only annotates
    verify_meta.needs_review — never auto-retries, never rewrites text

- spike_p3_m0_cache: cache key part "authority_epoch" sourced from
  host-injected request["_kb_epoch"] (Hermes_AI EpochSnapshot.cache_epoch);
  CACHE_CONTRACT_VERSION v2 -> v3.  Knowledge publish/withdraw/quarantine
  bumps an epoch and forces a miss; missing _kb_epoch hashes as "" so
  deployments without the dataplane keep existing behaviour

- tests/plugins/orchestration_p3_m2: 28 tests via the real PluginManager
  and production seams (apply_tool_request_middleware /
  run_llm_execution_middleware), incl. end-to-end hit -> epoch bump ->
  forced miss; injected model doubles, fully offline

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0187rqPXzMBVBDLmNBAfK1bf
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