-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix: fix task nonstopping error if model key is expired #1017
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
some questions:
|
|
@LuoPengcheng12138 Updated with model validation at first. |
hi, @bytecraftii Merge is good to go now. One more thing: we need to remove the Python pre-commit hook, as Wendong pointed out that we’re making a large number of updates to the project right now, and adding changes like linting rules will make PR reviews much more difficult. |
For now the pre-commit will not be automatically run, need to be trigger manually. Also I do think try to make the code cleaner will help to make the code review life easier in the long run. |
| # Make a simple test call in executor to avoid blocking | ||
| loop = asyncio.get_event_loop() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change to get_running_loop()? Since get_event_loop() is about deprecation
| mock_agent.step = Mock( | ||
| side_effect=Exception("Error code: 429 - Rate limit exceeded") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we treat rate limit as invalid signal? I think rate limit is temporal
| await loop.run_in_executor(None, lambda: agent.step("test")) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also add a timeout in external? like:
try:
await asyncio.wait_for(
loop.run_in_executor(None, lambda: agent.step("test")),
timeout=30.0
)
except asyncio.TimeoutError:
return False, "timed out"
Wendong-Fan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @bytecii ! I think this validation may be doing duplicate work. We already validate the model configuration via /model/validate on the settings page before users start tasks, so adding this would introduce extra latency to every task.
the root cause is in question_confirm when an API error occurs, the exception handler does return True instead of propagating the error. This silently swallows the failure and allows the task to continue running.
A much simpler fix would be to change that return True to raise. This lets the error bubble up to the main loop and be sent back to the frontend via SSE, no additional validation step required, WDYT?
|
added enhance PR #1170 based on review, feel free to check |
|
@Wendong-Fan Ok sounds good |
Description
Validate the model before the task starts and shows the errors if the basic validation fails.
Examples:
Fixes #1010
Fixes #1034
What is the purpose of this pull request?