Always-on agents, clearly explained!
An agent in a chat window only works while someone is typing to it. Once the tab closes, it stops and can’t act on anything that happens next.
Always-on agents keep state across sessions and act without supervision. Anthropic’s new guide on building them shows that the agent loop itself doesn’t change, and everything new is the architecture around it.
The agent also isn’t running all the time. It sleeps and wakes up for short runs, where each run receives an event, does the work, and saves what happened.
That cycle needs five primitives.
1) An event inbox
Webhooks, scheduled tasks, and user messages all land in a durable table instead of calling the agent directly. Direct calls let two events start competing runs, and a crash loses the event.
A single worker per inbox reads the table and starts runs. Events are deduplicated by source ID, and if a worker dies, a new one retries the pending event.
2) Timers
Follow-ups are deadlines the agent sets for itself, and schedules are recurring jobs. A scheduler polls for due timers and adds an event to the inbox, so every run still starts there.
3) Memory
Each run starts with a fresh context, so anything worth keeping lives in durable storage. The agent stores only what it can’t look up again and keeps pointers for the rest.
Instructions, an index, and a log of what the user was already told load on every run. User notes and per-task progress files are read on demand, and anything that must survive compaction gets written during the run.
4) Permissions
This carries the most risk, since the run holds the user’s access and nobody is watching. The agent sends requests without credentials, and a proxy adds them before forwarding.
For decisions that need a human, the agent makes a deferred tool call. The session is saved mid-call, the user sees an approval card, and the answer returns as an inbox event that resumes the session.
5) An outbox
The user gets the outcome, not every step. A run ends by sending a message, deciding nothing is worth sending, or asking for permission.
Too many messages make the agent noisy, and too few miss what matters, so the guide recommends starting quiet and tuning it with evals.
Timers and user replies keep feeding new events into the inbox, and those short runs repeated indefinitely are what make the agent look always on.
To see these ideas running in a real system, Alook (open-source) turns coding agents like Claude Code into an org chart with roles and real email inboxes for multi-agent collaboration.
Alook GitHub: https://github.com/alookai/alook
(don’t forget to star it ⭐️)
Security breaks in the gaps between your reviews
On October 21, GitLab patched a flaw dating back to 2014 that let anyone run code on self-managed servers without logging in.
That same week, researchers using an OpenAI model uncovered critical PHP bugs missed for decades, while the NSA urged organizations to patch or take affected systems offline.
Code that ran safely for years is now being read by models that can find these bugs, and anyone with a credit card or a laptop can run those models. The time from a bug going public to its first exploit has dropped from almost a year in 2021 to just over a day in 2026.
In a November 6, 2026 post, CodeRabbit reported finding more than 43,000 high or critical vulnerabilities by running their Deep Scan feature over the last 10 days.
Access control bugs are easy to miss in your own codebase because they rarely live in one file. A gateway checks who you are, but the service behind it never checks whether the order belongs to you.
We wanted to see whether a security tool could catch that gap, so we built two small services with Claude Code and ran CodeRabbit across both.
CodeRabbit is the trust layer for agentic software development. CodeRabbit Secure extends that with security checks on pull requests, existing code, and linked repositories, so it can trace a vulnerability from one service into another.
For the test, we recreated the pattern behind last year’s Next.js middleware auth bypass.
How the Next.js bypass worked
Next.js is a React framework with 143K+ GitHub stars. It lets you run middleware before a request reaches a page or route, and many apps check whether the user is logged in there.
To stop middleware from calling itself in a loop, Next.js marked its own internal requests with a header called x-middleware-subrequest. Any request carrying that header skipped the middleware.
The problem was that Next.js never checked where that header came from. Anyone could add that header to a request from outside and get past the login check.
The flaw was tracked as CVE-2025-29927, rated critical, and fixed in 15.2.3 with patches for older versions. Self-hosted apps that checked logins in middleware were exposed.
The same pattern can sit between two services, where one trusts that the other already checked.
The two services we built
The test uses two small repositories that depend on each other. shop-gateway handles login, and shop-orders only gets requests after they pass through the gateway.
We gave Claude Code one plain feature prompt for each, with nothing about security in either.
The gateway uses FastAPI and JWT login for two users, alice (user 1) and bob (user 2), and forwards /api/orders requests with the user’s ID in an X-User-Id header.
The orders service uses FastAPI and SQLite, reads the user from that header, and starts with orders 1 and 2 for alice and order 3 for bob. Both services ran, and all 27 tests passed.
Claude Code also added safeguards we hadn’t asked for. The gateway strips any X-User-Id a client sends, and the orders service checked that each order belonged to the caller.
In a 100-line service, that check is easy to get right. To recreate a codebase where the check gets missed, we removed it from the endpoint that fetches a single order (GET /orders/{order_id}), so the service now returns any order by its ID, no matter who asks.
With both services running, we logged in as bob and asked for his own order, number 3, which came back as expected.
Then we asked for order 1, which belongs to alice. The gateway returned it with "user_id": 1, so bob could read alice’s order.
From there, we ran CodeRabbit on the existing code first, then on a new pull request, a gateway refactor, and a commit that skipped review.
Scanning both repositories
CodeRabbit Secure scans code in two ways. PR scans review each new change before it merges, and a Deep Scan reviews all the code already in the repository. In my test, the missing check was already in the orders service, so we started with a Deep Scan.
First, we linked shop-gateway to shop-orders with CodeRabbit’s Multi-Repo Analysis, so the scan could read and understand context from both repositories.
Then we ran the scan with no hints about the bug. It maps where requests enter the code, follows each one, and has an independent verifier re-check every finding before reporting it.
The scan found the bug we had planted, the missing ownership check on the order lookup. CodeRabbit flagged it as an IDOR (CWE-639) and rated it Medium.
The finding also shows how it got there. It marks the bug as reachable from outside, and its trace follows a request in through the gateway, into the orders service, and down to the query that loads the order without checking who owns it.
That trace crosses into the gateway’s code, so the finding cites four parts of shop-gateway, including how the gateway turns the login token into a user ID and forwards it.
Nothing in those parts checks who owns an order, so the check had to happen in shop-orders. CodeRabbit could show that because the two repositories were linked and it read both of them.
Along with the finding, the scan built an Attack Surface Map of shop-orders, showing the 37 places in the code that matter for security, like routes, access checks, and database queries. All 37 were verified, and the one with the finding was marked.
Fixing what the scan found
To fix it, we clicked Fix on the finding, and CodeRabbit’s Fix with AI opened a pull request that put the ownership check back, this time inside the database query, so the service never loads another user’s order.
The pull request also added a test where another user’s order returns the same 404 as a missing one, since a different error would tell an attacker which order IDs exist.
We reviewed the diff, ran the tests locally, and merged. Bob’s request for order 1 now returns 404 Not Found.
CodeRabbit then marked the finding Fixed and linked it to the merged pull request.
Catching the bug before merge
Next, we asked Claude Code to add a reorder endpoint (POST /orders/{order_id}/reorder) that copies an order’s items into a new order for the current user. The codebase now had the fixed lookup to copy from, and Claude Code included the ownership check.
To see whether review would catch a missing check, we removed it and opened the pull request myself.
This time the PR scan caught it. CodeRabbit’s Secure flagged the lookup as a Major issue, the same kind of IDOR the Deep Scan had found, reachable from outside.
Its comment names the gap between the two services. The gateway supplies the logged-in user’s ID, but nothing checks that the order being copied belongs to that user, so alice could reorder bob’s order and get its items.
CodeRabbit can also publish a Security check on each pull request, which we had turned on for shop-orders. With one blocking Security comment, the check failed. The merge button still worked at that point, because GitHub only blocks on a failing check when a rule requires it.
We added CodeRabbit Security as a required check in the branch protection rule for main, and GitHub disabled the merge button.
We asked Claude Code to restrict reorders to the user’s own orders. CodeRabbit reviewed the new commit, the check passed with no blocking Security comments, and we merged.
After the fix, the pull request’s Security Blast Radius in Change Stack shows what the new endpoint touches, including the Order model it reads, the response schema it returns, and the test fixtures it relies on.
Reviewing a gateway refactor
The gateway’s forwarding code decides which user ID the orders service sees, which makes it the most sensitive code in this setup. We wanted to see how CodeRabbit handles a routine change to it.
We asked Claude Code to pull that code into a shared forward() function and pass tracing and language headers through to the orders service. Claude Code found those headers already passed through, and it kept stripping any X-User-Id a client sends.
CodeRabbit reviewed the pull request and flagged nothing. In Change Stack, the security architecture review shows the before and after, with the forwarding code moved out of the route and into the new shared function.
In the pull request, CodeRabbit rated both the merge risk and the security architecture risk as Minimal. Its overview of the change explains why. The same routes still require login and still reach the same orders service, and no new route is open to outside callers.
The gateway also still overwrites X-User-Id with the logged-in user’s ID. That overwrite is what this whole setup depends on, and the overview lists it as something the change keeps.
A change that skipped review
Not every change goes through a pull request, so we wanted to see what the map does when one doesn’t.
We pushed a small change straight to main, adding a one-line description to the function that returns a single order (get_order).
By the end of the test, the Attack Surface Map had gone from 100% verified to 89.2%, with four points marked stale, meaning CodeRabbit no longer counts them as checked.
Two of the stale points are in get_order, the function this push touched, because no review covered that change. They stay stale until a reviewed change or a new scan checks them again, which shows the team exactly which code to look at next.
Across the test, we tried four points where a change like this can get through, and CodeRabbit handled each one:
Code already in the repository: a Deep Scan found the missing check, traced it through both repositories, and Fix with AI opened the fix.
A new pull request: the Security Agent flagged the same mistake, and the required Security check blocked the merge until it was fixed.
A refactor of the gateway: CodeRabbit confirmed the gateway still sets the user ID itself and rated the change minimal risk.
A change that skipped review: the Attack Surface Map marked the code it touched as stale.
Start a free 14-day trial. No credit card, 2-click setup.
Ship code you can trust across every service →
Thanks to CodeRabbit for partnering today!

































