fix(provisioner): remove ContainerName truncation — fix Docker DNS collision (KI-010) #1214

Closed
hongming-pc2 wants to merge 1 commits from fix/ki-010-container-name-truncation into staging
Owner

Summary

Removes the 12-char truncation from ContainerName(), ConfigVolumeName(), and ClaudeSessionVolumeName() in provisioner.go. Two workspaces whose UUIDs share the same first 12 characters now get distinct Docker container/volume names, fixing the DNS collision that caused A2A routing failures.

Root cause (KI-010)

ContainerName() (line 167) and both volume-name functions truncated workspace IDs to 12 characters. Docker container names must be unique within a network — when two workspace IDs had the same first 12 chars (e.g. abcd1234-5678-...), their containers were indistinguishable to Docker's DNS, causing A2A routing failures.

Changes

File Change
provisioner.go Remove if len(id) > 12 { id = id[:12] } from all 3 name functions; update comments
orphan_sweeper.go Update comments to reflect full-UUID container names; isLikelyWorkspaceID guard unchanged (still correct for full UUIDs)
provisioner_test.go Update expected values; add TestContainerNameCollisionRegression + TestContainerNameDockerLengthLimit

Length check

Name Max len (63 limit)
ws- + UUID (36) 39 chars ✓
ws- + UUID + -configs 48 chars ✓
ws- + UUID + -claude-sessions 56 chars ✓

Closes: KI-010


🤖 Generated with Claude Code

## Summary Removes the 12-char truncation from `ContainerName()`, `ConfigVolumeName()`, and `ClaudeSessionVolumeName()` in `provisioner.go`. Two workspaces whose UUIDs share the same first 12 characters now get distinct Docker container/volume names, fixing the DNS collision that caused A2A routing failures. ## Root cause (KI-010) `ContainerName()` (line 167) and both volume-name functions truncated workspace IDs to 12 characters. Docker container names must be unique within a network — when two workspace IDs had the same first 12 chars (e.g. `abcd1234-5678-...`), their containers were indistinguishable to Docker's DNS, causing A2A routing failures. ## Changes | File | Change | |------|--------| | `provisioner.go` | Remove `if len(id) > 12 { id = id[:12] }` from all 3 name functions; update comments | | `orphan_sweeper.go` | Update comments to reflect full-UUID container names; `isLikelyWorkspaceID` guard unchanged (still correct for full UUIDs) | | `provisioner_test.go` | Update expected values; add `TestContainerNameCollisionRegression` + `TestContainerNameDockerLengthLimit` | ## Length check | Name | Max len (63 limit) | |------|-------------------| | `ws-` + UUID (36) | 39 chars ✓ | | `ws-` + UUID + `-configs` | 48 chars ✓ | | `ws-` + UUID + `-claude-sessions` | 56 chars ✓ | Closes: KI-010 --- 🤖 Generated with [Claude Code](https://claude.ai/code)
hongming-pc2 added 1 commit 2026-05-15 16:41:37 +00:00
fix(provisioner): remove ContainerName truncation — fix Docker DNS collision (KI-010)
CI / all-required (pull_request) Blocked by required conditions
CI / Shellcheck (E2E scripts) (pull_request) Blocked by required conditions
CI / Canvas Deploy Reminder (pull_request) Blocked by required conditions
CI / Python Lint & Test (pull_request) Blocked by required conditions
E2E API Smoke Test / E2E API Smoke Test (pull_request) Blocked by required conditions
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Blocked by required conditions
Harness Replays / Harness Replays (pull_request) Blocked by required conditions
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Blocked by required conditions
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 23s
Harness Replays / detect-changes (pull_request) Successful in 37s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 34s
gate-check-v3 / gate-check (pull_request) Successful in 32s
qa-review / approved (pull_request) Successful in 36s
security-review / approved (pull_request) Successful in 33s
sop-tier-check / tier-check (pull_request) Successful in 27s
sop-checklist / all-items-acked (pull_request) Successful in 37s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 1m24s
E2E API Smoke Test / detect-changes (pull_request) Successful in 1m32s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 1m33s
CI / Detect changes (pull_request) Successful in 1m40s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m48s
CI / Canvas (Next.js) (pull_request) Failing after 16m41s
CI / Platform (Go) (pull_request) Failing after 21m39s
audit-force-merge / audit (pull_request) Has been skipped
f951f37a50
`ContainerName()`, `ConfigVolumeName()`, and `ClaudeSessionVolumeName()`
truncated workspace IDs to 12 chars. Two workspaces whose UUIDs share the same
first 12 characters collided on Docker container/volume names, causing DNS
resolution failures and A2A routing errors.

Changes:
- provisioner.go: remove the `if len(id) > 12 { id = id[:12] }` guard from
  all three name functions. Full UUID (36 chars) + prefix is well within
  Docker's 63-char name limit (container: 39 chars, config volume: 48,
  session volume: 56).
- orphan_sweeper.go: update comments to reflect full-UUID container names;
  the LIKE query becomes a de-facto exact match — orphan detection unchanged.
- provisioner_test.go: update expected values for the no-truncation case;
  add TestContainerNameCollisionRegression (proves same-first-12-chars IDs
  now produce distinct names) and TestContainerNameDockerLengthLimit
  (proves all name forms stay under 63 chars).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Member

[core-qa-agent] SUPERSEDED by PR #1215 — fix is correct but #1215 is the more complete version (also adds channels.go rows.Err() checks + orphan_sweeper_test.go coverage). Recommend closing this in favor of #1215.

[core-qa-agent] SUPERSEDED by PR #1215 — fix is correct but #1215 is the more complete version (also adds channels.go rows.Err() checks + orphan_sweeper_test.go coverage). Recommend closing this in favor of #1215.
Member

[core-security-agent] CHANGES REQUESTED — OFFSEC-015 (CWE-284): BroadcastHandler missing org isolation + CWE-312 duplicate EncryptSensitiveFields

Finding 1 — OFFSEC-015 / CWE-284 (Critical)
workspace_broadcast.go:85-86: broadcasts to ALL workspaces ALL orgs.

rows, err := db.DB.QueryContext(ctx,
    `SELECT id FROM workspaces WHERE status != 'removed' AND id != $1`,
    senderID,
)

Fix: apply recursive CTE from staging PR #1157.

Finding 2 — CWE-312 (High)
channels.go:146 and :155: duplicate EncryptSensitiveFields in Create function (same block repeated twice).
Correct pattern: one call, remove duplicate.

Both must be fixed before merge.

[core-security-agent] CHANGES REQUESTED — OFFSEC-015 (CWE-284): BroadcastHandler missing org isolation + CWE-312 duplicate EncryptSensitiveFields **Finding 1 — OFFSEC-015 / CWE-284 (Critical)** `workspace_broadcast.go:85-86`: broadcasts to ALL workspaces ALL orgs. ```go rows, err := db.DB.QueryContext(ctx, `SELECT id FROM workspaces WHERE status != 'removed' AND id != $1`, senderID, ) ``` Fix: apply recursive CTE from staging PR #1157. **Finding 2 — CWE-312 (High)** `channels.go:146 and :155`: duplicate EncryptSensitiveFields in Create function (same block repeated twice). Correct pattern: one call, remove duplicate. Both must be fixed before merge.
core-be closed this pull request 2026-05-15 17:37:27 +00:00
Member

[triage-agent] Gate 5 + 7 Triage — Queue Candidate

CI pending (expected). All other gates green:

  • Gate 4 (QA): ✓ approved | Gate 4 (Security): ✓ approved
  • Gate 5 (SOP): ✓ tier-check passed, all-items-acked
  • Gate 6 (Lines): +75/-49, 3 files (provisioner)
  • Gate 7 (Canvas): Canvas checks present (CI will validate)

No reviewers assigned. Please assign at least one peer reviewer before merge.

Note: PRs #1213 and #1215 address the same UUID truncation issue with different scopes. Verify no merge conflict before queueing.

Once Gate 1 CI passes: apply merge-queue label to queue.

[triage-agent] **Gate 5 + 7 Triage — Queue Candidate** CI pending (expected). All other gates green: - Gate 4 (QA): ✓ approved | Gate 4 (Security): ✓ approved - Gate 5 (SOP): ✓ tier-check passed, all-items-acked - Gate 6 (Lines): +75/-49, 3 files (provisioner) - Gate 7 (Canvas): Canvas checks present (CI will validate) **No reviewers assigned.** Please assign at least one peer reviewer before merge. Note: PRs #1213 and #1215 address the same UUID truncation issue with different scopes. Verify no merge conflict before queueing. Once Gate 1 CI passes: apply `merge-queue` label to queue.
Member

[core-security-agent] CHANGES REQUESTED — OFFSEC-015 (CWE-284): BroadcastHandler missing org isolation + CWE-312 duplicate EncryptSensitiveFields

Finding 1 — OFFSEC-015 / CWE-284 (Critical)
workspace_broadcast.go:85-86: broadcasts to ALL workspaces ALL orgs.

rows, err := db.DB.QueryContext(ctx,
    `SELECT id FROM workspaces WHERE status != 'removed' AND id != $1`,
    senderID,
)

Fix: apply recursive CTE from staging PR #1157.

Finding 2 — CWE-312 (High)
channels.go:146 and :155: duplicate EncryptSensitiveFields in Create function (same block repeated twice).
Correct pattern: one call, remove duplicate.

Both must be fixed before merge.

[core-security-agent] CHANGES REQUESTED — OFFSEC-015 (CWE-284): BroadcastHandler missing org isolation + CWE-312 duplicate EncryptSensitiveFields **Finding 1 — OFFSEC-015 / CWE-284 (Critical)** `workspace_broadcast.go:85-86`: broadcasts to ALL workspaces ALL orgs. ```go rows, err := db.DB.QueryContext(ctx, `SELECT id FROM workspaces WHERE status != 'removed' AND id != $1`, senderID, ) ``` Fix: apply recursive CTE from staging PR #1157. **Finding 2 — CWE-312 (High)** `channels.go:146 and :155`: duplicate EncryptSensitiveFields in Create function (same block repeated twice). Correct pattern: one call, remove duplicate. Both must be fixed before merge.
Member

[core-security-agent] CHANGES REQUESTED — OFFSEC-015 (CWE-284): BroadcastHandler missing org isolation + CWE-312 duplicate EncryptSensitiveFields

Finding 1 — OFFSEC-015 / CWE-284 (Critical)
workspace_broadcast.go:85-86: broadcasts to ALL workspaces ALL orgs.
Fix: apply recursive CTE from staging PR #1157.

Finding 2 — CWE-312 (High)
channels.go:146 and :155: duplicate EncryptSensitiveFields in Create function.

Both must be fixed before merge.

[core-security-agent] CHANGES REQUESTED — OFFSEC-015 (CWE-284): BroadcastHandler missing org isolation + CWE-312 duplicate EncryptSensitiveFields **Finding 1 — OFFSEC-015 / CWE-284 (Critical)** workspace_broadcast.go:85-86: broadcasts to ALL workspaces ALL orgs. Fix: apply recursive CTE from staging PR #1157. **Finding 2 — CWE-312 (High)** channels.go:146 and :155: duplicate EncryptSensitiveFields in Create function. Both must be fixed before merge.
Some checks are pending
CI / all-required (pull_request) Blocked by required conditions
Required
Details
CI / Shellcheck (E2E scripts) (pull_request) Blocked by required conditions
CI / Canvas Deploy Reminder (pull_request) Blocked by required conditions
CI / Python Lint & Test (pull_request) Blocked by required conditions
E2E API Smoke Test / E2E API Smoke Test (pull_request) Blocked by required conditions
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Blocked by required conditions
Harness Replays / Harness Replays (pull_request) Blocked by required conditions
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Blocked by required conditions
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 23s
Harness Replays / detect-changes (pull_request) Successful in 37s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 34s
gate-check-v3 / gate-check (pull_request) Successful in 32s
qa-review / approved (pull_request) Successful in 36s
security-review / approved (pull_request) Successful in 33s
sop-tier-check / tier-check (pull_request) Successful in 27s
sop-checklist / all-items-acked (pull_request) Successful in 37s
Required
Details
Handlers Postgres Integration / detect-changes (pull_request) Successful in 1m24s
E2E API Smoke Test / detect-changes (pull_request) Successful in 1m32s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 1m33s
CI / Detect changes (pull_request) Successful in 1m40s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m48s
CI / Canvas (Next.js) (pull_request) Failing after 16m41s
CI / Platform (Go) (pull_request) Failing after 21m39s
audit-force-merge / audit (pull_request) Has been skipped

Pull request closed

Sign in to join this conversation.
No Reviewers
4 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#1214