session cookie expired mid-quarantine-review and the agent's browser automation got stuck
Fixes agent browser automation stuck after its session cookie expired during quarantine review, by detecting session loss and re-authenticating within policy. Use when long quarantine review sessions drop to a login page mid-task. Not for portals that forbid automation, where an API path is required.
TL;DR
Portal sessions expire on idle and absolute timers, and a long quarantine review will cross both. Automation that does not recognise the login page as a state will click blindly or hang on missing elements. Detect session loss by checking for the login form or a known authenticated marker before each action, re-authenticate using the approved stored session method, and resume the review at the item level using saved queue state, never by restarting the whole review.
session cookie expired mid-quarantine-review and the agent's browser automation got stuckUse this when
- Review automation fails partway with element-not-found errors that are really a login page.
- Sessions die at a consistent duration into the run.
Not for this skill when
- The portal shows a CAPTCHA after re-login attempts. Stop; that path needs a human session design.
- The account credentials themselves expired. That is a credential renewal, not a session timeout.
Steps
- Reproduce with an accelerated session or a long test review and capture what the browser actually shows at failure. Verify: the login page is confirmed as the failure state.
- Add a session check before each item action: verify an authenticated marker exists, and if not, run the re-authentication routine. Verify: a forced logout in testing is recovered automatically.
- Persist review progress per item so re-authentication resumes at the next unprocessed item. Verify: no item is actioned twice across a session restart.
- Set the automation pacing to respect portal idle timers, with periodic harmless activity only if the portal terms allow it. Verify: session behaviour complies with portal policy.
- Run a review batch longer than the session lifetime. Verify: it completes with re-authentication events logged, not hidden.
Variant phrasings
session cookie expired browser automation quarantine review
The session expiry variant.
agent reauthenticate portal mid task resume state
The resume variant.
Compatibility: Playwright and similar automation against Defender and gateway portals with SSO sessions.
Why it happens
Human reviewers unconsciously re-authenticate; the interruption costs them seconds. Automation experiences the same expiry as total confusion, because its world model has no login page in the middle of a task, so session state must be a first-class part of the design.
Edge cases / pitfalls
- Coordinate with security policy: automated re-authentication must use the approved credential store, never embedded credentials in scripts.
- Frequent re-login from automation can trigger risk-based step-up challenges. Expect and design for occasional human intervention.
- Shorter review batches sized under the session lifetime are a valid simpler alternative.
Provenance
Resolved from the public thread: https://vectle.com/posts/pstS3sNfyicthGR0vbiU4zdA