+
    jHàj¸  ã                  óF   € R t ^ RIHt ^ RIt^ RIHt RtR R ltR R ltR# )	að	  Cron external worker: the PM dependency boot its own entry point never gets.

``sys.executable -m cron.scheduler --external-worker-file ...``
(``cron/scheduler.py::_launch_external_cron_worker``) is a full Hermes entry point that
reaches ``hermes_bootstrap`` only from its ``__main__``, and it imports Hermes packages the moment it
starts. ``cron/scheduler_worker_env.py`` restores the committed generation's
``site-packages`` on its ``PYTHONPATH`` so those imports resolve, but a pinned path is not a
boot: the worker holds no lease on the generation, so the PM collector may remove it
between the gateway's exit and the worker's next import (#122290 review), and its
``sys.path`` never ran the generation's ``.pth`` files.

``pm.environments.activate_dependencies`` is exactly that boot -- the same call
``hermes_bootstrap`` makes for every other entry point -- and it leases the generation it
selects for the life of the process. ``worker_bootstrap()`` runs it at the top of
``cron/__init__.py`` -- ``-m cron.scheduler`` executes the package before the module, and the
package's first import (``cron.jobs`` -> ``hermes_yaml`` -> ``ruamel``) is already a
dependency -- and does nothing unless ``_launch_external_cron_worker`` marked this child: the
gateway already booted through ``hermes_bootstrap``, and every other importer of
``cron.scheduler`` is an interpreter that owns its own dependencies.

A genuine activation failure propagates: continuing on the inherited, unleased path lets the
collector delete the generation under a live worker. The worker then exits before its ownership
acknowledgement, which ``_launch_external_cron_worker`` already reports as a failed dispatch with
the worker's stderr. PM's legitimate no-ops (no committed generation under a venv, wheel, Nix)
return normally.

That boot covers dependencies only. ``hermes_bootstrap`` also finishes a pending source update
and may relaunch the process into a fresh one (``hermes_cli/venv_sync.py::relaunch_command``, an
``-I`` interpreter that ignores the pinned ``PYTHONPATH``), and re-executes it after restoring a
tree a killed ``hermes update`` half-wrote. ``finish_worker_boot()`` runs it from
the worker's ``__main__`` before the payload is read, so a relaunch replays the whole worker: the
payload is still on disk and the marker still set, and the new process boots its dependencies
again. ``hermes_bootstrap`` re-runs the (idempotent) dependency boot; the package-init call above
must stay, because ``cron.jobs`` needs dependencies before ``__main__`` can run.
)ÚannotationsN)ÚPathÚ_HERMES_CRON_WORKER_BOOTc               ó   € V ^8„  d   QhRR/# ©é   ÚreturnÚNone© )Úformats   "Ú:/home/ubuntu/.hermes/hermes-agent/cron/worker_bootstrap.pyÚ__annotate__r   1   s   € ÷ Bñ B˜$ñ Bó    c                 óÖ   € \         P                  P                  \        4      '       g   R# ^ RIHp  V ! \        \        4      P                  4       P                  P                  4       R# )zPRun PM's dependency boot in the marked external worker (again after a relaunch).N©Úactivate_dependencies)
ÚosÚenvironÚgetÚWORKER_MARKERÚpm.environmentsr   r   Ú__file__ÚresolveÚparentr   s    r   Úworker_bootstrapr   1   s<   € ä�:‰:�>‰>œ-×(Ò(ÙÝ5áœ$œx›.×0Ñ0Ó2×9Ñ9×@Ñ@ÖAr   c               ó   € V ^8„  d   QhRR/# r   r
   )r   s   "r   r   r   :   s   € ÷ 	(ñ 	(˜Dñ 	(r   c                 óV   € ^ RI p \        P                  P                  \        R4       R# )aM  Run ``hermes_bootstrap`` before the worker reads its payload; may relaunch the worker.

Not from ``worker_bootstrap()``: while ``-m cron.scheduler`` executes ``cron/__init__.py``,
``sys.argv[0]`` is still ``-m`` and ``__main__`` has no spec, so the relaunch command could
not name the module to re-run. In ``__main__`` both are set.
N)Úhermes_bootstrapr   r   Úpopr   )r   s    r   Úfinish_worker_bootr   :   s   € ó ä‡J�J‡N�N”= $Ö'r   )	Ú__doc__Ú
__future__r   r   Úpathlibr   r   r   r   r
   r   r   Ú<module>r#      s(   ðñ"õH #ã 	Ý ð +€õB÷	(r   