# Stop paying for browser sessions you forgot to close

> Every evening, find the cloud browsers left running by crashed or half-finished jobs, shut them down, and post the count to Slack.

- Workflow type: code
- Services: Kernel, Google Sheets, Slack
- Categories: Engineering, Operations
- Published: 2026-08-07

## What it does

- Checks your Kernel account every evening for browser sessions that are still running
- Closes any session that has been open longer than your chosen cutoff, which starts at one hour
- Records every session it closed in a Google Sheet, so you can spot the job that leaks one every single night
- Posts a short Slack update with three numbers: still running, reclaimed, and total checked, even when nothing needed closing

## What you'll need

- A Kernel account where your browser automations run
- A Google account and a spreadsheet to use as the audit log
- A Slack workspace and a channel for the nightly update

## Prompt

Every day at 6pm, on a cron trigger, sweep my Kernel account for browser sessions that were left running and reclaim them before they cost me money and block new work. This is a fully deterministic workflow: list, filter by age, delete, log, format, post. There is no judgement step anywhere, so build it as a code workflow.

Start by calling Kernel's List Browser Sessions, filtered to running sessions. Page through the results rather than reading only the first page, so an account with many sessions is fully covered.

For each running session, work out its age by comparing its creation timestamp to the current time. If a session is older than the age threshold, which should default to 60 minutes and be exposed as a configurable value, call Delete Browser Session for that session id. Leave anything younger than the threshold alone, since those are most likely legitimate in-flight runs.

For every session reclaimed, append one row to a Google Sheets audit log using Append Values. Each row should carry the session id, the session name, the age at reclaim in minutes, and the timestamp of the sweep. Append to the same tab every night so the log accumulates. This log is the point of the workflow as much as the deletions are: it is what lets someone notice that one particular job leaks a session every single night, which is the actual root cause worth fixing.

Finish by sending a Slack message with Send a Message to a configured channel, containing three numbers: how many sessions are still running after the sweep, how many were reclaimed, and how many were swept in total. Post this message on every run, including clean runs where nothing was reclaimed, so the team can see the sweep is alive rather than silently broken.

Keep the age threshold and the Slack channel as the two obvious knobs to change, defined clearly at the top of the workflow. The target spreadsheet and tab for the audit log should be configurable too. If a delete call fails for one session, log it and carry on with the rest rather than aborting the whole sweep, and reflect the failure in the counts.

## How to customize

- Change the age cutoff. One hour is the starting point. Raise it if your jobs legitimately run long, lower it if browsers should never linger.
- Pick which Slack channel gets the nightly update, and who should be watching it.
- Change the run time, or point the audit log at a different spreadsheet or tab.

## FAQ

### Will this close browsers that are still doing real work?

Only sessions older than your cutoff get closed. Anything started recently is left alone. If some of your automations genuinely run for hours, set the cutoff above their longest normal run and they will never be touched.

### What happens on a night when nothing needs closing?

You still get the Slack message with the counts. That is deliberate. If the update always arrives, then silence means the sweep itself has stopped working rather than meaning everything is fine.

### Why bother keeping a spreadsheet log?

Over a few weeks the log shows patterns. If the same automation shows up in it every night, you have found the job that never cleans up after itself, and fixing that job is the real solution.

### Do I need to be on a paid plan for this to be worth it?

No. It works with whatever plan you are on, and it tends to pay for itself fastest on smaller accounts, where even a few forgotten browsers make a visible difference.

### Can I run the sweep more than once a day?

Yes. Evening is a sensible default because it catches the whole day in one pass, but you can run it hourly if forgotten sessions are a frequent problem for your team.

Use this prompt in General Input: https://www.generalinput.com/prompts/stop-paying-for-browser-sessions-you-forgot-to-close