Skip to content

Background process completion notifications can start mid-line when output is truncated #23284

@Hamp-openclaw

Description

@Hamp-openclaw

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/agentCore agent loop, run_agent.py, prompt buildersweeper:implemented-on-mainSweeper: behavior already present on current maintool/terminalTerminal execution and process managementtype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions