Skip to content

fix(import): time out stalled GitLab MR requests - #1243

Merged
jeff-r2026 merged 1 commit into
Tencent:mainfrom
ydflow:fix/gitlab-mr-request-timeout
Oct 21, 2026
Merged

jeff-r2026 merged 1 commit into
Tencent:mainfrom
ydflow:fix/gitlab-mr-request-timeout

Conversation

@ydflow

@ydflow ydflow commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

GitLab MR import has no application-level request deadline: none of its fetch calls supplies one. A slow or unfinished response can hold up the batch and prevent the existing nonfatal commits, diff and review-thread handlers from continuing promptly. Transport inactivity timeouts do not provide a total deadline for a response that keeps sending data.

Give each request, including each discussion page, a fresh 30-second AbortSignal.timeout. It covers response-body reads as well as waiting for headers. Metadata failures still fail that MR; optional-data failures keep their existing fallback behavior. Add the deadline and fallback rules to the English and Chinese knowledge guides.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Test Plan

Local environment: Windows, Node 24.19.0; based on upstream 8487c34d1013f52a232199492a489fea63217de2.

  • npm run build
  • npx tsc --noEmit
  • npm run lint
  • npx vitest run src/__tests__/gitlab-mr-timeout.test.ts src/__tests__/gitlab-mr-discussions.test.ts src/__tests__/import-mr.test.ts src/__tests__/import-mr-threads.test.ts src/__tests__/github-mr-fetch.test.ts --maxWorkers=2 — 47 tests passed across 5 files.
  • npx vitest run --config vitest.e2e.config.ts src/__tests__/e2e/gitlab-mr-timeout.test.ts --maxWorkers=1 after the build — 1 test passed, about 30.4 seconds.
  • git diff --check
  • Full unit suite: attempted with npx vitest run --maxWorkers=4, then stopped after failures outside this change. Seven selected failures were reproduced in a separate clean worktree at the upstream base above: token mode assertions, symlink EPERM, skill installation and write-only env-file assertions in local-agent.test.ts / env-loader.test.ts. Other full-suite failures were not exhaustively diagnosed. This is not a claim that the Windows full suite passes; Linux/macOS remain for CI.

The regression tests use a loopback HTTP server that either withholds headers or sends an unfinished JSON body for metadata, commits, diff, first-page discussions and second-page discussions. They shorten the native timeout for speed while asserting every configured deadline is 30,000 ms. Before the production fix, all five endpoint cases failed because the import did not settle.

The real-CLI E2E uses the unmodified 30-second production deadline, with no mocked fetch or shortened timer. MR 41 sends an incomplete metadata body; after cancellation the built CLI requests MR 42 (404), reports 0 succeeded, 2 failed, exits 1, never reaches AI analysis, and creates no learning output. No live GitLab service or model credentials are needed.

Related Issues

Discovered from the current source; no matching issue or fix was found in the open PR list and GitLab/timeout searches at submission time.

Notes for Reviewers

The deadline is per API request, not a total deadline for the import. No automatic retries or new CLI flags are added. Existing host validation, manual redirects and optional-data fallback policies are unchanged.

@github-actions

Copy link
Copy Markdown

No findings in the specified PR diff.

The PR description documents sufficient testing, including a built, real-CLI E2E run with the unmodified 30-second deadline that verifies batch continuation and failure reporting. This satisfies the repository’s testing requirement.

Review was read-only; I did not run, build, or install anything from the PR.

@jeff-r2026
jeff-r2026 merged commit ab2d253 into Tencent:main Oct 21, 2026
14 checks passed
Walternater pushed a commit to Walternater/teamai-cli that referenced this pull request Nov 2, 2026
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.

2 participants