Skip to content

web 0.5.0: a saved copy is checked with the site past a 5-minute floor (board #137), and WEBFETCH_MODEL - #393

Merged
SSFSKIM merged 8 commits into
mainfrom
web-cache-freshness
Oct 26, 2026
Merged

SSFSKIM merged 8 commits into
mainfrom
web-cache-freshness

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Board #137, plus the owner's WEBFETCH_MODEL. The machine's shared cache reused a saved copy of a page for 24 hours without asking the site, so the first session to fetch a page that changes during the day (release notes, an issue, a status page) fixed what every session saw for a day. The owner approved the design and its three choices on 2026-10-26. It is recorded in the living spec, docs/doperpowers/specs/2026-10-25-web-fetch-design.md ("The cache", "The summary", I1, and the Decision Log entries dated 2026-10-26).

What changes (web 0.5.0)

  • A 5-minute floor. A copy answers as it stands for 5 minutes after its fetch or its last check.

  • A check past the floor. The call starts with the request a fetch would make, carrying the copy's ETag / Last-Modified. The copy stands when any of these holds:

    • the site answers 304;
    • the body is byte for byte the copy's;
    • the extracted text hashes as the copy's did.

    Its folder doesn't change, so cited paths stay valid, and the check is recorded in the entry's .checked.json. Anything else is a changed page, built from the answer already in hand, with no second request.

  • Rendered copies record no validators, since a script shell's 304 says nothing of its data. Their check renders again and compares. A copy filled in by a Defuddle site extractor's other requests records none either.

  • When the check fails:

    • Transient (network, timeout, 5xx, 408, 429): the copy answers with why, remembered like a failed fetch.
    • A page that comes back under 50 words where the copy had more (a failed render, a failed HTML page behind a markdown stub): the same.
    • A 4xx other than 408 and 429: R4, naming the copy.
  • Replies say what happened. For example: Cached, fetched 5 h ago, unchanged when checked 2 s ago (refresh: true fetches again), or …; a check for changes failed: HTTP 503 Service Unavailable. The tool description's line becomes "A saved copy is reused when the site shows the page unchanged (asked at most once every 5 minutes)".

  • Prune dates a generation by its last check too, so a path a check hands out stays readable as long as one a fetch hands out.

  • The HTTP client no longer pipes a 304's empty body through the gzip decoder its Content-Encoding names. GitHub's and Wikipedia's 304s failed with unexpected end of file.

  • WEBFETCH_MODEL names the model that answers a prompt; haiku when unset or blank. The owner asked for it.

  • The web plugin's version audit skips evals/runs/, whose transcripts quote any version string.

Evidence

  • Spike over the 93 eval URLs (91 answered):
    • 65 send validators and 61 answer a conditional request with 304, at 162 ms median.
    • 26 send none. Of the 25 that answered twice, 24 came back with the same bytes or the same extracted article.
    • Cache-Control says little about change: 42 send none, and Tom's Hardware sends no-store and still answers 304.
  • Live check through the new clipper: each URL fetched, moved past the floor, fetched again.
    • 81 of 88 copies were kept: 59 by a 304 (247 ms median), 19 by comparison (543 ms), 3 rendered pages by a render (3.0 s).
    • 7 were rebuilt, each for the page's own drift between two fetches seconds apart: rotating ads, a random avatar, a chart's generated SVG id, rendered tabs, a PDF that differs per download.
    • One stalled check gave the copy with why.
  • Regression eval: the first suite's 16 dev tasks on configuration B (sol at xhigh) gave 15 correct and 1 partial, one fetch each. The partial is gist-1, a summary that left out one reason; it was correct on the previous branch and is unrelated to this change.
  • WEBFETCH_MODEL=luna, live in claude -p: luna answered, and the reply says "Answered by luna". A name that doesn't resolve gave the page with "The answer could not be made (api-error 400, unknown)".
  • Tests: 188 clipper tests (Chromium present) and 67 mod tests. CI is green.

Review

doperpowers:review-code at medium, two rounds.

  • Round 1, four findings, all fixed in 70eb95d5, each with a test that failed first:
    • a site extractor's other requests were not reflected in the validators;
    • a failed fallback replaced a good copy;
    • a prune could take a copy a check had just handed out;
    • a fragment made a page look changed.
  • Round 2: no findings.

Three narrower edges are logged as debt on board #11:

  • a bot-wall copy whose check render fails;
  • a copy over 7 days old handed out unconfirmed;
  • a prune that races a check record.

Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)

…with the site past a 5-minute floor

Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)
…r (board #137, web 0.5.0)

A copy answered every call for 24 hours without a request, so the first
session to fetch a changing page fixed what every session saw for a day.
Now a copy answers as it stands for 5 minutes after its fetch or its last
check (CHECK_FLOOR_MS); past that the fetch is its check. The copy stands,
its folder unchanged and the check recorded in the entry's .checked.json,
when the site answers 304 to its ETag or Last-Modified, sends the same body,
or the extracted text (article, whole page, URL) hashes as the copy's did.
Anything else is a changed page, built from the answer already in hand. A
rendered copy records no validators (its shell's say nothing of what the
scripts load) and is checked by rendering again. A check the site fails
gives the copy with why; a 4xx other than 408 and 429 is the error, naming
the copy. The HTTP client no longer reads a 304's empty body through the
decoder its Content-Encoding names (GitHub's and Wikipedia's 304s failed).

Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)
…s quote any version string

Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)
Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)
…onses, a failed fallback, a prune, and a fragment (board #137)

Four ways the check of a saved copy could keep or hand out the wrong thing.

A copy whose article a site extractor filled in from other URLs (Reddit's
comments, YouTube's transcript) recorded the shell response's ETag,
Last-Modified and body hash, so an unchanged shell confirmed changed content.
Each extraction now notes whether it asked Defuddle's fetch for anything; such
a copy records only its text digest, and its check extracts again and compares.

A check whose fallback failed published a degraded page as a changed one: a
markdown stub whose HTML page answered 503, or a rendered copy's empty shell
when the render failed or the page's data API was down, each then confirmed by
its own body hash. During a check, a page under RENDER_MIN_WORDS where the copy
had at least that many is no longer published: the copy answers through the
failed-check path, remembered like any failed check, and checkFailed says how
many words came back and the render's or the HTML request's reason. A fresh
fetch is unchanged, and refresh still takes a page that really shrank.

A copy of any age can now be confirmed and handed out, so prune keeps a
generation while the later of its fetch and the check its entry's
.checked.json records for it is within the age, reading that record just
before it deletes. A check that confirms a copy writes the record first and
then makes sure the generation is still there; one a prune took while the
site was asked is no copy, and the call goes on as a fetch (a 304 is followed
by a full request, a matching body or text is published).

The cache key drops a URL's fragment, but the 304 guard, the body shortcut and
the text digest compared URLs with theirs, so /page#a checked as /page#b was
refetched and rebuilt. They now compare and hash the URL without its fragment.

Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)
…ailed fallbacks, the prune, fragments

Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)
…pt, haiku when unset

The owner's request: the summary's model is theirs to pick per machine.
$.model.complete resolves the name as --model does (WEBFETCH_MODEL=luna),
the reply's Answered-by line and usage.jsonl name the model that answered,
and a name the engine refuses fails the summary, not the fetch.

Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)
… the regression sample, WEBFETCH_MODEL

Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T05:23:33.680630Z 98892b0 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 98892b01f0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread web/clipper/src/clip.ts
Comment on lines +386 to +387
content = contentDigest(finalUrl, body, wholeText)
if (previous && content === validators?.content) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include saved metadata in the content comparison

When an HTML page changes only its extracted metadata, this digest remains identical and the check returns the old generation indefinitely. The metadata is part of the saved frontmatter and the tool result, so it is content consumers actually read, not merely extraction bookkeeping. I reproduced this with the committed bundle: changing <meta name="author"> from Alice to Bob after aging the cache returned Alice with cached: true and a new checkedAt, while a forced refresh returned Bob. Include the persisted metadata in the comparison, excluding only fetch-time fields, so changes to authors, publication dates, titles, and descriptions can publish a new copy.

Useful? React with 👍 / 👎.

Comment thread web/clipper/src/clip.ts
Comment on lines +433 to +437
const own = fromResponse && !rendered
const recorded: Validators = {
...(own && res.headers.etag ? { etag: res.headers.etag } : {}),
...(own && res.headers['last-modified'] ? { lastModified: res.headers['last-modified'] } : {}),
...(own ? { body: sha256(res.body) } : {}),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid validating a shell after an unsuccessful render

If the first fetch of a JavaScript page cannot render successfully—for example, Chromium times out or the page's data API is temporarily unavailable—extractPage can retain the plain shell with rendered: false. This condition then records the shell's validators and body hash. Subsequent checks accept a 304 or identical shell bytes before reaching extractPage, so rendering is never retried even after the browser or API recovers; repeated checks can preserve the empty loading page indefinitely. Track the unsuccessful render attempt and avoid the response-level shortcuts for that copy, allowing a later check to retry rendering.

Useful? React with 👍 / 👎.

Comment thread web/clipper/src/cache.ts
Comment on lines +67 to +68
export async function recordCheck(entry: string, generation: string, checkedAt: string): Promise<void> {
await writeRecord(entry, CHECKED_FILE, CHECKED_TMP_PREFIX, { generation, checkedAt })

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve check timestamps for previously returned generations

When a generation fetched over seven days ago is confirmed and handed out, then a replacement generation is published and checked, this write overwrites the older generation's only check timestamp. prune subsequently treats the older generation as never checked and deletes it based on its original fetch time, even though its path was just returned to another session. This does not require concurrent operations: I reproduced it by checking a nine-day-old generation A, publishing and checking B, then pruning; A survived the first prune but was deleted after B's check. Keep check timestamps per generation so checking a replacement does not revoke the retention protection of recently returned paths.

Useful? React with 👍 / 👎.

@SSFSKIM
SSFSKIM merged commit 6ea3980 into main Oct 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant