Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(autofix): Prevent long wait times for insights threadpool at end …
…of run (#1631) Issue #1630 I discovered in profiling that when the root cause step completed, there was sometimes a huge wait (the case I saw was 6 seconds) for the thread pool to finish it's last insight card generation, before moving onto the root cause formatter. (similar for the coding step) Why? Because we started a new insight sharing thread after every LLM call, including the final call of the agent run. Due to Zach's changes that make us wait for threads to complete before ending the run, this caused big delays. Solutions in this PR: 1. Don't generate an insight card on the final output of the run. That was somewhat redundant anyway if we're about to show the final output card, plus this avoids starting a new thread from scratch that blocks everything else. 2. Adds a second thread worker. That way while running in parallel with the main agent, one insight doesn't have to wait for the previous to complete, and it's unlikely that insights will "fall behind" the main agent. We could completely eliminate this delay if we didn't wait for the threads to be completed, and I'm not sure that's a bad idea, but I'm still assuming we don't want to sacrifice that safety. This PR mitigates most of the issue while maintaining thread safety.
- Loading branch information