Skip to content

Studio: give the liveness polls one shared heartbeat instead of one each - #8310

Merged
danielhanchen merged 6 commits into
mainfrom
studio-liveness-heartbeat
Aug 10, 2026
Merged

danielhanchen merged 6 commits into
mainfrom
studio-liveness-heartbeat

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Seven paths all answer the same question, "is the server up and answering". Each of them already heartbeats to 10s via _QUIET_POLL_PATHS, but each keeps its own bucket, and the SPA fires them together in one burst, so the log gets seven lines every ten seconds instead of one. They now share a single bucket.

Measured

Four Studio sessions, counting only /api/health, /api/auth/status, /api/inference/status, /api/inference/monitor, /api/inference/{images,video,audio/stt}/status:

session minutes access lines of those, liveness distinct 10s windows saved
A (chat, 4 tabs) 57 1717 852 (50%) 223 629 lines, 37% of the access log
B (training) 57 848 583 (69%) 188 395 lines, 47%
C (diffusion) 52 729 424 (58%) 158 266 lines, 36%
D (settings/API) 39 723 280 (39%) 100 180 lines, 25%

"Distinct 10s windows" is how many lines a shared bucket would emit, so the last column is the exact saving. On an otherwise idle Studio with one tab open this is the floor of the log: nothing is happening and the log still fills.

What changed

_LIVENESS_POLL_PATHS is the pure-liveness subset of _QUIET_POLL_PATHS. A 2xx GET on any of them dedups against one shared key instead of its own (method, path, query, status), so the first of each burst logs with its real path and the rest of that 10s window is dropped.

The query string is dropped from that key deliberately: these polls carry no meaningful query, and keeping it would split the bucket again.

Only this group is shared. The other _QUIET_POLL_PATHS entries, /api/train/runs, /api/models/checkpoints, /api/models/local, /api/rag/knowledge-bases and the legacy download polls, each report on a different subsystem, so collapsing them together would genuinely lose information. They keep their own heartbeat.

What stays logged

  • One liveness line every 10s, with its real path, so "the SPA is polling and the server is answering" is still visible and still timestamped.
  • Every non-2xx, every time. Dedup only ever applies to GET/2xx, so a health check that starts failing logs on every single poll even in the middle of a burst. There is a test for exactly that.
  • Every other path, unchanged.
  • --verbose restores all of them, as before: it zeroes both windows.

Tests

test_logging_middleware.py gains four cases and one existing case is updated:

  • test_indicator_status_polls_collapse_to_one_shared_heartbeat replaces test_indicator_status_polls_collapse_to_a_heartbeat. The old case asserted each of the four indicator paths logged exactly once per window, which is the behaviour this PR intentionally supersedes; it now asserts the whole burst produces exactly one line.
  • test_health_and_auth_status_share_the_liveness_bucket
  • test_non_liveness_quiet_polls_keep_their_own_heartbeat
  • test_a_failing_liveness_poll_always_logs (a 503 mid-burst logs all three times while the 2xx collapses to one)
  • test_verbose_restores_every_liveness_line

tests/test_logging_middleware.py + tests/test_load_progress_throttle.py: 34 passed.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 86169c96ed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# The liveness group shares one bucket, so a burst of them logs once, not once
# per path. The query string is dropped from that key on purpose: these polls
# carry no meaningful query, and keeping it would split the bucket again.
key = _LIVENESS_DEDUP_KEY if is_liveness else (method, path, query, status_code)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve query identity for parameterized STT status calls

When the voice settings or dictation flow calls fetchSttStatus(..., model), /api/inference/audio/stt/status receives a meaningful model query that extends its downloaded-model check for custom repositories. Replacing every liveness request with this query-less key means that request's access log is suppressed whenever any health or runtime-status 2xx completed during the preceding 10 seconds, masking its status and latency even though it is not equivalent to the background no-query poll. Keep the query in the key for parameterized STT requests, or only use the shared key when the query string is empty.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, fetchSttStatus(refreshKey, model) is a real caller and that request is not the background poll. Only the query-less form joins the shared bucket now, so a parameterized status call keeps its own line.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 222215592f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread studio/backend/loggers/handlers.py Outdated
# polls) each report on a different subsystem, so they keep their own heartbeat.
_LIVENESS_POLL_PATHS = frozenset(
{
"/api/health",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep health probes in their own heartbeat bucket

When the SPA issues these requests concurrently during startup, a fast status request stamps the shared bucket before /api/health finishes, so the health request's access line and process_time_ms are suppressed for the next 10 seconds. This endpoint is not equivalent latency-wise: main.py deliberately waits up to one second for hardware detection, and documents a two-second desktop preflight deadline whose timeout is not retried. Grouping it with the cheap status routes therefore hides slow-but-successful health calls precisely when diagnosing proximity to that deadline matters; keep /api/health on a separate heartbeat key.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, /api/health is not latency-equivalent to the cheap status polls. It is out of the shared bucket and back on its own heartbeat, so a slow but successful health call still shows its process_time_ms.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 028cded5cf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread studio/backend/loggers/handlers.py Outdated
_LIVENESS_POLL_PATHS = frozenset(
{
"/api/auth/status",
"/api/inference/status",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Give the slow inference probe its own heartbeat

When the loaded-models poll issues its four status requests concurrently, a cheap image/video/STT response normally stamps this shared key before /api/inference/status completes, so the latter's access line and process_time_ms are suppressed. That route can run a cold subprocess capability probe and a GitHub freshness request with a five-second timeout in get_status, making its latency at least as diagnostically relevant as the separately bucketed health route; keep /api/inference/status on its own heartbeat so these slow successful probes remain visible.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked the handler and agreed: get_status reads llama.cpp capabilities and runs a release-freshness check in an executor, so it is not latency-equivalent to its siblings. It is out of the shared bucket, like /api/health.

{
"/api/auth/status",
"/api/inference/status",
"/api/inference/monitor",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep API-monitor reads in a subsystem-specific bucket

When the API Monitor page is open while the global loaded-model card is polling, one of the card's cheap status responses can continually stamp this shared key before /api/inference/monitor completes, eliminating the monitor heartbeat from the access log. This endpoint is not a pure liveness check: get_api_monitor reads subject-scoped request history, queue state, active requests, and whether monitoring is enabled, so its periodic line is the only access-log evidence that this separate monitoring subsystem is being refreshed; retain its own heartbeat just like the other subsystem-specific quiet polls.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left this one shared. get_api_monitor is an in-memory read of request history and queue state, so it is not the slow-probe case that took /api/health and /api/inference/status out. The bucket only collapses a 2xx within 10s of another liveness 2xx, the first line of each burst still logs with its real path, and any non-2xx always logs, so a monitor refresh that is actually failing or slow is still visible.

danielhanchen and others added 5 commits August 10, 2026 08:31
Only the query-less form of a liveness path joins the shared bucket, so
/api/inference/audio/stt/status?model=... keeps its own access line.
It waits up to a second for hardware detection and the desktop preflight has a
two-second deadline, so a slow but successful health call is worth a line of
its own rather than being stamped out by a cheap status poll.
@danielhanchen
danielhanchen force-pushed the studio-liveness-heartbeat branch from 028cded to 95c499b Compare August 10, 2026 08:35

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 95c499bfb4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# worth seeing on its own rather than being stamped out by a cheap status poll.
_LIVENESS_POLL_PATHS = frozenset(
{
"/api/auth/status",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep auth status in its own heartbeat bucket

When a route guard or login/password-change form requests /api/auth/status within ten seconds of any successful runtime poll, the shared key suppresses the auth request's access line. This endpoint is not a runtime liveness probe: app/auth-guards.ts uses its initialization and password-change state to select redirects, and auth-form.tsx treats it as the server-side source of truth when local storage may be stale. Keep this auth-bootstrap flow in a separate heartbeat bucket so successful reconciliation requests remain distinguishable from loaded-model polling.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same reasoning as the monitor one. /api/auth/status is a cheap state read, and the guard and form flows care about the response, not about its access line. Suppression only applies to a 2xx inside a 10s window that already logged a liveness line, so the bootstrap sequence is still traceable and any failure still logs.

get_status reads llama.cpp capabilities and runs a release-freshness check in
an executor, so like /api/health its latency is worth its own line.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: de983b4726

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 64f6ed5 into main Aug 10, 2026
41 of 44 checks passed
@danielhanchen
danielhanchen deleted the studio-liveness-heartbeat branch August 10, 2026 10:36
danielhanchen added a commit that referenced this pull request Aug 25, 2026
Log reduction in Studio is several PRs deep (#6377, #7087, #8310, #8311)
and every round started the same way: someone noticed a log was huge,
measured it, and trimmed it. Nothing stopped the next chatty endpoint,
and nothing told the author they had added one.

Five guards, all CPU-only, no network, no sleeping. A 30 minute idle
session and a 5 minute in-flight session are replayed through the real
LoggingMiddleware against a virtual clock, so a thirty minute scenario
runs in a second and lands identically on a loaded runner.

  budget       lines per class against a formula of the poll period and
               the dedup window, plus an envelope on the whole scenario
  classify     a path cannot be quieted without recording how often it
               is polled, and cannot be polled without being classified
  signal       failures and mutations log at every interval, and the
               scenario is proved to have exercised the real middleware
               before any count from it is trusted
  parity       one JSON fixture defines a successful access record for
               both the backend and the desktop shell
  bounds       every log family prunes, and the two line caps agree

The signal guard is the point. An upper bound on log lines is satisfied
just as well by a middleware that was never mounted, a logger replaced
with a no-op, a scenario that stopped issuing requests, or an error log
someone deleted to get under the number. Each of those now fails.

Two ledgers record what is already broken rather than weakening the
rules to accommodate it: /api/settings/remote-access and /api/liveness
sit in the 300ms burst class and write a line per poll, and the
llama-server and diffusion-server directories never prune. Both ledgers
are self-expiring, so fixing an entry forces its removal.

Verified by mutation: eight deliberate breakages, each turning exactly
the intended guard red.
danielhanchen added a commit that referenced this pull request Aug 25, 2026
* Studio: guard log volume in CI so it cannot regress unnoticed

Log reduction in Studio is several PRs deep (#6377, #7087, #8310, #8311)
and every round started the same way: someone noticed a log was huge,
measured it, and trimmed it. Nothing stopped the next chatty endpoint,
and nothing told the author they had added one.

Five guards, all CPU-only, no network, no sleeping. A 30 minute idle
session and a 5 minute in-flight session are replayed through the real
LoggingMiddleware against a virtual clock, so a thirty minute scenario
runs in a second and lands identically on a loaded runner.

  budget       lines per class against a formula of the poll period and
               the dedup window, plus an envelope on the whole scenario
  classify     a path cannot be quieted without recording how often it
               is polled, and cannot be polled without being classified
  signal       failures and mutations log at every interval, and the
               scenario is proved to have exercised the real middleware
               before any count from it is trusted
  parity       one JSON fixture defines a successful access record for
               both the backend and the desktop shell
  bounds       every log family prunes, and the two line caps agree

The signal guard is the point. An upper bound on log lines is satisfied
just as well by a middleware that was never mounted, a logger replaced
with a no-op, a scenario that stopped issuing requests, or an error log
someone deleted to get under the number. Each of those now fails.

Two ledgers record what is already broken rather than weakening the
rules to accommodate it: /api/settings/remote-access and /api/liveness
sit in the 300ms burst class and write a line per poll, and the
llama-server and diffusion-server directories never prune. Both ledgers
are self-expiring, so fixing an entry forces its removal.

Verified by mutation: eight deliberate breakages, each turning exactly
the intended guard red.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Studio: fail CI when the app polls a path the log budget never declared

The budget suite compares two backend files against each other: the suppression
sets in loggers/handlers.py and the poll cadences in log_budget/session.py. A
pull request that adds a polling call site in the frontend edits neither, so
nothing fails, the endpoint lands in the normal class on a 300 ms window, and
the access log grows by lines nobody chose.

Static analysis does not close it. Polling here is 53 setInterval call sites,
most of them UI timers rather than fetches, plus 257 setTimeout of which an
unknown number are recursive poll loops, and the fetch usually sits several
helper layers below the timer.

So watch the browser. Walk the sidebar sections, count API requests per dwell
rather than across the walk (a timer repeats within one dwell, a per-view fetch
fires once and stops, and summing the two is what makes navigation look like
polling), and fail on any path repeated inside a single dwell that is absent
from the budget.

Measured on a runner with no GPU and no model, two paths qualify. The floor is
set there so a run that observed nothing fails instead of reporting green, and
the docstring states plainly that polls gated behind a loaded model are outside
what this can see.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Run the declared-polls guard where a backend actually exists

The step landed in studio-frontend-ci's build job, which drives Playwright
against a vite dev server: no backend, no BASE_URL, no auth. The suite reads
BASE_URL at import, so it would have failed on a KeyError every run rather than
guarding anything.

Move it to studio-ui-smoke's ui-indicator job, which installs Studio with
--local --no-torch and already boots an authenticated server per engine, and
reuse that job's boot/rotate/teardown script instead of duplicating it. The
script's suite path becomes STUDIO_PW_SUITE with its current value as the
default, so every existing caller is unchanged.

Own port and home, for the reason the three engines get one each: a shared home
races on the bootstrap password. tests/studio/** is already in this workflow's
paths filter, so no trigger change is needed.

* Ratchet the log budget onto a main that has #8763

Rebasing onto the merge turned three of these guards red, which is what they are
for: each one refuses to let a ledger outlive the problem it records.

  KNOWN_UNCLASSIFIED_POLLS  /api/liveness and /api/settings/remote-access now
                            have heartbeat classes, so both entries went stale.
  KNOWN_UNBOUNDED_FAMILIES  llama-server and diffusion-server now prune.
  the Rust parity check     process.rs implements the success rule but no Rust
                            test read the shared fixture, so the corpus was only
                            ever checked from Python.

Both ledgers are now empty. Added the shared_access_log_fixture_tests module the
fixture names, which asserts all 14 cases against is_backend_access_log_line;
verified green with cargo test.

Idle envelope ratcheted 1450 -> 1170 against a re-measured 1110. The old note
predicted the fix would take idle to roughly 930 and that was wrong: a 10s
heartbeat against a 5s poll still emits half of /api/settings/remote-access, 180
lines over 30 minutes, now the joint-largest contributor. Left at 1450 there
would have been 340 lines of slack, enough for a new 10s endpoint to land
unnoticed; at 1170 that same endpoint trips the envelope.

* Name the declared-polls suite where CI can see it

test_every_playwright_driver_is_invoked_by_ci caught this, and it was right on
both counts.

Routing the suite through STUDIO_PW_SUITE meant the only place its path appeared
was an env: block, and that guard reads run:, uses: and with:, never env:. Worse,
wrapping the script's invocation in ${STUDIO_PW_SUITE:-...} hid the suite that
was already there: the guard reported TWO orphans, mine and
playwright_loaded_models_indicator.py, which had been named literally since it
was written. A parameterisation that makes an existing suite invisible is a bad
trade even when it saves duplication.

So drop the indirection. The script goes back untouched, and the step moves to
the ui-smoke extra shard, which already boots a Studio on 18894 and already mints
the credentials, so every sibling step there is just 'python tests/studio/<driver>.py' against
it. Mine now reads the same, needs no second
boot, and the guard matches it the ordinary way.

Placed last in the shard: it dwells for two minutes and rotates the bootstrap
password, so a step after it would wait, then meet a password it did not mint.

Verified locally: the full Workflow guard suites step, 698 passed.

* Let the replay model a slow request

The harness could not express the case the suppressors are blindest to. Both of
them key on the status code and neither reads how long the request took, so a
200 that took a minute is indistinguishable from a 200 that took a millisecond
-- and _app_returning sent its response without touching the clock, so every
replayed request cost zero virtual time. A budget cannot bound what its harness
cannot express.

Request grows a duration_ms, defaulting to 0 so every existing scenario is
unchanged, and the poll loop now reads the clock instead of its own counter so
time spent inside a slow handler counts against the session rather than
extending it. Idle stays at 1110 and busy at 239, measured, and all 93 tests
pass.

The two new tests assert TODAY's behaviour, not the desired behaviour: a slow
success on a quiet-success path still writes nothing. The gap is worth closing,
but a guard that tolerated either answer would let an exemption be added and
then removed again unnoticed, so closing it should flip these deliberately and
budget the new volume. Measured, an unbounded exemption emits one line per
request on a sustained degradation, which is the growth these budgets exist to
stop; it needs a heartbeat of its own.

The third test guards the other two. If duration_ms ever stopped reaching the
middleware, every "slow" assertion here would silently be testing a fast
request. Verified by breaking the advance on purpose: that test, and only that
test, goes red.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
danielhanchen added a commit that referenced this pull request Aug 25, 2026
* Studio: guard log volume in CI so it cannot regress unnoticed

Log reduction in Studio is several PRs deep (#6377, #7087, #8310, #8311)
and every round started the same way: someone noticed a log was huge,
measured it, and trimmed it. Nothing stopped the next chatty endpoint,
and nothing told the author they had added one.

Five guards, all CPU-only, no network, no sleeping. A 30 minute idle
session and a 5 minute in-flight session are replayed through the real
LoggingMiddleware against a virtual clock, so a thirty minute scenario
runs in a second and lands identically on a loaded runner.

  budget       lines per class against a formula of the poll period and
               the dedup window, plus an envelope on the whole scenario
  classify     a path cannot be quieted without recording how often it
               is polled, and cannot be polled without being classified
  signal       failures and mutations log at every interval, and the
               scenario is proved to have exercised the real middleware
               before any count from it is trusted
  parity       one JSON fixture defines a successful access record for
               both the backend and the desktop shell
  bounds       every log family prunes, and the two line caps agree

The signal guard is the point. An upper bound on log lines is satisfied
just as well by a middleware that was never mounted, a logger replaced
with a no-op, a scenario that stopped issuing requests, or an error log
someone deleted to get under the number. Each of those now fails.

Two ledgers record what is already broken rather than weakening the
rules to accommodate it: /api/settings/remote-access and /api/liveness
sit in the 300ms burst class and write a line per poll, and the
llama-server and diffusion-server directories never prune. Both ledgers
are self-expiring, so fixing an entry forces its removal.

Verified by mutation: eight deliberate breakages, each turning exactly
the intended guard red.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Studio: fail CI when the app polls a path the log budget never declared

The budget suite compares two backend files against each other: the suppression
sets in loggers/handlers.py and the poll cadences in log_budget/session.py. A
pull request that adds a polling call site in the frontend edits neither, so
nothing fails, the endpoint lands in the normal class on a 300 ms window, and
the access log grows by lines nobody chose.

Static analysis does not close it. Polling here is 53 setInterval call sites,
most of them UI timers rather than fetches, plus 257 setTimeout of which an
unknown number are recursive poll loops, and the fetch usually sits several
helper layers below the timer.

So watch the browser. Walk the sidebar sections, count API requests per dwell
rather than across the walk (a timer repeats within one dwell, a per-view fetch
fires once and stops, and summing the two is what makes navigation look like
polling), and fail on any path repeated inside a single dwell that is absent
from the budget.

Measured on a runner with no GPU and no model, two paths qualify. The floor is
set there so a run that observed nothing fails instead of reporting green, and
the docstring states plainly that polls gated behind a loaded model are outside
what this can see.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Run the declared-polls guard where a backend actually exists

The step landed in studio-frontend-ci's build job, which drives Playwright
against a vite dev server: no backend, no BASE_URL, no auth. The suite reads
BASE_URL at import, so it would have failed on a KeyError every run rather than
guarding anything.

Move it to studio-ui-smoke's ui-indicator job, which installs Studio with
--local --no-torch and already boots an authenticated server per engine, and
reuse that job's boot/rotate/teardown script instead of duplicating it. The
script's suite path becomes STUDIO_PW_SUITE with its current value as the
default, so every existing caller is unchanged.

Own port and home, for the reason the three engines get one each: a shared home
races on the bootstrap password. tests/studio/** is already in this workflow's
paths filter, so no trigger change is needed.

* Ratchet the log budget onto a main that has #8763

Rebasing onto the merge turned three of these guards red, which is what they are
for: each one refuses to let a ledger outlive the problem it records.

  KNOWN_UNCLASSIFIED_POLLS  /api/liveness and /api/settings/remote-access now
                            have heartbeat classes, so both entries went stale.
  KNOWN_UNBOUNDED_FAMILIES  llama-server and diffusion-server now prune.
  the Rust parity check     process.rs implements the success rule but no Rust
                            test read the shared fixture, so the corpus was only
                            ever checked from Python.

Both ledgers are now empty. Added the shared_access_log_fixture_tests module the
fixture names, which asserts all 14 cases against is_backend_access_log_line;
verified green with cargo test.

Idle envelope ratcheted 1450 -> 1170 against a re-measured 1110. The old note
predicted the fix would take idle to roughly 930 and that was wrong: a 10s
heartbeat against a 5s poll still emits half of /api/settings/remote-access, 180
lines over 30 minutes, now the joint-largest contributor. Left at 1450 there
would have been 340 lines of slack, enough for a new 10s endpoint to land
unnoticed; at 1170 that same endpoint trips the envelope.

* Name the declared-polls suite where CI can see it

test_every_playwright_driver_is_invoked_by_ci caught this, and it was right on
both counts.

Routing the suite through STUDIO_PW_SUITE meant the only place its path appeared
was an env: block, and that guard reads run:, uses: and with:, never env:. Worse,
wrapping the script's invocation in ${STUDIO_PW_SUITE:-...} hid the suite that
was already there: the guard reported TWO orphans, mine and
playwright_loaded_models_indicator.py, which had been named literally since it
was written. A parameterisation that makes an existing suite invisible is a bad
trade even when it saves duplication.

So drop the indirection. The script goes back untouched, and the step moves to
the ui-smoke extra shard, which already boots a Studio on 18894 and already mints
the credentials, so every sibling step there is just 'python tests/studio/<driver>.py' against
it. Mine now reads the same, needs no second
boot, and the guard matches it the ordinary way.

Placed last in the shard: it dwells for two minutes and rotates the bootstrap
password, so a step after it would wait, then meet a password it did not mint.

Verified locally: the full Workflow guard suites step, 698 passed.

* Let the replay model a slow request

The harness could not express the case the suppressors are blindest to. Both of
them key on the status code and neither reads how long the request took, so a
200 that took a minute is indistinguishable from a 200 that took a millisecond
-- and _app_returning sent its response without touching the clock, so every
replayed request cost zero virtual time. A budget cannot bound what its harness
cannot express.

Request grows a duration_ms, defaulting to 0 so every existing scenario is
unchanged, and the poll loop now reads the clock instead of its own counter so
time spent inside a slow handler counts against the session rather than
extending it. Idle stays at 1110 and busy at 239, measured, and all 93 tests
pass.

The two new tests assert TODAY's behaviour, not the desired behaviour: a slow
success on a quiet-success path still writes nothing. The gap is worth closing,
but a guard that tolerated either answer would let an exemption be added and
then removed again unnoticed, so closing it should flip these deliberately and
budget the new volume. Measured, an unbounded exemption emits one line per
request on a sustained degradation, which is the growth these budgets exist to
stop; it needs a heartbeat of its own.

The third test guards the other two. If duration_ms ever stopped reaching the
middleware, every "slow" assertion here would silently be testing a fast
request. Verified by breaking the advance on purpose: that test, and only that
test, goes red.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant