hermes - ✅(Solved) Fix Background process completion notifications can start mid-line when output is truncated [2 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#23284Fetched 2026-05-11 03:30:12
View on GitHub
Comments
0
Participants
1
Timeline
6
Reactions
0
Participants
Timeline (top)
labeled ×4cross-referenced ×2

Fix Action

Fixed

PR fix notes

PR #23302: fix: 4 small surgical bugs — kanban delete alias, gateway title noise, bg truncation, cprint coroutine

Description (problem / solution / changelog)

Four independent one-area fixes, each with its own root cause analysis.

Fix 1 — kanban boards delete alias archives instead of deletes (#23139)

The delete subcommand alias shares _cmd_boards_rm but the --delete flag belongs only to the rm subparser. getattr(args, 'delete', False) therefore returns False when the alias is used, so remove_board(archive=True) runs — archiving the board instead of deleting it.

Fix: detect boards_action == 'delete' and treat it as force_delete=True. Test added.

Fix 2 — Gateway auto-title failure leaks as user-visible message (#23246)

When background title generation fails (e.g. HTTP 401 on auxiliary provider), _emit_auxiliary_failure routes the error through _emit_warning, which delivers it as a visible ⚠ message in Slack/Telegram/WhatsApp. Not actionable to the end user.

Fix: replace the failure_callback in Gateway mode with a debug-log-only lambda.

Fix 3 — Background process notification starts mid-line when output is truncated (#23284)

session.output_buffer[-2000:] truncates at an arbitrary byte offset, potentially starting the notification mid-line.

Fix: snap to the next newline boundary after the cut and prepend [… output truncated — showing last N chars] when content was dropped.

Fix 4 — _cprint() silently drops output from background threads (#23185 Bug A)

run_in_terminal() returns a coroutine (Future). Passing it bare to call_soon_threadsafe schedules the callback but never awaits the coroutine — Python garbage-collects it with RuntimeWarning, silently dropping the output.

Fix: wrap with asyncio.ensure_future() so the coroutine is properly scheduled on the running loop.

Changed files

  • cli.py (modified, +18/-5)
  • gateway/run.py (modified, +23/-8)
  • hermes_cli/kanban.py (modified, +6/-1)
  • scripts/release.py (modified, +1/-0)
  • tests/hermes_cli/test_kanban_boards.py (modified, +33/-0)
  • tools/process_registry.py (modified, +1/-1)

PR #23306: fix(process): align completion notifications to line boundaries

Description (problem / solution / changelog)

What does this PR do?

Fixes background-process completion notifications so truncated output is easier to read in gateway channels. Instead of slicing the last 2000 characters raw, completion previews now add an explicit truncation marker and align to the next full line when possible.

Related Issue

Fixes #23284

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

  • added ProcessRegistry._format_completion_output() in tools/process_registry.py
  • switched completion notifications to use a line-aware truncated tail with [output truncated: showing final lines]
  • extended tests/tools/test_notify_on_complete.py to cover the new truncation marker and line-boundary behavior

How to Test

  1. Run uv run --frozen pytest -q -o addopts='' tests/tools/test_notify_on_complete.py
  2. Confirm TestCompletionQueue::test_truncated_output_prefers_line_boundary passes
  3. Optionally reproduce with a long background process output and verify the completion notification starts with the truncation marker instead of a partial line

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 15.x

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

  • uv run --frozen pytest -q -o addopts='' tests/tools/test_notify_on_complete.py -> 22 passed
  • uv run --frozen ruff check tools/process_registry.py tests/tools/test_notify_on_complete.py -> passed
  • Full local python3 -m pytest tests/ -q --ignore=tests/integration --ignore=tests/e2e --tb=short -o addopts='' fails during collection on both this branch and a clean origin/main worktree because the local Python 3.10 environment is missing repo-required modules/features (tomllib, acp, websockets.asyncio, StrEnum)

Changed files

  • tests/tools/test_notify_on_complete.py (modified, +20/-1)
  • tools/process_registry.py (modified, +29/-3)

Code Example

g / down-right / inspecting-detail
[2026-05-10T16:44:49+02:00] 05 thinking-mode -> thinking / up-right / thinking-mode
...

---

[2026-05-10T16:43:49+02:00] 04 inspecting-detail -> working / down-right / inspecting-detail
RAW_BUFFERClick to expand / collapse

Bug description

A background process completion notification delivered through a messaging gateway can show only the tail/middle of stdout, without any explicit truncation marker or indication that earlier lines were omitted.

This makes the notification look like the command output itself started mid-line, which is confusing when using background processes to monitor demos or long-running jobs from WhatsApp/other gateway channels.

Observed evidence

During a WhatsApp-driven presence-display expression demo, the completed background process notification for proc_378f6708df1a started with:

g / down-right / inspecting-detail
[2026-05-10T16:44:49+02:00] 05 thinking-mode -> thinking / up-right / thinking-mode
...

The first visible line is the tail of the earlier expected line:

[2026-05-10T16:43:49+02:00] 04 inspecting-detail -> working / down-right / inspecting-detail

The process itself completed successfully with exit code 0 and the final state was correct, so this appears to be notification-output presentation/truncation rather than task failure.

Expected behavior

If background process output is truncated for a gateway notification:

  • truncate at line boundaries where possible;
  • include an explicit marker such as [output truncated: showing last N lines];
  • avoid starting a notification with a partial line unless clearly marked;
  • ideally include enough head/tail context for successful long-running jobs.

Actual behavior

The WhatsApp notification began mid-line with no truncation marker, which made it look like malformed command output.

Environment / context

  • Hermes Agent gateway, WhatsApp channel
  • Background process launched via tool/process notification flow
  • Command: bash /tmp/hamp_presence_expression_cycle.sh
  • Process completed successfully; issue is notification rendering/presentation only

Suggested fix

Audit the background-process completion notification path and centralize stdout truncation so all gateway notifications use line-aware truncation plus an explicit truncation header/footer. This should preserve the existing compact notification behavior while making truncated output unambiguous.

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

If background process output is truncated for a gateway notification:

  • truncate at line boundaries where possible;
  • include an explicit marker such as [output truncated: showing last N lines];
  • avoid starting a notification with a partial line unless clearly marked;
  • ideally include enough head/tail context for successful long-running jobs.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING