Skip to content

feat(gateway): add optional inbound message timestamp prefix#9784

Open
Jiawen-lee wants to merge 2 commits into
NousResearch:mainfrom
Jiawen-lee:feat(gateway)-configurable-message-timestamp-prefix
Open

feat(gateway): add optional inbound message timestamp prefix#9784
Jiawen-lee wants to merge 2 commits into
NousResearch:mainfrom
Jiawen-lee:feat(gateway)-configurable-message-timestamp-prefix

Conversation

@Jiawen-lee

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR adds an optional configuration flag message_timestamp_prefix that prepends a compact timestamp to inbound user messages before they are passed to the agent.

When enabled, Hermes will prefix inbound messages like:

[04-14 23:47] hello

Related Issue

Fixes #9628

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

Config support

Added new optional gateway config:

gateway.message_timestamp_prefix: true

Implemented:

  • config parsing support
  • nested gateway: YAML compatibility
  • serialization/deserialization handling

Files:

gateway/config.py

Runtime timestamp injection

Prepends timestamp during inbound message preprocessing:

gateway/run.py::_prepare_inbound_message_text()

Adds helper:

_format_inbound_message_timestamp()

Behavior:

  • format: [MM-DD HH:MM]
  • default timezone: UTC
  • override via:
HERMES_TIMEZONE=America/New_York

Gracefully falls back to UTC if timezone invalid.

Ordering guarantees

Preserves sender-prefix ordering in shared threads:

[timestamp] [username] message

Example:

[04-14 23:47] [alice] can you check this later?

Tests added

Added coverage for:

  • config parsing via nested gateway: dict
  • config.yaml loading bridge behavior
  • timestamp prefix formatting
  • ordering with username prefixes
  • UTC default handling

Files:

tests/gateway/test_stt_config.py

How to Test

  1. Enable the feature in config:
gateway:
  message_timestamp_prefix: true
  1. Run Hermes normally
hermes
  1. Send a message from any platform

Expected:

[MM-DD HH:MM] your message

Optional timezone override:

export HERMES_TIMEZONE=America/New_York

Restart Hermes and verify updated timestamps.

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:

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

For New Skills

  • This skill is broadly useful to most users (if bundled) — see Contributing Guide
  • SKILL.md follows the standard format (frontmatter, trigger conditions, steps, pitfalls)
  • No external dependencies that aren't already available (prefer stdlib, curl, existing Hermes tools)
  • I've tested the skill end-to-end: hermes --toolsets skills -q "Use the X skill to do Y"

Screenshots / Logs

@markojak

Copy link
Copy Markdown

Closing this as superseded by #17459/#17476.

The need is real, but we do not want a separate gateway-only timestamp-prefix mechanism. The chosen direction is one core ephemeral runtime/user-message context path for current time + timezone, with time-sensitive tools also returning explicit advisory metadata when relevant (#17474).

If there are useful tests or gateway adapter details here, please port them into the consolidated implementation rather than keeping this as a parallel feature flag.

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 P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: configurable message timestamp prefix to prevent temporal drift in long-lived sessions

3 participants