Skip to content

[Bug] Truncated Git event text can end in half a character #850

Done

Description

@dhananjay6561

Summary

truncate in services/api/internal/service/git/router.go cuts by bytes (s[:n]), so when the cut lands inside a multi-byte character the result ends with half a rune. It caps the issue/PR comment and review text sent to Git automations (500 / 2000 / 4000 bytes) and the inbox reason (400 bytes). A long comment with an emoji, accented letter or CJK text near the limit reaches the automation with a broken last character (a U+FFFD once it's JSON-encoded).

Area

API

Steps to reproduce

  1. Link a repo and add an automation on "PR commented" that uses the comment text.
  2. Post a PR comment longer than 2000 bytes where byte 2000 falls inside a multi-byte character, e.g. 1999 as followed by é.
  3. The text the automation receives is the 1999 as plus a trailing �, instead of just the as.

Expected behavior

The text is cut at the last whole character before the limit. automation_consumer.go already does this with strings.ToValidUTF8(s[:n], "").

Activity

  1. pullfrog commented on Dec 2, 2026

    @pullfrog
    Contributor
  2. dhananjay6561 commented on Dec 2, 2026

    @dhananjay6561
    ContributorAuthor

    Fix is up in #851.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions