Skip to content

[codex] Optimize VEGA startup and hot paths#99

Draft
unohee wants to merge 1 commit into
mainfrom
perf/int-2343-phase1-quick-wins
Draft

[codex] Optimize VEGA startup and hot paths#99
unohee wants to merge 1 commit into
mainfrom
perf/int-2343-phase1-quick-wins

Conversation

@unohee

@unohee unohee commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Summary

Implements INT-2343 Phase 1 quick wins from the performance roadmap:

  • Lazy-load fastmcp/mcp imports off the backend import path.
  • Cache SSL contexts, tool-group reads, and agent markdown reads with invalidation.
  • Switch SSE line reading to readline() with buffered fallback.
  • Move chat-start DB search/write work off the event loop.
  • Apply SQLite synchronous=NORMAL, remove duplicate message index creation, and add conversations(source, updated_at DESC).
  • Make startup-only WhatsApp/project-state initialization non-blocking.
  • Remove desktop warm-start sleep and shorten first backend poll.
  • Vendor marked, xterm, and addon-fit locally for offline/self-contained chat UI loading.

Operational cleanup

  • Removed the dev split-brain runtime by booting out com.unohee.vega-backend and keeping com.unohee.vega.server as the only port 8100 backend.
  • Restarted the source daemon and verified /api/health against vega.db.

Local code review

Ran openswarm review --path . before publishing.

Decision: APPROVE

OpenSwarm found no blocking correctness or quality issues. It suggested removing stale sourcemap references from vendored xterm assets; this PR includes that cleanup.

Validation

  • source ~/dev/mlx_env/bin/activate && python -m pytest -q -> 965 passed, 3 skipped in 87.80s
  • source ~/dev/mlx_env/bin/activate && python -m pytest tests/test_session_store.py tests/test_local_file_crawl.py tests/test_streaming_coverage.py tests/test_tools_workspace.py -q -> 101 passed, 2 skipped
  • cargo check in desktop/ -> pass
  • python -X importtime -c 'import web.server' -> 0.635s, under the <0.7s target
  • Importtime log contains no fastmcp / mcp.client
  • DB check: idx_messages_conv removed, idx_msg_conv retained, idx_conversations_source_updated added, PRAGMA synchronous=2 (NORMAL)
  • EXPLAIN QUERY PLAN list_sessions uses idx_conversations_source_updated
  • Runtime /api/health: app=vega-agent, db=vega.db, MCP background load recovered to mcp_tools=194, total_tools=295

unohee commented Jul 2, 2026

Copy link
Copy Markdown
Owner Author

Local Code Review

Tool: openswarm review --path .

Decision: APPROVE

Result:

  • No blocking correctness or quality issues found in the working-tree diff.
  • Reviewer validated the changed files directly and ran Python compile, desktop cargo check, and related pytest coverage.
  • Suggestion found: vendored xterm/fit assets had stale sourcemap references. Addressed before commit by removing sourceMappingURL comments from the vendored files.

This local review is attached separately from CI so the PR has both automated checks and an explicit pre-publish review record.

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