Skip to content

Conversation

@ThomasK33
Copy link
Member

Summary

  • Make debugTriggerStreamError async and await processingPromise to ensure error handling completes before returning (eliminates duplicate error-handling logic)
  • Wait for in-flight partial writes before writing error state to prevent inconsistent partial.json
  • Pass toolPolicy on resume to match original message (tools disabled → text output)
  • Add delay after resume to let history update complete before reading

Generated with mux

@ThomasK33 ThomasK33 force-pushed the fix-stream-error-race-conditions branch from fdc939e to 829ec28 Compare December 3, 2025 14:44
@chatgpt-codex-connector

This comment has been minimized.

- Make debugTriggerStreamError async:
  - Await in-flight partial writes before writing error state
  - Await processingPromise to ensure stream cleanup completes
  - Keep manual error handling (abort alone causes clean break, not throw)
- Fix race condition in error catch block: await partial writes before
  writing error state to prevent inconsistent partial.json
- Test fixes:
  - Pass toolPolicy on resume to match original message (tools disabled)
  - Add delay after resume to let history update complete
@ThomasK33 ThomasK33 force-pushed the fix-stream-error-race-conditions branch from 829ec28 to 50675c3 Compare December 3, 2025 14:48
@ThomasK33
Copy link
Member Author

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. 🚀

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ThomasK33 ThomasK33 added this pull request to the merge queue Dec 3, 2025
Merged via the queue into main with commit f4c4d3c Dec 3, 2025
21 of 23 checks passed
@ThomasK33 ThomasK33 deleted the fix-stream-error-race-conditions branch December 3, 2025 15:11
ammario pushed a commit that referenced this pull request Dec 3, 2025
## Summary

Add comprehensive E2E tests covering window lifecycle, IPC robustness,
streaming edge cases, persistence, and error display. These tests target
recent regression patterns.

## Recent Regressions Addressed

| Regression | Test Coverage |
|------------|---------------|
| `MockBrowserWindow.isDestroyed()` (#863) | IPC stability tests verify
no crashes during heavy IPC |
| IPC send to destroyed window (#859) | `ipcRobustness.spec.ts` -
concurrent IPC operations |
| Duplicate IPC handler registration (#851) | `windowLifecycle.spec.ts`
- rapid IPC calls test |
| Stream error handling (#880) | `streamEdgeCases.spec.ts` +
`errorDisplay.spec.ts` |

## New Test Files (26 tests total)

- **windowLifecycle.spec.ts** (6 tests): window operations, IPC
stability under load
- **ipcRobustness.spec.ts** (4 tests): concurrent IPC calls, state
preservation
- **streamEdgeCases.spec.ts** (6 tests): streaming during UI operations,
error scenarios
- **persistence.spec.ts** (4 tests): chat history, settings, mode
persistence
- **errorDisplay.spec.ts** (6 tests): error messages display, recovery
flows

## Infrastructure Changes

- **Error mock scenarios**: rate limit, server error, network error
scenarios
- **Stream timeline capture**: now handles `stream-error` events
(previously only `stream-end`)
- **CI matrix**: Linux (comprehensive, 47 tests) + macOS (window
lifecycle, 6 tests)

## CI Configuration

```yaml
matrix:
  include:
    - os: linux      # Comprehensive E2E tests
    - os: macos      # Window lifecycle tests only (platform-dependent)
```

_Generated with `mux`_
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