Skip to content

Script generated with create_file tool fails to mount on first sandbox run #25

Description

@battlev

Summary

When prompted to write and run a Python script using the 'Run Code' flag, the first sandbox run returns error as a result of the code file never being mounted. When prompted to try again, the second sandbox run successfully mounts the file and runs the code. Mounting consistently fails on first attempt. Issue potentially originates from main LibreChat application rather than code interpreter.

Environment

  • Self-hosted from source, commit 3fa1f6c
  • Connected to Librechat deployment on version v0.8.7
  • Mac override, Direct Nsjail sandboxing

Evidence

---------- FAILURE ----------

  • sandbox stdout/stderr
stdout: Empty. Ensure you're writing output explicitly.
stderr: python3: can't open file '/mnt/data/hello_a.py': [Errno 2] No such file or directory
  • LibreChat logs -- generated file is not found nor injected.
 [17:07:28.056] debug  [primeCodeFiles] IN
    file_ids       = 0
    resourceFiles  = 0
    {
      agentId          : "azureOpenAI__gpt-5-mini___OpenAI GPT-5 mini",
      file_ids         : (none),
      resourceFileIds  : (none),                         **<-- EMPTY**
      userId           : "6a19d744157c88d9b9d284b5"
    }

[17:07:28.059] debug  [primeCodeFiles] OUT
    returned          = 0                                **<-- NOTHING PRIMED**
    skippedNoRef      = 0
    reuploadFailures  = 0
    userId            = "6a19d744157c88d9b9d284b5"

[17:07:41.310] warn   [code-env:inject]
    tool              = bash_tool
    _injected_files   = 0                                **<-- NOTHING INJECTED**
    note              = "sandbox will see no input files"
    userId            = "6a19d744157c88d9b9d284b5"

[--:--:--]      —     [BashExecutor]
    session_id        = GDcRdgyj2wpQmp_QRXzbD
    msg               = "No injected files — exec will run without input files"
  • Code Interpreter logs -- file is never downloaded to sandbox.
[13:07:32]  file-server      (info)
    session   = 5g0lb8fYWb4bsBntBpuZr
    fileId    = ZukiBEqngS22RCTLMLEor
    filename  = hello_a.py
    sessKey   = local:user:local-test-user
    msg       = File ID assigned

[13:07:32]  file-server      (info)
    session   = 5g0lb8fYWb4bsBntBpuZr
    filename  = hello_a.py
    msg       = File uploaded successfully

[13:07:32]  sandbox-runner   (level 20)
    job       = sbx_tSlHnXftq7htFTLizQKg7A
    file      = hello_a.py
    id        = ZukiBEqngS22RCTLMLEor
    size      = 103
    msg       = Uploaded file

---------- SUCCESS ----------

  • On subsequent prompt to try again, code run succeeds.

  • LibreChat logs -- file is primed.

[17:10:43.431] debug  [primeCodeFiles] IN
    file_ids       = 0
    resourceFiles  = 1
    {
      agentId          : "azureOpenAI__gpt-5-mini___OpenAI GPT-5 mini",
      file_ids         : (none),
      resourceFileIds  : ["e3d16a8e-ca35-4577-aeef-8c9cf46661ec"],   <-- HAS REF
      userId           : "6a19d744157c88d9b9d284b5"
    }

[17:10:43.526] debug  [primeCodeFiles] FILE
    file              = e3d16a8e-ca35-4577-aeef-8c9cf46661ec
    path              = fresh-active
    storage_session   = SoPknhYryOUtkKkITchqq
    userId            = "6a19d744157c88d9b9d284b5"

[17:10:43.527] debug  [primeCodeFiles] OUT
    returned          = 1                                <-- ONE FILE PRIMED
    skippedNoRef      = 0
    reuploadFailures  = 0
    userId            = "6a19d744157c88d9b9d284b5"

[17:10:48.525] debug  [code-env:inject]
    tool                    = bash_tool
    files                   = 1                          <-- ONE FILE INJECTED
    missingResourceId       = 0
    missingStorageSessionId = 0
    missingVersion          = 1
    kinds                   = { user: 1 }
    userId                  = "6a19d744157c88d9b9d284b5"
  • Code Interpreter logs -- file is downloaded to sandbox.
[13:10:48]  sandbox-runner   (level 30)
    job       = sbx_ebd6u_QebcWtiaVShdTqTQ
    file      = hello_a.py
    hash      = 491174c6
    msg       = Downloaded file     

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions