Skip to content

Fix clone_repo TypeError and uvicorn reload loop triggered by data/repos writes - #5

Draft
H0NEYP0T-466 with Copilot wants to merge 2 commits into
masterfrom
copilot/start-linked-agent
Draft

Fix clone_repo TypeError and uvicorn reload loop triggered by data/repos writes#5
H0NEYP0T-466 with Copilot wants to merge 2 commits into
masterfrom
copilot/start-linked-agent

Conversation

Copilot AI commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Two bugs combined to crash the server during initialization: clone_repo() always raised TypeError due to a malformed tuple literal, and uvicorn's --reload-exclude pattern was too shallow to suppress WatchFiles events from deeply nested cloned repo files.

github_service.pyenumerate((1))enumerate([100, 1])

(1) is just the integer 1 in Python — no tuple is created without a trailing comma. This caused TypeError: 'int' object is not iterable on every new clone attempt, making it impossible to clone any repo.

The fix restores the intended fallback strategy:

# Before — crashes immediately
for attempt, depth in enumerate((1)):

# After — tries depth=100 first, falls back to depth=1 on index-pack/fetch-pack errors
for attempt, depth in enumerate([100, 1]):

run_commands.txtdata/*data/**

data/* only excludes one level of depth. Files like data/repos/some-repo/backend/main.py were not matched, so every git clone into data/repos/ triggered a WatchFiles reload, interrupting initialization mid-run.

-uvicorn main:app --reload --port 8006 --reload-exclude "data/*"
+uvicorn main:app --reload --port 8006 --reload-exclude "data/**"

📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Copilot AI changed the title [WIP] Start LinkedIn agent initialization and bot setup Fix clone_repo TypeError and uvicorn reload loop triggered by data/repos writes Mar 16, 2026
Copilot AI requested a review from H0NEYP0T-466 March 16, 2026 08:28
@H0NEYP0T-466
H0NEYP0T-466 marked this pull request as ready for review March 16, 2026 08:33
Copilot AI review requested due to automatic review settings March 16, 2026 08:33
@H0NEYP0T-466
H0NEYP0T-466 marked this pull request as draft March 16, 2026 08:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes two startup-breaking issues in the backend: a TypeError in repo cloning due to an invalid iterable, and a uvicorn reload loop caused by insufficient reload-exclude coverage for nested data/ paths.

Changes:

  • Fix clone_repo() retry loop to iterate over intended depths (100 then 1) instead of crashing on enumerate((1)).
  • Update dev run command to exclude all nested data/ paths from uvicorn reload triggers (data/**).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
backend/github_service.py Fixes clone retry depth iteration to prevent TypeError and allow fallback behavior.
backend/run_commands.txt Adjusts uvicorn reload-exclude pattern to cover nested files under data/.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread backend/github_service.py
log_callback(f"[github] Cloning {repo_name}...")
# Attempt clone, falling back to --depth=1 on network/index-pack errors
for attempt, depth in enumerate((1)):
for attempt, depth in enumerate([100, 1]):
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.

3 participants