Skip to content

fix(server): offload blocking git operations#833

Open
GautamSharma99 wants to merge 1 commit into
repowise-dev:mainfrom
GautamSharma99:fix/async-git-server-jobs
Open

fix(server): offload blocking git operations#833
GautamSharma99 wants to merge 1 commit into
repowise-dev:mainfrom
GautamSharma99:fix/async-git-server-jobs

Conversation

@GautamSharma99

Copy link
Copy Markdown
Contributor

fix -> #832

Summary

  • Offload polling fallback Git HEAD checks from the asyncio event loop.
  • Offload incremental regeneration’s Git and change-detection work.
  • Offload post-job state stamping and Git HEAD lookup.
  • Add regression tests proving these operations run on worker threads.
  • Include the polling job reference fix required for the scheduler path.

Problem

The server ran synchronous Git commands and change detection from async
FastAPI/APScheduler tasks. A slow repository could block the event loop,
delaying API responses, SSE progress updates, cancellation requests, and other
background jobs.

Polling processed repositories sequentially, with each Git HEAD lookup allowed
to block for up to 10 seconds.

Fix

Use asyncio.to_thread() for blocking Git, state-persistence, graph, and
change-detection operations while preserving the existing timeout and error
handling behavior.

Testing

  • uv run pytest tests/unit/server/test_scheduler_async.py tests/unit/server/test_job_executor.py -q
    • 13 passed
  • uv run pytest tests/unit/server -q
    • 964 passed
    • 2 unrelated pre-existing failures in test_code_rationale.py
  • Ruff lint and formatting checks passed.
  • Mypy passed for the changed server modules.**

@repowise-bot

repowise-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

✅ Health: 7.6 (unchanged)

📋 At a glance
1 file changed health · 3 hotspots touched · 1 new finding introduced · 5 co-change pairs left out · 2 files with recent fix history.

Files & modules (2)
  • packages (2 files)
    • .../server/job_executor.py
    • .../server/scheduler.py
  • tests (1 file)
    • .../server/test_job_executor.py

⚠️ Change risk: moderate (riskier than 38% of this repo's commits · raw 8.3/10)
This change's risk is driven by:

  • more lines added than baseline
  • more scattered than baseline

🩹 Review priority (files here with the most recent bug-fix history — defects cluster, so review these first)

File Score Δ Why
.../server/test_job_executor.py 8.8 → 9.1 ▲ +0.2 score drifted on re-parse — no PR-attributable biomarkers
🔎 More signals (2)

🔥 Hotspots touched (3)

  • .../server/job_executor.py — 8 commits/90d, 9 dependents · primary owner: Raghav Chamadiya (64%)
  • .../server/test_job_executor.py — 3 commits/90d, 1 dependents · primary owner: joptimus (52%)
  • .../server/scheduler.py — 0 commits/90d, 1 dependents · primary owner: Raghav Chamadiya (100%)

🔗 Hidden coupling (1 file)

  • .../server/job_executor.py co-changes with these files (not in this PR):
    • .../pipeline/orchestrator.py (4× — 🟢 routine)
    • .../commands/workspace_cmd.py (3× — 🟢 routine)
    • docs/USER_GUIDE.md (3× — 🟢 routine)
    • .../routers/repos.py (3× — 🟢 routine)
    • .../server/app.py (3× — 🟢 routine)

👀 Suggested reviewers @joptimus


📊 Full report · ⭐ Star Repowise · 📥 Install bot · Last updated 2026-07-14 13:21 UTC
Silence on a single PR with [skip repowise] in the title · Per-repo toggle on repowise.dev/settings?tab=bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant