Skip to content

Wire SANDCASTLE_CONTAINER_UID/GID env vars through to SandboxRunner#108

Merged
lsfera merged 1 commit into
mainfrom
fix/sandcastle-container-uid-gid-env
Jul 6, 2026
Merged

Wire SANDCASTLE_CONTAINER_UID/GID env vars through to SandboxRunner#108
lsfera merged 1 commit into
mainfrom
fix/sandcastle-container-uid-gid-env

Conversation

@lsfera

@lsfera lsfera commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • sandbox-runner.ts already validates a built inner image's UID/GID against RunnerOptions.containerUid/containerGid (defaulting to 1000), but main.ts never populated those fields from the environment — only SANDCASTLE_IMAGE was wired through.
  • Any custom base image whose non-root user isn't uid/gid 1000 (e.g. the dotnet SDK base image's app user at 1654, used by Dockerfile.dotnet) hit a hard WorktreeError: UID mismatch with no way to override it short of editing main.ts itself.
  • Adds SANDCASTLE_CONTAINER_UID/SANDCASTLE_CONTAINER_GID env vars, mirroring the existing SANDCASTLE_IMAGE pattern, and documents them in the module docstring.
  • Updates examples/dotnet-project/orchestrator.env to set both to 1654 so that recipe actually works end-to-end.

Found while running issue #4 (live end-to-end /afk validation) in .scratch/dotnet-afk-support/ — all 3 retries failed identically before this fix.

Test plan

  • npm run typecheck clean
  • npm test — 229/229 passing
  • Re-run the live /afk validation against lsfera/dotnet-afk-proof with the new env vars set, confirm the UID-mismatch error is gone

sandbox-runner.ts already validates a built image's UID/GID against
RunnerOptions.containerUid/containerGid (default 1000), but main.ts never
set them from env — only SANDCASTLE_IMAGE was wired. Any custom base image
with a non-1000 non-root user (e.g. the dotnet SDK base's uid 1654) hit a
hard UID-mismatch failure with no way to override it short of editing
main.ts directly.

Discovered via the live dotnet-recipe validation run (issue #4): all 3
retries failed with the same WorktreeError before this fix.
@lsfera lsfera merged commit 59618a3 into main Jul 6, 2026
3 checks passed
@lsfera lsfera deleted the fix/sandcastle-container-uid-gid-env branch July 6, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant