survey/analyze blocks workers — needs async task queue #107
Labels
No labels
a11y
backlog
beta-feedback
bug
enhancement
feature-request
frontend
needs-triage
question
vue
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Circuit-Forge/peregrine#107
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
POST /api/jobs/:id/survey/analyzeis the only LLM endpoint in Peregrine without an async task queue. It blocks its FastAPI worker thread for the full LLM inference duration.Discovered during load testing: at 100 concurrent users with survey tasks at weight 2, ~22 greenlets simultaneously blocked on LLM inference. This exhausted all LLM backends and starved every async task (cover letter, research, ATS optimizer) into 90-second poll timeouts.
Evidence (load test spike 2026-04-20, 100 users, 10 min)
Fix
Mirror the pattern used by cover_letter, research, and resume_optimizer:
Impact
Free tier: text-mode quick — fast but still blocks under concurrency. Paid tier: detailed + visual (vision model) — definitely needs queuing. Does not affect core job pipeline but degrades all LLM endpoints under real concurrency.
Fixed in commit 9101e71.
Moved
POST /survey/analyzeoff the FastAPI worker thread by routing it through the LLM task queue (same pattern ascover_letter,company_research,resume_optimize):scripts/survey_assistant.py— extracted prompt builders +run_survey_analyze()scripts/task_scheduler.py— addedsurvey_analyzetoLLM_TASK_TYPES, 2.5 GB VRAM budgetscripts/task_runner.py— addedelifbranch, result stored as JSONdev-api.py— sync endpoint →submit_task()+ new poll routeGET /survey/analyze/taskweb/src/stores/survey.ts—analyze()now submits task and polls at 3s intervalDuplicate in-flight tasks attach silently (same task_id returned).