hermes - ✅(Solved) Fix CLI file-drop misses quoted relative image paths [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#15197Fetched 2026-04-25 06:23:53
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×3cross-referenced ×1

Root Cause

Extend the starts_like_path prefilter in _detect_file_drop() to allow quoted relative prefixes ("./, './, "../, '../) and add regression tests in tests/cli/test_cli_file_drop.py. Also consider checking the same path through _collect_query_images() because single-query hermes chat -q '"./rel image.png" ...' depends on this detection path.

Fix Action

Fixed

PR fix notes

PR #15235: fix(cli): detect quoted relative paths in _detect_file_drop

Description (problem / solution / changelog)

Closes #15197

_extends the starts_like_path prefilter in _detect_file_drop() to also recognize quoted relative path prefixes ("./, "../, './, '../), which were previously rejected even though the underlying path resolution code already supports them.

Before this fix, inputs like "./rel image.png" describe this were treated as plain text instead of being parsed as an image attachment. The fix is a 4-line addition to the existing path-detection logic, consistent with the already-supported quoted absolute path patterns.

Changed files

  • cli.py (modified, +4/-0)
  • tools/send_message_tool.py (modified, +3/-1)

Code Example

source venv/bin/activate
python - <<'PY'
from pathlib import Path
from tempfile import TemporaryDirectory
import os
from cli import _detect_file_drop

with TemporaryDirectory() as td:
    p = Path(td) / 'rel image.png'
    p.write_bytes(b'fake')
    old = os.getcwd()
    os.chdir(td)
    try:
        print(_detect_file_drop('"./rel image.png" describe'))
        print(_detect_file_drop(f'"{p}" describe'))
    finally:
        os.chdir(old)
PY

---

None
{'path': PosixPath('.../rel image.png'), 'is_image': True, 'remainder': 'describe'}
RAW_BUFFERClick to expand / collapse

Bug Description

Quoted relative local image paths are not detected by the CLI file-drop/single-query image attachment path. This means an input like "./rel image.png" describe this is sent as plain text instead of attaching the image.

Affected files/lines

  • cli.py:1413-1449_detect_file_drop() has a starts_like_path prefilter that accepts unquoted ./ / ../, and quoted absolute / tilde / Windows paths, but not quoted "./..." or "../..." paths.
  • cli.py:1284-1324_split_path_input() already supports quoted path tokens and escaped spaces.
  • cli.py:1327-1362_resolve_attachment_path() already resolves relative paths against TERMINAL_CWD / os.getcwd().
  • tests/cli/test_cli_file_drop.py:133-193 covers escaped spaces, unquoted spaces, file URI, and tilde paths, but not quoted relative paths.

Why this is a bug

The lower-level path parsing/resolution code supports quoted and relative paths, but _detect_file_drop() rejects quoted relative inputs before it reaches that code. Quoting relative paths is a common shell/CLI habit when the filename contains spaces.

Minimal reproduction

From the repo root with the venv active:

source venv/bin/activate
python - <<'PY'
from pathlib import Path
from tempfile import TemporaryDirectory
import os
from cli import _detect_file_drop

with TemporaryDirectory() as td:
    p = Path(td) / 'rel image.png'
    p.write_bytes(b'fake')
    old = os.getcwd()
    os.chdir(td)
    try:
        print(_detect_file_drop('"./rel image.png" describe'))
        print(_detect_file_drop(f'"{p}" describe'))
    finally:
        os.chdir(old)
PY

Actual output observed during review:

None
{'path': PosixPath('.../rel image.png'), 'is_image': True, 'remainder': 'describe'}

Expected behavior

_detect_file_drop('"./rel image.png" describe') should return the same kind of attachment dict as the quoted absolute path case, with remainder == 'describe'.

Suggested investigation direction

Extend the starts_like_path prefilter in _detect_file_drop() to allow quoted relative prefixes ("./, './, "../, '../) and add regression tests in tests/cli/test_cli_file_drop.py. Also consider checking the same path through _collect_query_images() because single-query hermes chat -q '"./rel image.png" ...' depends on this detection path.

extent analysis

TL;DR

The issue can be fixed by extending the starts_like_path prefilter in _detect_file_drop() to allow quoted relative prefixes.

Guidance

  • Extend the starts_like_path prefilter to match quoted relative paths by adding checks for "./ and "../ within quotes.
  • Add regression tests in tests/cli/test_cli_file_drop.py to cover quoted relative paths.
  • Consider updating _collect_query_images() to ensure consistent path detection for single-query images.
  • Verify the fix by running the provided minimal reproduction script and checking the output of _detect_file_drop() for quoted relative paths.

Example

def starts_like_path(input_str):
    # existing checks for unquoted ./, ../, absolute, and tilde paths
    # add checks for quoted relative paths
    if input_str.startswith('"./') or input_str.startswith('"../'):
        return True
    # ...

Notes

The suggested fix only addresses the specific issue of quoted relative paths and may not cover all edge cases. Additional testing and verification are necessary to ensure the fix does not introduce new issues.

Recommendation

Apply the workaround by extending the starts_like_path prefilter and adding regression tests, as this directly addresses the identified issue and provides a clear path to resolving the bug.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

_detect_file_drop('"./rel image.png" describe') should return the same kind of attachment dict as the quoted absolute path case, with remainder == 'describe'.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix CLI file-drop misses quoted relative image paths [1 pull requests, 1 participants]