browser agent session expired, pricing sweep failed mid run
This skill fixes browser agents whose sessions expire mid pricing sweep. Use it when sweeps collect login pages or when building session-aware automation. It is not for scripting forbidden logins; the fix is session health checks, checkpoints, sessionless sources, and permitted re-authentication.
Browser agent session expired, pricing sweep failed mid run
TL;DR
An expired browser session mid sweep means the agent's login or session cookies died and every subsequent page fails. The fix is session health checks before the sweep and re-authentication on expiry, but only where the site permits automation. For pricing sweeps, prefer sources that do not need sessions at all: public pages, feeds, and vendor APIs.
The error
(sweep failed)
browser agent session expired, pricing sweep failed mid run; login page served instead of pricingWhen this helps
- a browser sweep dies on expired sessions
- pricing collection needs logins
- building session-aware automation
- choosing sessionless sources
When it doesn't
- the site forbids automated logins; do not script them, re-source instead
- sessions expire from bot defenses; that is a defense, not a session bug
- the sweep is small; manual sessions suffice
Works with
Any browser automation plus curl. Session behavior is site-side.
Steps
1. Detect session expiry instead of parsing the login page as pricing
def session_alive(html):
t = html.lower()
return "login" not in t[:2000] and "sign in" not in t[:2000]
print("session check ready; login pages fail the check immediately")Expected: A session check. The agent stops the sweep on expiry instead of collecting login pages as data.
2. Checkpoint the sweep before each batch
import json
open("sweep_state.json", "w").write(json.dumps({"done": 40, "total": 200}))
print("checkpointed; resume does not repeat the 40")Expected: A sweep checkpoint. Re-authentication resumes at 41, not at zero.
3. Prefer sessionless pricing sources
curl -s -A "IntelBriefingBot/1.0" "https://YOUR-site/pricing" -o pricing.html -w "HTTP %{http_code}\n"
python3 -c "print("public pricing page:", open("pricing.html").read().find("price") != -1)"Expected: A public page check. Sessionless sources never expire mid sweep.
4. Re-authenticate only where the site permits automation
import json
print("check the site's terms for automated access before scripting any login")
print("where permitted: refresh the session, resume from the checkpoint")Expected: A terms check first. Scripted logins where forbidden are the bigger problem than the expired session.
Other ways people phrase this
browser session expired mid sweep
Detect expiry, checkpoint, resume. Prefer sessionless sources.
pricing sweep login page instead
The sweep collected login pages as data. Session checks prevent that.
session expired automation pricing
Re-authenticate only where permitted. Otherwise re-source.
Why it happens
Browser sessions expire on timers the agent does not control, and sweeps that assume a live session collect login pages once it dies. Health checks catch the expiry, checkpoints make resume cheap, and sessionless sources sidestep the problem class entirely.
Edge cases
- Some sites expire sessions aggressively for automation-like patterns; that is intentional.
- Storing session cookies long-term can violate terms; check first.
- A sweep that needs sessions is fragile by design; budget for re-auth.
- Never share sessions across agents; one expiry then kills many runs.
Provenance
Resolved from the public thread: https://vectle.com/posts/pstHMejOKjWUQe2MPSRrWuVA