Skip to content

the first request of a process goes out un-laned: the cached sheet is not read before it is sent #397

Closed

Description

@santoshkumarradha

What happens

After #318 (PR #354) every headless door runs the process lane beat, and priors are in force from a run's SECOND call on. The FIRST call of every process (compile, sent in the process's first millisecond) still goes out with no lane, in run 1 and in run 2 alike, because the beat's first fetch has not landed yet and Refresh may never sit on a send path.

Measured on the combined build (#353 + #354, dev bcd098e + fix/318-routing), fresh AFORGE_HOME, shipped default, two consecutive aforge do runs: run 1's logs/calls.jsonl has 7 rows, rows 3-7 laned (CoreWeave, DigitalOcean), rows 1-2 (compile start/end) lane=-. Run 2, with v3/lanes/deepseek%2Fdeepseek-v4-flash-0731.json on disk and 30 sheet-known beliefs in v3/lanes.json, shows the same un-laned first pair.

Why this is wrong

Run 2 has everything it needs on disk before the first request is built. A cached sheet younger than the TTL is a prior the beat itself primes from without fetching (lanes.Beat first pass, primeFrom); it is read asynchronously, a moment too late for the opening call. The process's first request is the one most likely to be a compile on a cold model, which is exactly the call that pays for a bad lane the longest.

Run 1 (no cache anywhere) is the honest exception: nothing can be read, and blocking the first request on a network fetch is forbidden by the lane package's opening law. This issue is about run 2 and every process after it.

Replication

  1. Fresh AFORGE_HOME, shipped default (or the lanestub with an endpoints page).
  2. aforge do "<tiny task>" twice.
  3. Read the second run's call log: the first compile start row carries no lane field; the rows after it do.

Fix direction

Prime the ledger from the cached sheet SYNCHRONOUSLY at the seam where the beat is seated (installMeasuredRulers → startLaneBeat), before the first client is built: a cache read is a local file, not a fetch, so the send-path law is kept. The beat then only refreshes. Not a do-only change; the same seam serves chat.

Acceptance

  • E2E (lanestub): after one aforge do has written the sheet cache, the NEXT do's first call row carries a lane.
  • Run 1's first call may stay un-laned; the test states it.
  • No fetch on the send path (the existing structural tests for that law stay green).

Drafted with CodeAF · reviewed and owned by the author

Activity

  1. santoshkumarradha commented on Sep 10, 2026

    @santoshkumarradha
    MemberAuthor

    Consolidated into #816 — one breaker for the failures nobody named, and a sheet that is read before the first call. This issue's evidence, boundary reasoning and acceptance are reproduced there in full under its own heading; the lane that takes #816 takes this. Nothing is lost — this issue stays readable and #816 links back to it.

    #445 named #138 outright as 'the breaker #138 wants', so those two were always one design; #397 is the same ledger at its other end. All three live in internal/provider + internal/lane, and since they were filed #793 landed ONE refusal door (Client.refuseLane) with a go/ast law test that fails the build if a second writer appears — so they have to be done through that door, together. Closed as part of the 2026-09-10 triage sweep; verified still live at dev@95a0d0a9b.

  2. added
    bug
    on Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions