Skip to content

fix(gateway): cross-turn media dedupe, spaced/GIS MEDIA paths, code-block-safe display strip - #72193

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-86086c99
Jul 26, 2026
Merged

fix(gateway): cross-turn media dedupe, spaced/GIS MEDIA paths, code-block-safe display strip#72193
teknium1 merged 2 commits into
mainfrom
hermes/hermes-86086c99

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Closes the three MEDIA-delivery gaps left open after PR #72170: cross-turn duplicate re-delivery, GIS/spaced-path extraction, and streaming display mangling MEDIA examples inside code blocks.

Changes

Salvaged (cherry-picked, authorship preserved):

Our fixes:

Validation

Scenario Before After
Model echoes prior turn's MEDIA tag file re-uploaded every echo delivered once
MEDIA:/data/map data.kmz (spaced, GIS) silent drop delivered
MEDIA:/x/my server.log (spaced, unknown ext) silent drop delivered
spaced path + trailing prose path delivers, prose kept
spaced non-existent path stays visible (no delivery)
MEDIA: example in fenced code block (streaming) stripped from display preserved verbatim
MEDIA:/a MEDIA:/b extensionless pair both deliver both deliver (unchanged)

Infographic

media-delivery-wave2

dhruvkej9 and others added 2 commits July 26, 2026 13:03
…/tool output

The model sometimes echoes a previous MEDIA:path tag or bare file path in a later response. Previously both streaming delivery and non-streaming delivery would re-send those files, causing duplicate documents/images on later turns.

Changes:

- _collect_history_media_paths now also scans assistant messages for MEDIA: tags, not just tool results.

- _deliver_media_from_response accepts pre-computed history_media_paths and filters extracted media/local files.

- BasePlatformAdapter gains _history_media_paths_for_session for non-streaming dedup.
… display strip

Follow-up wave to #72170 resolving the remaining open MEDIA-delivery gaps:

- #24032: add .kmz/.kml/.geojson/.gpx to MEDIA_DELIVERY_EXTS, and recover
  unknown-extension paths containing spaces via _match_extensionless_path —
  validation-gated forward extension across single spaces (bounded at 8
  tokens, stops at newline / next MEDIA: keyword). The regex itself stays
  non-greedy and whitespace-bounded so the #68773 absorption bug class
  cannot return; the on-disk file check is the oracle.

- #16434 (streaming half): _strip_media_tag_directives now uses the same
  mask-as-locator pattern as extract_media, so MEDIA tags inside fenced
  code blocks, inline-code examples, and JSON string values survive in
  streamed display text instead of being mangled. Display and delivery
  now agree on every protected-span rule.

- Updated three stream_consumer display expectations that pinned the old
  inconsistent behavior (backtick/double-quote tags stripped from display
  while delivery never attempted them).
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/windows Native Windows-specific behavior or breakage sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows needs-decision Awaiting maintainer decision before any implementation labels Jul 26, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related: #24217 and #24049 overlap the spaced/GIS/Windows MEDIA-path repair. This PR also adds distinct cross-turn dedupe and code-span-safe display handling, so it is not a same-scope duplicate; maintainers should consolidate the parser strategy.

@github-actions

github-actions Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 165b076

ℹ️ Info

Desktop E2E visual evidence · View test artifacts · View job

1 visual diff.

inline evidence upload failed.

Failed to upload diff-665a0833239e-onboarding-overlay-diff.png with gh image (exit code 1): Error uploading /home/runner/work/_temp/e2e-evidence/diff-665a0833239e-onboarding-overlay-diff.png: step 0 (get upload token): uploadToken not found on repo page — do you have write access to NousResearch/hermes-agent? (or, if NousResearch enforces SAML SSO, authorize at https://github.com/orgs/NousResearch/sso)

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 needs-decision Awaiting maintainer decision before any implementation P2 Medium — degraded but workaround exists platform/windows Native Windows-specific behavior or breakage sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants