From 23ddc0858c642c4a06dc51c8e1f08c1d5c9fdba7 Mon Sep 17 00:00:00 2001 From: Henrique Goncalves Date: Fri, 26 Jun 2026 16:25:36 -0300 Subject: [PATCH] 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) --- internal/sandbox/docker.go | 1 + internal/sandbox/docker_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/internal/sandbox/docker.go b/internal/sandbox/docker.go index 345d79a3..044b88c0 100644 --- a/internal/sandbox/docker.go +++ b/internal/sandbox/docker.go @@ -454,6 +454,7 @@ func sanitizeKey(key string) string { "/", "-", " ", "-", ".", "-", + "@", "-", ).Replace(key) if len(safe) > 50 { diff --git a/internal/sandbox/docker_test.go b/internal/sandbox/docker_test.go index 7efe5678..d790bd88 100644 --- a/internal/sandbox/docker_test.go +++ b/internal/sandbox/docker_test.go @@ -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 {