Skip to content

fix(apple): translate Docker tmpfs-mode mount option - #1537

Merged
skevetter merged 3 commits into
devsy-org:mainfrom
atty303:atty303/apple
Oct 18, 2026
Merged

skevetter merged 3 commits into
devsy-org:mainfrom
atty303:atty303/apple

Conversation

@atty303

@atty303 atty303 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Workspaces using file-mounted or terminal secrets fail to start with the Apple provider. Devsy generates tmpfs-mode for these mounts, but Apple container expects mode and rejects the generated arguments with unknown directive tmpfs-mode.

Translate tmpfs-mode to mode when building tmpfs mount arguments for the Apple provider (workspace mount and additional mounts). Shared Docker/Compose mount config is unchanged; raw runArgs are untouched.

Known limitation: tmpfs-size

tmpfs-size is intentionally not translated. Apple container 1.5.0 parses --mount type=tmpfs,size= below 1 MiB as zero, which removes the cap (apple/container#2340, fix #2341 still open). A Docker-style tmpfs-size= is passed through unchanged so the CLI rejects it instead of silently creating an uncapped mount. Safe size compatibility is left to a separate change. Native size= written by the user passes through as-is.

Validation

  • Unit: go test -race -count=1 ./pkg/driver/apple ./pkg/apple ./pkg/devcontainer ./pkg/devcontainer/config and ./pkg/driver/docker pass; lint clean on the changed code.
  • Opt-in native test (DEVSY_APPLE_E2E=1 go test -count=1 -v -run '^TestTmpfsMountsIntegration$' ./pkg/driver/apple): waits for running state before exec, uses ghcr.io/devsy-org/test-images/base:ubuntu, asserts capacity in bytes, cleans up on failed runs. Native result at the final head: see the PR comment (must be recorded before merge).
  • Workspace startup with file secrets and with terminal secrets on Apple container: see the PR comment (must be recorded before merge).

Summary by CodeRabbit

  • Bug Fixes
    • Improved tmpfs mount handling for Apple containers, including mount size and permission settings. Other mount options are preserved, and unsupported options continue to be cleaned up.
  • Tests
    • Added coverage for tmpfs mount behavior, including an opt-in integration test.

atty303 and others added 2 commits October 17, 2026 16:47
Render structured tmpfs mounts using Apple container's native --tmpfs syntax.
Retain octal modes, exact byte capacities, Docker size suffixes and zero-as-unset
defaults, boolean spellings, and last-option-wins precedence. Reject unsupported
or unrepresentable input rather than dropping restrictions. Explicit runArgs,
other mount types and other providers keep their existing paths.

Validate with Apple unit/race tests, devcontainer/config tests, CI-parity lint,
and a real Apple container 1.5.0 probe for modes, page-exact capacities and write
rejection. A minimal workspace now starts with generated file/terminal secret
mounts and the requested permissions.

The full unit suite is not green in six unchanged packages; focused baseline
runs reproduce two failures. Complete user-configured tmpfs workspace validation
also remains blocked by Apple 1.5.0 rejecting embedded equals in metadata labels.

## Evidence

Apple 1.5.0 rejects tmpfs-mode as an unknown --mount directive. The runtime probe
observes modes 755/700/1770 and tmpfs block counts 1/257 at 4096 bytes per block;
it also checks size suffixes, zero defaults, boolean aliases, duplicate settings
and read-only write rejection. The separate label parser failure reproduces with
-l probe.key=a=b and is outside this fix.

## Transcript

- U1:
    > $dig <private-consumer-wrapper> にapple containerのworkaroundがある。これをprovider側修正としてPRする案
  - A: Read the consumer wrapper and current Apple driver. The wrapper translates Docker tmpfs-mode mount directives into Apple --tmpfs options. Asked whether the provider fix should cover generated secrets mounts, all structured tmpfs mounts, or raw runArgs.

- U2:
    > A or B, apple containerの仕様とdocker仕様の差異が原典で確実ならB
  - Selection: Q1 / B
    > 利用者定義のtmpfsも含め、mode・size・read-onlyの変換まで保証する。対応仕様と検証範囲が広がる。
  - A: Checked Apple container 1.5.0 parser source and Docker primary documentation/implementation. Adopted the conditional B scope after confirming mode, size and read-only representations; selected --tmpfs to avoid Apple --mount size rounding. Asked for the validation scope.

- U3:
    > A
  - Selection: Q2 / A
    > 最小devcontainerで、wrapperなしの起動、mode・size・read-only、secrets用mountを検証する。
  - A: Accepted a public minimal devcontainer validation scope. Proposed preserving structured tmpfs semantics while excluding raw runArgs rewriting, consumer changes, DinD remounts and other providers; limited execution to local changes, validation and PR preparation.

- U4:
    > A
  - Selection: Q3 / A
    > この内容で確定し、実装依頼promptを作る。
  - A: Produced a self-contained implementation request for the agreed scope. No push or PR creation was authorized.

- U5:
    > ジック
  - A: Asked whether the short message meant execution.

- U6:
    > 実行
  - A: Fetched origin and confirmed the current task branch matched main. Applied repository and observability guidance; classified the changed argument conversion as a deterministic local path using existing errors and runtime evidence. Implemented structured tmpfs conversion, Docker byte/suffix and zero-default semantics, explicit input validation and regression/runtime tests. An independent reviewer found true-spelling and duplicate-option differences; fixed them using sequential typed parsing and added unit/runtime cases. Delta review had no actionable findings. Apple unit/race tests, relevant devcontainer/config tests, CI-parity lint and real Apple 1.5.0 probes pass. A minimal isolated workspace with dummy mounted and attached secrets starts; guest tmpfs modes and dummy file presence were checked. User-defined tmpfs metadata still hits an independent Apple label parser error on embedded equals, reproduced directly. The full CLI suite failed six unchanged packages; a baseline source overlay reproduced tunnelserver ignore-policy and Docker image inspection failures, while the other four focused groups passed. Removed all task containers, isolated homes/dummy stores, fixture, binaries and temporary HTTP server; retained local review/test artifacts and the public PR draft. The staged diff exactly matches the reviewed snapshot. No remote writes were performed.

Co-authored-by: Codex <noreply@openai.com>
Keep --mount and translate only Docker's tmpfs-mode= and tmpfs-size= directive
names to Apple's mode= and size=. Preserve values, directive order and unknown
forms so the native CLI owns their interpretation across versions.

Remove host-side value parsing, whole-mount admission checks, --tmpfs lowering
and the added buildRunArgs error return. Keep existing Docker Desktop cleanup,
other mount types and explicit runArgs behavior unchanged.

Apple driver/config race tests and CI-parity lint pass. A real Apple 1.5.0
--mount test verifies generated secret directory permissions, native mode/size,
duplicate size selection and read-only behavior. Fresh independent review has
no actionable findings. Full workspace secret injection was not rerun in this
follow-up; native size rounding and metadata-label limitations remain documented
in the prepared PR text.

## Transcript

- U1:
    > atty303にpush
  - A: Pushed the existing signed tmpfs change to atty303/apple and verified that the remote ref matched d1081e1. No PR was created.

- U2:
    > orcaのenv4 workspaceで起動した。修正が実際に利用されているか確認して
  - A: Read-only inspection matched the selected Orca worktree to its Apple workspace. Host and guest used v0.0.0-atty.4 revision 04d22c4, which includes the original fix; its runargs source blob matched d1081e1. Saved driver path was container, and live tmpfs permissions were 0755 and 0700. No workspace settings were changed.

- U3:
    > この修正が有効でありPRできると判断するか?
  - A: Judged the original secrets-startup fix suitable for a PR with explicit native-label and unrelated full-suite validation limits.

- U4:
    > func (d *appleDriver) buildRunArgs(params *driver.RunImageDevContainerParams) ([]string, error) {
    > errorを追加したのは必須なの?
  - A: Explained that the error return was introduced by added host-side validation rather than required by the original syntax mismatch.

- U5:
    > 解析失敗をerrorにする必要ある? 解析できなかったら変換せずにパスしたほうが元の挙動を維持できてPRとして安全じゃない?
  - A: Agreed that native CLI interpretation is safer than a new Devsy refusal condition. Initially proposed whole-mount pass-through.

- U6:
    > 「解析できないエラー」これが今後containerの更新に対しても常に妥当であることを保証できるか?
  - A: Acknowledged that a local parser cannot classify future CLI input validity and must not become a compatibility gate.

- U7:
    > 修正して
  - A: Started the requested follow-up in the current branch, fetched origin, and reproduced the rejection regression. Removed the public argument-generation error path. A preliminary pass-through implementation and runtime checks were subsequently superseded by the clarified minimal contract.

- U8:
    > 解析できない指定が一つでもあれば ← なんで? 解析できたものだけ変換すればいいだろう?
  - A: Acknowledged that whole-mount gating came from changing the CLI flag. Explored per-directive conversion while retaining the native mount path; that intermediate variant was not committed.

- U9:
    > 最大限container cliに解析を任せ、確実にサポートしていないことがわかる形式を変換するのが目的だ。理解しているか?
  - A: Removed independent value parsing and admission checks. Final implementation maps only exact tmpfs-mode= and tmpfs-size= names to native mode= and size= in structured tmpfs mounts, preserving raw values, order and unknown directives. Native CLI semantics include units, duplicates, malformed values and zero values.

- U10:
    > > --mount から --tmpfs へ切り替える実装
    > 
    > これ必要なの? --mountのままtmpfs指定を変換できないの?
  - A: Confirmed that --mount supports mode and size directly and retained that flag. Restored buildRunArgs and its callers to []string, removed Docker-value emulation, and updated PR text around native parsing ownership and its known size/label limitations.

- U11:
    > それがこちらの意図する最小PRだ
  - A: Final source adds only directive-name translation to the pre-fix production path. Apple/config race tests, CI-parity lint and real Apple 1.5.0 --mount tests pass. Tests cover opaque values, duplicates, unknown directives and input immutability; runtime checks cover secret directory modes, native size/mode, last size selection and read-only writes. Fresh independent review found no actionable issues. Integration resources were cleaned up. The reviewed diff matches the staged snapshot. Existing env4 and installed binaries were not changed; no push or PR creation was performed for this follow-up.

Co-authored-by: Codex <noreply@openai.com>
@netlify

netlify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev ready!

Name Link
🔨 Latest commit 1abe961
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6ad50c40bf1782eef52d5264
😎 Deploy Preview https://deploy-preview-1537--devsydev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit 1abe961
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6ad50c40f7b8f5ab5b7376c4

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T00:46:22.017611Z 12e80be PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e5699baf-fe33-485d-8c76-dda6950f8b4d
📥 Commits

Reviewing files that changed from the base of the PR and between e0fe773 and 12e80be.

📒 Files selected for processing: 3
  • pkg/driver/apple/runargs.go
  • pkg/driver/apple/runargs_integration_test.go
  • pkg/driver/apple/runargs_test.go

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

📝 Walkthrough

The Apple driver now translates tmpfs mode and size options when appending workspace and regular mounts. Unit tests cover conversion and argument preservation. An opt-in integration test checks tmpfs mounts in an Apple container.

Changes: Apple tmpfs mount handling

Layer / File(s) Summary
Mount conversion and unit coverage
pkg/driver/apple/runargs.go, pkg/driver/apple/runargs_test.go
Workspace and regular mounts use a shared path that converts tmpfs-mode= and tmpfs-size= to mode= and size= before cleaning. Unit tests cover conversion, preservation of other options and raw RunArgs, and fallback cleaning.
Container-level tmpfs verification
pkg/driver/apple/runargs_integration_test.go
An opt-in integration test configures five tmpfs mounts and checks mount types, permissions, sizes, writable behavior, and read-only rejection.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: skevetter

Merge Risk: ⚪ Minimal · up to 12e80

This change lets the Apple provider start workspaces that use tmpfs-backed secret mounts. No remaining merge-blocking risk was identified.

Security architecture risk: ⚪ Minimal · up to 12e80

The change preserves mount permission values, option ordering and read-only directives while translating two option names. No material security risk was identified in the reviewed change.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • observed — The changed behavior is restricted to structured tmpfs mounts assembled by the Apple provider. Non-tmpfs mounts bypass option translation, and raw configured RunArgs retain their existing path and ordering.

Trust Boundaries and Controls

  • inferred — Translating the aliases does not establish a new privilege boundary: callers could already supply native mode/size directives or raw mount arguments. The new code preserves requested values rather than granting additional capabilities or substituting more permissive defaults.

Resilience and Maintainability Implications

  • observed — The integration test requires explicit opt-in, uses a timestamp-derived container name, and registers cleanup before launch. Cleanup uses an independent timeout and attempts to stop and remove that named container; it cannot guarantee removal after process termination or container-service failure.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main Apple-provider fix: translating Docker's tmpfs mount option. It names tmpfs-mode, which is a primary part of the change, although it does not mention `tmpfs-size…
Full details: Title check

Explanation

The title clearly describes the main Apple-provider fix: translating Docker's tmpfs mount option. It names tmpfs-mode, which is a primary part of the change, although it does not mention tmpfs-size.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
✨ Simplify code
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mergify

mergify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@skevetter skevetter changed the title fix(apple): translate Docker tmpfs mount option names fix(apple): translate Docker tmpfs-mode mount option Oct 18, 2026
@skevetter

skevetter commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor
  • DEVSY_APPLE_E2E=1 go test -count=1 -v -run '^TestTmpfsMountsIntegration$' ./pkg/driver/apple: PASS (71.8s). Output: /run/secrets 755, /run/devsy/secrets-env 700, /probe-native 700, capacity 1 MiB / 2 MiB in bytes, read-only mount blocks writes. container ls -a afterwards: empty (probe removed).
  • Raw CLI, confirming root cause: --mount type=tmpfs,dst=/s,tmpfs-mode=0755 -> Error: unknown directive tmpfs-mode. tmpfs-size=4096 -> unknown directive tmpfs-size (rejected, not silently uncapped, as intended). size=512k -> container starts with 0-byte capacity reading, matching [Bug]: tmpfs --mount with size under 1 MiB has no size limit apple/container#2340.
  • Real devsy workspace up (provider apple, binary built from this head, isolated DEVSY_HOME, disposable sentinel secrets, image ghcr.io/devsy-org/test-images/base:ubuntu):
    • File secret (--secret NAME,type=mount): workspace started; /run/secrets is tmpfs mode=755; FILE_SECRET is -rw------- vscode and holds the sentinel.
    • Terminal secret (attached secret): workspace started; /run/devsy/secrets-env is tmpfs mode=700; ENV_SECRET is -rw------- vscode; devsy workspace ssh sees the sentinel as an env var.
  • All probe containers, workspaces, secrets and temp homes removed afterwards.

@skevetter

Copy link
Copy Markdown
Contributor

Thanks for this fix!

@skevetter
skevetter merged commit fa86210 into devsy-org:main Oct 18, 2026
111 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants