Skip to content

Instantly share code, notes, and snippets.

@tmcpro
Created March 21, 2025 14:17
Show Gist options
  • Save tmcpro/319ecbff2b1758c09bf6458710d4cc17 to your computer and use it in GitHub Desktop.
Save tmcpro/319ecbff2b1758c09bf6458710d4cc17 to your computer and use it in GitHub Desktop.
Automatically clear the ChatGPT Operator alerts/"mark safe and resume" to keep the agent running
/*
Paste this into your Google Console, you may need to type `allow paste` to enable it
The goal of this script is to automatically clear the alert on ChatGPT Operator that
often pops up saying its getting conflicting instructions from the page.
*/
// Auto-click "Mark safe and resume" button whenever it appears
(function() {
console.log("🟢 Auto Resume Script activated - watching for 'Mark safe and resume' buttons");
// Function to find and click the button
function clickResumeButton() {
// Look for buttons containing "Mark safe and resume" text
const buttons = Array.from(document.querySelectorAll('button'));
const resumeButton = buttons.find(button =>
button.textContent &&
button.textContent.includes('Mark safe and resume')
);
if (resumeButton) {
console.log("🟢 Found 'Mark safe and resume' button - clicking it");
resumeButton.click();
return true;
}
return false;
}
// Try immediately in case the button is already on the page
clickResumeButton();
// Set up a MutationObserver to watch for changes in the DOM
const observer = new MutationObserver((mutations) => {
if (clickResumeButton()) {
console.log("🟢 Successfully clicked the resume button");
}
});
// Start observing the document with the configured parameters
observer.observe(document.body, {
childList: true,
subtree: true
});
// Return the observer so it can be stopped if needed
return observer;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment