Skip to content

fix(onlion): the fold budget became a deadline; the request line records the method - #134

Merged
wefio merged 1 commit into
mainfrom
fix/fold-deadline-and-method
Oct 30, 2026
Merged

wefio merged 1 commit into
mainfrom
fix/fold-deadline-and-method

Conversation

@wefio

@wefio wefio commented Oct 30, 2026

Copy link
Copy Markdown
Owner

What

  • Doc owner: docs/decisions/implemented/2026-10-30-fold-budget-is-a-deadline.{md,zh-CN.md,terms.yaml} — supersedes the platform claim in 2026-10-30-fold-runs-after-the-response.
  • foldPending(env, userId, { deadline }) refuses to start past the deadline and checks it between entries, leaving the rest of the batch in the log (safe: entry is durable, folding idempotent, next scheduled accept retries). Accept passes startedAt + foldBudget; /admin/fold passes 100 s.
  • Confirmed from production logs that execution: "inline" on every request: the Makers Node cloud function context has no waitUntil (documented: uuid / params / env / clientIp / server). The hook the previous round cited is a Pages Edge Function feature — different runtime. The fold-after-response never took effect; nothing depends on it now.
  • nmg_request gains method (the two 404s at 16:59 were 24-47 ms on dead-cold 81 MB isolates — not POST work requests; this makes the next one identifiable instead of guessed).

Not verified

Not yet deployed (local verify 37 PASS, CI pending). The fold deadline is bounded by construction but no burst has been re-measured; the 404 rows remain unexplained until a method value shows up.

…records the method

Two production facts, both from log lines:

1. Every request since the stabilisation deploy reports execution: "inline" -
   the Makers Node cloud function context has no waitUntil (documented
   properties: uuid / params / env / clientIp / server). The waitUntil the
   previous record cited belongs to Pages Edge Functions, a different runtime.
   So "the fold runs after the response" never took effect; the accept folds
   inline, and the 15:00 distribution (p50 1.02 s, tail 6.5 s) was that shape.

2. The fold budget was a start gate: `Date.now() - startedAt < foldBudget` only
   decided whether a fold began, and a fold beginning at 19.9 s still ran a
   whole partition rewrite plus a 32-record backfill. That is the 14:09-14:15
   mechanism (Adds 11-25 s, tail 100.7 s, five 120 s kills, every stack in
   foldPending).

foldPending now takes { deadline }, refuses to start past it, and checks it
between entries - stopping leaves the remainder in the log, which is safe
because the entry is already durable and folding is idempotent. The accept
passes startedAt + foldBudget, /admin/fold passes 100 s. The waitUntil branch
stays for runtimes that provide one; nothing depends on it.

Also: two /add and /search requests answered 404 in 24-47 ms on dead-cold
isolates (81 MB, SQLite never loaded). Those routes accept POST only, so they
were not work requests; nmg_request now carries method, so the next one is
identified instead of guessed.

Recorded in docs/decisions/implemented/2026-10-30-fold-budget-is-a-deadline.*
@wefio
wefio merged commit 6849dee into main Oct 30, 2026
8 checks passed
@wefio
wefio deleted the fix/fold-deadline-and-method branch October 30, 2026 09:58
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