hermes-agent/tools
Ben Barclay ce6dd1a65f
fix(sync): read org state from the org endpoints, not the personal ones (#75237)
Org-shared skills were unusable past the first propose. Three defects, one
root cause plus two that it masked.

ROOT CAUSE — org reads went to the personal endpoint.

`SyncClient.get_refs()` / `get_object()` only ever called `/v1/sync/refs`
and `/v1/sync/objects/:hash`. Those routes are hard-scoped server-side to
the token's own owner, so asking them for `refs/org/<id>/` returns the
caller's PERSONAL refs rather than an error, and org objects 404. Both org
call sites read org state through them:

- `pull_org_skills` resolved head=None for a populated org and reported
  `{"ok": true, "head": null, "updated": []}` — org skills silently never
  arrived, which reads as "my org has no skills" rather than as a failure.
- `propose_skill` resolved base_head=None, so the FIRST propose to an org
  succeeded by accident (`from: null` happened to be correct) and EVERY
  later one CAS'd against a head it had never seen -> 409 -> a raw
  `SyncConflict` traceback. Worse, it built its root from an empty skill
  map, so a landed CAS would have REPLACED the org set rather than splicing
  into it — the 409 was accidentally preventing data loss.

Fix: `org_scope=True` on `get_refs`/`get_object`, threaded through
`get_commit_json`, `get_tree_json`, `_root_tree_of_commit`,
`_skill_trees_of_root`, and `materialize_tree` — walking an org commit needs
the org route on every hop, not just the first. Both org call sites now go
through one `_read_org_head()` helper.

ALSO FIXED

- `propose_skill` retries on conflict. When the org HEAD moves between the
  read and the CAS (another member proposing, an admin merging), it
  re-splices this one skill onto the NEW head and retries, bounded at 5
  attempts. Re-splicing rather than replaying the old root is what stops a
  concurrent proposal being dropped.
- An empty `actual` in a 409 means "the ref does not exist", not "here is a
  commit". `SyncConflict` normalizes "" to None in its constructor, and the
  personal push path redoes the CAS as a create instead of fetching "" as an
  object — which surfaced as the baffling `object  not found` (doubled
  space). This is what a client hits after switching sync planes, since
  `.sync_state` is not environment-scoped and carries a foreign head.

THE MOCK WAS THE REASON THIS SHIPPED

The test mock served org refs and org objects off the personal routes, so
21 org tests passed against a client that could not work against the real
plane. The mock now mirrors production: `/v1/sync/org/refs` and
`/v1/sync/org/objects/:hash` exist, org objects live in a separate scope,
and the personal routes refuse org content. Two existing tests had to be
corrected to assert against the org scope — they had been passing on the
mock's over-permissiveness.

Tests: 5 new (org head invisible on the personal route; second propose
splices and preserves the first; pull resolves a real org head; empty
`actual` -> None; push recovers from a stale cross-plane head). Verified
they FAIL without the fix: reverting just `_read_org_head` to the personal
route fails the second-propose test and the pre-existing splice test.
1278 passed / 0 failed across 54 suites via scripts/run_tests.sh.

Verified against PRODUCTION with a real org token, not just the mock:
- `pull_org_skills` -> head `sha256:1adf9333…`, materialized
  `software-development/gateway-gateway-connector` into the `_org` mirror
  (was head=None, updated=[]).
- A second `hermes sync propose` succeeded where it previously raised, and
  the org set afterwards contains BOTH skills with the new commit
  descending from the first.
2026-07-30 22:31:42 -07:00
..
computer_use fix(computer_use): resolve gateway session-key namespace in permission-mode lookup 2026-07-29 12:19:37 -07:00
environments modernize re-added Vercel integrations: SDK 0.7.2, telemetry off, sibling-site wiring 2026-07-29 19:48:37 -07:00
neutts_samples
wakewords feat(voice): bundle the trained "hey hermes" model as the out-of-the-box default 2026-07-28 07:58:16 -07:00
__init__.py
ansi_strip.py fix(cli): sanitize terminal escapes when replaying stored history (/resume recap, /status recap) 2026-07-17 04:53:38 -07:00
approval.py Revert "remove Vercel AI Gateway and Vercel Sandbox (#33067)" 2026-07-29 19:48:37 -07:00
async_delegation.py fix(state): restore async_delegation.py symbols, keep only journal_mode routing 2026-07-29 18:13:09 -07:00
audio_container.py refactor: extract shared audio container sniffer to tools/audio_container.py 2026-07-28 11:52:44 -07:00
binary_extensions.py
blueprints.py chore: remove unused imports and dead locals (ruff F401/F841 sweep) 2026-07-29 11:53:39 -07:00
browser_camofox.py fix(browser): block Camofox input on private pages 2026-07-03 03:27:47 -07:00
browser_camofox_state.py
browser_cdp_tool.py fix(browser): stop stale cdp_url from stalling every startup by 10+ seconds 2026-07-27 14:32:05 -07:00
browser_dialog_tool.py
browser_supervisor.py perf(imports): lazy-load heavy SDKs off the cold-start waterfall 2026-07-29 10:54:04 -07:00
browser_tool.py perf: lazy mcp SDK import + tool-discovery mtime cache + browser_tool import diet 2026-07-29 10:02:03 -07:00
budget_config.py
checkpoint_manager.py refactor: single build_subprocess_env() factory for all child-process spawns (profile + secret-scrub single owner) 2026-07-29 10:14:11 -07:00
clarify_gateway.py feat(clarify): extend multi-select to gateway text fallback and TUI bridge 2026-07-26 17:46:55 -07:00
clarify_tool.py refactor: migrate hand-rolled error envelopes to shared tool_error() 2026-07-29 10:14:00 -07:00
close_terminal_tool.py chore: remove unused imports and dead locals (ruff F401/F841 sweep) 2026-07-29 11:53:39 -07:00
code_execution_tool.py Revert "remove Vercel AI Gateway and Vercel Sandbox (#33067)" 2026-07-29 19:48:37 -07:00
computer_use_tool.py feat(computer_use): align cua-driver 0.10 permission modes 2026-07-29 12:19:37 -07:00
credential_files.py Revert "remove Vercel AI Gateway and Vercel Sandbox (#33067)" 2026-07-29 19:48:37 -07:00
cronjob_tools.py fix(cron): scrub ALL GitHub auth-header curl blocks, not just the first 2026-07-29 12:41:40 -07:00
daemon_pool.py fix(cli): reliable interrupts, bounded exit, and exit feedback (#57000) 2026-07-02 04:20:43 -07:00
debug_helpers.py feat(moa): expose MoA presets as selectable virtual models (#46081) 2026-06-25 13:52:06 -07:00
delegate_tool.py chore: remove unused imports and dead locals (ruff F401/F841 sweep) 2026-07-29 11:53:39 -07:00
delegation_live_log.py fix(delegation): redact credentials in live subagent transcripts 2026-07-20 06:50:31 -07:00
desktop_ui.py feat(desktop): agent can focus panes + shared desktop-UI event bridge 2026-07-22 12:13:01 -05:00
discord_tool.py chore: remove unused imports and dead locals (ruff F401/F841 sweep) 2026-07-29 11:53:39 -07:00
env_passthrough.py fix(security): strip dynamic Hermes secrets from all subprocess spawn env 2026-07-01 14:37:22 +05:30
env_probe.py modernize re-added Vercel integrations: SDK 0.7.2, telemetry off, sibling-site wiring 2026-07-29 19:48:37 -07:00
fal_common.py
feishu_doc_tool.py
feishu_drive_tool.py
file_operations.py fix(file_ops): apply umask-default permissions in _atomic_write for new files (#70856) 2026-07-30 21:53:38 +05:30
file_state.py
file_tools.py modernize re-added Vercel integrations: SDK 0.7.2, telemetry off, sibling-site wiring 2026-07-29 19:48:37 -07:00
flux3_video_tool.py flux3 messaging system fixes 2026-07-30 15:20:09 -07:00
focus_pane_tool.py feat(desktop): agent can focus panes + shared desktop-UI event bridge 2026-07-22 12:13:01 -05:00
fuzzy_match.py fix(tools): normalize Unicode space family and minus sign in patch fuzzy matching 2026-07-26 20:58:43 -07:00
homeassistant_tool.py refactor: migrate hand-rolled error envelopes to shared tool_error() 2026-07-29 10:14:00 -07:00
hook_output_spill.py fix: route stray HERMES_HOME hardcodes through get_hermes_home() (profile + native-Windows safety) 2026-07-29 09:33:48 -07:00
image_generation_tool.py fix(deepinfra): harden multimodal provider routing 2026-07-14 02:59:39 +05:30
image_source.py nous portal video gen (#74963) 2026-07-30 14:52:15 -04:00
interrupt.py fix(interrupt): run user-approved commands from a clean interrupt slate 2026-07-06 04:58:42 -07:00
kanban_tools.py fix: scope kanban auto-subscriptions to active profile 2026-07-26 16:27:52 -07:00
lazy_deps.py modernize re-added Vercel integrations: SDK 0.7.2, telemetry off, sibling-site wiring 2026-07-29 19:48:37 -07:00
managed_tool_gateway.py nous portal video gen (#74963) 2026-07-30 14:52:15 -04:00
mcp_dashboard_oauth.py fix(mcp): preserve live OAuth state during reauth 2026-07-17 04:50:47 -07:00
mcp_oauth.py perf: lazy mcp SDK import + tool-discovery mtime cache + browser_tool import diet 2026-07-29 10:02:03 -07:00
mcp_oauth_manager.py fix(mcp): make Figma remote OAuth work via DCR allowlist defaults 2026-07-28 00:53:16 -05:00
mcp_stdio_watchdog.py fix(mcp): use direct parent identity in stdio watchdog 2026-07-18 04:15:13 -07:00
mcp_tool.py fix(mcp): propagate cancellation untouched in _connect_server orphan reap 2026-07-30 03:35:35 +05:30
memory_tool.py refactor: extract atomic_write_text to utils.py; fix write-failure error handling 2026-07-29 16:49:07 +05:30
microsoft_graph_auth.py
microsoft_graph_client.py refactor: single shared Retry-After parser 2026-07-29 10:13:50 -07:00
neutts_synth.py fix(voice): reconcile NeuTTS backbone/codec GPU device strings 2026-07-28 14:07:21 -07:00
open_preview_tool.py feat(desktop): agent can focus panes + shared desktop-UI event bridge 2026-07-22 12:13:01 -05:00
openrouter_client.py
osv_check.py
patch_parser.py fix(patch): ignore inert context-only hunks (#63678) 2026-07-13 02:42:18 -07:00
path_security.py refactor: migrate hand-rolled error envelopes to shared tool_error() 2026-07-29 10:14:00 -07:00
process_registry.py fix(process_registry): reader loop no longer hangs when an orphaned grandchild holds the stdout pipe 2026-07-24 15:59:02 -07:00
project_tools.py feat(tools): add project workspace tools 2026-06-25 16:40:27 -05:00
react_to_message_tool.py feat(desktop): reactions are opt-in under Settings → Appearance, off by default 2026-07-30 00:08:28 -05:00
read_extract.py
read_terminal_tool.py chore: remove unused imports and dead locals (ruff F401/F841 sweep) 2026-07-29 11:53:39 -07:00
registry.py refactor: migrate hand-rolled error envelopes to shared tool_error() 2026-07-29 10:14:00 -07:00
schema_sanitizer.py fix(schema): preserve dependentRequired property names 2026-07-28 14:37:19 -07:00
send_message_tool.py chore: remove unused imports and dead locals (ruff F401/F841 sweep) 2026-07-29 11:53:39 -07:00
session_search_tool.py fix(session): resolve default state DB path at call time 2026-07-29 18:55:10 -07:00
skill_manager_tool.py Merge origin/main into feat/hsp-sync-client 2026-07-29 13:01:36 -07:00
skill_provenance.py
skill_usage.py Merge origin/main into feat/hsp-sync-client 2026-07-29 13:01:36 -07:00
skills_ast_audit.py
skills_guard.py fix(skills): bind bundles to exact files and origins 2026-07-12 02:59:27 -07:00
skills_hub.py chore: remove unused imports and dead locals (ruff F401/F841 sweep) 2026-07-29 11:53:39 -07:00
skills_sync.py fix(skills): avoid redundant bind-mount scans (#72622) 2026-07-28 04:24:50 -05:00
skills_sync_client.py fix(sync): read org state from the org endpoints, not the personal ones (#75237) 2026-07-30 22:31:42 -07:00
skills_tool.py Revert "remove Vercel AI Gateway and Vercel Sandbox (#33067)" 2026-07-29 19:48:37 -07:00
slash_confirm.py
terminal_tool.py modernize re-added Vercel integrations: SDK 0.7.2, telemetry off, sibling-site wiring 2026-07-29 19:48:37 -07:00
thread_context.py
threat_patterns.py fix: bound threat-pattern/FTS5 regex input and cover V4A Move-File edits 2026-07-01 01:05:28 -07:00
tirith_security.py fix: add explicit UTF-8 encoding to all subprocess text=True calls (#53428) 2026-07-24 11:45:57 -07:00
todo_tool.py fix(compression): preserve synthetic user provenance 2026-07-22 06:56:53 -07:00
tool_backend_helpers.py fix(voice): single scoped resolver — STT/TTS keys fall back to the credential pool 2026-07-28 11:53:09 -07:00
tool_output_limits.py
tool_result_storage.py fix: keep persisted tool results inside their storage directory 2026-06-30 16:39:41 -07:00
tool_search.py refactor: migrate hand-rolled error envelopes to shared tool_error() 2026-07-29 10:14:00 -07:00
transcription_tools.py fix(stt): kill faster-whisper silence hallucinations at the source 2026-07-29 00:01:33 -07:00
tts_streaming.py fix(tts): route streaming-provider secrets through resolve_provider_secret; bound per-sentence stream bodies at 16 MiB 2026-07-28 22:31:40 -07:00
tts_text_normalize.py fix(tts): unify TTS text preprocessing behind one shared cleaner 2026-07-28 11:55:01 -07:00
tts_tool.py feat(voice): calm ambient "thinking" sound while the agent works in voice chat 2026-07-29 08:24:00 -07:00
url_safety.py fix: scope private URL policy per profile 2026-07-28 14:17:45 -07:00
video_generation_tool.py feat(providers): Support DeepInfra as an LLM provider 2026-07-14 02:59:39 +05:30
vision_tools.py perf(imports): lazy-load heavy SDKs off the cold-start waterfall 2026-07-29 10:54:04 -07:00
voice_mode.py fix(voice): full-duplex agent-turn listener — interrupt by voice during generation AND playback 2026-07-29 10:08:53 -07:00
wake_word.py fix(wake): route desktop control and select input devices 2026-07-29 14:04:21 -06:00
web_tools.py chore: remove unused imports and dead locals (ruff F401/F841 sweep) 2026-07-29 11:53:39 -07:00
website_policy.py fix(website-policy): key blocklist cache on the real default config path 2026-07-04 15:08:49 -07:00
working_diff.py feat(diff): cross-surface /diff with staged/all/session modes 2026-07-26 18:28:20 -07:00
write_approval.py
x_search_tool.py docs(xai): clarify x_search vs xurl routing without schema cross-refs 2026-07-23 21:06:47 -07:00
xai_http.py fix(voice): single scoped resolver — STT/TTS keys fall back to the credential pool 2026-07-28 11:53:09 -07:00
xai_video_tools.py feat(xai): Imagine public-URL storage, chaining & video edit/extend 2026-06-29 21:11:58 -07:00
yuanbao_tools.py