Skip to content

Allow GPU access inside sandbox #3141

Open

Description

@enolan

What feature would you like to see?

Currently the sandbox breaks access to nvidia gpus on Linux:

enolan@chonk ~> nvidia-smi
Wed Sep  3 23:07:27 2025       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 570.153.02             Driver Version: 570.153.02     CUDA Version: 12.8     |
|-----------------------------------------+------------------------+----------------------+
[snip]
enolan@chonk ~> ~/.npm-global/bin/codex debug landlock nvidia-smi
Failed to initialize NVML: Unknown Error

There should be a way to allow Codex to use GPUs without completely disabling the sandbox. I want it to be able to run tests for my ML projects. Or it should be allowed by default maybe. But that's a lot of attack surface.

Are you interested in implementing this feature?

No

Additional information

No response

Activity

  1. added
    enhancement
    on Sep 4, 2025
  2. L1aoXingyu commented on Sep 11, 2025

    @L1aoXingyu

    met the same issue

  3. davidstap commented on Sep 17, 2025

    @davidstap

    I'm also interested in this.

  4. nallana commented on Sep 22, 2025

    @nallana

    +1

  5. L1aoXingyu commented on Sep 23, 2025

    @L1aoXingyu

    i found when i pass --dangerously-bypass-approvals-and-sandbox, it can use GPU in docker.

  6. ShangAlex commented on Sep 30, 2025

    @ShangAlex

    +1

  7. annawoodard commented on Oct 13, 2025

    @annawoodard

    same issue for me but --dangerously-bypass-approvals-and-sandbox (thanks @L1aoXingyu) works on campus HPC cluster

  8. Hemistone commented on Oct 15, 2025

    @Hemistone

    +1

  9. devjj commented on Oct 24, 2025

    @devjj

    +1

  10. CedricHwong commented on Nov 8, 2025

    @CedricHwong

    @L1aoXingyu Thanks!

  11. Jadiker commented on Nov 11, 2025

    @Jadiker

    Similar issue on Windows and WSL using the VSCode extension. I'm not a security expert so it's not clear to me why it can't access GPU resources without being in "full access" mode. I still want to limit its access to files on my computer, as I have sensitive data, but I want it to be able to autonomously run ML experiments using my local GPU.

    (One especially confusing aspect is the fact that in non-full-access mode, it can successfully run nvidia-smi and see that the GPU device exists, but torch.cuda.is_available() == False.)

  12. glennmatlin commented on Nov 12, 2025

    @glennmatlin

    i found when i pass --dangerously-bypass-approvals-and-sandbox, it can use GPU in docker.

    Dangerous bypass should not be required for GPU access -- ideally a flag should be used when calling just like how websearch has one.

  13. haimat commented on Nov 14, 2025

    @haimat

    I hit the same issue and agree - it should be possible to allow GPU access while still restrict other access.

  14. HenryQUQ commented on Nov 14, 2025

    @HenryQUQ

    Totally agree. Should have a command maybe called "enable_GPUs"

  15. Infinity12306 commented on Nov 17, 2025

    @Infinity12306

    really need this feature!!!!

  16. 16 remaining items

  17. added a commit that references this issue on Feb 14, 2026
  18. johnnoren commented on Mar 1, 2026

    @johnnoren

    For me "/dev" workaround was fine for one project, but in another torch didn't see the card.

    The fix for me was upgrading the nvidia drivers, giving codex write permission to the uv cache dir and then having codex run code through uv, in addition to the "/dev" workaround.

  19. milianks commented on Mar 17, 2026

    @milianks

    i found when i pass --dangerously-bypass-approvals-and-sandbox, it can use GPU in docker.
    thanks,but it is very dangerous

  20. TheReaperJay commented on Mar 31, 2026

    @TheReaperJay

    Still an issue on the latest versions. I will see if there is a way to patch this and then submit a PR, as it seems silly to me that hardware pass-through should require dangerously escalating permissions elsewhere.

  21. WillerZ commented on Apr 13, 2026

    @WillerZ

    This works, and I feel better about it than allowing all of /dev. It seems to me that it might be impossible to scope the sandbox hole any smaller than this:

    [sandbox_workspace_write]
    writable_roots = [ "/dev/nvidia", "/dev/dri" ]
    
  22. milianks commented on Apr 13, 2026

    @milianks
  23. johnolusetire commented on Apr 25, 2026

    @johnolusetire

    Any safe solutions if you are working on a hpc cluster? I don't think i should be giving codex writable permissions to the /dev dir (it probably would get denied)

  24. WillerZ commented on May 1, 2026

    @WillerZ

    After the latest update it causes a sandbox error to have the config I proposed earlier:

    [sandbox_workspace_write]
    writable_roots = [ "/dev/nvidia", "/dev/dri" ]
    
  25. Shercoolcool commented on May 7, 2026

    @Shercoolcool

    really need this feature

  26. jabowery commented on Jun 10, 2026

    @jabowery

    The inability to allow GPU access within the sandbox is a very strange state of affairs. Does anyone have an explanation other than Ernestine's response to customers: "We don't care. We don't have to. We're The Phone Company."?

  27. mysteryx93 commented on Sep 24, 2026

    @mysteryx93

    Just so you know, Grok Code has no issue working with the GPU.

  28. TheReaperJay commented on Sep 24, 2026

    @TheReaperJay

    @mysteryx93 but did they fix the bug where they were uploading your entire project folder to their servers, inclusive of secrets and .env?

  29. mysteryx93 commented on Sep 25, 2026

    @mysteryx93

    @mysteryx93 but did they fix the bug where they were uploading your entire project folder to their servers, inclusive of secrets and .env?

    They turned the feature off

  30. diogovalada commented on Sep 27, 2026

    @diogovalada

    I found another layer to this with the network proxy enabled: with the NVIDIA devices exposed, CUDA still needed abstract Unix sockets during initialization. Enabling dangerously_allow_all_unix_sockets in the GPU profile got a small CUDA allocation/copy test working. Details: #16910 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementsandbox

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions