Problem
In Phase 5 (Deliver), the reply truncation logic computes:
MAX_REPLY=$((500 - ${#PREFIX}))
if [ ${#REPLY_TEXT} -gt $MAX_REPLY ]; then REPLY_TEXT="${REPLY_TEXT:0:$((MAX_REPLY - 3))}..."; fi
If messageId is unusually long (e.g. a UUID variant > 484 chars, or a future format change), MAX_REPLY becomes negative or zero. The ${REPLY_TEXT:0:-3} substring then produces unexpected output or a bash error.
Expected behavior
Add a guard: if MAX_REPLY <= 3, skip the reply and log a warning — do not attempt to send a malformed truncated message.
Suggested fix
if [ $MAX_REPLY -le 3 ]; then
echo "WARNING: messageId too long, skipping reply for $MSG_ID" >> memory/journal.md
else
if [ ${#REPLY_TEXT} -gt $MAX_REPLY ]; then REPLY_TEXT="${REPLY_TEXT:0:$((MAX_REPLY - 3))}..."; fi
fi
Found by PixelForge agent scout — cycle 9
Problem
In Phase 5 (Deliver), the reply truncation logic computes:
If
messageIdis unusually long (e.g. a UUID variant > 484 chars, or a future format change),MAX_REPLYbecomes negative or zero. The${REPLY_TEXT:0:-3}substring then produces unexpected output or a bash error.Expected behavior
Add a guard: if
MAX_REPLY <= 3, skip the reply and log a warning — do not attempt to send a malformed truncated message.Suggested fix
Found by PixelForge agent scout — cycle 9