Fix PythonWorker cold start drop issue#289
Conversation
Adds python_ready signal, queue draining, and deferred retry mechanism.
|
Hi @Abhi-1100 — thanks for the PR! Our automated scope gate flagged the following: ❌ No scope-approved linked issue. This PR must close an issue that carries one of: Please read CONTRIBUTING.md. Once an issue with the appropriate label exists and is linked here, re-run this check by pushing an empty commit or editing the PR description. A maintainer can also bypass this gate by adding the PRs that remain unresolved for 7 days will be closed automatically. |
… and remove unused handle_response
SummaryFixed a critical bug where AI chat assistant replies were being persisted Changes Made1. Added request-time state snapshot variablesAdded three member variables to QString pending_req_session_; 2. Snapshotting context on dispatchIn pending_req_session_ = active_session_id_; 3. Persisting to the original sessionIn ChatRepository::instance().add_message( 4. Cleanup and lifecycle management
User Impact
Testing Performed
Files Modified
|
Summary
Fixed a critical bug where early market data requests were silently dropped
during application cold starts. Asynchronous Python detection caused the
PythonWorker daemon to drop incoming requests before the environment was
fully initialized, leaving watchlist rows, market panels, and equity screens
stuck on spinners or
--values with no way to recover without a restart.Changes Made
python_ready()signal toPythonRunnerthat emits upon successfulcompletion of asynchronous Python detection.
route_yfinance_to_daemon()inPythonRunnerto interceptyfinance_data.pycalls and accurately route them, returning false earlyto allow fallback to the subprocess queue when Python is not yet available.
python_readysignal in thePythonWorkerconstructor toautomatically trigger
ensure_started()once Python resolves.QTimer::singleShot500ms deferred retry loop insidePythonWorker::launch_process()to safely hold and queue requests withoutblocking the UI thread while waiting for the Python executable.
PythonWorker::dispatch_queued()natively drains all pendingrequests correctly upon the daemon's ready handshake.
User Impact
background Python detection.
launch without silently failing or requiring manual user refreshes.
data requests — queued calls resolve the moment the daemon is ready.
Testing Performed
several seconds.
detection period.
throughout.
moment the Python daemon finishes its background boot sequence.
Files Modified
fincept-qt/src/python/PythonRunner.hfincept-qt/src/python/PythonRunner.cppfincept-qt/src/python/PythonWorker.cpp