STRA-338 S7: last_activity at the start and end of a request reads the request's clock

run_backend_worker (twice per request) and the stdio worker's run_session (once per request) stamp last_activity with
ObsHandle::now(). The stamps at attach or READY and the per-engine-line stamp keep Instant::now(). The instant-now ratchet
of strata-control falls from 26 to 23. Docs: gateway-ports.md lists what is and is not behind the Clock.
This commit is contained in:
Pavlo Ratushnyi
2026-11-06 01:36:49 +01:00
parent c0f6888310
commit e765c06ae3
4 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -180,7 +180,7 @@
"instant-now:leleka-npu-service": 5,
"instant-now:leleka-obs": 3,
"instant-now:leleka-runtime": 17,
"instant-now:strata-control": 26,
"instant-now:strata-control": 23,
"instant-now:strata-desktop-core": 15,
"path-include:leleka-cuda-driver": 115,
"path-include:leleka-model-format": 12,
@@ -166,13 +166,13 @@ pub async fn run_backend_worker(
{
continue;
}
status.write().await.last_activity = Some(Instant::now());
status.write().await.last_activity = Some(command.request.obs.now());
let _activity = command.activity.take();
match serve_one(&engine, &config, &status, &mut shutdown, &mut command, &loaded)
.await
{
Served::Done => {
status.write().await.last_activity = Some(Instant::now());
status.write().await.last_activity = Some(command.request.obs.now());
refresh_prefix_view(&engine, &config).await;
}
Served::Shutdown => {
+1 -1
View File
@@ -180,7 +180,7 @@ pub(super) async fn run_session(
if command.result.is_closed() || command.queue.take().is_some_and(|ticket| !ticket.claim()) {
continue;
}
status.write().await.last_activity = Some(tokio::time::Instant::now());
status.write().await.last_activity = Some(command.request.obs.now());
// Retain the command activity until protocol cleanup,
// including STOP/QUIT and failed-process termination.
let _activity = command.activity.take();
+4 -3
View File
@@ -62,10 +62,11 @@ Completions translation) is the crate `leleka-gateway-domain` (layer L2); `strat
* The request's own stamps read the `Clock`: `Observe.clock` (the router builds it from `services.clock`) goes into the
request record `ReqCtx`, which stamps `admitted`, `engine_start`, `first_token` and the line written at the end with it.
The backend worker's `serve_one` and `conclude` and the stdio worker's `combine_done` take the start and end of a
request from `ObsHandle::now()` (the clock of the request's record; the system's when the request has none). Those are a few
stamps per request and none per streamed token or event.
request, and the `last_activity` stamps at the start and the end of a request, from `ObsHandle::now()` (the clock of the
request's record; the system's when the request has none). Those are a few stamps per request and none per streamed token
or event.
* Still direct `Instant::now()`, tracked with the `instant-now` ratchet in `architecture-baseline.json`: the activity
stamps of the worker supervisors (`last_activity`), the per-event progress stamps and the cancel and stop-drain deadlines
stamps of the worker supervisors at attach or `READY` and per engine line, the per-event progress stamps and the cancel and stop-drain deadlines
inside the streaming loops, the metrics counters, the MCP hub and server, the model fetch, the memory, prefix and
hardware views, the request monitor and the stage trace.