-
Notifications
You must be signed in to change notification settings - Fork 79
fix(browser): improve automation reliability #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(browser): improve automation reliability #56
Conversation
- 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.
There was a problem hiding this 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.
e31d172 to
5b24cf0
Compare
|
@steipete Ready for review - these work well for me :) |
|
Thanks Alex! Taking over! |
Summary