Skip to content

Improve startup and historical session readiness#754

Merged
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/web-ui-bundle-p4
May 16, 2026
Merged

Improve startup and historical session readiness#754
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/web-ui-bundle-p4

Conversation

@limityan
Copy link
Copy Markdown
Collaborator

Summary

This PR improves startup observability and historical session readiness without changing chunkSizeWarningLimit and without submitting design or baseline documents.

Changes

  • Add lightweight startup trace aggregation for desktop/web startup phases and API payload/remote-call counters.
  • Reduce pre-render startup blocking by moving non-critical context/recommendation/config watcher setup after the first render path.
  • Dedupe concurrent ConfigManager.getConfig() reads for the same path to avoid repeated IPC during startup bursts.
  • Track historical session hydrate state explicitly (metadata-only, hydrating, ready, failed) so opening a saved session shows a loading/retry state instead of briefly looking like a new empty session.
  • Reuse pending historical hydrate before ensuring backend session setup, reducing duplicate session restore/create work.
  • Add focused regression tests for startup tracing, config read dedupe, history hydrate transitions, failed/retry UI, pending hydrate reuse, ACP restore skip, and Modern store sync preservation.

Performance Results

Local release-like startup sampling, 3 runs each:

Metric Before After Result
First Render Scheduled avg 82.8ms 68.0ms -17.9%
Start Application avg 1249.3ms 1038.5ms -16.9%
After Render avg 1165.1ms 969.4ms -16.8%
Main Window Shown avg 2285.3ms 2004.4ms -12.3%
Interactive Shell Ready avg 2447.2ms 2196.3ms -10.3%
Startup API count avg 21.0 20.0 -1 call
Startup response bytes avg 14561 13559 -1002 bytes
Remote command count avg 0.0 0.0 no local increase

Historical-session UX improvement: saved sessions now enter a visible loading/retry lifecycle immediately, instead of falling through to the new-session empty state while turns are hydrating.

Risks / Follow-ups

  • Native window creation had one outlier in the after sample; this PR does not modify native window creation, so that metric is not claimed as a direct win and should continue to be sampled.
  • Real remote SSH workspace sampling was not available locally. The trace counters show no local remote-call increase, but remote command count / payload / serialization data should be verified with a real remote workspace before making remote-specific claims.
  • Deferring non-critical setup after render is intentionally conservative, but very early consumers of context/recommendation/config watcher state should be watched in manual smoke testing.
  • Historical sessions still load full turns; this PR avoids high-risk paging/worker/protocol changes. Very large sessions may still need a later, separately reviewed optimization.
  • Existing Vite chunk-size / dynamic-import warnings remain. This PR does not hide them by raising thresholds.

Validation

  • git diff --cached --check
  • rustfmt --edition 2021 --check --config skip_children=true src\apps\desktop\src\lib.rs src\apps\desktop\src\theme.rs
  • pnpm run lint:web
  • pnpm run type-check:web
  • pnpm --dir src/web-ui run test:run (124 files / 650 tests)
  • cargo check -p bitfun-desktop
  • cargo test -p bitfun-desktop (27 tests)
  • pnpm run desktop:build:release-fast passed during local milestone verification; existing Vite chunk warnings are still present.

Add startup phase tracing across desktop and web startup, reduce pre-render initialization work, and dedupe concurrent config reads.

Track historical session hydrate state explicitly so saved sessions show a loading or retry surface instead of briefly looking like a new empty session.

Add focused tests for startup tracing, config read dedupe, historical session state transitions, retry UI, pending hydrate reuse, ACP restore skip, and Modern store sync.
@limityan limityan merged commit d67df49 into GCWing:main May 16, 2026
4 checks passed
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