Skip to content

fix: repo creation race condition + AI review timeouts#20

Merged
avrabe merged 1 commit intomainfrom
fix/repo-creation-and-ai-review
Mar 8, 2026
Merged

fix: repo creation race condition + AI review timeouts#20
avrabe merged 1 commit intomainfrom
fix/repo-creation-and-ai-review

Conversation

@avrabe
Copy link
Contributor

@avrabe avrabe commented Mar 8, 2026

Summary

  • New repo race condition: repository.created webhook fires before the default branch exists. Branch protection API returns 404, then issue creation crashes. Now polls up to 5 times (2s intervals) for the branch to appear, and wraps issue creation in try/catch.
  • AI review timeouts: Ollama streams responses by default. Without stream: false, response.json() hangs reading SSE chunks until the AbortController fires after 120s. Added stream: false and bumped default timeout to 300s.
  • AI reviews enabled: Flipped ai_review.enabled to true in config + updated server config.

Root causes

  1. GitHub fires repository.created before the repo has any commits/branches — the branch protection PUT returns 404
  2. Ollama's /v1/chat/completions defaults to streaming SSE. The code called response.json() expecting a single JSON blob, but got chunked SSE data that never terminates cleanly

Test plan

  • All 654 tests pass
  • Create a new repo in the org — temper should wait for the branch and then configure it
  • Open a non-bot PR — AI review should post within ~5 minutes

🤖 Generated with Claude Code

Repository creation:
- Poll for default branch existence (up to 5 retries, 2s apart) before
  applying branch protection — new repos don't have a branch until the
  first commit lands
- Wrap issue creation in try/catch to prevent crash if issues API isn't
  ready yet

AI reviews:
- Add stream: false to ollama request — without it, ollama streams SSE
  chunks and response.json() hangs until the AbortController fires
- Increase default timeout from 120s to 300s for the 3B model
- Enable ai_review in config (was disabled)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@avrabe avrabe merged commit 1960b60 into main Mar 8, 2026
5 checks passed
@avrabe avrabe deleted the fix/repo-creation-and-ai-review branch March 8, 2026 11:28
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