fix(server): launch persisted polling sync job#831
Conversation
|
✅ Health: 7.6 (unchanged) 📋 At a glance 🔎 More signals (1)🔥 Hotspot touched (1)
📊 Full report · ⭐ Star Repowise · 📥 Install bot · Last updated 2026-07-14 12:54 UTC |
|
The one-line fix is correct. upsert_generation_job returns the persisted GenerationJob, so job.id on the launch line is now defined, which clears both the NameError and the F821. The added test is a real regression test: on the current code the NameError is swallowed by the outer except before execute_job is ever awaited, so assert_awaited_once() would fail without the fix. Two things to sort out before merge:
Fine to merge this as the targeted crash fix, but let's not close #830 on it. Suggest routing the scheduler through the shared managed-launch path in a follow-up so it gets the same cancellation and failure-marking as the REST path |
fix #830
Summary
GenerationJobreturned by the polling fallback upsert.and executor invocation.
Problem
When the polling fallback detected that a repository's HEAD differed from its
last synchronized commit, it created and committed a pending generation job.
The returned job object was discarded, but the scheduler subsequently attempted
to call
execute_job(job.id, app_state). This raised aNameError, which wascaught by the scheduler's outer exception handler.
As a result:
already existed.
Fix
Store the result of
upsert_generation_job()injoband use its persisted IDwhen launching the background task.
Testing
test_polling_fallback_launches_persisted_job.Verification note: the full Python run reached 7,484 passed, 14 skipped. Two unrelated code-rationale tests fail independently on the existing
branch. Thirteen initially sandbox-sensitive failures passed when rerun outside the sandbox. Repository-wide Ruff/format/mypy also report
substantial pre-existing issues, while both changed files pass their focused checks.