perf(#4759): parallelize fresh sidebar boot fetches - #4992
3 commits merged into
Conversation
|
| Filename | Overview |
|---|---|
| static/sessions.js | Extracts session+project fetching into _loadSidebarSessionListPayload; projects IIFE starts before sessions await, achieving genuine parallelization while preserving all existing timeout, retry, and fallback behavior. |
| tests/test_issue4759_parallel_sidebar_boot_fetch.py | New async behavioral regression tests exercise parallel fetch start order (cold and warm boot), project-failure fallback, and preserved session request options via a Node.js subprocess harness. |
| tests/test_issue4766_sidebar_source_pushdown.py | Adds _ensure_async guard and injects the new _loadSidebarSessionListPayload helper into the existing harness so the refresh-path compatibility check exercises the real call chain. |
| tests/test_session_sidebar_resilience.py | Updates helper-shape assertions to trace the extracted _loadSidebarSessionListPayload instead of the old inline block; project-isolation invariants are still fully checked. |
Sequence Diagram
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant R as _runRenderSessionListRefresh
participant L as _loadSidebarSessionListPayload
participant AP as /api/projects
participant AS as /api/sessions
R->>L: await _loadSidebarSessionListPayload(qs, opts)
activate L
L->>AP: api('/api/projects') [IIFE starts, not awaited yet]
Note over L,AP: projectPromise in flight
L->>AS: await api('/api/sessions', opts)
Note over L,AS: sessions and projects now in parallel
AS-->>L: sessData
L->>L: await projectPromise
AP-->>L: projData (or fallback on error)
L-->>R: "{sessData, projData}"
deactivate L
R->>R: generation guard, apply payload
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant R as _runRenderSessionListRefresh
participant L as _loadSidebarSessionListPayload
participant AP as /api/projects
participant AS as /api/sessions
R->>L: await _loadSidebarSessionListPayload(qs, opts)
activate L
L->>AP: api('/api/projects') [IIFE starts, not awaited yet]
Note over L,AP: projectPromise in flight
L->>AS: await api('/api/sessions', opts)
Note over L,AS: sessions and projects now in parallel
AS-->>L: sessData
L->>L: await projectPromise
AP-->>L: projData (or fallback on error)
L-->>R: "{sessData, projData}"
deactivate L
R->>R: generation guard, apply payload
Reviews (2): Last reviewed commit: "test(#4759): guard async harness extract..." | Re-trigger Greptile
b9cea92
|
Shipped in v0.51.679 (Release YI, just deployed) — thanks @rodboev! Fixes #4759. Fresh sidebar boot now fetches /api/sessions and /api/projects concurrently instead of sequentially. Error handling preserved (a failing project fetch falls back to the cached list without dropping sessions). Gate: Codex SAFE, full suite 10693. Verified on prod. |
Thinking Path
origin/masterhas already shipped the#4842cache-rebuild fixes, so the remaining spec has to point at a different seam.renderSessionList(), and first-loadrenderSessionList()still starts/api/projectsonly after/api/sessionsreturns.What Changed
static/sessions.js: start the first-load/api/projectsrequest before awaiting/api/sessions, while preserving the current timeout, retry, and fallback behavior.tests/test_issue4759_parallel_sidebar_boot_fetch.py: add async behavioral regression coverage for parallel fetch start order, project-failure fallback, and preserved session request options.tests/test_session_sidebar_resilience.py: update the existing helper-shape assertions so they trace the extracted sidebar payload loader instead of the old inline project fetch block.tests/test_issue4766_sidebar_source_pushdown.py: load the extracted async helper into the existing sidebar-source harness so the refresh-path compatibility checks still exercise the real production call chain.Why It Matters
Fresh desktop tabs no longer wait for two independent sidebar boot fetches in sequence before the first sidebar payload can complete. The change stays inside the current frontend load contract, which keeps review risk low while still removing a measurable cold-boot tax.
Verification
pytest tests/test_issue4759_parallel_sidebar_boot_fetch.py -v --timeout=60pytest tests/test_issue4759_parallel_sidebar_boot_fetch.py tests/test_4167_sidebar_payload_and_scope.py tests/test_1694_root_saved_running_policy.py -v --timeout=60pytest tests/test_issue4759_parallel_sidebar_boot_fetch.py tests/test_session_sidebar_resilience.py tests/test_issue4766_sidebar_source_pushdown.py tests/test_4167_sidebar_payload_and_scope.py tests/test_1694_root_saved_running_policy.py -v --timeout=60Full-suite CI context, not a required local check unless requested:
pytest tests/ -v --timeout=60.Upstream
Closes #4759.
Builds on the shipped sidebar perf work in #4952 and #4962 by removing the remaining frontend-side serialization on fresh boot.
Model Used
GPT 5.5 via Codex CLI