You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(workspace): agent page initial load is slow — profile and parallelize build_page #2160
Opening an agent's page in the Workspace (ent#360, PR #2147) takes noticeably long before anything useful renders. The page payload is assembled server-side in one shot, so the client waits on the slowest sub-read before seeing anything.
Context
src/backend/client_portal/agent_page.py::build_page composes health, windowed stats, operator asks, recent work, reports metadata and last-active into a single response. If those reads run sequentially (or any of them is an unindexed/wide query), first paint is bounded by their sum. Part of the Workspace polish pass following ent#357–ent#361.
Acceptance Criteria
Profile build_page on a realistic dataset and record where the time goes (health probe, stats window, asks, recent work, reports) — findings noted on this issue before the fix
Independent sub-reads run concurrently (or below-the-fold sections load progressively) — the page shell with header/identity renders promptly instead of blocking on the full payload
Any hot query gets an index or a bounded window; no unbounded scans on schedule_executions/agent_activities for one page load
The page shows an honest loading state per section while data arrives (design-system data-loading motion standard) — never a blank/hung-looking page
Repeat visits within a short window don't refetch identical windowed stats (consider the ${name}:${window} cache convention from stores/executions.js)
Measured on the live instance against evt-boss (1600 executions, 16 reports), Postgres backend, window 30d. Each sub-read timed individually inside the backend container:
sub-read
time
_health
4.0 ms
_stats(30d)
12.5 ms
_asks
3.1 ms
_recent_work
2.1 ms
_last_active
4.9 ms
reports
6.0 ms
sum
32.7 ms
build_page is not the bottleneck. The premise in the issue — that the sub-reads run sequentially and first paint is bounded by their sum — is true but the sum is 33 ms. Parallelising them would buy ~20 ms and is not worth the concurrency.
The endpoint, however, is ~150 ms:
GET /agents/evt-boss/page?window=30d 0.167s / 0.152s / 0.144s
The missing ~115 ms is one line I wrote in ent#360's router:
Opening ONE agent's page builds the entire roster — and get_roster fans _agent_briefing across every agent: a Docker lookup plus up to two agent HTTP calls each, at a 5 s timeout, awaited with gather. So the page pays for N agents to render 1, and inherits the floor documented in #2163: the page's load time is bounded by the slowest agent in the fleet, not by the agent you opened. One wedged agent ⇒ a 5 s agent page for an unrelated agent. That is the fleet-scale version of what was reported as "noticeably long".
Two corrections to the issue's technical notes while I'm here:
_health does not reach the live container. It reads the last persisted agent_health_checks row (4 ms) precisely so the page renders for a stopped agent (ent#360 AC Feature/process engine #6). The AC asking that it not gate first paint is already satisfied.
So the fix is to stop building N cards to render one, not to parallelise a 33 ms body. AC5 (client-side window cache) still stands on its own merit — switching 7d→30d→7d refetches identically today.
Activity
dolho commentedon Aug 13, 2026
Profile (AC1) — recorded before the fix
Measured on the live instance against
evt-boss(1600 executions, 16 reports), Postgres backend, window30d. Each sub-read timed individually inside the backend container:_health_stats(30d)_asks_recent_work_last_activereportsbuild_pageis not the bottleneck. The premise in the issue — that the sub-reads run sequentially and first paint is bounded by their sum — is true but the sum is 33 ms. Parallelising them would buy ~20 ms and is not worth the concurrency.The endpoint, however, is ~150 ms:
The missing ~115 ms is one line I wrote in ent#360's router:
Opening ONE agent's page builds the entire roster — and
get_rosterfans_agent_briefingacross every agent: a Docker lookup plus up to two agent HTTP calls each, at a 5 s timeout, awaited withgather. So the page pays for N agents to render 1, and inherits the floor documented in #2163: the page's load time is bounded by the slowest agent in the fleet, not by the agent you opened. One wedged agent ⇒ a 5 s agent page for an unrelated agent. That is the fleet-scale version of what was reported as "noticeably long".Two corrections to the issue's technical notes while I'm here:
_healthdoes not reach the live container. It reads the last persistedagent_health_checksrow (4 ms) precisely so the page renders for a stopped agent (ent#360 AC Feature/process engine #6). The AC asking that it not gate first paint is already satisfied._recent_workisLIMIT 20,reportsLIMIT 20,_last_activeLIMIT 1, and_statsis the feat(ui): Agent Detail Overview dashboard as default tab + Info tab redesign #1107 windowed accessor. AC3 has nothing to fix.So the fix is to stop building N cards to render one, not to parallelise a 33 ms body. AC5 (client-side window cache) still stands on its own merit — switching 7d→30d→7d refetches identically today.
fix(workspace): the agent page built the whole roster to render one a…
fix(workspace): roster shows container availability honestly — never …
perf(workspace): the roster stops waiting for the slowest agent — bri…
feat(workspace): the backend half of the model dropdown — payload, la…
docs(workspace): why the agent page pays for a model default it never…
feat(workspace): the backend half of the model dropdown — payload, la…
docs(workspace): why the agent page pays for a model default it never…
feat(workspace): the backend half of the model dropdown — payload, la…
docs(workspace): why the agent page pays for a model default it never…
feat(workspace): a user-friendly model dropdown in the chat composer (A…
fix(canvas): state the bound, audit the Workspace writes, gate Manage…
feat(canvas): delete, pin, search and a stated bound for the canvas p…
feat(canvas): share a canvas at a link, and download it as a PDF (ent…
feat(canvas): the open canvas is shared context for the turn (ent#555) (
Merge origin/dev into fix/2695-stt-capability-probe