the success oracle · lesson 7 of 9 · sources checked 2026-11-22
the settle algorithm and its cost
This lesson shows a settle function that decides when a page is final, and the time and the false reads that each settle rule costs.
purpose
The success oracle reads a page at one point in time. If it reads too early, it judges a page that is not final. If it waits too long, each read costs more browser time.
objectives
- Name the four conditions of a settle function.
- Explain why one condition alone can settle a page too early.
- Record the end state, the time, and the settled status of each attempt.
- Compare the settle time and the false settles of settle rules, and give the cost of a rule.
new terms
- positive rule
- A wait or verdict rule that says what must be on the page.
how it works
To settle is to wait until a page reaches a final state, or until a cap ends the wait. The settle function decides that point in time for each attempt. Then the oracle reads the page.
A false settle is a settle before the page is final. For example, the oracle reads a challenge shell that clears one second later. The verdict of that attempt is then false.
the four conditions
The settle function checks four conditions:
- No interstitial marker: the page shows no challenge shell.
- Network idle: no request of the page is open for a set window, for example 500 ms.
- DOM quiet: the DOM has no change for a set period, for example 500 ms.
- The settle cap: a maximum time, for example 6 s. At the cap, the wait stops.
The page is settled when conditions 1, 2, and 3 are true at the same time. Condition 4 only ends the wait.
one condition alone is not sufficient
Each condition alone has a page where it settles too early:
- A challenge shell can load all its requests and then wait. The network is idle, but the shell is still on the page.
- A client render can stop its DOM changes for a short time between two requests. The DOM is quiet, but the content is not there yet.
- A page that asks the server for news each 400 ms never gets network idle. Only the cap ends the wait.
Thus the combined rule reads the three conditions together. The settle cap limits the wait on a page that never settles.
A positive rule is a different kind of condition. It says what must be on the page, for example the text of the result. It gives the fewest false settles. But each page must have its own definition.
the end states and their records
The function has two end states. Each one writes its own record:
| end state | what the record gets |
|---|---|
| Settled | The settle time and the settled status |
| Cap reached | The time of the cap and the condition that is still open |
The settled status is the HTTP status of the last main-frame document after all interstitials clear. For example, a challenge shell comes with status 403. After it clears, the document of the page has status 200.
An oracle that reads the status of the first document gives a hard block to a page that cleared. Thus record the status of the last main-frame document.
An open condition at the cap is also evidence. An interstitial that is still open at the cap goes to stage 1 of the oracle as a block. More detail on stage 1 is in Stage 1: block signatures, definitive and ambient (not yet published).
A network that is still busy at the cap does not prove a block. The oracle reads the page, and the record keeps the cap.
the cost of the wait
The settle time is a cost on each attempt. A long fixed wait, for example 6 s, seldom reads a page too early, but each page costs the full wait. A short fixed wait, for example 1.5 s, costs little, but it reads slow pages too early.
example A denial page never settles, so each attempt on it waits the full cap. With a cap of 6 s, 1,000 such attempts cost 6,000 s of browser time, which is 100 minutes.
The wait also leaves a signal. The time from the load to the first action, and the length of the browser session, are values that a site can read. A long settle keeps the browser session open for a longer time.
the two sides
| automation side | detection side |
|---|---|
| A short settle records the interstitial and its status. A long settle costs browser time on each attempt and keeps the browser session open for a longer time. | A challenge can clear after a delay. The time from the load to the first action and the length of the browser session are signals that the site can read. |
design decisions
| option | gain | cost | when it is correct |
|---|---|---|---|
| A short fixed wait | Low time for each attempt | It reads slow pages and challenge shells too early. | Only on static pages that you know |
| A long fixed wait | Few false settles | Each attempt costs the full wait. | A small set of slow pages, when time is cheap |
| Network idle only | Fast on most pages | It settles on a shell that waits, and it never settles on a page that sends requests all the time. | Never alone |
| DOM quiet only | Fast on most pages | It settles in a pause of a client render. | Never alone |
| The combined rule with a cap | Each condition covers a fault of another condition. | More code, and a cap time on each page that never settles | Each page with no definition of its content |
| A positive rule with a cap | The fewest false settles | Each page must have a definition of its content. | Each page with a known content |
diagram
settle states of one page: each end state writes its own record
code example
The example runs a settle function on four synthetic page timelines, with a simulated clock.
example The pages, the requests, and the times are synthetic. No part describes a real site or product.
Check the interstitial marker, the network idle window, the DOM quiet period, and the cap. Return the end state, the time, the open condition, and the status of the last main-frame document.
// Settle function, in model form, on synthetic page timelines.
// No browser and no network: a simulated clock reads each timeline.
type Page = {
name: string;
interstitialUntil: number; // ms; the interstitial marker shows until then
requests: [number, number][]; // start and end of each request, in ms
domChanges: number[]; // time of each DOM change, in ms
documents: [number, number][]; // time and status of each main-frame document
};
type Rule = { idleMs: number; quietMs: number; capMs: number; stepMs: number };
type Result = { state: "settled" | "cap-reached"; ms: number; open: string; status: number };
function statusAt(page: Page, t: number): number {
let status = 0;
for (const [at, s] of page.documents) if (at <= t) status = s;
return status;
}
function openCondition(page: Page, t: number, rule: Rule): string {
if (t < page.interstitialUntil) return "interstitial";
const busy = page.requests.some(([a, b]) => a <= t && b > t - rule.idleMs);
if (busy) return "network";
const changed = page.domChanges.some((c) => c <= t && c > t - rule.quietMs);
if (changed) return "dom";
return "none";
}
function settle(page: Page, rule: Rule): Result {
for (let t = 0; t <= rule.capMs; t += rule.stepMs) {
const open = openCondition(page, t, rule);
if (open === "none") return { state: "settled", ms: t, open, status: statusAt(page, t) };
}
const t = rule.capMs;
return { state: "cap-reached", ms: t, open: openCondition(page, t, rule), status: statusAt(page, t) };
}
const rule: Rule = { idleMs: 500, quietMs: 500, capMs: 6000, stepMs: 100 };
const pages: Page[] = [
{ name: "static", interstitialUntil: 0, requests: [[0, 300]], domChanges: [200],
documents: [[0, 200]] },
{ name: "shell then render", interstitialUntil: 2500, requests: [[0, 400], [2500, 3100]],
domChanges: [2600, 3200], documents: [[0, 403], [2500, 200]] },
{ name: "denial", interstitialUntil: 99999, requests: [[0, 300]], domChanges: [100],
documents: [[0, 403]] },
{ name: "polling", interstitialUntil: 0, requests: Array.from({ length: 30 }, (_, i) => [i * 400, i * 400 + 200] as [number, number]),
domChanges: [300], documents: [[0, 200]] },
];
for (const p of pages) {
const r = settle(p, rule);
console.log(`${p.name}: ${r.state} at ${r.ms} ms, open condition ${r.open}, last main-frame status ${r.status}`);
}output
One line for each synthetic page, with its end state and its time.
static: settled at 800 ms, open condition none, last main-frame status 200
shell then render: settled at 3700 ms, open condition none, last main-frame status 200
denial: cap-reached at 6000 ms, open condition interstitial, last main-frame status 403
polling: cap-reached at 6000 ms, open condition network, last main-frame status 200The second page starts with status 403 and settles with status 200, so its record is not a hard block.
The denial page reaches the cap with an open interstitial. The fourth page sends a request each 400 ms. It reaches the cap with an open network condition.
data
The chart is a lab result of this course, on invented lab pages. The design of each page sets each false settle. Thus the chart shows the method, not a rate on real pages.
settle time and false settles of 6 settle rules on 8 lab pages
status of this figure: measured by me
source: Lab result of this course: settle time and false settles of 6 settle rules on 8 invented lab pages; date 2026-11-17; sample of 480; condition: The page design sets each false settle, so the values show the method, not a rate of real pages. One host, one browser build.
data table
| series | settle rule | value | unit |
|---|---|---|---|
| median settle time | fixed wait 1.5 s | 1.51 | s |
| median settle time | fixed wait 6 s | 6.01 | s |
| median settle time | network idle | 0.57 | s |
| median settle time | DOM quiet | 0.57 | s |
| median settle time | combined rule | 1.42 | s |
| median settle time | positive rule | 2.12 | s |
| false settles | fixed wait 1.5 s | 40 | trials |
| false settles | fixed wait 6 s | 0 | trials |
| false settles | network idle | 30 | trials |
| false settles | DOM quiet | 45 | trials |
| false settles | combined rule | 12 | trials |
| false settles | positive rule | 0 | trials |
Network idle alone and DOM quiet alone are the fastest rules, and they read many lab pages too early. The long fixed wait and the positive rule give no false settle. The long fixed wait pays for that with the longest time on each page.
failure modes
| problem | cause | correction |
|---|---|---|
| A page that cleared a challenge counts as a hard block. | The oracle read the status of the first document. | Settle until no interstitial marker is on the page. Record the status of the last main-frame document. |
| A challenge shell reads as a real page. | The settle rule used network idle only. | Use the combined rule, with the interstitial check first. |
| A client render reads as an empty page. | The DOM was quiet for a short time between two requests. | Read the three conditions together, or use a positive rule. |
| Attempts on a page that sends requests all the time take a long time. | The network never becomes idle. | Set a cap. Record the open condition at the cap. |
| The settle time of the attempts is not known. | The function returns only the page. | Return the end state and the time with each page. |
check questions
Name the four conditions of a settle function, and say which condition only ends the wait.
sample answer
The conditions are no interstitial marker, network idle for a set window, DOM quiet for a set period, and the cap. The cap only ends the wait. The page is settled when the first three conditions are true at the same time.
Explain why a settle rule with network idle only can read a challenge shell as the final page.
sample answer
A challenge shell can load all its requests and then wait. The network is then idle, but the shell is still on the page. Thus the rule settles too early. The combined rule also checks the interstitial marker and the DOM.
A page starts with a challenge shell and status 403. The shell clears, and the next main-frame document has status 200. Which status does the record get?
- 403, the status of the first document
- 200, the status of the last main-frame document
- No status, because the page had an interstitial
- Both statuses, and the oracle gives a hard block
answer
b. 200, the status of the last main-frame document
The settled status is the status of the last main-frame document after all interstitials clear. A record with 403 gives a hard block to a page that cleared.
A page sends a request to the server each 400 ms, and the cap is 6 s. What does the settle record get?
- Settled at the first time the DOM is quiet
- A hard block, because the page did not settle
- Cap reached at 6 s, with the open condition network
- No record, because the attempt did not settle
answer
c. Cap reached at 6 s, with the open condition network
The network never becomes idle, so only the cap ends the wait. The record keeps the time of the cap and the condition that is still open. An open network condition does not prove a block.
A denial page never settles. The cap is 6 s. How much browser time do 500 attempts on that page cost?
- 500 s
- 3,000 s
- 6,000 s
- No time, because the attempts fail
answer
b. 3,000 s
Each attempt waits the full cap of 6 s. 500 attempts times 6 s is 3,000 s of browser time, which is 50 minutes.
exercise
exercise Do this task on paper, with the synthetic page timeline below. Do not send a request to a site.
The settle rule:
- Network idle window: 500 ms.
- DOM quiet period: 500 ms.
- Cap: 6,000 ms.
The page timeline:
- The interstitial marker shows from 0 ms to 2,000 ms.
- Request 1 is open from 0 ms to 300 ms. Request 2 is open from 2,000 ms to 2,800 ms.
- The DOM changes at 2,100 ms and at 3,000 ms.
- The first main-frame document has status 403. At 2,000 ms, a new main-frame document has status 200.
- Find the first time at which each of the three conditions is true.
- Write the settle time and the condition that is true last.
- Write the settled status.
- Write what a fixed wait of 1,500 ms reads on this page.
- Write the end state and the open condition if the cap is 3,000 ms.
sample answer
The answer uses the four conditions and the two end states.
The interstitial marker clears at 2,000 ms. Network idle is true at 3,300 ms, 500 ms after request 2 ends. DOM quiet is true at 3,500 ms, 500 ms after the last change. Thus the page settles at 3,500 ms, and DOM quiet is true last. The settled status is 200.
A fixed wait of 1,500 ms reads the interstitial with status 403. That is a false settle. With a cap of 3,000 ms, the end state is cap reached. The open condition is the network, because request 2 ended less than 500 ms before the cap.
sources
- My model of a settle function, its four conditions, its end states, and the cost of the wait, 2026-11 (not public).
- Lab result of this course: settle time and false settles of six settle rules on invented lab pages, 2026-11 (not public).