Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Problem

Integration tests from PR #513 were flaking in CI due to stream timeouts:

  • tests/ipcMain/runtimeFileEditing.test.ts - File creation timed out after 15s
  • tests/ipcMain/sendMessage.test.ts - Multiple Anthropic provider tests timed out after 30s
  • tests/ipcMain/sendMessage.test.ts - Image support test timed out

CI logs show tests that passed took 10-258 seconds total, while failing tests hit the 15-30s stream timeouts. The issue is exacerbated by:

  • API rate limiting in CI (shared across parallel test runs)
  • CI environment overhead
  • Jest retry logic (3 retries) multiplying timeout impact

Solution

Make stream timeouts CI-aware with 2.5x multiplier for CI environments:

  • STREAM_TIMEOUT_LOCAL_MS: 15s → 37.5s in CI
  • STREAM_TIMEOUT_SSH_MS: 25s → 62.5s in CI
  • waitForStreamSuccess default: 30s → 75s in CI

CI detection uses standard process.env.CI check. Local development keeps existing faster timeouts for quick feedback.

Testing

The failing tests already have Jest retry logic (jest.retryTimes(2-3)) which will validate the fix across multiple attempts if needed. Extended timeouts give API calls breathing room without slowing down successful runs (streams still end immediately on completion).

Generated with cmux

Integration tests were timing out in CI due to:
- API rate limiting causing slower response times
- CI environment overhead
- Tests using 15s/25s timeouts insufficient for file operations

Changes:
- Add CI detection to increase timeouts by 2.5x in CI environments
- STREAM_TIMEOUT_LOCAL_MS: 15s → 37.5s in CI
- STREAM_TIMEOUT_SSH_MS: 25s → 62.5s in CI
- waitForStreamSuccess default: 30s → 75s in CI

Fixes flakes in:
- tests/ipcMain/runtimeFileEditing.test.ts
- tests/ipcMain/sendMessage.test.ts (anthropic provider tests)
- tests/ipcMain/sendMessage.test.ts (image support test)
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

The previous commit added CI-aware timeout constants but tests
were still passing hardcoded values (10s, 30s) directly to
waitForStreamSuccess, bypassing the CI multiplier.

Changes:
- Export STREAM_TIMEOUT_SHORT_MS (10s → 25s in CI)
- Export STREAM_TIMEOUT_MEDIUM_MS (30s → 75s in CI)
- Replace all hardcoded timeouts in sendMessage.test.ts with constants

This ensures all flaky tests get the CI timeout multiplier:
- Anthropic provider tests (was 10s, now 25s in CI)
- OpenAI provider tests (was 30s, now 75s in CI)
- Image support tests (was 30s, now 75s in CI)
@ammario ammario closed this Nov 7, 2025
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