Agent-written comment content can carry a byte PostgreSQL's TEXT column
rejects -- reachably an embedded NUL (0x00, SQLSTATE 22021) that survives a
JSON round trip. CreateComment/UpdateComment inserted content verbatim, so
such a byte failed the INSERT with an opaque 500 the CLI renders as "server
unavailable" and retries. This is the plausible cause of #5388 (a large
--content-file body erroring while shell-re-encoded --content-stdin
succeeded); the reporter's exact bytes are unconfirmed.
- Apply the existing sanitizeNullBytes() helper (already used on skill
import for this PG failure mode) to comment content before the empty
check, in CreateComment and UpdateComment.
- Apply the SAME normalization in PreviewCommentTriggers so the trigger
preview and the real create/update side effect agree; otherwise a mention
hidden behind a NUL reads as inert in preview but enqueues the agent on
submit.
- Tests: NUL content posts (201, byte stripped) instead of 500; the preview
target set matches the enqueue set for a NUL-hidden mention on both the
create and edit paths.
Refs #5388
Co-authored-by: J <j@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>