Skip to content

fix(channels): ensure newline between narration and draft status lines#4394

Merged
theonlyhennygod merged 1 commit intomasterfrom
fix/telegram-draft-newline
Mar 23, 2026
Merged

fix(channels): ensure newline between narration and draft status lines#4394
theonlyhennygod merged 1 commit intomasterfrom
fix/telegram-draft-newline

Conversation

@theonlyhennygod
Copy link
Copy Markdown
Collaborator

Summary

  • Base branch target: master
  • Problem: In draft-capable channels (Telegram), native tool-call narration text that doesn't end with \n gets concatenated directly with the next status line, producing garbled output like Task started.⏳ count_to
  • Why it matters: User-facing draft messages become unreadable when narration and status lines run together
  • What changed: The narration delta sent via on_delta now always ends with \n before being dispatched to the draft updater
  • What did not change: Non-draft channels, progress line format, final-answer streaming, console output

Label Snapshot (required)

  • Risk label: risk: low
  • Size label: size: XS
  • Scope labels: agent
  • Module labels: agent: loop
  • Contributor tier label: N/A
  • If any auto-label is incorrect, note requested correction: N/A

Change Metadata

  • Change type: bug
  • Primary scope: agent

Linked Issue

Validation Evidence (required)

cargo fmt --all -- --check   # pass
cargo check --lib            # pass
cargo test run_tool_call_loop_relays_native_tool_call_text_via_on_delta   # pass
  • Existing test updated to match new trailing-newline behavior.

Security Impact (required)

  • New permissions/capabilities? No
  • New external network calls? No
  • Secrets/tokens handling changed? No
  • File system access scope changed? No

Privacy and Data Hygiene (required)

  • Data-hygiene status: pass
  • Redaction/anonymization notes: N/A
  • Neutral wording confirmation: Yes

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No

Human Verification (required)

  • Verified scenarios: Reviewed the delta accumulation path; narration text without trailing newline now gets one appended before dispatch
  • Edge cases checked: Narration text that already ends with \n (no double newline — guarded by ends_with check); empty display_text (guarded by outer !display_text.is_empty())
  • What was not verified: Live Telegram draft rendering

Side Effects / Blast Radius (required)

  • Affected subsystems/workflows: Draft message rendering in channels that support supports_draft_updates()
  • Potential unintended effects: An extra blank line could appear if the model's narration already ends with \n — mitigated by the ends_with guard
  • Guardrails/monitoring for early detection: Existing test updated to assert trailing newline

Rollback Plan (required)

  • Fast rollback command/path: Revert this single commit
  • Feature flags or config toggles: None
  • Observable failure symptoms: Narration and status lines concatenated without separator in Telegram drafts

Risks and Mitigations

  • Risk: None — the change is a one-line guard adding a newline character.

Narration text from native tool-call providers that doesn't end with
a newline now gets one appended before being dispatched to the draft
updater. This prevents garbled output like "Task started.⏳ count_to"
in Telegram drafts.

Update test to expect trailing newline in relayed narration.

Closes #4348
@theonlyhennygod theonlyhennygod force-pushed the fix/telegram-draft-newline branch from a03f3fe to cb0c880 Compare March 23, 2026 18:38
@theonlyhennygod theonlyhennygod merged commit 0d2b57e into master Mar 23, 2026
18 checks passed
@theonlyhennygod theonlyhennygod deleted the fix/telegram-draft-newline branch March 23, 2026 19:30
webhive pushed a commit to webhive/zeroclaw that referenced this pull request Mar 24, 2026
zeroclaw-labs#4394)

Narration text from native tool-call providers that doesn't end with a newline now gets one appended before dispatch to the draft updater. Prevents garbled output in Telegram drafts.

Closes zeroclaw-labs#4348
whtiehack added a commit to whtiehack/zeroclaw that referenced this pull request Apr 18, 2026
Upstream c70e86c (zeroclaw-labs#5505) appended `.trim()` to strip_think_tags_inline,
which eats the trailing `\n` that Progress events carry (e.g. `"⏳ tool\n"`).
wecom_ws note_progress_update then push_str'es straight into the work log
with no separator, producing stacked progress lines without line breaks.

Fix: after trim_start / trim_end, re-append `\n` if the original post-strip
text ended with one. Behaviour of 0d2b57e (zeroclaw-labs#4394) is restored without
losing the think-tag stripping guarantee.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Telegram draft updates concatenate native tool narration with status lines

1 participant