fix(sandbox): sanitize @ in container names for WhatsApp LID chat IDs (#1031)

WhatsApp LID-format chat IDs contain @ (e.g. 551152861098:5@s.whatsapp.net)
which is invalid in Docker container names, causing sandbox creation to fail
for any WhatsApp-triggered agent session.

Add @ to the sanitizeKey replacer alongside the existing : / . and space
characters. Adds a test case with a realistic WhatsApp LID key.

Fixes #1029

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrique GoncalvesandClaude Opus 4.6 authored and GitHub committed 2026-06-27 02:25:36 +07:00
1 parent e6ab6838cb
commit 23ddc0858c
2 files changed
+2

No files matched your search

+1
View File
@@ -454,6 +454,7 @@ func sanitizeKey(key string) string {
"/", "-",
" ", "-",
".", "-",
"@", "-",
).Replace(key)
if len(safe) > 50 {
+1
View File
@@ -97,6 +97,7 @@ func TestSanitizeKey(t *testing.T) {
{"simple", "simple"},
{"has/slash", "has-slash"},
{"has space", "has-space"},
{"agent:chloe:whatsapp:551152861098:5@s.whatsapp.net", "agent-chloe-whatsapp-551152861098-5-s-whatsapp-net"},
{strings.Repeat("x", 100), strings.Repeat("x", 50)},
}
for _, tc := range tests {