Skip to content

Automation: the host recognises a revocation by a deadline, so a window closed after it exits with 71 (#709) - #710

Merged
ambroise-leclerc merged 1 commit into
developfrom
709-statut-echeance-watchdog
Nov 28, 2026
Merged

ambroise-leclerc merged 1 commit into
developfrom
709-statut-echeance-watchdog

Conversation

@ambroise-leclerc

Copy link
Copy Markdown
Collaborator

Closes #709.

What changes

Automation (include/webfront/automation/Session.hpp, Enable.hpp)

  • The session records which native deadline revoked it: Session::revokedBy() returns operation-deadline or startup-deadline (Session::operationDeadline, Session::startupDeadline), empty when the session is open or closed for another reason. describe(), hence the webfront.session tool, gives it as revocation. The first closing fixes it, like the failure reason.
  • The supervisor no longer calls session->close("Native automation deadline exceeded") after an expiry: expire and expireStartup already closed the session with their own reason, so that call had no effect, and its reason was never the one the session kept.

Test host (test/web/AutomationHost.cpp)

  • automation_host exits with 71 when revokedBy() names a deadline, and writes Automation <deadline>: <reason> on stderr. Before, it compared the failure with "Native automation deadline exceeded", which no deadline ever wrote: a window that closed after the deadline exited with 0, and AutomationMcpWatchdog passed only when the renderer kept the window open (72). A startup deadline now also exits with 71 instead of 70, as the issue asks.

Documentation: docs/AUTOMATION.md (the revocation member of webfront.session, the new case of AutomationMcpWatchdog) and docs/CHANGELOG.md (Fixed).

Tests

  • Unit (test/unit/AutomationTests.cpp): an expired operation gives revokedBy() == operation-deadline and the same revocation in describe(), and a later close("Native automation deadline exceeded") keeps both the deadline and the first reason; an expired startup gives startup-deadline; a session closed for another reason ("Developer window disconnected") names no deadline.
  • AutomationMcpWatchdog (test/tools/AutomationClient.py) first runs an operation that never completes in a responsive renderer (await new Promise(() => {})): the deadline revokes the session, the page runs the request to close, show() returns, and the host must exit with exactly 71 and log Automation operation-deadline: Native operation deadline exceeded. This is the case of the issue (window closed after the deadline), now deterministic. The blocked-renderer case still accepts 71 or 72. The two archives are built by one helper (operation_archive).
    • With the former check of the host restored: AssertionError: exit 0, the symptom of the issue.
    • With the fix: passes.
  • Local run (Windows, WebView2, Release): the two automation unit scenarios, AutomationMcpWatchdog and AutomationMcpWindow pass.
  • Not run locally: the macOS job where the failure occurred, and the complete suite.

…st exits with 71 (#709)

Session::expire and expireStartup close the session with their own reason, which the supervisor's later close could not
replace: automation_host compared the failure with a reason no deadline ever wrote, and a window that closed after the
deadline exited with 0. The session now records which deadline revoked it (revokedBy(), and revocation in
webfront.session), the host reads that state, and AutomationMcpWatchdog first runs an operation that never completes in a
responsive renderer, whose window closes after the deadline: status 71, deterministically.
@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

La session expose maintenant la cause d’une révocation par échéance. Le superviseur distingue les échéances d’opération et de démarrage. L’hôte utilise la cause enregistrée pour déterminer le statut de sortie, et le test watchdog couvre la fermeture après l’expiration d’une opération.

Changes: Révocation native et statut de sortie 71

Layer / File(s) Summary
Contrat et état de révocation
include/webfront/automation/Session.hpp, test/unit/AutomationTests.cpp, docs/AUTOMATION.md, docs/CHANGELOG.md
Session expose revokedBy() et le champ revocation, qui indique operation-deadline, startup-deadline ou une valeur vide. Les tests vérifient que la première cause de fermeture est conservée. La documentation décrit ces valeurs.
Traitement des échéances et du statut de sortie
include/webfront/automation/Enable.hpp, test/web/AutomationHost.cpp, test/tools/AutomationClient.py, docs/AUTOMATION.md
Le superviseur traite séparément les échéances d’opération et de démarrage. L’hôte attribue le statut 71 lorsqu’une cause de révocation est présente. Le test watchdog vérifie ce statut après qu’une opération reste en attente dans un renderer réactif, ainsi que le nettoyage des ressources MCP.

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

Change: Bug fix · Severity of issue fixed: Low

Possibly related PRs

  • ambroise-leclerc/WebFront#407 — Introduit le chemin d’automatisation de fenêtre et le watchdog natif dont cette PR modifie la révocation par échéance.
  • ambroise-leclerc/WebFront#502 — Ajoute enableAutomation et Session, concernés par le contrat de révocation par échéance modifié ici.

Suggested reviewers: am-l

Merge Risk: Minimal · up to 9e011

This change makes the automation host exit with 71 whenever a native deadline revoked the session, including a window that closes after the deadline. No significant production risk remains. The only open point is a minor diagnostic-text edge case that does not change the exit status.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed Le titre décrit le changement principal : l'hôte d'automatisation reconnaît une révocation par délai natif, et une fenêtre fermée après ce délai quitte avec le code 71. Le résumé et les objectifs conf…
Description check Passed La description relie le changement à l'issue #709 et détaille les modifications de Session.hpp, Enable.hpp, AutomationHost.cpp, de la documentation et des tests. Elle correspond directement au changes…
Linked Issues check Passed [#709] Exigence : l'hôte doit reconnaître une révocation par échéance quelle que soit la raison exacte, et une fenêtre fermée après l'échéance doit sortir avec 71. Preuves au head : Session::expire …
Out of Scope Changes check Passed Les modifications relèvent de #709 : état de révocation dans Session (revokedBy(), champ revocation), suppression de l'appel générique de fermeture dans le superviseur, adaptation de l'hôte de t…
Full details: Title check

Explanation

Le titre décrit le changement principal : l'hôte d'automatisation reconnaît une révocation par délai natif, et une fenêtre fermée après ce délai quitte avec le code 71. Le résumé et les objectifs confirment ce point (Session::revokedBy(), sortie 71, issue #709). Le titre est long (108 caractères) mais reste précis.

Full details: Description check

Explanation

La description relie le changement à l'issue #709 et détaille les modifications de Session.hpp, Enable.hpp, AutomationHost.cpp, de la documentation et des tests. Elle correspond directement au changeset.

Full details: Linked Issues check

Explanation

[#709] Exigence : l'hôte doit reconnaître une révocation par échéance quelle que soit la raison exacte, et une fenêtre fermée après l'échéance doit sortir avec 71. Preuves au head : Session::expire appelle closeLocked(..., operationDeadline) et Session::expireStartup appelle closeLocked(..., startupDeadline). Session::revokedBy() renvoie la valeur mémorisée et describe() expose le champ revocation. Selon la description de la PR et le résumé, test/web/AutomationHost.cpp teste revokedBy() au lieu de la chaîne fixe, sort avec 71 en cas de révocation, et applique aussi 71 à l'échéance de démarrage. Le superviseur Enable.hpp ne referme plus la session avec le motif générique. Tests : test/unit/AutomationTests.cpp couvre l'expiration d'opération, la première raison conservée, l'expiration de démarrage et une fermeture sans échéance ; test/tools/AutomationClient.py ajoute le cas déterministe où la fenêtre se ferme après l'échéance (exit 71, journal attendu). Limite : le corps de closeLocked et les fichiers AutomationHost.cpp, Enable.hpp et AutomationClient.py n'ont pas pu être relus directement (lecture du diff indisponible, fichier tronqué). Le constat repose sur la description de la PR et le résumé, qui concordent avec le code relu.

Full details: Out of Scope Changes check

Explanation

Les modifications relèvent de #709 : état de révocation dans Session (revokedBy(), champ revocation), suppression de l'appel générique de fermeture dans le superviseur, adaptation de l'hôte de test, tests unitaires et de scénario, et helpers operation_archive / operation_body qui servent le nouveau cas de test. La documentation (docs/AUTOMATION.md, docs/CHANGELOG.md) décrit ces mêmes changements. Aucune modification sans lien avec l'issue n'a été relevée dans les preuves disponibles. Limite : les diffs complets n'ont pas pu être lus ; la conclusion repose sur le résumé de la PR et sur la relecture partielle de Session.hpp.

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

Warning

Some tools did not complete. Review the errors below.

Cppcheck (2.22.0)

Cppcheck (2.22.0) exceeded its 180-second time budget. Findings from completed work are retained; remaining checks are incomplete.

test/unit/AutomationTests.cpp

Cppcheck interrupted; analysis of this file is incomplete

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

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: afefe445-79aa-44ac-94f1-5cb36ea1fcf3
Commits

Reviewing files that changed from the base of the PR and between 6f3ac79 and 9e011d6.

Files selected for processing: 7

  • docs/AUTOMATION.md
  • docs/CHANGELOG.md
  • include/webfront/automation/Enable.hpp
  • include/webfront/automation/Session.hpp
  • test/tools/AutomationClient.py
  • test/unit/AutomationTests.cpp
  • test/web/AutomationHost.cpp

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

@ambroise-leclerc
ambroise-leclerc merged commit 60e7b11 into develop Nov 28, 2026
23 of 24 checks passed
@ambroise-leclerc
ambroise-leclerc deleted the 709-statut-echeance-watchdog branch November 28, 2026 08:27
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.

AutomationMcpWatchdog : le statut 71 est inatteignable, la raison de révocation ne correspond pas

2 participants