Bound Apple container identifiers to 64 characters - #1237
Conversation
Default identity-scoped sandbox names plus session UUIDs exceed Apple Container's 64-character identifier limit, and stale-name generation suffixes can make them longer still. Generate deterministic bounded Apple-only names with hashed components, reserve room for generation suffixes, keep cleanup discovery aligned, and expose the active runtime name for diagnostics without changing Docker naming.
Greptile SummaryThe PR bounds Apple Container identifiers to 64 characters while preserving stable naming, stale-container generations, management discovery, and backend-aware diagnostics.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| crates/tools/src/sandbox/container_name.rs | Defines stable bounded Apple container names and delimiter-aware compact-prefix matching, including maximum-generation coverage. |
| crates/tools/src/sandbox/apple.rs | Uses the bounded naming helper consistently for container creation, generation rotation, runtime reporting, and session cleanup. |
| crates/tools/src/sandbox/containers.rs | Extends Apple container discovery and cleanup to recognize compact runtime prefixes while preserving Docker naming behavior. |
| crates/web/src/container_management.rs | Accepts compact Apple runtime names during management authorization, resolving the previously reported rejection. |
| crates/swift-bridge/src/ffi_sandbox.rs | Aligns Swift stop and remove authorization with compact Apple container naming. |
| crates/chat/src/service/chat_impl.rs | Resolves backend metadata and runtime container name from one effective session backend, resolving the previously inconsistent response pair. |
| crates/tools/src/sandbox/router.rs | Delegates runtime metadata through failover and session backend routing so backend names remain paired with their runtime resource names. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Configured prefix and session key] --> B[Normalize components]
B --> C[Compact long values with stable digest]
C --> D[Reserve generation suffix space]
D --> E[Apple identifier at most 64 characters]
E --> F[Create and report runtime container]
E --> G[List, stop, remove, and clean by matching prefix]
Reviews (3): Last reviewed commit: "test(sandbox): cover management prefix f..." | Re-trigger Greptile
Merging this PR will degrade performance by 10.32%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | session_history_path[default] |
6.2 µs | 6.9 µs | -10.32% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing fix/apple-container-name-limit (d6130ea) with main (fc65e52)
Footnotes
-
9 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Allow Web and Swift management authorization to recognize deterministic Apple prefixes, and resolve the session backend once so diagnostics pair its runtime name with the correct backend label.
The compact-prefix matcher is covered in the sandbox naming module; keeping the duplicate Web assertion pushed api.rs over the enforced 1,500-line limit.
Container management reloaded the raw configured prefix even though gateway startup replaces it with an identity-scoped runtime prefix, so generated Apple containers could not be listed or managed. Read the immutable router prefix in web and Swift paths, with an identity-derived fallback before the embedded gateway starts.\n\nFailover diagnostics also read runtime name and backend state separately. Capture both from one selected backend so chat.context cannot report a container from one backend with another backend's label.
|
@greptile review |
Exercise the configured-prefix fallback, duplicate-prefix branch, and identity-scoped gateway helper so the runtime management paths remain covered on Linux CI.
|
@greptile review |
Bring in moltis-org#1237 Apple container ID bounds and moltis-org#1243 cron channel context while keeping fork-only xAI OAuth and audit remediations.
After merging moltis-org#1237, name length is handled by apple_container_name(). Drop the fork-only "ms" default to reduce drift from upstream.
After merging moltis-org#1237, name length is handled by apple_container_name(). Drop the fork-only "ms" default to reduce drift from upstream.
Summary
flowchart LR A[Instance prefix + session key] --> B[Normalize components] B --> C[Bound prefix and key with stable digest] C --> D[Reserve generation suffix] D --> E[Apple container ID at most 64 chars] E --> F[Create, report, and clean same ID]Closes #1137
Validation
Completed
cargo test -p moltis-tools container_namecargo test -p moltis-tools apple_container_names_fit_runtime_limitcargo check -p moltis-chatjust release-preflight./scripts/local-validate.sh 1237Remaining
Manual QA
tools.exec.sandbox.backend = "apple-container"with the default Moltis identity.