Skip to content

fix(gateway): stop MEDIA tag regex from absorbing following tag or text (#68773) - #68837

Closed
webtecnica wants to merge 2 commits into
NousResearch:mainfrom
webtecnica:fix/68773-media-tag-separator
Closed

fix(gateway): stop MEDIA tag regex from absorbing following tag or text (#68773)#68837
webtecnica wants to merge 2 commits into
NousResearch:mainfrom
webtecnica:fix/68773-media-tag-separator

Conversation

@webtecnica

Copy link
Copy Markdown
Contributor

Closes #68773

Problem

MEDIA_TAG_CLEANUP_RE regex requires a separator (space, newline, end) after file extension via lookahead. When there's no separator (e.g. two MEDIA tags back-to-back or tag followed by text), the regex fails — media delivery silently fails and spurious truncation detection occurs.

Fix

Adjusted the lookahead boundary to also accept MEDIA: as a valid follow boundary, so back-to-back tags and tag+text both match correctly.

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 comp/cli CLI entry point, hermes_cli/, setup wizard tool/skills Skills system (list, view, manage) sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages duplicate This issue or pull request already exists labels Jul 21, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #68781: the same MEDIA regex repair is already open there, while this PR also bundles unrelated profile skill-count changes. #68781 is the cleaner canonical patch.

webtecnica and others added 2 commits July 21, 2026 20:36
Previously _count_skills() only counted SKILL.md files inside the
profile's own skills/ directory, making the WebUI profile card show
a misleading low count (e.g. 0 for 'default', 30 for 'webtecnica')
even though the profile loaded 150+ skills from global + external
dirs.

Now it scans three sources:
1. Profile-specific skills/ dir (as before)
2. Global ~/.hermes/skills/ dir (via get_default_hermes_root)
3. External dirs from skills.external_dirs config

Deduplication by skill name (from YAML frontmatter) prevents double-
counting when the same skill exists in both global and profile dirs,
matching how scan_skill_commands() loads skills at runtime.

The cache is updated to key on all scanned directories and track
their combined mtime signatures.
…xt (NousResearch#68773)

Two MEDIA: path tags emitted back-to-back without a separator merged
into a single invalid path and were silently dropped. The same happened
for extension-less tags.

Root cause: both regexes in gateway/platforms/base.py used greedy
quantifiers in their path class, causing adjacent tags to be absorbed.

Fix: make both regexes non-greedy (add ? to quantifiers) and add
MEDIA: to the trailing lookahead boundary set so the next MEDIA:
keyword stops the current match cleanly.
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #72170 (rebase-merge) — your commit was cherry-picked onto current main with your authorship preserved in git history. Thanks for the fix!

PR #72170 consolidated six open MEDIA-delivery fixes (formatting-variant regex misses + the Discord upload race) into one salvage wave so the overlapping regex changes could be resolved together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages tool/skills Skills system (list, view, manage) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent fails to append separators after MEDIA tags, URLs, and file paths, causing cascading delivery and truncation failures

3 participants