Skip to content

model_loader.cpp is cited by line number from 109 sites in 45 files, so any edit near its top invalidates them silently #1143

Description

@localai-bot

src/vllm/entrypoints/model_loader.cpp is cited by absolute line number from 109 distinct sites across 45 files — specs, matrices, docs and code comments in other translation units. The file is ~1640 lines and is edited by almost every engine and model row. So any edit near its top silently invalidates every citation below it, in files the editing change never opens.

Measured, on this change

PR #1132's repair round (#1136) inserts about 45 lines near line 100 of that file: one struct and one helper (AutoDeviceResolution / ResolveAutoDevice), so that ResolveModelDeviceType and SelectQueueForModel can share one description of the auto arm.

Comparing the TEXT at every cited line between the reviewed head e7d0a1f7c and the repaired head:

citations checked, unmoved      : 10
citations MOVED by this change  : 203   (109 distinct citing sites, 45 files)
out of range in one revision    : 0

Read that carefully: 203 is line references, 109 is citing sites, and neither number says how many were CORRECT beforehand. Spot-checking says several were already stale at e7d0a1f7c.agents/model-matrix.md:197 cites model_loader.cpp:184-223 as the "live loader" while line 184 at e7d0a1f7c is static const bool once = [] { inside the VT_LOAD_STATS helper. So this is not a claim that one change broke 109 good citations; it is a measurement that the surface cannot survive an ordinary edit, and that nobody can tell the two cases apart today.

Why the repair round did not sweep it

Two reasons, both deliberate:

  1. It is 109 sites in 45 files, most of them in specs owned by other rows. That is a sweep with its own scope, not a record edit riding along with a device-fit repair.
  2. Distinguishing "this change broke it" from "it was already wrong" needs a per-citation judgement about intent that no script can make. Rewriting all 109 from the current tree would launder pre-existing debt into a clean-looking record — the opposite of what the record is for.

What the round DID fix is the two anchors it authored itself (tests/vllm/entrypoints/test_gguf_device_fit_reach.cpp and tests/vllm/model_executor/test_gguf_device_fit.cpp), and it added them to its own anchor verifier so they cannot go stale inside their own pull request — which is what happened to platforms/cuda.cpp:67 in the round before.

The shape of a fix

Not chosen here. The candidates, in rough order of cost:

  • Cite symbols, not lines, for anything crossing a file boundary: model_loader.cpp ResolveAutoDevice rather than model_loader.cpp:100-115. A symbol name survives every edit that does not rename it, and git grep finds it. This is the only option that removes the class rather than re-baselining it.
  • A gate that checks anchors, holding each file:line against an expected substring. The repair round wrote a throwaway version (72 anchors, hardcoded expectations, no row reading its expectation from the file it checks — that shape is a tautology, see Spec-body file:line anchors are unchecked (4772 of them) and an anchor into a file the row is editing is stale by default: one spec shipped 8 stale anchors, then 7 more from the merge alone #911). Making it a real checker is a checker change and needs its own spec, and the expectation table is itself a record surface that every PR would have to edit, which AGENTS.md calls a lock.
  • Split model_loader.cpp. It is a 1640-line file doing config resolution, device selection, load-stats instrumentation, draft-model resolution, GGUF dispatch and engine-stack assembly. The citation blast radius is a symptom of the size.

Owner: needs one. Filing it against no row would make it the untracked kind check-agent-record.py counts, so it is listed under ## Owed in expert-streaming.md until a row claims it, on the grounds that ENG-EXPERT-STREAM is the row that measured it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions