Repository navigation
fix(git-sync): raise default git timeout to 300s and make it configurable per org - #755
Conversation
…able per org Fixes #492 Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
|
📁 PR Artifacts Notice This PR adds or changes temporary PR-specific documents under |
|
Warning Your comment is too long (maximum is 65536 characters), so the coverage report was not added. See the job log for how to reduce it. |
|
@all-hands-bot Please review the latest head 071aa4d. All CI checks pass and the branch merges cleanly with main. This comment was created by an AI agent (OpenHands) on behalf of Graham Neubig. |
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Reviewed at head 071aa4da5e10b7465bcfa3488d5e5b5618340502 against issue #492 and the repository's review guidance.
Scope: git_sync/ is owned by this repository; the Canvas frontend follow-up is correctly left to OpenHands/OpenHands. The .pr/ evidence files follow the repo's PR-Specific Documents convention.
Correctness (verified in the workspace and against the current head):
- The default change (60→300 s) and env-var override work as described;
git_sync_git_timeout_secondsflows throughresolve_effective_git_sync_settingsto bothPUT /config's response/GET /statusand the sync cycle, and_lease_ttl(max(300, 5 × timeout)) reads the same merged settings, so the lease grows with the org's timeout. - The new override follows the repo's PATCH semantics: omitted fields stay unchanged (
model_dump(exclude_unset=True)), an explicitnullpops the override and reverts to the env default, and out-of-range values (0,-5,5,9.9,3601) are rejected with 422 while10–3600are accepted. I exercised the schema, merge, and lease-TTL code paths directly. POST /checkclamps to its fixed 20 s operator-facing timeout (min(timeout, _CHECK_TIMEOUT_SECONDS)), so a raised org timeout does not slow the check form.- The timeout error message names both the per-org setting and the env var, which is what the error banner surfaces.
- API contract change is additive: the new response field and optional request field are backward-compatible with the current Canvas consumer.
Tests: test_git_sync_client.py::TestTimeout, test_git_sync.py, and test_git_sync_backoff.py pass locally (99 passed); the router suite requires the PostgreSQL container fixture and is covered by the green unit-tests run on this exact head. All 10 CI checks pass at 071aa4d.
No material correctness, security, or compatibility findings.
✅ APPROVED
|
🚀 Released in 1.33.0. |
Why
Fixes #492. Git Sync's per-command timeout defaulted to 60 s. The first clone of a normal-sized repo over a slow link takes longer, so the first sync of an otherwise correct config failed with
git command timed out after 60.0s. The only way to change it wasAUTOMATION_GIT_SYNC_GIT_TIMEOUT_SECONDSand a restart, and the error did not say so.Summary
GitSyncSettings.git_sync_git_timeout_secondsdefaults to 300 s.interval_seconds:PUT /v1/git-sync/configacceptsgit_timeout_seconds(10–3600 s;nullreverts to the env default). It maps to the existingGitSyncSettingsfield, so the cycle, the lease TTL (max(300 s, 5 × timeout)) and/checkall read it through the normal merge.GET /v1/git-sync/status(and thePUTresponse) report the effectivegit_timeout_seconds.git_timeout_secondsin the Git Sync config, or the env var), since that message is what the Git Sync error banner shows.Scope: this does not change how git is spawned. The SSH hang in #491 is tracked separately in #493.
How to Test
209 passed. New tests: default is 300, env var sets the default,
PUTsets/clears the override and the cycle's merged settings see it, out-of-range values are rejected with 422, and a timed-out git command's error names the setting.pre-commitpasses on the changed files.Live check: I ran the service from each checkout in local mode (SQLite, local agent-server). Git Sync pointed at a ~9 MB repo served by a local
sshd, with the SSH link throttled to ~50 KB/s. A plaingit cloneof it takes ~100 s. Script:.pr/repro492.sh.Notes
status/configAPI it already uses. Adding the input there is a frontend follow-up..pr/holds temporary review evidence only; the release PR removes it.This PR was created by an AI agent (OpenHands) on behalf of Graham Neubig.