#13360: fix: widen slugifySessionKey base from 32 to 41 chars
agents
stale
Cluster:
Session Management Enhancements
## Summary
Fixes #13276
`slugifySessionKey` hardcodes `safe.slice(0, 32)` for the human-readable base of container/workspace slugs. For direct-message session keys like `agent:clawfront:direct:2305705470`, the slugified form is 33 characters — the last digit of the phone number gets truncated.
Widens the base limit from 32 to 41, which fits within Docker's 63-char container-name limit with the default 13-char prefix and 9-char hash suffix (63 − 13 − 9 = 41).
## Changes
- `src/agents/sandbox/shared.ts`: increase `slugifySessionKey` base slice from 32 to 41
## Test plan
- [x] `pnpm lint` — passes
- [x] `pnpm build` — passes
- [x] `pnpm test` — all tests pass (1 pre-existing timezone test failure unrelated)
- [ ] Verify container names for phone-number session keys now preserve full number
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR changes `slugifySessionKey` in `src/agents/sandbox/shared.ts` to widen the human-readable base portion of the sandbox slug from 32 to 41 characters, preventing truncation of certain direct-message session keys (e.g., phone-number suffixes). The slug remains suffixed with an 8-hex SHA1 hash, and downstream sandbox container/workspace naming continues to enforce Docker’s 63-character limit by slicing the full container name in `src/agents/sandbox/docker.ts`.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- The change is a small, localized constant adjustment with no behavioral impact beyond allowing a longer slug base; container names are still capped to 63 characters downstream, and the function already appends a hash to preserve uniqueness.
- No files require special attention.
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#18904: fix(sandbox): restore SHA-1 in slugifySessionKey to preserve worksp...
by steflsd · 2026-02-17
77.8%
#23671: fix(security): use crypto.randomInt for session slug generation
by kevinWangSheng · 2026-02-22
76.8%
#15176: fix(sessions): allow channel-routed session IDs and cross-agent paths
by cathrynlavery · 2026-02-13
74.7%
#16061: fix(sessions): tolerate invalid sessionFile metadata
by haoyifan · 2026-02-14
74.4%
#9598: fix(agents): check base64 string length against 5MB API limit
by BlockBB · 2026-02-05
73.5%
#20336: fix(sessions): resolve transcriptPath using agentId when storePath ...
by Limitless2023 · 2026-02-18
73.3%
#16531: fix(sessions): allow WhatsApp-style identifiers in session IDs (#16...
by robbyczgw-cla · 2026-02-14
73.2%
#23639: fix(agents): stop re-resizing session history images on every turn ...
by yinghaosang · 2026-02-22
73.0%
#15888: fix: store relative session file paths instead of absolute
by devAnon89 · 2026-02-14
72.9%
#19177: fix: use parseAgentSessionKey instead of fragile split pattern
by El-Patronum · 2026-02-17
72.7%