Skip to content

test(electron): fix Windows cleanup and retain packaged smoke diagnostics - #1665

Open
4gray wants to merge 4 commits into
masterfrom
agent/release-ci-investigation
Open

4gray wants to merge 4 commits into
masterfrom
agent/release-ci-investigation

Conversation

@4gray

@4gray 4gray commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Windows Electron E2E can time out while closing the app, kill only Playwright’s cmd.exe wrapper, and leave Electron holding the temporary profile. A subsequent launch exits before CDP attaches, followed by ECONNRESET, a locked database and worker teardown timeout. Terminate the owned Windows process tree with taskkill /T /F; retain Unix signal escalation. Cleanup retries termination errors and throws unless process exit is confirmed. A real Windows shell/descendant regression runs in the E2E workflow.

Retain the Node child-process handle immediately after source, packaged and raw migration launches, in a WeakMap keyed by the ElectronApplication. Partial restart assignments therefore cannot pair a new application with an old process handle. When Linux exits after its last window closes, Playwright disposes its dispatcher; later electronApp.process() calls throw even after a clean exit. Cleanup now uses the retained handle, including preparation failures, without suppressing unconfirmed-exit errors.

The Linux portable build now uploads frame-copy smoke reports and traces even on failure. Pin the upload action and register its exact SHA in the build-workflow allowlist. The original master smoke failure passed unchanged on rerun and on the previous PR head; its original root cause remains unconfirmed and its assertions are unchanged.

Validation on e85d9befc: the disposed-dispatcher and partial-restart regressions, plus two packaging policy tests, failed before their fixes and passed afterwards. Locally, 272 packaging tests, 504 harness tests and 12 packaged fixture tests passed; the real Windows integration test is skipped on macOS. Three actual macOS E2E scenarios passed: unsaved-settings close/save/relaunch, M3U favorites across restart, and corrupt legacy-profile recovery. Targeted strict TypeScript, E2E lint (0 errors, 156 existing warnings), guidance validation and diff checks passed. Both process-ownership findings were addressed. Fresh reviews on this exact head: Greptile 5/5; Codex found no major issues; zero unresolved review threads. Full CI is still running; merge/release readiness is not yet established.

Updated the Electron debugging guide. No release note: test infrastructure, CI and documentation only; no application behavior change.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 22, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-22T21:23:40.131868Z e85d9be Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@4gray 4gray added the no-release-note PR intentionally ships without a .changes/ release note label Sep 22, 2026
@4gray

4gray commented Sep 22, 2026

Copy link
Copy Markdown
Owner Author

@greptileai

@greptile-apps

greptile-apps Bot commented Sep 22, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the earlier cleanup and action-pinning findings are fully addressed and no new actionable defects remain.

Summary

This PR hardens Electron E2E process cleanup and preserves packaged smoke-test diagnostics.

  • Retains each launched Electron child-process handle in a WeakMap keyed by its application, allowing cleanup after Playwright disposes its process dispatcher and after fixture restart assignments.
  • Terminates the complete Windows process tree with taskkill /T /F, while retaining Unix signal escalation and requiring confirmed exit.
  • Adds lifecycle and real Windows process-tree regressions to the E2E workflow.
  • Uploads Linux portable frame-copy smoke diagnostics on success or failure using a pinned artifact action.
  • Documents the cleanup and diagnostic workflow.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Launch Electron application] --> B[Capture child process in WeakMap]
    B --> C[Prepare application and run E2E]
    C --> D{Cleanup requested}
    D --> E[Retrieve handle by application identity]
    E --> F{Process already exited?}
    F -- Yes --> G[Cleanup confirmed]
    F -- No --> H[Request Playwright close]
    H --> I{Exit confirmed?}
    I -- Yes --> G
    I -- No --> J[Terminate owned process]
    J --> K{Windows?}
    K -- Yes --> L[taskkill /PID /T /F]
    K -- No --> M[SIGTERM then SIGKILL]
    L --> N{Exit confirmed?}
    M --> N
    N -- Yes --> G
    N -- No --> O[Throw exit-unconfirmed error]
Loading

Reviews (4) · Last reviewed commit: "test(electron): bind captured processes ..."

Comment thread apps/electron-backend-e2e/src/electron-test-fixtures.ts Outdated
Comment thread .github/workflows/build-and-make.yaml Outdated
@4gray

4gray commented Sep 22, 2026

Copy link
Copy Markdown
Owner Author

@greptileai

@4gray

4gray commented Sep 22, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: f48be2ac63

ℹ️ 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".

@4gray

4gray commented Sep 22, 2026

Copy link
Copy Markdown
Owner Author

@greptileai

@4gray

4gray commented Sep 22, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Comment thread apps/electron-backend-e2e/src/electron-test-fixtures.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a5bc36699c

ℹ️ 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".

Comment thread apps/electron-backend-e2e/src/electron-test-fixtures.ts Outdated
@4gray

4gray commented Sep 22, 2026

Copy link
Copy Markdown
Owner Author

@greptileai

@4gray

4gray commented Sep 22, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: e85d9befca

ℹ️ 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".

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-release-note PR intentionally ships without a .changes/ release note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant