Skip to content

fix(task-bridge): lift conversation.log line cap from 200 → 2000 chars - #609

Merged
sonichi merged 1 commit into
mainfrom
fix/conversation-log-200-char-cap
May 5, 2026
Merged

sonichi merged 1 commit into
mainfrom
fix/conversation-log-200-char-cap

Conversation

@liususan091219

Copy link
Copy Markdown
Collaborator

Why

Per Susan 2026-05-05: voice transcripts in conversation.log were getting truncated mid-sentence. The 200-char slice() cap was aggressive — visible especially with longer user turns and CJK text where each char can cost 2-4 bytes at the layer above. Made the log unreadable for normal-length user/assistant exchanges.

What changes

src/task-bridge.ts — bump the slice cap from 200 → 2000.

  • Matches Discord's per-message limit, so a single log line can never exceed what could legitimately appear elsewhere in the conversation surface.
  • Tunable via SUTANDO_LOG_LINE_MAX_CHARS env override.
  • Both call sites updated (logConversation() and the [task:N] summary log).

Test plan

  • npx tsc --noEmit — clean
  • (manual) After voice-agent picks up the new code, observe conversation.log for a longer user turn (>200 chars) and verify it's not truncated. Re-truncation visible if env override is set.

🤖 Generated with Claude Code

Per Susan 2026-05-05: voice transcripts in conversation.log were getting
truncated mid-sentence — visible especially with longer turns and CJK text
where each char can be multi-byte at the layer above. The 200-char cap was
aggressive and made the log unreadable for normal-length user/assistant
exchanges.

Bump to 2000 (matches Discord's per-message limit, so a single log line
never exceeds what could legitimately appear in the conversation surface).
Both call sites updated. Tunable via SUTANDO_LOG_LINE_MAX_CHARS env if a
host wants tighter logs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@sonichi sonichi left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (commenting since GH won't approve sonichi PRs… but this is liususan091219; commenting anyway because Mini-bot doesn't have approve rights either).

Verified:

  • Both 200-char call sites updated (line 238 logConversation, line 553 [task:N] summary). No other slice(0, 200) in task-bridge.ts. ✓
  • LOG_LINE_MAX_CHARS = Number(process.env.SUTANDO_LOG_LINE_MAX_CHARS) || 2000 — Number(undefined) → NaN → falsy → falls through to 2000. Number("0") → 0 → falsy → 2000. The latter is a minor footgun if a host explicitly wants 0 to disable, but probably fine — env override at 0 isn't a real use case.
  • conversation.log on this Mini is 105KB after ~3 days, append-only, no rotation. 10x cap → maybe 1MB after similar period. No concern.
  • CJK rationale checks out — JS slice operates on UTF-16 code units; 200 of those is ~30 English words, ~30-50 CJK characters at most. Frequent mid-sentence cuts. 2000 is the right neighborhood.

Gate check (community PR per repo norm):

  • Import strategy: no new imports ✓
  • Defaults: 2000 matches Discord per-message limit; env-tunable down for tighter hosts ✓
  • Bind-address: N/A ✓

One non-blocker observation: log rotation is the missing piece — conversation.log is unbounded. Not in scope here, but if growth ever becomes a concern (e.g. after a long voice session), a tail -n N rotation policy or daily-bucket files would close that out. Today's file size makes it a future-not-now problem.

Approve. Recommend merging via gh pr merge --squash (no --delete-branch per repo norm).

@sonichi
sonichi merged commit e4fa79d into main May 5, 2026
1 check passed
@sonichi
sonichi deleted the fix/conversation-log-200-char-cap branch May 5, 2026 23:28
liususan091219 added a commit to liususan091219/sutando-fork that referenced this pull request May 28, 2026
sonichi#609)

Per Susan 2026-05-05: voice transcripts in conversation.log were getting
truncated mid-sentence — visible especially with longer turns and CJK text
where each char can be multi-byte at the layer above. The 200-char cap was
aggressive and made the log unreadable for normal-length user/assistant
exchanges.

Bump to 2000 (matches Discord's per-message limit, so a single log line
never exceeds what could legitimately appear in the conversation surface).
Both call sites updated. Tunable via SUTANDO_LOG_LINE_MAX_CHARS env if a
host wants tighter logs.

Co-authored-by: Xueqing Liu <xueqingliu@Xueqings-Mac-Studio.local>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants