# How we test switching for days at a time

> We test switching on a fake clock. One run gives twenty sources four days, with a 30-minute outage every night and a refused sign-in every hour.

Source: https://shuriken.sh/blog/how-we-test-switching

We test switching on a fake clock. One run gives twenty sources four days, with a 30-minute outage every night and a refused sign-in every hour.

[Story](https://shuriken.sh/blog) By Shuriken Updated 15 November 2026 5 min read

**Contents**

We test switching on a fake clock. Days pass in minutes, fake providers hit limits, refuse sign-ins and drop off the network when the test tells them to, and the real switching code runs in the middle. It is failover testing for AI accounts, and since Shuriken 3.0 (12 October 2026) some of those runs cover several days at a time.

## The feature we can't get wrong #

[Automatic source switching](https://shuriken.sh/features/source-switching) is [the reason we built Shuriken](https://shuriken.sh/blog/why-we-built-shuriken) in the first place. When the account a chat is using reaches your switch point or hits a limit, the chat moves to another of your accounts with room and keeps going.

That is easy to get mostly right. Mostly right is the problem. Switching runs when you're asleep, at a limit, often in the middle of a long task. When it goes wrong, nobody is there to notice:

- the chat stops at 3 a.m. and you find out at 9;
- it moves onto an account that can't take it, and spins;
- a network blip marks a perfectly good account as out, and everything piles onto the rest.

None of those crash anything. They waste your night quietly. So a switch has to be boring every time, and the only way we know to get there is tests nastier than real life.

## Days on a fake clock #

Real limits take hours to come back, and nobody waits four days for a test. The longest run is in checking-over-days-l3.test.ts, and it sets up this world:

- twenty sources, one in three on a 30-day Claude sign-in and the rest on one-year sign-ins;
- a clock that starts at 09:00 UTC on 12 October 2026 and moves 15 minutes per step, for four days;
- a 30-minute network outage at 3 a.m. every night;
- on every hour, one source's sign-in refused with API Error: 401.

The test has no Keychain and no network. Any request the code could send to a real provider throws, so nothing is billed. After 384 steps the run checks three things:

- every source is usable again, and the ones that report usage still show their bars;
- nothing is stuck on "Checking" or "Needs sign-in";
- the five maps the service keeps per source (lookedAt, answeredAt, looks, judgedReports, pollsHeard) hold at most twenty entries each, so what the service keeps grows with the number of sources, not with the number of days.

One test file, four simulated days: nightly outages, hourly refusals, then the checks.

Another file, chat-routing.park-l3.test.ts, spends every source until three days out. A workflow's subagent must wait the whole time, have the spent sources read again every 15 minutes, never give up, and go on at the soonest reset. A source added while it waits is taken at the next look.

## What we throw at it #

### Limits #

In switching-at-scale-l3.test.ts, forty chats hit a wall on one of thirty sources at the same moment. They must all land on one source with room, each with exactly one card, and that source is looked at once, not forty times. A source that Anthropic resets early must be taken again on its next reading, not hours later at the reset the wall named.

### Refusals #

An account that refuses a request moves the chat to another usable source ([more on that](https://shuriken.sh/blog/how-switching-picks-the-next-account)). A sign-in token that expired during an outage is a different case. It is not a refused account: the request goes again once with the refreshed token on the same source, and nothing is marked. A one-year Claude sign-in that a chat's CLI refused once is set aside and looked at again a quarter of an hour later, never left on "Needs sign-in" for the rest of the year.

### Network drops #

A dropped connection is not a limit. In the tests:

- a 30-minute outage below HTTP, where nothing answers at all, moves no chat, rests no source and shows no card;
- a turn waiting out an outage is never called stuck;
- a six-hour outage with a restart of the background service in the middle ends with the chat going on by itself the moment the network is back;
- a subagent's request inside a workflow rides out a nine-hour outage without its workflow giving up.

### A device that goes away #

Laptops sleep. A Mac that sleeps through the night must not wake up and announce it has had no internet for nine hours: only time the device was awake counts. A service that restarts in the middle of an outage must not fire every waiting turn into a dead network on boot.

### Chaos mid-switch #

- The background service restarts while chats are moving. Every chat relaunches on a source that can take it, the walled source stays set aside, and no card shows twice.
- A source is removed while a chat is moving to it. The next request lands on one that exists, and the chat's marker names that one.

Shuriken moves a running chat to another of your own accounts when one reaches its limit, on every device.

[Try Shuriken](https://shuriken.sh/)

## Every bug becomes a test that failed first #

A switching fix lands with a test that is red on the old code and green on the new, and our 3.0 changelog names each one next to its fix. One line there ends Gate: accounts/switching-at-scale-l3.test.ts (four legs, red on the old code). That file landed on 12 October 2026, and its commit names what the old code did:

- the fallback pick changed with every usage reading, and forty chats were traded back and forth between two sources that both had room;
- a limit stood until the reset its wall named, even after the provider reset the source early, unless every source was spent;
- one network drop cut every stream at once and rested the source in use, so every chat moved with a "Limit reached" card.

A bug we fixed once can't quietly come back while its test runs.

Fake providers have a limit of their own. When a provider changes how it words a limit, the fake one doesn't know yet. We find those in real use, and each one becomes another test.

## What a failure looks like to you #

When something does happen, you shouldn't have to guess. Each of these says what happened, in words:

- "Switched to …", a small card in the chat, with the reason on a second line, such as Personal reached its limit or Personal passed 99%;
- "Stayed on …" with No other source has room, when there was nowhere better to go;
- "Paused — no Claude source has usage left" (or the provider in question), one card, when every source is out;
- "Waiting for the connection" in the turn's footer while the device is offline, instead of a spinner pretending to work;
- "still retrying" on the turn's card while the provider itself is having trouble, never a dead "Stopped".

No pop-ups, and no silent moves. You can read back exactly what happened and why. (The order in which the next source is chosen is in [How Shuriken picks the next account](https://shuriken.sh/blog/how-switching-picks-the-next-account).)

## The fine print #

Switching only uses the plans and API keys you add. Add accounts you own and are entitled to use; providers' terms may not allow sharing a subscription sign-in, so don't add someone else's.

If your limits keep cutting your work short, start with [what to do when Claude's limit is reached](https://shuriken.sh/guides/claude-limit-reached-what-to-do), read [how Shuriken picks the next account](https://shuriken.sh/blog/how-switching-picks-the-next-account), and [try Shuriken](https://shuriken.sh/) to let your chats move on their own.

Share

[X](https://x.com/intent/post?url=https%3A%2F%2Fshuriken.sh%2Fblog%2Fhow-we-test-switching&text=How%20we%20test%20switching%20for%20days%20at%20a%20time)[LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fshuriken.sh%2Fblog%2Fhow-we-test-switching)[Hacker News](https://news.ycombinator.com/submitlink?u=https%3A%2F%2Fshuriken.sh%2Fblog%2Fhow-we-test-switching&t=How%20we%20test%20switching%20for%20days%20at%20a%20time)[Reddit](https://www.reddit.com/submit?url=https%3A%2F%2Fshuriken.sh%2Fblog%2Fhow-we-test-switching&title=How%20we%20test%20switching%20for%20days%20at%20a%20time)[E-mail](mailto:?subject=How%20we%20test%20switching%20for%20days%20at%20a%20time&body=https%3A%2F%2Fshuriken.sh%2Fblog%2Fhow-we-test-switching)

## Frequently asked questions

**How does Shuriken tell a network drop from a usage limit?**

It asks the device's own network check. A stream cut while that check finds no internet, or found trouble in the minute before, is the network's fault and never counts toward the two cuts that rest a source. The chat waits for the connection instead of moving.

**What happens when every account is out?**

The chat pauses with one card that says so, keeps checking, and goes on by itself at the soonest reset among your sources.

**Can Shuriken switch to an account I didn't add?**

No. Chats only run on sources you added yourself: your own plans and API keys, which you must be entitled to use.

**What if Shuriken restarts in the middle of a switch?**

That is one of the cases we test. After the restart, the chat must end up working, on a source that still exists.

Source switching

One account runs dry. The next one takes over.

Add the Claude, Codex and Gemini accounts you own. At your switch point, your chats move to another of them and keep going.

[Try Shuriken](https://shuriken.sh/)

[How it works](https://shuriken.sh/features/source-switching)

## Keep reading

- [The 5-hour clock starts when you do. So we start it.: Story 27 Oct 2026 4 min read Claude's 5-hour window only starts when you use an account, so an idle one wastes time. Shuriken starts its clock with one tiny background request.](https://shuriken.sh/blog/the-5-hour-clock-starts-when-you-do)
- [Hot swapping: chats that move when an account runs out: Story 27 Oct 2026 4 min read Hot swapping AI accounts, the way Shuriken does it: your running chats move to another of your accounts when one nears its limit. What happens at 99%.](https://shuriken.sh/blog/hot-swapping-accounts)
- [Every plan and key you own, working as one: Story 27 Oct 2026 4 min read Add your Claude, ChatGPT, Gemini and other plans and API keys to Shuriken as sources. When one runs out, your chats move to the next.](https://shuriken.sh/blog/what-is-a-source)
- [Max 20x is now Ultra: no 5-hour limit once verified: Update 30 Oct 2026 2 min read Anthropic renamed Max 20x to Ultra and drops its 5-hour limit for verified accounts. What changed, what stays, and what Shuriken does about it.](https://shuriken.sh/blog/claude-ultra-plan)
- [Codex with more than one ChatGPT account: Update 27 Oct 2026 4 min read Add each ChatGPT sign-in you own as a source. When one reaches its Codex limit, Shuriken moves your Codex chats to the next and they carry on.](https://shuriken.sh/blog/codex-multiple-chatgpt-accounts)
- [Distribute: spread work across accounts on a clock: Update 27 Oct 2026 4 min read Two modes: Rotation moves your chats only when an account runs out; Distribute moves them every 15 to 60 minutes to the one with the most left.](https://shuriken.sh/blog/distribute-mode)
- [Shuriken is officially launched, in beta: Story 27 Oct 2026 5 min read The harness for Claude Code, Codex and other coding agents is open to everyone. It began as our internal tool; here is what it does and what beta means.](https://shuriken.sh/blog/shuriken-is-now-in-beta)
- [Bring your own plans: we never bill model usage: Story 27 Oct 2026 3 min read Shuriken runs Claude Code, Codex and other agents with your own subscriptions and keys. We never resell tokens or add a margin.](https://shuriken.sh/blog/we-dont-bill-model-usage)

## Free tools

- [Claude limit reset tracker](https://shuriken.sh/tools/limit-resets/claude)
- [Codex limit reset tracker](https://shuriken.sh/tools/limit-resets/codex)
