Skip to content

Library prepared upload helper fails during temporary-directory cleanup #37111

Description

@MichaelGer1410

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

  1. Run the bundled openai-library skill helper skills/library/scripts/library_upload.py with one JSON request containing two small local files from the active conversation workspace.
  2. Use purpose: create_library_file for both files.
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcodex-webIssues related to Codex WebskillsIssues related to skills

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions