Bug report: posthog code - non-ascii slack task titles break header
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39.9k
- Forks
- 3.4k
- Avg merge
- 7h 27m
- Merged PRs (30d)
- 222
Description
When a task is triggered from Slack with a prompt containing non-ASCII characters, the run fails immediately with Internal error: API Error: Header 'x-posthog-property-task_title' has invalid value: '<the prompt text>'. This was hit with Danish characters (å, æ, ø), e.g. the prompt "har vi nogle logs på bil-fabrikken her de sidste par dage?", but it applies to any non-ASCII title (accents, CJK, emoji, etc.). The task title is set verbatim as the x-posthog-property-task_title HTTP header so the title can be lifted onto the in-sandbox agent's $ai_generation traces, but HTTP header values are ASCII-only (RFC 7230), so the request is rejected before it is sent and the whole task fails. Expected: a task with a non-ASCII title runs normally (the trace tag can be encoded, sanitized, or dropped, but it should never fail the run).
The task title originates from the raw Slack message text in posthog/temporal/ai/slack_app/activities/task_creation.py and is stored unmodified (correct, the DB and UI want the real title). The failure is at the header-construction boundary in the PostHog Code agent-server (configureEnvironment, where x-posthog-property-* properties are attached), which lives in the separate PostHog Code monorepo, not in PostHog/posthog. Same mechanism as the ai_stage property forwarded from products/tasks/backend/models.py.
How to reproduce
- Connect the Slack integration to PostHog Code.
- Send a prompt to the bot containing a non-ASCII character, e.g.
har vi nogle logs på bil-fabrikken her de sidste par dage?(note theå). - The task fails with
Task Failed :x: Internal error: API Error: Header 'x-posthog-property-task_title' has invalid value: '...'.
Workaround for affected users: write the prompt in plain ASCII (e.g. "paa" instead of "på") or in English.
Additional context
From: https://posthoghelp.zendesk.com/agent/tickets/61102 (moved to PostHog: https://us.posthog.com/project/2/support/tickets/63013)
PostHog AI conversation ID: 06590392-0647-4573-a0a9-490acda642cc
Trace ID: 13bb2cb2-e6ca-4115-b4bd-59e15879953f
Debug info
Session replay: https://us.posthog.com/project/sTMFPsFhdP1Ssg/replay/019efbf1-eb46-706a-b19f-6cad75c7e0fd?t=0
EU Cloud, project ID 152609.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with posthog/temporal/ai/slack_app/activities/task_creation.py and products/tasks/backend/models.py to understand how the title and ai_stage are forwarded. Then inspect configureEnvironment in the separate PostHog Code monorepo, where x-posthog-property-* headers are attached. Reproduce with a Slack prompt containing å, and consider the task complete when the run succeeds without an invalid-header error while preserving the stored title.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100