Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -751,3 +751,140 @@ The type check that #13498 added to the deploy (by a fleet lane, while
this was in review) caught a fourth before it could reach the deploy:
a test passing a list where the page's function, read by the checker,
took none.

## 2026-11-24T01:45Z Correction: the kept answers were not kept

**What was wrong.** The two updates above say GitHub's answers are
kept and asked for again by their tags, so that a list that has not
changed costs nothing of the hour's allowance. As deployed (#13570)
that was not so. The answers, the times GitHub said to ask again and
the count of its answers were held in the Worker object's memory, and
the 18:10Z update gives the reason: persisting them was "considered
and not done", because "a restart costs one full answer of each, which
is less than the writes would". That took a restart to be rare. It is
the ordinary case. Cloudflare takes an idle Durable Object out of
memory after about ten seconds
([its lifecycle](https://developers.cloudflare.com/durable-objects/concepts/durable-object-lifecycle/))
and starts another, with nothing in memory, on the next request; this
object's work is a read every minute or so. Every read in service was
made by an object that had kept nothing, so every read was a full one
and nothing was saved. What the owner was told on 2026-11-23, that an
unchanged list no longer used the allowance, was true of the tests and
not of the Worker.

**How it was found.** By looking at the live Worker on 2026-11-24 at
00:45Z, two hours after the deploy: health showed
`github: {answers: 0, unchanged: 0, kept: 0}` seven minutes after a
self-check that had made four reads, with no deploy in between. The
local runtime showed the same when left alone: an object's memory was
gone forty seconds after its last request.

**Why nothing caught it.** Every unit test, every planted fault and
the real-runtime check read a list twice within one object's life.
The edge's tests have been able to start a new object over the same
storage since they were first written (2026-11-22), and the code
beside the memory says in three places that the object is put away
when idle; the memory was written as if that were rare, and none of
its tests started a new object.

**What changed.**

- _Kept in the object's storage._ An answer is stored in pieces of
600,000 characters. A stored value holds about two million bytes,
and the list of sixty open pull requests, as GitHub gave it on
2026-11-24, was 1.4 million characters of two bytes each: three
pieces. Each piece is marked with the address
and tag it belongs to; one index names the pieces and is written
last. An answer half stored when the object was put away, or when
the store failed, never reads as an answer: its pieces do not carry
what the index names.
- _Bounded._ At most 240 answers and thirty million characters; the
one longest unasked-for goes first, never the one just kept. Places
are few and used again, and whoever writes to a place or empties it
clears whatever else is in it, so what a stopped write left behind
lasts only until its place is next used.
- _One change at a time._ An object's first look reads every list side
by side, none of them kept before: two answers kept at once would
have taken the same place.
- _GitHub's wait and the count, the same way._ An object that starts
during a wait keeps to it; "Try again now" is stored too. Health's
`github.answers` and `github.unchanged` are counted since
`github.since`, whichever object answered.
- _A store in trouble._ One that cannot be written is a memory that
forgot. One that cannot be read is not written to (what it holds is
not known, and is not to be written over with less), is tried again
by the next to ask, and the object keeps to GitHub's wait in its own
mind meanwhile. What is read back is held to what could have been
written: a wait for no longer than one can be set for, an index line
for no more than an answer kept here can be.
- _Health says when the object started_ (`woke`), so how long one
lasts can be seen from outside.
- _Nothing left running._ `AbortSignal.timeout` leaves its timer
running for the whole of the deadline after the request is over, and
an object with a timer running is not put away. In the local runtime
an object that had asked GitHub one thing (twenty seconds allowed)
was still in memory 26 seconds after its last request and gone by
32; one that had left no timer was there at 11 seconds and gone
within 14. Deadlines are now made with `timed` (`src/timed.ts`), which
clears its timer when the request is over, for GitHub, the push
services, the key set, the released build and the dashboard. A test
follows the Worker's imports and fails if anything it runs uses
`AbortSignal.timeout`. An answer whose body is not going to be read
(a push service's, a refusal's) is let go of at once, which the old
deadline did only when it ran out.

**How it is checked now.**

- Unit tests start a new memory over the same store between reads: the
tag, the wait, "Try again now" and the count all carry over. With the
memory given no store, as first built, the edge's test of this fails.
- A property over generated runs of keeping, asking, letting go,
starting again and being stopped part-way at any write (pieces as
small as one character, so most answers are several): what is read
back is an answer that was kept or nothing, each place holds its
first so many pieces with none missing, the places are few, no more
is kept than there is room for, and a change that finishes leaves
nothing behind it.
- 73 single faults planted in the memory, the deadline and the edge's
use of them: 71 fail a test. The two that do not each remove a check
that another doubles (a missing index line, also caught by the catch
around the read; a missing piece, also caught by the answer's
length), and either way the read gives the same "nothing kept".
- The real-runtime check leaves the Worker alone until health says
another object answers, then asks the first one's questions of it: a
long answer (over a million characters of two units each, one cut in
half by a piece's edge) is still asked for by its tag and GitHub's
"not modified" still stands for it, a wait GitHub set is still kept
to, "Try again now" lifts it, and the count goes on from the one
before.

**What it costs.** One small write for each answer of GitHub's (the
count), and for an answer that changed its pieces and the index. One
hour of the object's own clock with nothing changing, in the edge's
tests: 60 reads of GitHub, all "not modified", and 74 writes to
storage, 60 of them the count. Storage is bounded at thirty million
characters of answers.

**Also here.** A test of the plan pages asked that the id roadmap have
at least ten rows. The planners tidied it to eight at 00:34Z, and from
then every run of the console's tests failed, which would have stopped
the next deploy. The test now asks that the roadmap files have rows
between them, and leaves how many each has to the planners.

**Considered and not done.** Writing the count less often (it would
no longer be exact, and it is how this fault was seen). Storing an
answer's pieces and the index in one batch, which the store allows up
to a size: it would remove the half-stored case in service, but the
case still has to read as nothing kept, and does. Listing the store to
sweep what stopped writes left: the list reads every value it lists.

**Not yet shown, as this is written.** That the deployed Worker now
gets "not modified" from GitHub itself. It is to be read from health
after the deploy: `github.kept` above nought and `github.unchanged`
growing while `woke` changes.

**Next.** The same wrong assumption may sit elsewhere in the object:
the ten-minute gate on asking for the released Android build is in
memory, so every object that starts asks again; the queue store is
asked with no deadline at all. #14001 has the list, to be gone through
one by one.
2 changes: 2 additions & 0 deletions planning/roadmaps/pm-stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ The roadmap of record is this file and its siblings in `planning/roadmaps/`. The
| The edge's own GitHub allowance | in-progress | The core must not stop being readable when agents have used the account's hourly allowance. | #13489 |
| Queue tasks filed, cancelled and unblocked from Cloudflare | shaped | A prompt sent with the laptop away is picked up, not only filed. | #13490 |
| Questions, what needs you and sessions with no machine | shaped | The last sections that are only as fresh as a machine's last report. | #13491 |
| What waits for a machine, done from Cloudflare once it can be | shaped | With GitHub answering again and no machine there, what the owner did is done by the edge itself and not kept waiting; never twice. | #13831 |
| The laptop's console follows main | proposed | The console on the laptop runs the build main is at, and it is seen from outside when it does not. | #13833 |

## Next

Expand Down
53 changes: 42 additions & 11 deletions pm-stack/console/edge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,17 +237,48 @@ it (the laptop's, the sign-in issuer's).
most of what the edge asks is now free. Nothing is served from the
kept answers without asking: GitHub decides each time whether the
answer still stands, so what is shown is never older than it was
before. The answers live in the object's memory (twelve million
characters and two hundred answers at most, the one asked for longest
ago dropped first); a restart costs one full answer of each. A tag
belongs to the token it was given to, so after a new token the old
tags only get full answers. An answer whose body was cut off
part-way is not kept: under GitHub's tag it would have been the
answer every time GitHub said "not modified" after. Health counts GitHub's answers and how
many were "not modified" (`github.answers`, `github.unchanged`).
This does not give the edge an allowance of its own: when the agents
use the hour up, the edge is turned away with them until it turns
(#13489 has what would change that).
before. The answers are kept in the object's storage, not its
memory (see the next point: as first built, on 2026-11-23, they were
in memory, and in service every read was a full one). An answer is
stored in pieces of 600,000 characters, since a stored value holds
about two million bytes and a list of open pull requests is more
than that. Each piece is marked with the address and the tag it
belongs to, and the index that names them is written last: an answer
half stored when the object was put away reads as nothing kept,
never as an answer. At most 240 answers and thirty million
characters, the one longest unasked-for going first. The time GitHub
said to ask again is stored the same way, so an object that starts
during a wait keeps to it. A store that cannot be read is a memory
that forgot, and is not written over. A tag belongs to the token it
was given to, so after a new token the old tags only get full
answers. An answer whose body was cut off part-way is not kept:
under GitHub's tag it would have been the answer every time GitHub
said "not modified" after. Health counts GitHub's answers and how
many were "not modified" (`github.answers`, `github.unchanged`,
counted since `github.since` whichever object answered) and says how
many answers are kept (`github.kept`). This does not give the edge
an allowance of its own: when the agents use the hour up, the edge
is turned away with them until it turns (#13489 has what would
change that).
- **The object is put away whenever it is idle.** Cloudflare takes an
idle object out of memory within seconds and starts another, with
nothing in mind, on the next request; `woke` in health is when the
one answering started. So nothing the edge needs later is kept only
in memory, and nothing it starts is left running behind a request.
A deadline on an outgoing request is made with `timed`
(`src/timed.ts`), which clears its timer when the request is over
(and an answer whose body will not be read is let go of with
`unread`):
`AbortSignal.timeout` leaves its timer running for the whole of the
deadline, and an object with a timer running is not put away. In
the local runtime an object that had asked GitHub one thing, with
twenty seconds allowed, was still in memory 26 seconds after its
last request; one that had left no timer was gone within 14. A test
follows the Worker's imports and fails if anything it runs uses
`AbortSignal.timeout`. The real-runtime check (`scripts/edge-smoke.ts`)
leaves the Worker alone until health says another object answers,
and only then asks whether a list is still asked for by its tag and
GitHub's wait still kept to.
- **The same for what it reads.** A section the edge is refused for is
the laptop's to read for the hour, exactly as it was before the edge
read anything: the edge stops naming it under `owns`, the laptop's
Expand Down
Loading