Repository navigation
fix(ui): a failed background refresh keeps the data and says so (ent#253) - #2382
Conversation
ecd4774 to
302df29
Compare
obasilakis
left a comment
There was a problem hiding this comment.
Reviewed against /validate-pr. The core fix is right and well argued — a catch that assigns the data ref turns a claim about the request into a claim about the subject (#1926), the stale banner is correctly a sibling rather than an v-else-if arm, and splitting refreshError from error (the collector's own verdict out of a successful response) is the distinction that was actually driving available = false. The store-level tests are behavioural rather than regex, which is the right call for the half where the honesty is decided. The audit correction on the issue — grep setInterval finds code that polls, not surfaces a user can reach — is a good durable output.
One blocking item, on the one surface here that is actually mounted.
"Agent Not Running" is now unreachable; a stopped agent's Dashboard tab renders blank forever
viewState() deliberately ignores loading (loadingState.js:37, void loading). Its only inputs are hasLoaded and error:
if (!hasLoaded) return { state: hasError ? 'failed' : 'loading', stale: false }For a stopped agent, onMounted takes the else { loading.value = false } branch and never fetches. So dashboardData stays null, loadError stays '', and firstLoad is true permanently. The new placeholder is first in the chain:
v-if="firstLoad" ← wins forever
v-else-if="loadFailed"
v-else-if="agentStatus !== 'running'" ← never evaluated
Result: an empty min-h-[8rem] aria-hidden div under a ScanlineReveal stuck at :loading="true" — a dimmed, animating, wordless panel. Previously v-if="loading" was false here and the chain fell through to "Agent Not Running · Start the agent to view its dashboard."
This is reachable on the default path: the Dashboard tab is gated on hasDashboardFlag, which comes from the DB-backed /exists probe (AgentDetail.vue:883), not on run state — so any stopped agent that has ever published a dashboard.yaml shows the tab. DashboardPanel is the only mounted surface this PR touches (AgentDetail.vue:176), so this is the whole live blast radius.
Either gate the placeholder on run state:
- <div v-if="firstLoad" class="min-h-[8rem]" aria-hidden="true"></div>
+ <div v-if="firstLoad && agentStatus === 'running'" class="min-h-[8rem]" aria-hidden="true"></div>…or seed hasLoaded on the non-running mount branch. Whichever you pick, ScanlineReveal's :loading needs the same treatment or it animates behind the not-running copy.
Note the stop-while-viewing path is fine — hasLoaded is true by then and the chain falls through correctly. It is specifically mounting on a stopped agent that breaks, which is why the Playwright verification in the description read green: it only drove the running path.
MetricsPanel.vue:32 has the identical construction. Unmounted today, so not user-visible, but worth fixing with it rather than leaving the pattern in the tree to be copied.
Non-blocking
stores/observability.js — on a failed refresh with hasLoaded true, error is deliberately left alone (correct — that is the fix), but a stale collector message from an earlier successful response keeps rendering while the new failure only reaches refreshError. Narrow window (success → collector-reports-unavailable → transport failure), and arguably fine as-is.
Process
Body says "Related to Abilityai/trinity-enterprise#253" rather than Fixes. Cross-tracker doesn't auto-promote either way, so ent#253 needs a manual status-in-dev at merge.
|
Resolve by running |
|
Resolve by merging |
Code review — re-review at
|
obasilakis
left a comment
There was a problem hiding this comment.
Re-reviewed at 536c6605, the tip of origin/feature/ent253-refresh-treatment. Every hunk read at that revision via git show, the branch chains traced arm by arm in both panels, loadingState.js / ScanlineReveal.vue / InlineError.vue / LoadFailed.vue read for the contracts this pass adopts, both ratchet scanners run against a git archive of the branch tree, and the new spec read in full.
Before the code: this PR's GitHub record is wedged, and the green checks belong to a tree that no longer exists
The branch ref is 536c6605. The PR record's head is 302df29, and that commit is not an ancestor of the branch — it was orphaned by the force-push. mergeable is null/unknown, and there are zero check-runs against 536c6605. The full green matrix everyone can see (pytest, e2e, build, CodeQL, gitleaks) ran against 302df29, i.e. against the code before the fix for the blocking finding from the last round.
Three consequences worth stating plainly: the GitHub diff view is showing reviewers the pre-fix tree, no CI has evaluated what is actually on the branch, and the two nightly "merge conflict against dev" comments predate the rebase (the branch's merge-base is now exactly origin/dev, so there is no conflict left). Please unwedge the PR — an empty commit, or a close/reopen — before anyone tries to merge it, so the checks and the diff describe the tree that would land.
Earlier findings
Blocking — "Agent Not Running" unreachable, blank panel forever: fixed. awaitingFirstLoad = firstLoad && props.agentStatus === 'running' now gates both the placeholder arm and ScanlineReveal's :loading, in both panels. I re-derived the stopped-agent mount: onMounted takes the else branch, dashboardData stays null, firstLoad stays true, awaitingFirstLoad is false, arm 1 and arm 2 both fall through, and agentStatus !== 'running' renders. The primitive gets the same gate, so nothing animates behind the not-running copy. The spec case pins the rule rather than the spelling, and the assertion that the not-running arm stays downstream of the two request-shaped arms is the right thing to have written down.
Non-blocking — a stale collector message outliving its response: unchanged. Still the narrow success → collector-reports-unavailable → transport-failure window. Fine as-is; noting only that it was not silently claimed as fixed.
Process — Related to rather than Fixes. Unchanged, as expected across trackers. ent#253 still needs its status-in-dev label applied by hand at merge.
New findings
Blocking: the agentStatus watcher never clears loadError, so a request-shaped arm outranks the run-state arm again
DashboardPanel.vue:691 — the watcher's non-running branch calls stopRefresh() and nothing else. loadError and lastLoadedAt survive the transition, and both feed arms that sit above v-else-if="agentStatus !== 'running'" (:45). Two reachable outcomes, both on the one surface this PR actually ships to users:
-
Agent running, Dashboard tab opened, first fetch fails — a container that is up while its agent-server is still booting returns 502, and this endpoint proxies to the agent.
LoadFailedrenders, correctly. The operator then stops the agent.dashboardDatais stillnullandloadErroris still set, soloadFailed(:36) keeps winning and the panel says "Couldn't load the dashboard — The agent did not return its dashboard. This is not the same as an agent without one." with a Retry button that cannot succeed, wheredevsays "Agent Not Running · Start the agent to view its dashboard." -
Agent running with a rendered dashboard, one poll fails, banner appears, operator stops the agent.
hasLoadedis true soview.staleis true and theInlineErrorat:9stays pinned, asserting "showing data from 10:42" directly above a panel body that is rendering "Agent Not Running" and showing no data at all.
This is the same shape as the item I blocked on last round — an arm that describes the request pre-empting the truer statement about the subject — and (2) in particular is the PR's own thesis inverted: a banner that promises the data is still on screen, printed over a panel where it is not. It is a regression against dev on DashboardPanel, which the description correctly identifies as the whole live blast radius.
Clearing loadError in the watcher's else branch fixes both: view falls back to loading, awaitingFirstLoad is false because the agent is not running, view.stale goes false, and the chain reaches arm 3. One line, mirroring what the agentName watcher already does. lastLoadedAt does not need clearing — staleMessage only renders under view.stale.
You have already written this up yourself as Medium #1 in the review comment on this PR; I am confirming it independently and treating it as blocking rather than as a note, because it is a user-visible regression on the only mounted surface and the fix is two lines plus a spec case. MetricsPanel.vue:421 carries the identical construction and should move with it for the same reason the last fix did — not because it is reachable, but so the pattern is not left in the tree to be copied.
Low: ObservabilityPanel hand-rolls the stale banner, and the hand-rolled version is the one that lies
ObservabilityPanel.vue:156 interpolates formatLastUpdated (:185), whose only reactive dependency is observabilityStore.lastUpdated; the elapsed time comes from a bare Date.now(). On a failed refresh lastUpdated does not change, so the computed is never invalidated and keeps serving its cached string — a reading taken at 10:00 renders "just now" for the entire outage, and the banner reads "Couldn't refresh — showing the reading from just now." That is the never-present-stale-data-as-fresh rule broken by the very line written to honour it.
The structural point underneath it: every other adopter of this pass — InfoPanel, SchedulesPanel, MobileAdmin, and now DashboardPanel and MetricsPanel — renders <InlineError :message="staleBannerMessage(...)">, and staleBannerMessage prints an absolute toLocaleTimeString, which is immune to this by construction. Skipping ScanlineReveal on a 192px chip is a justified call and the comment makes the case; skipping the shared banner helper is a separate decision that was not argued and is what produced the bug. Reaching for staleBannerMessage here would fix the honesty defect and the consistency gap in one edit, and would also give this panel the role="alert" the bare <p> lacks.
Low: a failed first fetch still renders as a claim about the platform's configuration
ObservabilityPanel.vue:46 — the chain opens with v-if="!observabilityStore.enabled" → "OTel not enabled. Set OTEL_ENABLED=1." enabled defaults to false and the catch never touches it, so a failed first fetch renders a misconfiguration instruction. That is the #1926 class this pass exists to remove, one arm further up than the arm that was fixed. The store's new if (!this.hasLoaded) branch (stores/observability.js:196) records the real reason and the spec asserts store.error is truthy, but the arm that would display it is a v-else-if behind !enabled and can never be reached — the test has coverage the UI does not.
Low: hasLoaded means "the request returned 200", not "we have data"
stores/observability.js:185 sets hasLoaded on every successful response, including {enabled: false} or {available: false, error: …} payloads carrying no metrics — and lastUpdated with it. Since isStale = refreshError && hasLoaded, a later transport failure on an OTel-disabled install renders "Couldn't refresh — showing the reading from …" when there has never been a reading to show. Deriving the flag from the presence of data.metrics / data.totals would make the name true.
Low: viewState is called without count, so the celebratory wipe plays over the empty state
DashboardPanel.vue:479 and MetricsPanel.vue:234 pass loading / hasLoaded / error but no count, which defaults to 1 — so view.state is 'ready' for every successful response, has_dashboard: false and has_metrics: false included. ScanlineReveal's documented prop contract is that reveal is "false when loading ended without real data (error / empty): snap to loaded instead of playing the celebratory pass", so the 550 ms wipe currently runs over "No Dashboard Defined". Cosmetic, but it is a deviation from the primitive this pass is adopting, and count: dashboardData.value?.has_dashboard ? 1 : 0 honours it. The failure path is already correct here — 'failed' gives reveal: false and snaps.
Low: the raw-color ratchet moved the wrong way on ObservabilityPanel, and the description reports only half of it
Running scan-raw-colors.mjs over the merge-base and over 536c6605 for the three touched files:
| file | base | head |
|---|---|---|
DashboardPanel.vue |
8 nongray / 101 gray | 8 / 101 |
MetricsPanel.vue |
0 / 63 | 0 / 63 |
ObservabilityPanel.vue |
1 / 80 | 0 / 82 |
The raw_nongray: 1 → 0 the description claims is real — that is the text-blue-600 on the removed overlay spinner. But the replacement <span class="text-xs text-gray-500 dark:text-gray-400">Loading…</span> adds two raw_gray hits, taking that file from 80 to 82 against a committed baseline of 80, and raw-color-baseline.json is untouched by this PR. CLAUDE.md §9 states per-file counts may only shrink. Nothing in CI enforces this today (frontend-build.yml runs check:tokens only, and the scanner always exits 0), so it is a documented-rule miss rather than a red build — but the description asserts the file improved, and on the tracked-gray axis it did not.
Verified clean
- Loading-gate ratchet is exact. The regenerated baseline (60 files / 77 gates) matches
scan-loading-gates.mjsrun against the branch tree with zero per-file mismatches, and the three fixed files are correctly absent. - The fix is not inert.
agents.jsgetAgentDashboard/getAgentMetricshave nocatch, so the rejection genuinely reaches the component'scatch— worth having confirmed, since a swallowing store action would have made the whole change a no-op. - Polling teardown.
onUnmounted → stopRefreshin both panels, the interval body re-checks run state on every tick, and theagentNamewatcher stops before restarting. No leaked intervals; theagentStatuswatcher'sstopRefreshis correct as far as the timer goes — it is only the error state it forgets. - Stale-banner treatment matches its siblings on the two panels that matter:
InlineError+staleBannerMessagegated onview.stale, as a sibling above the primitive rather than an arm inside it, identical toInfoPanel/SchedulesPanel/MobileAdmin. - Accessibility of the failure states.
InlineErrorandLoadFailedare bothrole="alert"with the failure named in text and the trace behind a disclosure, so nothing is conveyed by colour alone;ScanlineRevealcarriesaria-busyduring loading and the placeholder is correctlyaria-hidden. - Store behaviour. The five Pinia cases are behavioural rather than regex, and they test the right distinctions — a later failure keeps
metrics/totals/available, a first failure still fails honestly, and a transport failure never overwrites the collector's own message. - Scope.
ReplayTimeline.vueuntouched, and the non-polling bare gates correctly left in the baseline rather than swept.
Verdict
Requesting changes on the agentStatus watcher clearing loadError in both panels — it is a live regression on DashboardPanel and it re-opens the exact class this PR closes. The five Low items are yours to take or leave, though the formatLastUpdated one is worth taking with it: it is a one-line switch to staleBannerMessage and it removes a banner that currently states the opposite of the truth.
Separately and independently of the code: please unwedge the PR head so CI runs against 536c6605 and the diff view stops showing the orphaned tree.
…253) Audit first, per the issue's own AC #1: all 31 interval-refreshed files, each with its verdict and the evidence for it, posted as a comment on ent#253 before any change. #1927 had already fixed four surfaces and shipped the rule (`utils/loadingState.js::viewState`) plus the bare-gate ratchet, so most of the inventory was already green. Three were not: MetricsPanel, DashboardPanel, and ObservabilityPanel via the observability store. All three shared a defect worse than the cosmetic one the issue describes. The re-flash was real — each set its loading flag inside the function the poll calls, so the panel was replaced by a spinner on every tick — but the `catch` was the serious half: it OVERWROTE the data with a synthetic empty payload (`{has_metrics: false}`, `{has_dashboard: false}`, `available = false`). One transient 502 therefore rewrote a working agent as one with no metrics, no dashboard, or an unreachable collector, and the real values were gone until the next success — a claim about the subject manufactured out of a claim about the request, which is #1926 one layer down. Each also logged to `console.error` and nowhere else. The fix, per surface: gate on "no data yet" via `viewState`, keep `loading` meaning "fetch in flight" for the retry labels, keep the data on a failed refresh and raise the shared stale banner beside it (never as an else-if arm, which would replace the data it promises to keep), give a failed FIRST load a `LoadFailed` with a retry — distinct from the empty state, which is a statement about the agent — and replace the bespoke spinners with the #245 `ScanlineReveal` primitive, which brings `prefers-reduced-motion` with it. The agent-switch watchers clear the error too, so agent B's first failure is not reported with agent A's detail. In the store, a transport failure is now held apart from `error`, which carries the collector's own message out of a successful response — collapsing the two let a dropped request read as the collector declaring itself down. Verified live against a local stack (Vite-mounted branch source) on the one mounted surface, driving the panel's real 30s poll with the endpoint aborting: the loading face is never re-entered, the dashboard stays on screen, the "no dashboard" empty state does not appear, and the stale banner does. Honest scope, and it corrects the audit: MetricsPanel and ObservabilityPanel turn out to be mounted by NOTHING (`stores/observability.js` has exactly one consumer — that orphaned panel). Their defect is real in code and unreachable in the app; the live win is DashboardPanel. Correction posted on the issue, and the convention note now says to record consumer-reachability in the audit, because `grep setInterval` finds code that polls, not surfaces a user reaches. Out of scope and untouched: ReplayTimeline (excluded by the issue), and the bare gates on surfaces that do not poll — they re-flash only on a user-triggered refetch, which is a different complaint, and they stay in the ratchet baseline. Related to Abilityai/trinity-enterprise#253 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ent#253) Caught reviewing this PR's own diff, then confirmed live against a held-open response: `ScanlineReveal` clips its slot only during the REVEAL. During the loading phase `.scan-content` is an ordinary child under a 50%-opacity track, so moving each panel's branch chain inside the slot meant that with the data ref still null the chain fell through to `v-else-if="!metricsData?.has_metrics"` — and the panel spent the whole first load telling the operator this agent has no metrics / no dashboard. Dimmed, but exactly the false claim this pass exists to remove. The bare `v-if="loading"` it replaced had been doing a second, unwritten job: short-circuiting the chain. Fix: the chain's first arm is now a `v-if="firstLoad"` placeholder that renders nothing and reserves height, so no terminal is reachable before data exists and nothing shifts on arrival (p4). `LibrarySkillsSection` — the ent#245 reference adopter — solves the same problem by gating each terminal on `store.hasLoaded`; the comment records why this one reserves height instead. Verified live both ways: during a 6s-delayed first load the empty state no longer renders (it did before this commit), and the failed-refresh path is unchanged — content survives, no re-flash, stale banner shown. Learning captured: a primitive that replaces a `v-if` gate inherits everything that gate was silently doing, and "the content is visually covered" is a claim to verify in the CSS rather than assume from the name. Related to Abilityai/trinity-enterprise#253 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…nt#253) The placeholder arm added in cd99a1a took the `v-if`, so `LoadFailed` became `v-else-if` — and the assertion written against the earlier shape failed on a change that preserved everything it guards. Matched by rule instead: a failed first load has its own branch, whichever keyword introduces it. Related to Abilityai/trinity-enterprise#253 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…hat can clear it (ent#253)
`viewState` ignores `loading` by design, so `hasLoaded` is the only thing that
retires `firstLoad` — and on a STOPPED agent no fetch ever runs. `onMounted`
takes the `else { loading = false }` branch, the data ref stays null, and
`firstLoad` is true for the entire life of the mount. Gated on that alone, the
placeholder arm added in the previous commit wins forever: the `loadFailed` and
`agentStatus !== 'running'` arms below it are never evaluated, and the operator
gets a blank `min-h-[8rem]` `aria-hidden` div under a `ScanlineReveal` stuck at
`:loading="true"` where "Agent Not Running · Start the agent to view its
dashboard" used to be.
Reachable on the default path, not a corner: the Dashboard tab is gated on the
DB-backed `/exists` probe, not on run state, so any stopped agent that has ever
published a `dashboard.yaml` shows the tab. `DashboardPanel` is the only mounted
surface this branch touches, so that is the whole live blast radius;
`MetricsPanel` carries the identical construction and is fixed with it rather
than left in the tree to be copied.
`awaitingFirstLoad = firstLoad && agentStatus === 'running'` gates the
placeholder AND the primitive — the second half matters, or the track animates
behind the not-running copy. The placeholder is a claim that data is COMING,
which is only true while a fetch can happen.
The stop-while-viewing path was already correct (`hasLoaded` is true by then),
which is why the live Playwright pass read green: it only drove the running
path. The new spec case pins the rule rather than the spelling.
Related to Abilityai/trinity-enterprise#253
…d three honesty gaps in the chip (ent#253) **A failed first load outranked "Agent Not Running", and nothing cleared it.** Putting the request-shaped arms ahead of the run-state arm was right, but the status watcher's stopped branch only called `stopRefresh()`. So an agent that 502'd while booting kept rendering "Couldn't load the dashboard" with a Retry that can only fail again — where the not-running copy belongs — and with data on screen the stale banner stayed pinned above it. The error described a request that is no longer possible, so it now goes with the run state that made it impossible, mirroring what the `agentName` watcher already did. Both panels. **The chip's stale banner could call a 20-minute-old reading "just now".** `formatLastUpdated`'s only reactive dependency is `lastUpdated`, and the elapsed time came from a non-reactive `Date.now()` — but a FAILED refresh does not change `lastUpdated`, so the computed was never invalidated and served its cached string for the whole outage. That is stale-presented-as-fresh in the one line written to deny it. The banner prints an absolute time (what `staleBannerMessage` does on the sibling panels); the "Updated …" line keeps the relative form, where every successful poll refreshes it. **A failed FIRST fetch still rendered as a claim about the platform.** `enabled` sits at its `false` default after a dropped request, and that arm was first — so a transport failure read as "OTel not enabled. Set OTEL_ENABLED=1." The store recorded the real reason and the spec asserted it was truthy, but no arm could ever display it: the test covered something the UI did not do. The request-shaped arm goes first, which is the #1926 rule one arm further up than this pass had applied it. **`isStale` claimed a reading the panel never had.** `hasLoaded` means "a request succeeded", not "we have data" — it is set on `{enabled:false}` and `{available:false}` too, so a later transport failure asserted "showing the reading from …" on an install that never had one. The banner is a claim about data, so it gates on data. `hasLoaded` itself is deliberately unchanged: it also retires the first-load placeholder, and narrowing it would leave an OTel-disabled install behind that placeholder forever — this branch's previous bug arriving by a new route. Also: `viewState` was called without `count`, which defaults to 1, so `state` was 'ready' for every successful response including an empty one and the celebratory 550ms wipe played over "No Dashboard Defined" — against `ScanlineReveal`'s documented contract. Related to Abilityai/trinity-enterprise#253
536c660 to
561d3fc
Compare
The two review findings still open after 561d3fc (@obasilakis) — the blocking watcher item and the misconfiguration arm were fixed there. hasLoaded now means WE HAVE A READING, not 'the request returned 200'. It gates isStale, so setting it on every success made an OTel-disabled install — which answers 200 with {enabled: false} and no metrics — render "Couldn't refresh — showing the reading from …" on the next transport failure, when there had never been a reading to show. Derived from the payload, so the name is true. The stale banner uses the SHARED staleBannerMessage. Skipping ScanlineReveal on a 192px chip is a justified call and is argued in the source; skipping the shared banner was a separate decision that was never argued, and it is what produced the stale-as-fresh bug. The helper prints an absolute time by construction, so the defect is unreachable from here and every adopter of this pass now says the same words. role="alert" with it — the bare <p> announced nothing. One of my own tests pinned the literal sentence rather than the rule, so it failed on a change that made the guarantee stronger. Re-pinned as the rule: the banner's time must not be the relative computed. 1266 passed (59 files). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Re-review — ent#253 refresh treatmentFresh pass over the merge-base diff ( Verdict: approve with nits. All four prior findings genuinely hold in the code — verified by reading, and the blocking one by mutation. Two new Low findings below are worth acting on; the rest are nits. Prior findings — verified1. BLOCKING — 2. 3. Failed FIRST fetch rendered as a config claim → FIXED. Pinned by an index comparison ( 4. New findingsNEW-1 — Low (high confidence): The watcher clears synchronously on the prop change; the // DashboardPanel.vue:461-475
const loadDashboard = async () => {
loading.value = true
try { … } catch (error) {
loadError.value = error?.response?.data?.detail || error?.message || 'Request failed'
} finally { loading.value = false }
}// DashboardPanel.vue:696-711
watch(() => props.agentStatus, (newStatus) => {
if (newStatus === 'running') { … } else {
stopRefresh()
loadError.value = ''
}
})Stop the agent while a dashboard fetch is in flight — the common case, because a wedged agent is exactly the one whose fetch is slow and the one you press Stop on — and the order is: watcher clears → request rejects (the backend proxy answers 502/503 once the container is gone) → Same shape on the Fix is one guard, e.g. capture the request's identity and drop a stale outcome: const forAgent = props.agentName
… catch (error) {
if (props.agentName !== forAgent || props.agentStatus !== 'running') return
loadError.value = …
}NEW-2 — Low (high confidence):
The next commit ( // stores/observability.js:192
this.hasLoaded = this.hasDataTwo consequences:
Cheapest fix preserving both properties is the one NEW-3 — Low: Dashboard/Metrics can still print "showing data from 10:42" over an empty state.
NEW-4 — nit: one event, two colour semantics. The same failed background refresh renders NEW-5 — nit (test quality): one assertion pins the spelling while its comment claims the rule. expect(src, name).toMatch(
/const awaitingFirstLoad = computed\(\(\) => firstLoad\.value && props\.agentStatus === 'running'\)/)An operand swap or a line wrap — both no-ops — fail it. Same for Checked clean, and what proved it
Reviewed at |
…ay monotonic (ent#253) Two re-review findings. 1. THE BLOCKING SYMPTOM WAS STILL REACHABLE, BY ORDERING. The `agentStatus` watcher clears `loadError` synchronously on the stop transition, but the fetch's `catch` lands later and wrote unconditionally — so stopping an agent mid-fetch put a request-shaped arm back in front of "Agent Not Running", which is the exact symptom the blocking finding was about, on exactly the wedged-agent case an operator is most likely to hit. Both panels now drop a failure that arrives after the agent stopped. 2. MY OWN EARLIER FIX WAS REDUNDANT AND HARMFUL. I changed the store to `hasLoaded = hasData` so the stale banner could not claim "showing the reading from …" on an install that never had a reading. But `isStale` already carries `&& hasData` — the guard was already at the point that makes the claim — while `firstLoad` is `loading && !hasLoaded`, so a payload-derived flag goes false again on every no-data poll and re-arms the first-load placeholder every 60 seconds. That is the "disturbs on every tick" gate this whole branch exists to delete, reintroduced by its own fix. It also broke the catch's `if (!this.hasLoaded)`, which means "before any first success" and would have started meaning "no metrics right now". `hasLoaded` is monotonic again. Two different questions — "has a request completed" (placeholders) and "do we have data" (claims about data) — and one flag cannot answer both. The test that pinned the wrong version is replaced by one that pins the RULE: the BANNER gates on data. Where `hasLoaded` is assigned is not the rule. 1269 frontend tests pass. Related to Abilityai/trinity-enterprise#253 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
obasilakis
left a comment
There was a problem hiding this comment.
Approving — this clears my earlier CHANGES_REQUESTED.
The blocking item is fixed and verified: the agentStatus watcher now clears loadError in its else branch on both panels, so a request-shaped arm no longer outranks "Agent Not Running". The early return in the catch when agentStatus !== 'running' closes the in-flight-rejection race, which I hadn't asked for.
Four of the five low items are in too: the stale banner now goes through staleBannerMessage (absolute time by construction, plus role="alert"), the error arm precedes !enabled so a failed first fetch stops reading as a config claim, and viewState gets a real count. On hasLoaded you kept it monotonic and gated isStale on && hasData instead — that answers the actual complaint (the banner claiming a reading that never existed), so I'm fine with the alternative.
Merge note: conflicts with dev on docs/memory/learnings.md (EOF append, no code). #2379 and #2386 conflict on the same file.
One thing I'd like picked up rather than dropped, since it won't surface on its own — CI is green here because the scanner isn't a failing gate: the raw-color ratchet moved the wrong way. ObservabilityPanel.vue measures raw_gray 82 against a committed baseline of 80, and raw-color-baseline.json is untouched. The design-system contract is that per-file counts may only shrink. The PR description also reports only the improving half ("loses a raw text-blue-600 (1 → 0)"). Either bring the count back under 80 or update the baseline with the reason stated — but the description should match whichever you do.
…-treatment # Conflicts: # docs/memory/learnings.md
Audit first (AC #1)
All 31 interval-refreshed files, each with its verdict and the evidence for it, posted on the issue before any change: audit comment. #1927 had already fixed four surfaces and shipped the rule (
utils/loadingState.js::viewState) plus the bare-gate ratchet, so most of the inventory was already green. Three were not.What was actually wrong
The re-flash the issue describes was real — each of the three set its loading flag inside the function the poll calls, so the panel was replaced by a spinner on every tick. But the
catchwas the serious half:One transient 502 rewrote a working agent as one with no metrics / no dashboard / an unreachable collector, and the real values were gone until the next success. That is a claim about the subject manufactured out of a claim about the request — #1926 one layer down — and it also violates AC #5 outright. Each failure also went to
console.errorand nowhere else.The fix, per surface
viewState;loadingkeeps meaning "fetch in flight" so it can still drive the retry labels. The poll is now invisible.LoadFailed+ retry, kept distinct from the empty state (a statement about the agent, not about the request).ScanlineRevealprimitive, which bringsprefers-reduced-motionwith it (AC fix: add missing logging_config.py to backend Dockerfile #4, AC Feature/process engine #6).refreshError) is held apart fromerror, which carries the collector's own message out of a successful response. Collapsing the two let a dropped request read as the collector declaring itself down, and that is what setavailable = false.Verified live, not just asserted
Against a local stack with this branch's source Vite-mounted, on the one mounted surface, driving the panel's real 30 s poll with the endpoint aborting (
page.route(... r.abort())):Honest scope — this corrects the audit
MetricsPanelandObservabilityPanelturn out to be mounted by nothing;stores/observability.jshas exactly one consumer, that orphaned panel. Their defect is real in code and unreachable in the app — the live win isDashboardPanel. Correction posted on the issue; the convention note now says to record consumer-reachability during the audit, becausegrep setIntervalfinds code that polls, not surfaces a user can reach.Worth someone's decision, filed rather than folded in: the observability store polls on an interval with an unmounted consumer — delete the surface or wire it back is a product call, not a refresh-treatment one.
Tests
tests/unit/refreshTreatment.spec.js:metrics/totalsandavailable, setsrefreshError, and leaveshasLoadedtrue; a first failed fetch still fails honestly (available = false, nothing to protect); a transport failure never overwrites the collector's own message; a later success clears the stale flag.hasLoaded-derived loading face, no data-clobberingcatch,InlineError+LoadFailedpresent, agent-switch clears the error, bespoke spinners gone.Ratchet:
loading-gate-baseline.jsonregenerated (63 files/80 gates → 60/77 — the ratchet spec pins the baseline exactly, so a fixed file's stale entry fails CI).npm run check:tokenspasses;ObservabilityPanelalso loses a rawtext-blue-600(1 → 0).Docs (AC #7)
The convention already lived in
design-system.md§6 /design-system-contract.mdfrom #245/#1927. This adds the half ent#253 found: a failed request never becomes a statement about the subject — keep the data, set an error, raise the banner; acatchthat assigns the data ref is the smell. Plus the reachability note above.Not in this pass
ReplayTimeline.vue— excluded by the issue, untouched.SkillsPanel, enterpriseAudit, the settings tabs): they re-flash only on a user-triggered refetch, a different and much weaker complaint. They stay in the ratchet baseline.Related to Abilityai/trinity-enterprise#253
🤖 Generated with Claude Code