Skip to content

fix(chatgpt): fall back to DOM upload when setFileInput times out - #2457

Open
mnm-matin wants to merge 1 commit into
jackwener:mainfrom
mnm-matin:fix/chatgpt-filechooser-fallback
Open

mnm-matin wants to merge 1 commit into
jackwener:mainfrom
mnm-matin:fix/chatgpt-filechooser-fallback

Conversation

@mnm-matin

Copy link
Copy Markdown

Problem

Uploading a reference image in ChatGPT could fail with:

Page.fileChooserOpened not received within 5s — the input may not have opened a file chooser

When the file input exists but no native chooser opens, page.setFileInput throws this timeout and the error was rethrown before the existing DOM DataTransfer fallback could run, so the reference image was never attached.

Change

Treat the fileChooserOpened timeout like the other already-handled setFileInput failures (Unknown action, not supported, Not allowed, No element found) in both:

  • uploadChatGPTImages (image/reference-image upload)
  • uploadChatGPTProjectFiles (project file upload)

This lets the adapter fall through to the DOM upload path that injects the file via new DataTransfer() instead of surfacing the timeout as a hard failure.

Test

Adds a regression test that rejects setFileInput with the fileChooserOpened timeout and asserts the DOM DataTransfer fallback runs and the upload reports success.

npx vitest run --project adapter clis/chatgpt/utils.test.js
Test Files  1 passed (1)
Tests      120 passed (120)

ChatGPT reference-image uploads could fail with 'Page.fileChooserOpened not received within 5s' when the file input is present but no native chooser opens. Treat that timeout like the other setFileInput fallbacks and let the DOM DataTransfer path run instead of rethrowing.

This branch has not been deployed

No deployments
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