Skip to content

Conversation

@TheCrazyLex
Copy link
Contributor

Summary

  • fix(browser): erroneous attachment removal clicks
  • fix(browser): prevent Pro mode getting disabled by thinking time select
  • fix(browser): wait for send button ready before treating upload done
  • fix(browser): resolve locale issues by forcing en

- Sometimes ChatGPT uses the system-specific language
-> But the page-component matching logic is built for English
- So: We force English via chrome flags now
Previously, attachment upload was considered complete when:
1. Expected files were detected in UI/input
2. Stability threshold passed (1.5s)
3. Button was disabled but spinner wasn't detected

This caused false positives.

Now, we only consider upload complete when the send button is actually
enabled ('ready' state). This is more reliable since ChatGPT always
disables the button during upload and enables it when done.

This aligns the implementation with docs/browser-mode.md which already
documented the correct behavior: "wait for ChatGPT to re-enable the
send button before submitting".

Impact: Most noticeable with larger files or slower connections where
upload takes longer than the 1.5s stability threshold.
The composite pill button has two interactive elements: a toggle button
(no aria-haspopup) and a dropdown trigger (aria-haspopup="menu"). Previously,
clicking the toggle button would disable Pro mode.
Now we skip buttons without
aria-haspopup="menu" to ensure we only click the dropdown trigger.
Copilot AI review requested due to automatic review settings December 31, 2025 04:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the reliability of browser automation by addressing four key issues: preventing erroneous attachment removal clicks, protecting Pro mode from being inadvertently disabled, ensuring uploads complete before sending, and resolving locale-related inconsistencies.

Key Changes

  • Modified attachment completion logic to only treat send button state as ready when explicitly enabled, not when disabled
  • Added locale enforcement flags to Chrome to ensure consistent English UI
  • Updated thinking time selector to skip toggle buttons and only interact with dropdown triggers

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/browser/attachmentsCompletion.test.ts Updated test to verify that disabled send button now causes timeout instead of resolving
src/browser/chromeLifecycle.ts Added --lang=en-US and --accept-lang=en-US,en flags to force English locale
src/browser/actions/thinkingTime.ts Added check to skip buttons without aria-haspopup="menu" to prevent disabling Pro mode
src/browser/actions/attachments.ts Refined attachment removal selectors, added form submission prevention logic, and removed disabled button from completion criteria

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Restrict clearComposerAttachments to "Remove" file buttons
and force type=button to prevent form submission.

This resolves cases where we would accidentally reset the chosen
model to a non-Pro one.
@adesso-alex adesso-alex force-pushed the fix/browser-automation-fixes branch from e31d172 to 5b24cf0 Compare December 31, 2025 04:08
@TheCrazyLex
Copy link
Contributor Author

@steipete Ready for review - these work well for me :)

@steipete
Copy link
Owner

Thanks Alex! Taking over!

@steipete steipete merged commit 65a5473 into steipete:main Dec 31, 2025
4 checks passed
@TheCrazyLex TheCrazyLex deleted the fix/browser-automation-fixes branch December 31, 2025 14:31
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.

2 participants