Got it. Here’s a concise plan to make the share-status check run immediately after loadRemoteConfig() completes, before any other startup work. No changes executed yet.
Goal
Run server share-status reconciliation right after remote config is loaded, instead of waiting for controller start/list.
Plan (read-only)
Phase 1 — Core flow adjustments (lowest level first)
- Confirm the startup sequence in
cli/src/tui/app.tsx around loadRemoteConfig(), controller.start(), and controller.list().
- Identify the earliest safe point to call a share-status sync (after config, before list).
- Decide whether to call
controller.reconcileSharedState() directly or refactor a public “sync share status now” method on TraceController (prefer no API changes unless needed).
Phase 2 — TUI initialization ordering
- Insert the share-status sync immediately after
loadRemoteConfig() and before controller.start()/controller.list().
- Ensure it respects the existing auth/config gates (so it no-ops when not logged in).
Phase 3 — Diagnostics and behavior checks
- Update diagnostics timings (if needed) to reflect the new ordering so startup metrics remain accurate.
- Verify refresh throttling (
REMOTE_SHARE_REFRESH_MS) still behaves as expected with the new call order.
Atomic checklist
- Confirm current startup order in
cli/src/tui/app.tsx.
- Decide whether to expose a public share-sync method or call existing controller method.
- Insert share-sync call immediately after remote config load.
- Adjust diagnostics timings if they become misleading.
- Re-validate that unauthenticated/config-missing paths still short-circuit.
Before I proceed: do you want this to force an immediate server call even if it was recently synced (i.e., bypass the 15s throttle), or should it still respect the throttle? I recommend respecting the throttle unless you want a guaranteed call on every startup.