From 662924c6a1fb707812b85c21c7bcb2b1519a8e2d Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Sun, 29 Mar 2026 21:21:14 -0400 Subject: [PATCH] fix: pass user to _run_job so get_user_gemini_key resolves correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NameError: name 'user' is not defined in orchestrator._run_job — user was resolved in the endpoint but not forwarded to the background task. Co-Authored-By: Claude Sonnet 4.6 --- cortex/routers/orchestrator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cortex/routers/orchestrator.py b/cortex/routers/orchestrator.py index 536f9d9..330ccd3 100644 --- a/cortex/routers/orchestrator.py +++ b/cortex/routers/orchestrator.py @@ -105,7 +105,7 @@ async def orchestrate(req: OrchestrateRequest) -> OrchestrateResponse: _jobs[job_id] = job # Run in background — caller polls GET /orchestrate/{job_id} - asyncio.create_task(_run_job(job_id, req)) + asyncio.create_task(_run_job(job_id, req, user)) logger.info("Orchestrator job queued: %s — %.80s", job_id, req.task) return OrchestrateResponse(job_id=job_id, status="queued") @@ -135,7 +135,7 @@ async def list_jobs() -> list[JobStatusResponse]: # Background runner # --------------------------------------------------------------------------- -async def _run_job(job_id: str, req: OrchestrateRequest) -> None: +async def _run_job(job_id: str, req: OrchestrateRequest, user: str) -> None: """Execute the orchestration job and update the job store.""" async with _jobs_lock: _jobs[job_id]["status"] = "running"