Add submit timeout flag and surface api errors to user#137
Merged
aliroberts merged 1 commit intodevfrom Apr 17, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prevents runs from hanging on lost
/suggestresponses and surfaces real backend error detail instead of the genericsubmit_failedtermination.Context
Users were seeing runs stuck in
submittingfor ~40 min before the server heartbeat reaper killed them. Root cause:submit_execution_resulthad a 3650 s readtimeout; the backend
/suggestwould commit the nextexecution_tasksrow and return 200, but the reply was getting dropped in transit (LB/proxy/network). Meanwhileevery failure in the submit path was swallowed by a
try/except Exception: return None, so users only ever sawtermination_details="Failed to submit execution result"— hiding real causes like insufficient credits, auth errors, and candidate-generation failures.Changes
Queue-mode recovery on submit (
core/api.py)WecoClient.suggestnow runs_recover_queue_suggestonReadTimeout/ConnectionError/ 5xx when atask_idis supplied.get_run_status(include_history=True)+get_execution_tasks: if a ready task is queued (or the run iscompleted), synthesize a success responseso the main loop continues via its normal poll/claim path. Also pulls the previous step's
metric_valuesoui.on_metricfires for the recovered step.Configurable submit timeout
timeoutplumbedWecoClient.suggest→submit_execution_result→_run_optimization_loop→optimize/resume_optimization.--submit-timeout SECONDSflag onweco runandweco resume. Default (None) preserves the existing(10, 3650)behavior — no impact on existingclients.
Error surfacing (ported from
feature/derive-run; derive feature excluded)format_api_errorrenders backenddetail/suggestion/ extras as a multi-line string suitable forui.on_error.submit_execution_resultno longer swallows exceptions; signature tightened fromOptional[Dict]toDict; docstring now records what it raises.except HTTPErrorin_run_optimization_looppushes the formatted error through the UI and returnsOptimizationResult(reason=f"http_{status_code}", details=error_message)soruns.termination_reason/termination_detailscarry the real cause.