Skip to content

fix(gateway): allow canonical media cache delivery roots - #33550

Closed
chbo297 wants to merge 1 commit into
NousResearch:mainfrom
chbo297:fix/canonical-media-cache-roots
Closed

fix(gateway): allow canonical media cache delivery roots#33550
chbo297 wants to merge 1 commit into
NousResearch:mainfrom
chbo297:fix/canonical-media-cache-roots

Conversation

@chbo297

@chbo297 chbo297 commented May 28, 2026

Copy link
Copy Markdown

What does this PR do?

Adds the canonical Hermes media cache directories to the default native media delivery safe roots.

Hermes cache helpers prefer paths under ~/.hermes/cache/, but installations that still have legacy cache directories can resolve IMAGE_CACHE_DIR, AUDIO_CACHE_DIR, etc. to legacy paths. In that state, media files written to the canonical cache directories may be filtered out before gateway delivery.

This keeps the existing legacy roots and safety checks intact, while always allowlisting:

  • ~/.hermes/cache/images
  • ~/.hermes/cache/audio
  • ~/.hermes/cache/videos
  • ~/.hermes/cache/documents
  • ~/.hermes/cache/screenshots

Related Issue

Fixes #33549

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Security fix
  • Documentation update
  • Tests (adding or improving test coverage)
  • Refactor (no behavior change)
  • New skill (bundled or hub)

Changes Made

  • gateway/platforms/base.py: add canonical ~/.hermes/cache/* media directories to MEDIA_DELIVERY_SAFE_ROOTS.
  • tests/gateway/test_platform_base.py: add regression coverage for the canonical roots.

How to Test

Focused tests run on macOS with Python 3.11.15:

PYTHONPATH=/private/tmp/hermes-agent-cache-roots \
  /Users/bdmap/.hermes/hermes-agent/venv/bin/python -m pytest -o addopts= \
  tests/gateway/test_platform_base.py

Result:

102 passed, 2 skipped in 0.27s

Full pytest tests/ -q was not run in this local pass.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS / Darwin, Python 3.11.15

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

Not applicable; this is path allowlist behavior covered by automated tests.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery labels May 28, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Competing fix for #31733 / #33549 — same change as #31764 and #33238 (add canonical cache paths to MEDIA_DELIVERY_SAFE_ROOTS). See also #33251 for a broader variant with diagnosable rejection reasons.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for this — the fix is correct, but it's already on main. The top-level ~/.hermes/cache/images (and sibling cache/*) roots were added to MEDIA_DELIVERY_SAFE_ROOTS in #34485, so the original symptom in #31733 is resolved.

The issue was then reopened for a narrower case your PR doesn't cover: profile-scoped gateways with a symlinked HERMES_HOME (e.g. /opt/data/root/.hermes with $HOME not under /root), where the model emits profiles/<name>/cache/images/... paths. That's being fixed in #54060 (per-profile cache roots added to the allowlist).

Closing as already-implemented. Appreciate the contribution.

@teknium1 teknium1 closed this Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Canonical media cache directories should be safe delivery roots

3 participants