FEA-1550: Cut Agent Dashboard over to PGlite#275
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cc4e0e7bc4
ℹ️ 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".
880ed3e to
b8030f7
Compare
|
Several follow-up replies say fixes landed in the latest push, but the PR head is still |
826320f to
b07437c
Compare
- Add a recoverable SQLite to PGlite migration layer for agent dashboard data - Wire dashboard startup through database preparation before backend handoff - Copy supported tables with row-count verification and .bak retention handling - Cover successful migration, fallback, skip, startup, and backup cleanup paths - Bump desktop minor version to 0.16.0 for the database technology transition Testing: Full desktop test suite, typecheck, lint, and focused migration tests passed Risks: Migration currently covers the in-process Agent Dashboard tables present in this repo
- Restrict backup cleanup to exact naming pattern, regular files only, no recursive delete - Stamp backup mtime with migration time instead of preserving SQLite mtime - Stage PGlite in temp directory, promote only after backup succeeds - Sanitize absolute paths and error stacks from logs - Batch inserts (500 rows) instead of per-row INSERT - Validate all SQLite tables are managed before migration - Require .bak + .pgdata for already_migrated; detect downgrade scenario - Wire migration into startup with keepSource, non-blocking background execution - Pass startup result to runtime for PGlite readiness signaling Testing: Full migration test suite (9 tests), typecheck, and lint pass
- Preserve live SQLite when prior backup and PGlite data already exist. - Copy SQLite source rows in bounded batches instead of materializing entire tables. - Sanitize the remaining SQLite path in migration failure logs. - Add regression coverage for recreated SQLite, multi-batch event copy, and sanitized logs. Testing: Focused SQLite-to-PGlite migration tests, desktop typecheck, desktop lint, desktop build, and full desktop test suite passed. Risks: PGlite remains a prepared background copy while SQLite is the active runtime until async stores cut over.
- Replace the design-system Agent Dashboard SQLite runtime with a fresh PGlite data directory - Remove the SQLite-to-PGlite migration startup path and migration tests - Add async PGlite-backed dashboard stores, hook writes, collector imports, session sync, and reconciliation reads - Cover fresh PGlite startup and first hook ingestion Testing: Desktop typecheck, lint, focused PGlite dashboard tests, sync tests, and boot-recovery test passed; full desktop suite progressed through touched coverage but was interrupted after hanging in boot-recovery, which passed in isolation Risks: Existing agent-dashboard.sqlite data is intentionally not migrated; the new PGlite database starts empty and repopulates from hooks and collectors after first start
- Remove the generated Agent Monitor sidecar, third-party dashboard package wiring, and ClosedLoop-owned SQLite repository. - Keep Agent Dashboard on the PGlite runtime with fresh ingest state, ungated session import/sync, always-on chunked sync, and sanitized payloads. - Add PGlite coverage for dashboard parity, metered usage rows, and sync sanitization while retaining OpenCode ingestion from its external database. Testing: Desktop typecheck, lint, and focused dashboard/sync/reconciliation/parser tests passed. Risks: Full desktop test suite was not rerun after removing the legacy sidecar and SQLite-only tests.
b07437c to
292d589
Compare
Compatibility Smoke Test Results
|
- Use bigint token arithmetic in PGlite analytics and session totals, and carry hook identity fields into sync payloads. - Align dashboard pages, tables, controls, and visualizations on design-system primitives. - Port deleted SQLite/sidecar coverage that still maps to first-party PGlite behavior, including token reconciliation, pagination, lifecycle/import, parser, catchup-cache, and sync edge cases. Testing: Desktop typecheck, lint, build, focused PGlite dashboard tests, and expanded dashboard/PGlite/sync/parser/reconciliation/boundary tests passed. Risks: Full desktop test suite was not rerun; generated sidecar/vendor-only tests remain intentionally deleted because the sidecar path was removed.
- Add a PGlite-era boot probe for the disabled Agent Dashboard flag.\n- Wire the CI-invoked boot-off package script back into desktop package scripts.\n\nTesting:\nFull desktop test suite, typecheck, lint, and CI boot-off checks passed.\n\nRisks:\nLow; test-only script wiring and boot assertion coverage.
- Force the boot-off probe child process to exit on both success and failure.\n- Add a parent-side timeout so CI reports probe failures instead of hanging.\n\nTesting:\nTargeted boot-off script passed locally.\n\nRisks:\nLow; test-only probe control flow.
- Restore old_string, new_string, patch, arguments to STRIPPED_LEAF_KEYS to prevent leaking sensitive file diffs and shell args to cloud relay - Replace LIKE with ILIKE in PGlite session search for case-insensitive parity with the old SQLite behavior - Make runtime close() async and await it in both shutdown paths to prevent data loss from fire-and-forgotten PGlite close - Update apps/desktop/CLAUDE.md security model to document intentional sandbox gate removal (FEA-1550 ungated local import/sync) - Add agentSessionChunkedSyncEnabled cleanup in settings-store migration - Add TODO(FEA-1550) comment to settings migration blocks for future removal tracking - Wire getUserIdentity through runtime options to openPgliteAgentDatabase - Fix sweepStaleSessions to use injected now parameter instead of Date.now() for deterministic stale session cutoff - Expand sanitization test to cover all 12 stripped keys Testing: typecheck (no new errors), lint clean on changed files, agent-session-sync-sanitization tests pass (2/2), pglite-agent-dashboard-database tests pass (10/10) Risks: close() is now awaited in shutdown — if PGlite.close() hangs, it could delay app exit (mitigated by existing shutdown timeout). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use design-system Tabs, Switch, Input, Checkbox, Badge, and Button primitives across active renderer screens. - Remove the obsolete monolithic renderer HTML and stop staging it for packaging. Testing: Desktop typecheck, renderer build, focused renderer boundary tests, staging script syntax check, and raw control scan passed. Risks: Low; visual controls now come from the shared design system, and the removed HTML was no longer loaded by the main window.
thadeusb
left a comment
There was a problem hiding this comment.
Massive cleanup, the sidecar removal alone is worth celebrating. A few things inline on the new PGlite paths, biggest one being boot can crash if PGlite init fails.
- Degrade Agent Monitor startup when PGlite runtime init fails instead of crashing desktop boot. - Drain queued PGlite writes before close and cap live hook event data at the existing 64KB import limit. - Strip cloud-synced event summaries and update sanitization coverage. - Refresh stale Agent Monitor docs and delete dead pull request E2E audit/contract files. Testing: Full desktop typecheck, lint, focused PGlite and sync sanitization tests, and full desktop test suite passed. Risks: Low; cloud sync now omits event summaries, which reduces relay detail but avoids leaking raw tool error text.
…Glite app - Add 10 new PGlite tables: pack_catalog, pack_catalog_history, pack_install_runs, agent_packs, skills, project_pack_associations, plans, plan_versions, pull_requests, pr_backfill_seen - Port catalog-store (seed, list, fetch result, install runs) from CJS/SQLite to TypeScript/PGlite with jsonb columns and positional params - Port pack-store (upsert, list, skills, usage, sessions) with PG-native json operators replacing json_extract, string_agg replacing GROUP_CONCAT - Port pack-scanner (filesystem discovery of 5 harness skill roots) and 6 catalog detector adapters (RTK, SuperClaude, voltagent, etc.) - Port install-orchestrator with security-hardened child env, 10min timeout, concurrency guard, and IPC streaming replacing SSE - Port catalog-fetcher (GitHub API stats with gh CLI + REST fallback) and catalog-contents (7 content type scrapers with 7-day TTL) - Port plan-store with extraction from hook events (ExitPlanMode, file writes, Codex plans) and startup backfill from ~/.claude/plans/ - Port pr-store with command-gated detection of gh pr create and startup transcript backfill with mtime caching - Add 25+ IPC handlers for catalog, packs, plans, and PR features - Add preload bridge wrappers and shared DTO types for all new features - Build full React UI: PacksCatalog with install/uninstall cards, InstallModal with streaming output, Sparkline, PlansView with version history and confirm/reject, PullRequestsView with stat pills - Wire startup lifecycle: catalog seed → pack scan → GitHub fetch - Schedule 24h recurring catalog fetch with cleanup on close - Expose constrained storeDb accessor (PgliteExecutor, not raw client) Testing: typecheck clean, lint clean, 26/26 tests pass Risks: First run creates empty catalog/inventory tables; data populates from filesystem scan and GitHub fetch on next boot cycle. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Import design-system globals.css before local globals.css so DS styles are the base layer and local overrides apply on top - Replace arbitrary size-[18px] span wrapper with standard size-4 class directly on SVG elements, matching the design system's own icon sizing convention and ensuring Tailwind generates the class Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…er CSS - Add fade-in, slide-up, and pulse-slow animations via @theme inline (ported from sidecar tailwind.config.js, candidates for DS upstream) - Extend font fallback chains to match sidecar (Inter, Fira Code) The design system already provides surface-*, accent, border color tokens via @theme inline — no color additions needed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Align pack install IPC results and streamed output payloads across main, preload, and renderer types - Handle failed catalog mutation starts without opening a stale install modal - Pass selected recent project cwd through project-scoped install and uninstall actions - Keep local-only agent session user and org identity explicitly null until server-owned identity is available Testing: Desktop typecheck, lint, and renderer build passed Risks: Low; scoped to pack catalog install UI flow and typed IPC contracts
- Register dashboard database IPC handlers before PGlite startup completes and wait on the shared database promise per invocation. - Route pack scanner/catalog warnings through gateway logging and resolve catalog probe binaries through the login-shell resolver. - Retry stale worktree directory removal and fall back from invalid Git overrides before materializing PRD branches. - Add focused guards for early IPC registration, binary resolution fallback, and stale PRD worktree cleanup. Testing: Full desktop test suite, desktop typecheck, and desktop lint passed. Risks: Low; dashboard IPC now backpressures on database startup, and invalid Git overrides fall back to the login-shell Git path.
Code Review Results (21 findings, 1 rejected)Verdict: NEEDS_ATTENTION HIGH (3)
MEDIUM (18)
Dismissed (1)
🤖 Generated with Claude Code |
- Map pack catalog SQL rows into the shared renderer CatalogEntry DTO before crossing IPC. - Update catalog contents, install runs, and install orchestration to consume the same camelCase catalog contract. - Guard Packs UI rendering against malformed catalog array fields so partial data cannot crash the screen. - Add focused catalog-store contract coverage for catalog, history, and install-run DTO mapping. Testing: Catalog-store contract test, desktop typecheck, desktop lint, and renderer production build passed. Risks: Low; catalog IPC now uses the documented shared DTO shape consistently.
- Replace the Packs recent-projects DISTINCT query with a Postgres-compatible GROUP BY query. - Filter blank cwd values and preserve most-recent ordering by MAX(started_at). - Add a boundary guard for the invalid DISTINCT/ORDER BY pattern. Testing: Agent dashboard boundary test, desktop typecheck, and desktop lint passed. Risks: Low; only affects the recent project picker query used by pack actions.
There was a problem hiding this comment.
Correction from my earlier reply: apps/desktop/src/main/database/pglite.ts is hand-written source, not generated. I added a top-of-file note in 19235e6 to make that explicit.
There was a problem hiding this comment.
how do we maintain this file? how do we handle DB migrations/schema changes?
- Map installed packs, skills, plans, and pull requests into shared renderer DTOs before IPC. - Add renderer array guards for ported screens so stale or malformed arrays cannot crash map/length usage. - Add ported-screen store contract coverage for the IPC-facing DTO shapes. Testing: Full desktop test suite passed; focused ported-screen store contract tests, catalog contract tests, dashboard boundary tests, desktop typecheck, desktop lint, and renderer production build passed. Risks: Low; ported screen IPC now returns documented shared DTO shapes and renderer guards tolerate empty or malformed arrays.
|
Handled the latest summary-only review feedback in
Validation: full desktop test suite passed ( |
Summary
agent-dashboard.pgdata;agent-dashboard.sqliteis intentionally not read, copied, renamed, or migrated.opencode.db; SQLite is not used as a ClosedLoop app database.GROUP BYworkflow queries by grouping on subtype columns and aggregating fallback names.intcasts and using bigint token arithmetic for aggregate totals.0.16.0.Notes
apps/desktop/dist/main; after the bigint analytics fix, rebuild/restart the app so the stale::intanalytics query is not still loaded from old dist output.Testing
pnpm -C apps/desktop buildpnpm -C apps/desktop typecheckpnpm -C apps/desktop lint./apps/desktop/node_modules/.bin/tsx --test apps/desktop/test/pglite-agent-dashboard-database.test.ts./apps/desktop/node_modules/.bin/tsx --test apps/desktop/test/pglite-agent-dashboard-database.test.ts apps/desktop/test/agent-session-sync-service.test.ts apps/desktop/test/agent-session-sync-sanitization.test.ts apps/desktop/test/collectors-parsers.test.ts apps/desktop/test/ingest-orchestrator.test.ts apps/desktop/test/reconciliation-worker.test.ts apps/desktop/test/feature-flags.test.ts apps/desktop/test/agent-dashboard-boundary.test.ts apps/desktop/test/agent-monitor-listener.test.tsRisks
agent-dashboard.sqlitedata is not migrated by design; the new PGlite DB starts empty and repopulates from scrapers.