Library prepared upload helper fails during temporary-directory cleanup
Summary
A ChatGPT Work/Codex Library upload using the bundled prepared-upload helper fails with FileNotFoundError for its own temporary state directory. The failure occurs after the upload workflow has started, leaving the final Library write status uncertain and preventing a safe retry because duplicate Library items may be created.
Reproduction
- Run the bundled
openai-libraryskill helperskills/library/scripts/library_upload.pywith one JSON request containing two small local files from the active conversation workspace. - Use
purpose: create_library_filefor both files. - Let the helper perform preparation, transfer, finalization, and metadata writeback.
The helper exits with status 1 and reports:
library upload failed: [Errno 2] No such file or directory: '/tmp/openai-library-upload-<random>'
The relevant workflow creates this directory with tempfile.TemporaryDirectory(prefix="openai-library-upload-", dir=Path("/tmp")). The exception is surfaced by the helper's top-level OSError handler. No ordered result payload is returned, and no Library identity xattrs were present on the original local files afterward.
Expected behavior
The helper should return a definitive ordered result for every file. Temporary-directory cleanup must not turn an otherwise completed or partially completed operation into an unknown outcome. If cleanup discovers the directory is already absent, it should either tolerate that condition or preserve the confirmed finalization result.
Actual behavior
The helper exits with FileNotFoundError for its own /tmp/openai-library-upload-* directory. Because the error occurs after the workflow starts, the caller cannot safely retry or switch to direct Library writes without risking duplicates.
Environment
- Surface: ChatGPT Work / Codex
- OS/runtime: managed Linux workspace
- Library skill package:
openai-library/0.1.41 - Files: two small YAML files (approximately 56 KB and 80 KB)
- Batch mode: prepared upload helper, both files in one request
Suggested fix
- Make temporary state cleanup robust to a missing state directory.
- Ensure the helper emits the definitive finalization result before non-critical cleanup.
- If finalization is uncertain, return a structured per-item unknown-state result or a recovery identifier so callers can verify without creating duplicates.
1 Comment
Additional user impact: paid credit consumption
This bug has a direct billing/usage impact. Diagnosing the failure, verifying the uncertain upload state, and retrying the product-owned upload workflow require additional Codex turns and tool calls, which consume the user's included or purchased credits even though the extra usage exists only because of the confirmed product bug.
Please treat this as more than a workflow inconvenience:
The affected user is a paying customer and explicitly disputes being charged for usage caused by this bug. No account identifiers or private file contents are included here; any credit adjustment necessarily requires private review by OpenAI Support.