Skip to content

Remove the Windows agent's profile after a forced exit [#439] - #441

Merged
ambroise-leclerc merged 2 commits into
developfrom
439-watchdog-profile-windows
Oct 31, 2026
Merged

ambroise-leclerc merged 2 commits into
developfrom
439-watchdog-profile-windows

Conversation

@ambroise-leclerc

Copy link
Copy Markdown
Collaborator

Fixes #439.

When the agent's exit is forced, the in-process removal of the WebView2 profile retries for 2 s and then gives up. If msedgewebview2.exe still holds files, the profile is left behind (the failure of AutomationCliWatchdog on loaded runners). A detached cmd.exe now repeats the removal for about 20 s, as the Linux side already does with a shell. The case's second CLI invocation limit goes from 15 s to 45 s.

Validation: AutomationCliWatchdog and AutomationMcpWatchdog pass locally (Windows, WebView2 build), including in a parallel web-integration run. The failure is intermittent and was not reproduced locally, and no regression test was added: this needs the hosted Windows runner (rerun of the desktop job) to be confirmed.

The WebView2 processes can hold the profile past the 2 s in-process retry, which then leaves it behind once the agent exits. A detached cmd.exe repeats the removal for about 20 s. The watchdog case's second CLI invocation now has a 45 s limit.
Copilot AI balanced review requested due to automatic review settings October 31, 2026 11:08
@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 47f959fb-05a2-4190-a289-d8dc9b4519e6
Commits

Reviewing files that changed from the base of the PR and between e26248f and 343bb37.

Files selected for processing: 3
  • docs/CHANGELOG.md
  • js/developer/tools/WebFrontAgent.cpp
  • test/tools/AutomationClient.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

Sous Windows, l’agent lance un processus détaché pour réessayer la suppression du profil après l’échec du nettoyage immédiat. Le watchdog teste ce comportement avec un fichier verrouillé et attend plus longtemps la disparition du profil et la seconde invocation CLI.

Changes: Nettoyage des profils Windows

Layer / File(s) Summary
Lancement et mode de nettoyage détaché
js/developer/tools/WebFrontAgent.cpp
L’agent peut relancer le même exécutable avec l’option interne --cleanup-profile. Le mode extrait le chemin du profil et réessaie remove_all jusqu’à 20 fois, avec une seconde entre les tentatives.
Intégration au nettoyage et vérification Windows
js/developer/tools/WebFrontAgent.cpp, test/tools/AutomationClient.py, docs/CHANGELOG.md
Après l’échec des tentatives de suppression intégrées, l’agent lance le nettoyeur détaché. Le watchdog vérifie la suppression après libération d’un fichier verrouillé. Les délais d’attente du test augmentent, et le changelog décrit ce comportement.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant Agent
  participant NettoyeurDetache
  participant Profil
  Agent->>NettoyeurDetache: Lance --cleanup-profile avec le chemin du profil
  NettoyeurDetache->>Profil: Réessaie la suppression
  Profil-->>NettoyeurDetache: Suppression réussie après libération du fichier verrouillé
Loading

Possibly related PRs

Suggested reviewers: am-l

Merge Risk: Minimal · up to 343bb

No merge-blocking issue is established. The cleanup change still needs confirmation on the hosted Windows runner.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed Le titre décrit clairement le changement principal : le nettoyage du profil Windows après une sortie forcée de l’agent.
Description check Passed La description est directement liée aux changements. Elle explique le nettoyage détaché, les nouvelles tentatives et l’augmentation du délai du watchdog.
Linked Issues check Passed Pour #439, le code Windows lance un processus détaché avec une commande Unicode et réessaie la suppression du profil pendant environ 20 secondes. Le test check_windows_profile_cleaner vérifie le ver…
Out of Scope Changes check Passed Les changements restent liés à #439. Le code C++ ajoute le nettoyage différé du profil Windows. Le test Python couvre le nettoyeur et le watchdog. L’entrée de docs/CHANGELOG.md documente ce comporte…
Docstring Coverage Passed Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
Full details: Linked Issues check

Explanation

Pour #439, le code Windows lance un processus détaché avec une commande Unicode et réessaie la suppression du profil pendant environ 20 secondes. Le test check_windows_profile_cleaner vérifie le verrouillage d’un fichier et un chemin contenant des caractères Unicode et des métacaractères. Le scénario cli-watchdog utilise ce contrôle et attend la fenêtre de nettoyage. Le délai de la seconde invocation CLI passe à 45 secondes. Ces changements couvrent les exigences de code et de test de #439. La validation sur le runner hébergé reste une validation opérationnelle, pas une exigence de code manquante.

Full details: Out of Scope Changes check

Explanation

Les changements restent liés à #439. Le code C++ ajoute le nettoyage différé du profil Windows. Le test Python couvre le nettoyeur et le watchdog. L’entrée de docs/CHANGELOG.md documente ce comportement. Aucun changement indépendant n’est démontré.

Full details: Docstring Coverage

Explanation

Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 8 functions across 2 files. (1 skipped: 1 unsupported.)

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Copilot AI 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.

Copilot was unable to review this pull request due to rate limiting. Please try again later.

Comment thread js/developer/tools/WebFrontAgent.cpp Resolved
Comment thread js/developer/tools/WebFrontAgent.cpp Resolved
@ambroise-leclerc
ambroise-leclerc merged commit 6728582 into develop Oct 31, 2026
11 checks passed
@ambroise-leclerc
ambroise-leclerc deleted the 439-watchdog-profile-windows branch October 31, 2026 12:58
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.

AutomationCliWatchdog intermittently fails on Windows: native profile left behind after the forced exit

3 participants