Skip to content

design: what a picture costs — behold cannot say where 147 seconds went, and the estate read is all-or-nothing #419

Closed

Description

@lex00

Design and tracking, in the shape of #366, #397 and #410. Nothing here starts a build.

What

#367 measured behold's read cost and fixed half of it. The half it fixed was duplicate work: a shared FIFO budget across every chant read, in-flight sharing by read identity, cancellation per subscriber, and the removal of the browser's unconditional 3/8/15s follow-ups. That landed as cbede01.

The half it did not fix is the number itself, and it said so:

An 11-member Kubernetes estate took 153s to observe, then 147s on a repeated read with the source cache warmed. A single member made 217 API requests in 28s.

This addresses duplicate work and resource spikes; it does not remove Chant's per-read Kubernetes discovery cost. No production latency improvement is claimed yet.

Nothing tracks that. Two and a half minutes of blank screen for one picture of a real estate, on a warm cache, is the largest known defect in behold and it has no issue.

Why this is not a performance chore

behold's discipline is refusing to show an answer it does not have. _unobserved carries the reason it could not look. A card goes neutral rather than green when the plan did not mention it. The behaviour overlay splits a refusal from an absence so a missing engine can never read as an estate that costs nothing. Every one of those is the same move: name the gap rather than paper over it.

There is no equivalent for time. A member that has not reported yet is not missing and not unobserved — it is pending, and behold has no word for it. That absence is why the estate read is all-or-nothing: mapWithConcurrency and Promise.all await every member before /api/graph or /api/overlay returns anything (src/estate.ts:52-70, src/server.ts:1913), and SSE carries change notifications rather than graph content (src/server.ts:1356), so there is no partial picture to fall back to. Giving time the same vocabulary the other gaps already have is what turns 147 seconds of nothing into a picture that fills in.

behold cannot currently say where the time goes

  • There is no /api/doctor. src/doctor.ts is a CLI report (diagnose, formatReport) and nothing serves it.
  • memberIrCacheStats() returns hits, misses and entries, and its own comment calls it "cheap enough to expose for a future /api/doctor line". Nothing but its own test has ever called it.
  • There is no timing instrumentation on the read path at all. Every Date.now() in src/ is domain logic in operator, frames or gh-run.

So the 147 seconds is a single opaque number. Which member, which phase, how much was chant evaluating TypeScript and how much was the cluster answering — none of it is observable from inside behold, which is why the first milestone is measurement and not a fix.

The measurement has an obvious home. ReadScheduler (src/read-scheduler.ts, #367) is the chokepoint every chant read already passes through, and each job already carries an identity key built from the project, the resolved chant, the source stamp and generation, the argv and the effective environment. Timing keyed by that costs almost nothing and needs no new plumbing.

The rules

A completed live result is never cached. #367 settled that and this epic does not reopen it: live means live, and a cached live read is the same lie as a faked figure. Rendering a member before its neighbours is not caching — it is showing what has arrived and saying plainly that the rest has not.

Freshness is never implied. A member drawn from an earlier moment says which moment, the way component-status.ts already labels tier-3 evidence rather than colouring from it.

The invariant is untouched. Nothing here writes to a cloud or to source.

What stays chant's

The per-read Kubernetes discovery cost is chant's, and src/estate.ts's own comment already names the other half: each member read is "a whole Node process doing a full TypeScript evaluation of that member's source — seconds of CPU each, before the live half even talks to a cluster." Neither is worked around here. M1 exists partly so the upstream issue can be filed with a breakdown instead of one aggregate number.

Milestones

Refs #367, #295, #334, #393.

Activity

  1. added
    epic
    read-cost
    on Sep 16, 2026
  2. lex00 commented on Sep 16, 2026

    @lex00
    ContributorAuthor

    Ordering and current state.

    M1 and M2 are implemented on feat/420-read-cost-instrumentation and awaiting review as PR #425; both close when it merges.

    M3 is the milestone worth pulling forward. It carries one decision the issue deliberately leaves open — SSE carrying per-member IR as it lands, versus a polled partial payload — and it is the only one of the five that changes what a person sees. Everything else in the lane is measurement, a test ceiling, or a filing.

  3. lex00 commented on Sep 17, 2026

    @lex00
    ContributorAuthor

    All five milestones are done and there is no behold work left in this epic.

    The number this epic opened on, with the share that is chant's isolated. chant --help — argv parse, exit, no graph work — costs 799 ms. An 8-node graph read costs 1048 ms, so 76% of it is startup. behold shells the project's own chant per member because members pin different versions, so the 11-member estate behind the 147s is ~8.8 s of CLI startup before any graph work or any substrate call.

    That is the half behold could fix by not asking twice, and it has: the #367 budget and in-flight sharing, #307's source cache, the removed browser follow-ups. What is left per invocation is upstream, which is what #2481 asks about.

    Closing. The remaining latency work is chant's, tracked there.

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

    epicread-cost

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions