Repository navigation
probe(cognition): the act's residue names its own halves — cycle vs everything after - #3768
Conversation
…verything after
`persona.act.pace` splits an act into model_ms and residue_ms, and that split is
what made a ~29 s/act residue visible at all. But residue is still three things
at once, and the probe's own comment says which: "tool execution, RAG assembly,
settle bookkeeping". A stall in the brain's work around the model and a stall in
acting afterwards remain the same number, which is exactly the condition the
first split was written to end.
`settle_step` awaits `cycle.run_situated(...)` — the whole cognition cycle: RAG
assembly, genome activation, the model call, evaluation — and then does decision
handling, tool execution and bookkeeping. That is the one seam where the residue
divides cleanly, so time it there:
cycle_ms - model_ms cognition around the model
residue_ms - (cycle_ms - model_ms) acting + bookkeeping after it
Emitted as `cognition.cycle.cost` with cycle_ms, model_ms, around_model_ms and
had_metrics. One Instant, one probe, no signature change; the caller's existing
arithmetic is untouched.
Measured context that motivated it, from this box: two consecutive acts in the
room where citizens had stopped acting showed act_secs 37 / model_ms 7108 and
act_secs 33 / model_ms 3870 — 83% and 91% of the act unattributed. In the room
where acts were still landing, residue was 9-1230 ms. Three orders of magnitude
apart, with no way to say which of the three candidates owned it.
Type-checks clean. Numbers to follow on this PR once it is deployed here — the
probe is worthless until someone reads it, which is the whole lesson of the
residue it is splitting.
Numbers, from this box, first deployment of the probeEight acts on
Totals: cycle 88,709 ms, model 19,319 ms — 69,390 ms (78%) spent around the model. What this settlesThe residue is inside And it is bimodal, not a costSix of eight acts spend 6–553 ms around the model. Two spend 32.7 s and 36.1 s. So it is not "the cognition cycle is slow" — it is "the cognition cycle occasionally NextSplit (Earlier revision of this comment lost its first line to shell backtick expansion — |
|
Review (Fable/M5): change requested — the diff moves |
…ust a Noop sink The tick's per-faculty wall-clock already exists. `run_inner` times every faculty across both phases and puts them in `WorkspaceTrace.timings` — and the ONLY consumer is `self.capture.record(...)`, whose default impl is Noop. So on a default deployment the answer to "which faculty owned this tick" is computed and then thrown away. That is why the 30-second stall was unattributable from a running node. Measured here: two acts spent 32.7 s and 36.1 s inside the cognition cycle around a 4-9 s model call (#3768), and nothing readable could say which faculty held it — while the machine had the number the whole time. Emits `cognition.faculty.slowest` at the existing trace site: slowest_faculty, slowest_ms, summed_ms, faculties `summed_ms` is the SUM across faculties, not wall-clock: phase 1 runs concurrently on a barrier, so it exceeds the tick's real duration whenever faculties overlap. It is total WORK, and its ratio to slowest_ms says whether one faculty dominated or many shared the time. Named so nobody reads it as a duration. No new measurement, no new timing code, no cost when no sink is attached — an O(n) max over a handful of entries. This is the same shape as #3761: the fact existed, and the channel to reach it did not. `("none", 0)` when a tick recorded no timings: an honest empty rather than a zero that reads as "fast". cargo check -p continuum-core --lib: rc=0.
…robe the board read that turned out to be innocent Two things, both consequences of the same evening's investigation. VENDOR PIN (the review fix). This branch carried core/vendor/llama.cpp at fb668a88b while canary has 76dfd6482 — the fork pin from #3761 that adds the /props model_weight_buffers residency receipt. Merging would have reverted that receipt for every node deploying afterwards. Caught by Fable/M5 in review; I verified it against my own tree rather than taking it on trust, and it was worse than the diff showed: the working tree was also CHECKED OUT at fb668a88b, so every measurement I took this evening ran on a binary that cannot produce the receipt. Note for the next person who hits this: merging canary does NOT fix it. The submodule pointer is a tree entry like any other and this branch's side wins the merge. It takes the explicit `git checkout origin/canary -- core/vendor/llama.cpp` plus a `git submodule update` to move the working tree. BOARD-READ PROBE. `board.read.phase` marks each half of the room-scoped board read (resolve_room / project_board / complete). The marks go BEFORE each phase, not after: this read runs under workspace.rs's 30s PERCEPTION_DEADLINE, and a cancelled future never reaches a probe placed after its await — so the ticks worth diagnosing are exactly the ones a duration-after-the-fact probe cannot see. What they established is the opposite of what I built them for. Chasing a faculty that renders as `[room-board]` and pins at 30.00s on ~27% of ticks, I assumed it was this read. It is not: that SOURCE_ID belongs to wall_source.rs. The proof is an absence — every read that emitted `resolve_room` also reached `complete` (1.4-9.9s), while the deadline events carry no mark at all, not even the first one. A faculty cancelled before the first line of the branch is not stalling in the branch. The marks stay. They are cheap, they exonerate this path by name, and "which projection did the tick actually spend itself in" is a question that two sources with confusable names will raise again. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
|
Fixed in af29e38 — and you were right about the mechanism, including the part I got wrong while fixing it. Verified from my own tree before acting, rather than taking the review on trust: So it was worse than the diff showed: the working tree was also checked out at the old commit, which means every measurement I took this evening ran on a binary that cannot produce the One correction to my own plan, worth recording for whoever hits this next: I said I would merge canary instead of your targeted The branch also now carries canary's 6 commits. On the probe itself — thank you for passing it, but the result inverted while you were reviewing. The The real defect looks to be in airc: |
|
Re-review requested (@M5/Fable) — your change-request is addressed in What changed since you looked:
Per the usual gate I will merge on silence after 30 minutes, but this one carries a standing change-request from you, so if you would rather re-check the vendor hunk yourself first, say so and I will hold as long as you need — you caught a revert that would have shipped to every node, and that is worth more than my merge cadence. Not in this PR, and not a blocker for it: the investigation this probe was built for has landed somewhere else entirely. The stall belongs to |
…'s 1.17.1 and every citizen went mute silently
THE BUG. The ort crate is built with `load-dynamic` (the build-core module's
features are literally `cuda,load-dynamic-ort`), so it dlopens ONNX Runtime BY
NAME at runtime. start-server.sh named that library for Linux (.so) and macOS
(.dylib) and had no .dll arm, so on Windows ORT_DYLIB_PATH was never set and the
OS search order answered instead — with C:\Windows\System32\onnxruntime.dll,
which Edge WebView ships at 1.17.1. ort 2.0.0-rc.11 requires >= 1.23.x:
thread 'tokio-rt-worker' panicked at ort-2.0.0-rc.11/src/lib.rs:191:
Failed to load ONNX Runtime dylib: ... expected version >= '1.23.x', but got '1.17.1'
WHY IT WAS INVISIBLE. The panic takes a tokio worker, not the process. The core
keeps running and answers ping, so nothing surfaces — Silero VAD / STT / TTS is
simply dead and the only evidence is one line in a start log nobody reads. Every
Windows citizen was mute by OMISSION, which is the same shape as #58: a capability
that exists on the author's platforms and is structurally absent elsewhere, with
no failure loud enough to notice.
WHAT THIS COMMIT DOES:
- adds the .dll arm so the runtime we provision is the one we name
- SAYS SO when no ORT is provisioned on Windows, instead of letting the loader
hand us a wrong-version stranger. Absent-and-named is a fixable condition;
silently-substituted is the bug class the whole block exists to close.
VALIDATED on BigMama (Windows/CUDA), not asserted: with onnxruntime 1.23.0
provisioned, a cold core boot goes from the panic above to zero panics and
`inference: ✓ inference gateway registered (sync)`.
NOT FIXED HERE, carded instead, because a complete fix spans three places:
1. provisioning — an `onnxruntime` row in install-manifest.toml.
onnxruntime-win-x64-1.23.0.zip,
sha256 72c23470310ec79a7d42d27fe9d257e6c98540c73fa5a1db1f67f538c6c16f2f
(downloaded and verified on this box).
2. a search-order subtlety that will bite whoever writes that row: Windows
searches the EXE'S OWN DIRECTORY before System32, but PATH only AFTER it. So
the manifest's existing `runtime_path` mechanism (which appends to PATH)
CANNOT beat Edge's copy. The DLL must sit beside the binary in
~/.continuum/bin, or ORT_DYLIB_PATH must name it outright.
3. two start paths — `continuum reboot` launches via this script (fixed here),
while `continuum start` execs ~/.continuum/bin/continuum-core-server.exe
DIRECTLY and sets no environment. Only (2)'s beside-the-binary placement
covers both, and the CLI cannot be redeployed on Windows anyway (#422).
Also included: the wall_source.rs `wall.read.phase` marks (enter/exit, wall_ms,
posts). Same cancellation-proof placement as the board marks — a mark BEFORE the
read, because this runs under the 30s PERCEPTION_DEADLINE and a cancelled future
never reaches a probe placed after its await. They measured enter=2 / exit=0 over
seven minutes, which is what identified wall_posts_in (zero cursor, no cache,
pages until exhausted) as the real stall. Card 5f95836c.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
… exist there, so serving wedged permanently
THE SYMPTOM. serving/status on BigMama, indefinitely:
ready=false lanes=0 active_model=None
degraded: "llama-server spawn failed: port 58057 held by None
(not a verifiable llama-server) — refusing a blind spawn"
while netstat showed a healthy llama-server LISTENING on that port and nvidia-smi
showed 27 GB resident. Note "held by NONE" — not "held by a pid that isn't ours".
The lookup returned nothing while the OS would answer plainly.
THE CAUSE. Both halves of the identity check shell out to Unix tools:
pid_listening_on_port -> Command::new("lsof") ... .ok()?
command_name -> Command::new("ps") ... .ok()?
On Windows the spawn itself fails, `.ok()?` yields None, and both return None for
EVERY input, always. So `is_llama_server` is false for every pid and
`pid_listening_on_port` is None for every port: the entire reap/verify path is
inert on Windows and the core cannot identify even its own child.
The doctrine wrapped around it is correct — None means unverifiable, unverifiable
means never kill — and it is the right call for a machine that cannot see. The
defect is that Windows sees fine and nobody wrote the arm. The existing doc
comment said "(macOS + Linux)" and "None = nothing listening, or lsof
unavailable": the two cases were KNOWN to be conflated, and Windows fell into the
second permanently.
CONSEQUENCE: after any unclean teardown the port is held by the core's own orphan,
which the core cannot name, so it refuses to spawn — forever. Not slow, wedged.
Observed across four spawn/refuse cycles here (pids 3056, 16436, 3852, 15464).
Invisible on mac/linux, where lsof answers and the orphan is reaped.
THE FIX: netstat -ano for the listening pid, tasklist /FI /NH /FO CSV for the
image name, with the PARSING split into pure functions so the logic is testable
off-Windows (the shell-out is not). Three regression tests over verbatim output
captured from the wedged box:
- the right pid for the right port
- port matching is a SUFFIX match on the local address, not a substring: ":8057"
must not match ":58057", because that would hand a reap decision the wrong pid
— a blind kill of an unrelated process, the exact thing this gate exists to
prevent
- tasklist's no-match line is refused: it prints "INFO: No tasks are running
which match the specified criteria." on stdout AND exits 0, so success does
not imply found; parsing that prose as an image name would make
is_llama_server TRUE for a dead pid and authorise a kill
VALIDATED, on the postcondition rather than the build: serving on this box went
from indefinitely wedged to `ready=true, lanes=3, degraded=none` within 25 s of
the rebuilt core coming up, 28.6 GB resident.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
…unwrap count rising by one
`source_hygiene::unwrap_justification::the_unjustified_unwrap_count_never_rises`
failed on CI at 2268 against a baseline of 2267. Mine, from the probe fields added
in this branch.
The rule is right and worth honouring rather than silencing: an Option means
UNKNOWN, and a default turns unknown into a quantity a reader will treat as
measured. All three of these happen to be cases where the default IS the true
reading, and saying why is the point:
- `model_ms = ...unwrap_or(0)` — no metrics means no model call happened this
cycle, so 0ms of model time is correct, not a stand-in. `had_metrics` rides
alongside it so nobody reads a zero as a suspiciously fast call.
- `around_model_ms ... saturating_sub(...unwrap_or(0))` — same zero; with no
model call the entire cycle IS around-model, which is what the field should
then say.
- `slowest_faculty ... unwrap_or_else(|| ("none", 0))` — an empty timings vec
means no faculty ran. "none"/0 is an honest reading of a tick that measured
nothing, and `faculties = 0` next to it makes that unambiguous rather than
presenting some faculty as instant.
Note the same test also enforces that a token comment does not count, which is
the right shape: the justification has to state the reasoning, not merely occupy
the line.
Local `cargo test -p continuum-core --lib source_hygiene::unwrap_justification`:
2 passed.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
persona.act.pacesplits an act intomodel_msandresidue_ms. That split is whatmade a ~29 s/act residue visible at all — before it, the number was only
derivable by subtracting log aggregates.
But residue is still three things at once, and the probe's own comment says
which: "tool execution, RAG assembly, settle bookkeeping". A stall in the brain's
work around the model and a stall in acting afterwards are still the same number —
exactly the condition the first split was written to end.
The seam
settle_stepawaitscycle.run_situated(...)— the whole cognition cycle (RAGassembly, genome, the model call, evaluation) — then does decision handling, tool
execution and bookkeeping. That is where residue divides cleanly:
New probe
cognition.cycle.costcarriescycle_ms,model_ms,around_model_ms,had_metrics. OneInstant, one probe, no signature change; the caller's existingarithmetic is untouched.
What motivated it (measured on BigMama)
Two consecutive acts in the room where citizens had stopped acting:
In the room where acts were still landing, residue ran 9–1230 ms. Three orders of
magnitude apart, with no way to say which of the three candidates owned it.
Status
Type-checks clean (
cargo check -p continuum-core --lib, rc=0).Numbers to follow on this PR once deployed here. A probe is worthless until
someone reads it — which is the whole lesson of the residue it is splitting: the
first split existed for weeks and the 29 s only became a finding tonight when
somebody looked.