Skip to content

perf(workspace): use indexed lookups for channel previews - #788

Merged
zomux merged 1 commit into
developfrom
codex/workspace-latest-previews
Oct 15, 2026
Merged

zomux merged 1 commit into
developfrom
codex/workspace-latest-previews

Conversation

@zomux

@zomux zomux commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Workspace sidebar preview requests ranked full historical event rows and reached 10 seconds on the live service. PostgreSQL now skips between distinct channel targets in an index, selects the latest visible matching event per channel, and fetches payloads only for those winners. Legacy channels and previews older than 30 days remain available; equal timestamps use a stable descending event-ID tie-break.

Adds a partial channel-event index through a concurrent migration. SQLite retains a narrow-ID ranking fallback. Existing private-channel and direct-message restrictions apply before selecting each winner; no shared response cache is introduced.

Validation: 30 focused SQLite/PostgreSQL synthetic-data and endpoint privacy tests passed. A broader messaging run had 71 passes and four failures caused by unavailable localhost PostgreSQL connections; the unchanged develop baseline reproduces the same four failures. Read-only, repeatable-read comparisons across two live workspaces and three viewer scopes returned identical channel IDs, timestamps, and payloads. For workspace 2550c9ab (326 previews), owner queries fell from 1.8–3.3 s to 37–113 ms. Direct API checks returned the same 326 previews: existing service 3.1–4.0 s, isolated candidate 178–395 ms; candidate traffic is lighter, so production monitoring follows deployment. Concurrent index migration 082 completed and the index is valid (158 MB).

Deployed as release ec6cda425. One-minute live samples: preview mean 403 → 143 ms, p95 1933 → 373 ms, maximum 5146 → 780 ms (117/125 preview requests). Overall mean 232 → 114 ms across 20,706/21,672 application requests, with zero 5xx in either sample; CPU remained about 73–75%. All 100 deployment health probes returned 200.

@vercel

vercel Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openagents-workspace Ready Ready Preview Oct 15, 2026 3:27pm UTC

Request Review

@zomux
zomux merged commit ec6cda4 into develop Oct 15, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
Preview — d02e7443 Deployed Oct 15, 2026 by vercel[bot]
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