+
    jHàjI{  ã                  ó–  € R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RI	t	^ RI
t
^ RItR R ltR R ltR R	 ltR
 R ltR R ltR R ltR R ltR R ltR R ltR R ltR R ltRtR R ltR R ltR R  ltR! R" ltR# R$ ltR% R& lt ! R' R(4      tR) R* ltR+ R, lt R- R. lt!R/ R0 lt"]#R18X  d   ]$! ]!! 4       4      hR# )2zæFresh-checkout source update completion and its stdlib-only parent transport.

Imported before a swap; executed by path from the selected tree afterward. The
parent never imports application helpers from the replacement checkout.
)ÚannotationsN)ÚPathc               ó$   € V ^8„  d   QhRRRRRR/# )é   Úpathr   ÚdataÚdictÚreturnÚNone© )Úformats   "ÚA/home/ubuntu/.hermes/hermes-agent/hermes_cli/update_completion.pyÚ__annotate__r      s!   € ÷ ñ �dð  $ð ¨4ñ ó    c                ó˜   € V P                  R 4      pVP                  \        P                  ! V4      RR7       VP	                  V 4       R# )ú.tmpúutf-8©ÚencodingN)Úwith_suffixÚ
write_textÚjsonÚdumpsÚreplace)r   r   Ú	temporarys   && r   Ú_write_jsonr      s<   € Ø× Ñ  Ó(€IØ×ÑœŸš DÓ)°GÐÔ<Ø×Ñ�dÖr   c               ó    € V ^8„  d   QhRRRR/# )r   ÚcodeÚintr	   r   )r   s   "r   r   r      s   € ÷ -ñ -�sð -˜sñ -r   c                ó&   € V ^ 8¼  d   V # ^€V ,
          # )é    r   )r   s   &r   Ú_exit_statusr!      s   € Ø˜1”9ˆ4Ð, #¨¥*Ð,r   c          
     ó,   € V ^8„  d   QhRRRRRRRRR	R/# )
r   Úrequestr   Úresult_pathr   r   r   Úreceiptúdict | Noner	   r   )r   s   "r   r   r      s1   € ÷ ñ  Tð ¸ð ÀCð ÐR]ð Ðbeñ r   c                óp   € \        VR^RV R,          R,          RVRVRRRV P                  R4      /4       V# )z[The bootstrap child's answer; windows_resume stays the parent's token (and its atexit net).ÚschemaÚ	update_idr%   Ú	exit_codeÚwindows_resumeNÚ
pm_receipt)r   Úget)r#   r$   r   r%   s   &&&&r   Ú_write_bootstrap_resultr.      sG   € ä�Ø�!�[ '¨)Õ"4°[Õ"AÀ;ÐPTØ�7Ð,¨d°LÀ'Ç+Á+ÈlÓB[ðô ð €Kr   c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   Úproczsubprocess.Popenr#   r   Úrequest_pathr   r	   r
   r   )r   s   "r   r   r   &   s*   € ÷ !ñ !Ð+ð !°dð !È$ð !ÐSWñ !r   c                ó´  € ^ RI Hp ^ RIHpHp V! V 4      pVe¶   RV R2p\        RV 24       VP                  RRV4       VP                  P                  4       pVeq   VP                  P                  R	4      VR
,          R	,          8X  dC   \        P                  ! \        P                  ! VP                  4      4      VR
&   \        W!4       V! V 4       R# )aE  Windows: bind the suspended completion child to the update's job, then resume it.

Post-commit, refusing the child would fail a committed update, so a child the job refuses
still runs, fenced by its own checkout lease instead (R5b: it joins our lock holding a lease
byte, which keeps the checkout busy after a killed owner until the child exits). Never
silently: the refusal is printed and recorded as a failed ``update_custody`` step in this
run's receipt and, before the child runs (it has not read its request yet), in the receipt it
resumes, so the terminal receipt carries it.©Úupdate_receipt)Úbind_child_to_update_treeÚresume_suspended_childNz6the update's job would not take the completion child (z=), so it runs outside the job, holding its own checkout leaseu     âš  Update completion: Úupdate_custodyFr)   r%   )Ú
hermes_clir4   Úhermes_cli.update_lockr5   r6   ÚprintÚrecord_stepÚ_currentr-   r   r   Úloadsr   r   )	r0   r#   r1   r4   r5   r6   ÚrefusalÚdetailÚcurrents	   &&&      r   Ú_bind_and_resumerA   &   s¾   € õ *ßXá'¨Ó-€GØÒØJÈ7È)ð TDð DˆäÐ)¨&¨Ð2Ô3Ø×"Ñ"Ð#3°U¸FÔCØ ×)Ñ)×-Ñ-Ó/ˆØÒ 7§<¡<×#3Ñ#3°KÓ#@ÀGÈIÕDVÐWbÕDcÔ#cÜ!%§¢¬D¯JªJ°w·|±|Ó,DÓ!EˆG�IÑÜ˜Ô.Ù˜4Ö r   c               ó    € V ^8„  d   QhRRRR/# )r   r#   r   r	   r   )r   s   "r   r   r   ?   s   € ÷ \ñ \˜Dð \ Tñ \r   c                ó  € \        V R,          4      p\        P                  P                  R4      '       dH   \        P
                  ! \        P                  RRRRR\        V4      .VR\        P                  R	R
7       \        \        P                  V R,          RR7      pR@ F  pVP                  VR4       K  	  \        P                  ! RR7      ;_uu_ 4       p\        V4      R,          p\        V4      R,          p/ V CR\        P                  P!                  4       /Cp \        \        V4      R,          4      V R&   \#        WP4       \        P                  RRRRRRRV R,           2\        VR,          4      \        V4      \        V4      .p^ RIHpHp	 \        P*                  ! V3RVRVR\        P,                  R\        P.                  /\        P0                  R8X  d   R R!R"V	! V4      /MR#\        P2                  V,          /B p
\4        P6                  ! R$4      ! R%4      p \        P0                  R8w  d   \9        W V4        V
P                  P;                  R&4      p\        P                  P=                  VP?                  WÌ'       * R'7      4       \        P                  PA                  4        V'       d   Kx   T
PC                  4       p T
P                  PU                  4        \W        T4      p \X        PZ                  ! TP]                  R/R07      4      pTR1,          ^8w  g   TR2,          T R3,          R2,          8w  d   \_        R44      hTR5,          T8w  d   \_        R64      hTPa                  R34      pTec   TPa                  R24      T R3,          R2,          8w  g4   TPa                  R74      '       d   T^ 8H  TPa                  R84      R98H  8w  d   \_        R:4      hT^ 8X  d   Tf   \_        R;4      hTuuRRR4       #   \D         Edl   p  \        P0                  R8X  dC    \        PF                  ! T
PH                  \J        PL                  4       M~  \N         d     Mqi ; i\        P
                  ! R(R)R*R+\        T
PH                  4      .\        P                  \        P                  \        P                  ^
R!\        P2                  R,7        T
PQ                  4        T
PC                  ^
R-7       h   T
PC                  ^
R-7       i ; i   T
PQ                  4        T
PC                  ^
R-7       i   T
PC                  ^
R-7       i ; i; i  \D         d   pTPS                  R.4       YïhRp?ii ; iRp?ii ; i  T
P                  PU                  4        i ; i  \b        \^        \d        \f        3 d/   pR5T;'       g    ^R3RR<RR=T R>T R?2/u Rp?uuRRR4       # Rp?ii ; i  + '       g   i     R# ; i)AzOWait for new code; zero exit without a correlated terminal result fails closed.ÚsourceÚlinuxú-Iú-Sz-Bz-czpimport sys; sys.path.insert(0, sys.argv[1]); from pm.libatomic import install_before_lock; install_before_lock()NF)ÚcwdÚstdoutÚstderrÚcheckÚhomeÚ1)ÚHERMES_HOMEÚPYTHONUNBUFFEREDzhermes-completion-)Úprefixzrequest.jsonzresult.jsonÚstdout_isattyÚbytecodeÚbytecode_cacheú-uú-XÚutf8úpycache_prefix=úhermes_cli/update_completion.py)ÚCREATE_SUSPENDEDÚcheckout_lock_fdsrH   ÚenvrI   rJ   ÚposixÚstart_new_sessionTÚpass_fdsÚcreationflagsr   r   i    )ÚfinalÚtaskkillz/Tz/Fz/PID)ÚstdinrI   rJ   ÚtimeoutrK   r_   )rc   z@Completion cleanup failed; child processes may still be running.ú	utf-8-sigr   r(   r)   r%   z%completion response identity mismatchr*   z/completion response disagrees with process exitÚfinished_atÚoutcomeÚsuccessz/completion receipt does not attest this outcomez-completion did not publish a terminal receiptr+   Úerrorz  (the completion process exited Ú))Ú
PYTHONPATHÚ
PYTHONHOMEÚVIRTUAL_ENV)4r   ÚsysÚplatformÚ
startswithÚ
subprocessÚrunÚ
executableÚstrÚDEVNULLr   ÚosÚenvironÚpopÚtempfileÚTemporaryDirectoryrI   Úisattyr   r9   rY   rZ   ÚPopenÚPIPEÚSTDOUTÚnameÚCREATE_NO_WINDOWÚcodecsÚgetincrementaldecoderrA   Úread1ÚwriteÚdecodeÚflushÚwaitÚBaseExceptionÚkillpgÚpidÚsignalÚSIGKILLÚProcessLookupErrorÚkillÚadd_noteÚcloser!   r   r=   Ú	read_textÚ
ValueErrorr-   ÚOSErrorÚKeyErrorÚ	TypeError)r#   Úrootr[   ÚkeyÚ	directoryr1   r$   ÚcommandrY   rZ   r0   ÚdecoderÚchunkr   ÚexcÚcleanup_errorÚresultr%   s   &                 r   Úrun_completionrž   ?   s  € ä�˜Õ!Ó"€Dô
 ‡|�|×Ñ˜w×'Ò'Ü�ŠœŸ™¨¨d°D¸$ð^Ü_bÐcgÓ_hðjð  ¨´Z×5GÑ5GÈuõ	Vô Œr�z‰z w¨v¥ÈÔ
M€CÛ:ˆØ�‰��TÖñ ;ä	×	$Ò	$Ð,@×	AÕ	AÀYÜ˜I“¨Õ7ˆÜ˜9“o¨Õ5ˆØC�WÐC˜o¬s¯z©z×/@Ñ/@Ó/BÑCˆÜ$'¬¨Y«¸*Õ(DÓ$EˆÐ Ñ!Ü�LÔ*Ü—>‘> 4¨¨t°T¸6À4È?Ð[bÐcsÕ[tÐZuÐIvÜ�tÐ?Õ?Ó@Ü�|Ó$¤c¨+Ó&6ð8ˆ÷ 	Oô
 ×ÒØñSØðSØ#&ðSÜ/9¯©ðSÜGQ×GXÑGXðSäSU×SZÑSZÐ^eÔSeÐ# T¨:Ñ7HÈÓ7NÑOØ¤×!<Ñ!<Ð?OÕ!OÐPñSˆô ×.Ò.¨wÔ7¸	ÓBˆð%	 ä�w‰w˜'Ô!Ü  °Ô=ØØŸ™×)Ñ)¨$Ó/�Ü—
‘
× Ñ  §¡°¼Y Ó!GÔHÜ—
‘
× Ñ Ô"ß‘uØØ—9‘9“;‰Dð6 �K‰K×ÑÔÜ˜DÓ!ˆð	NÜ—Z’Z × 5Ñ 5¸{Ð 5Ó KÓLˆFØ�hÕ 1Ô$¨¨{Õ(;¸wÀyÕ?QÐR]Õ?^Ô(^Ü Ð!HÓIÐIØ�kÕ" dÔ*Ü Ð!RÓSÐSØ—j‘j Ó+ˆGØÒ"Ø—‘˜KÓ(¨G°IÕ,>¸{Õ,KÔKØ—{‘{ =×1Ò1Ø˜A‘I 7§;¡;¨yÓ#9¸YÑ#FÔGä Ð!RÓSÐSØ�qŒy˜Wš_Ü Ð!PÓQÐQð
 ÷[ 
BÒ	Aøô< õ 	ð-ð.Ü—w‘w 'Ô)ð!ÜŸIšI d§h¡h´·±Õ?øÜ1ô !Ù ð!úô #Ÿš¨
°D¸$ÀÌÈDÏHÉHËÐ'VÜ-7×-?Ñ-?Ì
×HZÑHZÜ.8×.@Ñ.@È"ÐTXÜ5?×5PÑ5PõRð.ØŸ	™	œàŸ	™	¨"˜	Ô-ð øð	 Ÿ	™	¨"˜	Õ-ûð.ØŸ	™	œàŸ	™	¨"˜	Õ-ø˜Ÿ	™	¨"˜	Õ-þÜ ô -Ø—‘Ð_Ô`ØÐ,ûð-þð+	ûð4 �K‰K×ÑÕûô" œ¤X¬yÐ9ô 	Nà § ¨¨I°tÐ=MÈtØ ˜uÐ$DÀTÀFÈ!ÐLðNô N÷W 
BÒ	AûðR	Nú÷S 
B×	AÐ	Aúsú   ÃEW0È-BPËPË%W0Ë>CV$Ï=V$Ï?W0ÐVÐTÐ//QÑTÑQ-	Ñ*TÑ,Q-	Ñ-A0TÓTÓ.UÔ U=ÔT	ÔUÔU	ÔT=
Ô*U	Ô=UÕU	ÕUÕU:	Õ"U5	Õ5U:	Õ:U=Õ=VÖVÖV!Ö!W0Ö$W-Ö?W(×W-×W0×(W-×-W0×0X	c               ó    € V ^8„  d   QhRRRR/# )r   r   r   r	   r
   r   )r   s   "r   r   r   ž   s   € ÷ Añ A˜$ð A 4ñ Ar   c                ó¸   € ^ RI Hp \        P                  VP                  4      pWn        V R,          Vn        VP                  P                  V4      Vn	        R# )r    r3   r)   N)
r8   r4   ÚobjectÚ__new__ÚUpdateReceiptr   Úcorrelation_idr<   ÚsetÚcurrent_token)r   r4   r%   s   &  r   Ú_resume_receiptr§   ž   sF   € Ý)ô �n‰n˜^×9Ñ9Ó:€GØ„LØ! +Õ.€GÔØ*×3Ñ3×7Ñ7¸Ó@€GÖr   c               ó    € V ^8„  d   QhRRRR/# ©r   r#   r   r	   r&   r   )r   s   "r   r   r   ¨   s   € ÷ 	7ñ 	7 Dð 	7¨[ñ 	7r   c                óÈ   € ^ RI Hp V R,          R,          pVP                  V4      pVe(   V^,          P                  R4      '       d
   V^,          # VP	                  V4      # )r    r3   r%   r)   re   )r8   r4   Úread_run_recordr-   Úfinalized_receipt)r#   r4   r)   Úfounds   &   r   Ú_read_terminal_receiptr®   ¨   sX   € Ý)à˜	Õ" ;Õ/€IØ×*Ñ*¨9Ó5€EØÒ˜U 1�XŸ\™\¨-×8Ò8Ø�Q�xˆð ×+Ñ+¨IÓ6Ð6r   c               ó    € V ^8„  d   QhRRRR/# r©   r   )r   s   "r   r   r   ´   s   € ÷ ñ ˜Tð  kñ r   c                óÄ   € ^ RI Hp V! V R,          R,          4      pVe   V^,          P                  R4      R8w  d   R# V^,          P                  RR4       V^,          # )r    )r«   r%   r)   Nrf   ÚrunningÚ
writer_pid)Úhermes_cli.update_receiptr«   r-   rw   )r#   r«   r­   s   &  r   Ú_running_recordr´   ´   sP   € Ý9á˜G IÕ.¨{Õ;Ó<€EØ‚}˜˜a�Ÿ™ YÓ/°9Ô<ÙØ	ˆ!…H‡L�L�˜tÔ$Ø��8€Or   c               ó    € V ^8„  d   QhRRRR/# )r   r#   r   r	   z
str | Noner   )r   s   "r   r   r   ¾   s   € ÷ Jñ J˜tð J¨
ñ Jr   c                ó~   € V P                  R4      ;'       g    RpV'       d   VP                  R4      '       g   V# R# )u  The unsettled-autostash notice (#122557) when this run parked the user's local changes.

``_complete_source_update`` hands it over as the completion message, and a completion message
that is not a ``âœ“`` line is never a success (``_print_verified_update_completion``).
Úcompletion_messageÚ u   âœ“N)r-   ro   )r#   Úmessages   & r   Ú_owed_user_actionrº   ¾   s8   € ð �k‰kÐ.Ó/×5Ð5°2€Gß g×&8Ñ&8¸×&?Ò&?ˆ7ÐIÀTÐIr   c               ó    € V ^8„  d   QhRRRR/# ©r   r#   r   r	   Úboolr   )r   s   "r   r   r   È   s   € ÷ ñ  dð ¨tñ r   c                óN   € ^ RI Hp \        V 4      pV'       d
   V! RV4       VRJ # )zTLand the parked local changes on the receipt; True when nothing is owed to the user.)Úrecord_user_actionÚlocal_changesN)r³   r¿   rº   )r#   r¿   Únotices   &  r   Ú_record_owed_user_actionrÂ   È   s&   € å<ä˜wÓ'€FßÙ˜?¨FÔ3Ø�Tˆ>Ðr   c               ó    € V ^8„  d   QhRRRR/# ©r   r#   r   r	   r
   r   )r   s   "r   r   r   Ò   s   € ÷ Mñ M dð M¨tñ Mr   c                óF  € V P                  R4      '       g   R#  \        V R,          4      R,          pVP                  VP                  R,           4      pVP	                  RRR7       VP                  V4       R#   \         d   p\        R	T 24        Rp?R# Rp?ii ; i)
ah  The gateway /update watcher's status: the code is committed (same as _complete_selected).

Guarded like ``update_cmd_fleet._write_gateway_update_exit_code`` (which this stdlib-only
process cannot import): an unwritable home must not turn the committed run into an error
before its result is written (review P1). The watcher then falls back to its own timeout.
Úgateway_modeNrL   z.update_exit_coder   Ú0r   r   u5     âš  Could not publish the gateway's update status: )r-   r   Ú	with_namer~   r   r   r’   r:   )r#   Úmarkerr   r›   s   &   r   Ú_publish_gateway_successrÊ   Ò   s‘   € ð �;‰;�~×&Ò&ÙðMô �g˜f•oÓ&Ð)<Õ<ˆØ×$Ñ$ V§[¡[°6Õ%9Ó:ˆ	Ø×Ñ˜S¨7ÐÔ3Ø×Ñ˜&Ö!øÜô MÜÐEÀcÀUÐK×LÒLûðMús   ›AA< Á<B ÂBÂB zDesktop app build owed:c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   r#   r   Úrecordr&   Úreasonrs   r	   r
   r   )r   s   "r   r   r   ë   s)   € ÷ :ñ :¨ð :°kð :È3ð :ÐSWñ :r   c                ój  € V P                  R4      '       g   R# \        ;QJ d?    R T;'       g    / P                  R4      ;'       g    R
 4       F  '       g   K   RM4	  RM0! R T;'       g    / P                  R4      ;'       g    R
 4       4      '       d   R# \        R\         RV 2RR	7       R# )aÁ  Name the owed Desktop build when this run never got the build to its own verdict (F6, review P4).

The builder prints the line only when the build itself fails; a run that never reached it
(dependencies owed, the tail refused by the lock, a completion process lost) would otherwise end
as a plain "Update complete." in the hand-off. A ``build`` stage on the run's record means the
build ran and printed this line itself when the Desktop app failed.
ÚdesktopNc              3  óz   "  € T F1  p\        V\        4      ;'       d    VP                  R 4      R8H  x € K3  	  R# 5i)r~   ÚbuildN)Ú
isinstancer   r-   )Ú.0Úmarks   & r   Ú	<genexpr>Ú-_report_desktop_build_owed.<locals>.<genexpr>õ   s2   é € Ð
qÑNpÀdŒ:�dœDÓ!×AÐA d§h¡h¨vÓ&6¸'Ñ&AÔAÓNpùs   ‚;ž;ÚstagesTFz  Ú ©r…   r   )r-   Úanyr:   ÚDESKTOP_BUILD_OWED)r#   rÌ   rÍ   s   &&&r   Ú_report_desktop_build_owedrÜ   ë   s‘   € ð �;‰;�y×!Ò!Ùß
ƒsÑ
qÈvÏ|È|ÐY[×N`ÑN`ÐaiÓNj×NpÐNpÐnpÐNpÓ
q‡s‡s‚sÑ
qÈvÏ|È|ÐY[×N`ÑN`ÐaiÓNj×NpÐNpÐnpÐNpÓ
q×qÒqÙÜ	ˆBÔ!Ð" ! F 8Ð
,°D×9r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r#   r   rÍ   rs   r	   r   )r   s   "r   r   r   ú   s&   € ÷ !_ñ !_ Dð !_°#ð !_¸$ñ !_r   c                ó†  € ^ RI Hp \        RV 2RR7       \        V 4      pVf­    ^ RIHp V! \        V R,          4      4       \        V \        V 4      R	4       VP                  4        VP                  R
VRR7       \        V 4      '       * pV'       d   \        \        V 4      4       TP                  V'       d   ^M^ R4       \        V 4      pT;'       g    / P                  R4      pVR8X  d   ^‚M
VR8X  d   ^M^ pV^ 8X  d   \!        V 4       RVRVRRRR/#   \         d   p\        RT 24        Rp?LöRp?ii ; i)at  The parent's side of C3: the code is committed, but the completion never answered (review P2).

Reached when spawning or reading the completion failed (an OSError from the temporary
directory, the request file or Popen) or the child died without a correlated terminal result
(OOM, SIGKILL). The tail is owed, never a failed update: it is armed for the next launch, the
run's receipt is a success that names the ``completion`` follow-up, and the exit is 0 -- unless
the user's local changes are still parked (#122557: ``partial``, exit 1). Runs in the parent
(pre-swap) interpreter: everything it uses is already imported there.
r3   u/     âš  Source update completion did not finish: TrÙ   N©Úarm_completionrD   õ4     âš  Could not record the owed source-update tail: z$the update completion did not finishÚ
completionz.the next launch or `hermes update` finishes it©Úretryz*completion owed after the code was updatedrf   ÚinterruptedÚpartialr*   r%   r+   r,   )r8   r4   r:   r®   Úhermes_cli.venv_syncrà   r   Ú	ExceptionrÜ   r´   Úresume_run_recordÚrecord_followuprÂ   rº   Úfinalize_pending_update_receiptr-   rÊ   )	r#   rÍ   r4   r%   rà   r›   Úparkedrf   r   s	   &&       r   Úsettle_lost_completionrí   ú   s2  € õ *ä	Ð;¸F¸8Ð
DÈDÕQÜ$ WÓ-€GØ‚ð	PÝ;áœ4 ¨Õ 1Ó2Ô3ô 	# 7¬O¸GÓ,DÐFlÔmØ×(Ñ(Ô*Ø×&Ñ& |°VÐCsÐ&ÔtÜ-¨gÓ6Ô6ˆßÜÔ# GÓ,Ô-Ø×6Ñ6¿F±qÈÐKwÔxÜ(¨Ó1ˆØ�}ˆ}˜"×!Ñ! )Ó,€GØ˜]Ô*‰3°WÀ	Ô5I±Èq€DØˆq„yÜ  Ô)Ø˜˜y¨'Ð3CÀTÈ<ÐY]Ð^Ð^øô ô 	PÜÐHÈÈÐN×OÑOûð	Pús   §D ÄE Ä(D;Ä;E c          
     ó,   € V ^8„  d   QhRRRRRRRRRR	/# )
r   r#   r   r$   r   Ústeprs   rÍ   r	   r   r   )r   s   "r   r   r     s7   € ÷ Hñ H $ð H°Tð HÀð HÈcð HÐVYñ Hr   c                ó”  € ^ RI Hp ^ RIHp  V! \	        V R,          4      4       \        V 4      pVf³   \        V 4      ;'       g
    V R,          p\        WV R24       \        V4       TP                  VR8X  d   R	MR
R4       TP                  Y#VR8X  d   RMRR7       \        V 4      '       g   \        \        V 4      4       VP                  ^ V R24       \        V 4      pVe   VP!                  R4      R8X  d   ^ M^p	V	^ 8X  d   \#        V 4       \%        WW—4      #   \
         d   p\        RT 24        Rp?ELRp?ii ; i)aÈ  The tree already moved, so a failure here is owed work, never a failed update (C3, A6).

Runs in the bootstrap interpreter (stdlib + the new tree) when dependency preparation failed or
the prepared child died without a result. The tail obligation stays armed, so the next launch
syncs the dependencies and finishes the tail; the run's receipt is a success that names the
follow-up, so nothing reports "still on the previous version" while the tree is new.
r3   rß   rD   rá   Nr%   z did not finishÚdependenciesÚdepsrÑ   Úfailedu:   dependencies not installed yet â€” the next launch retriesz-the next launch or `hermes update` retries itrã   z  owed after the code was updatedrf   rg   )r8   r4   rç   rà   r   r’   r:   r®   r´   rÜ   r§   Úrecord_stagerê   rÂ   rº   rë   r-   rÊ   r.   )
r#   r$   rï   rÍ   r4   rà   r›   r%   rÌ   r   s
   &&&&      r   Ú_settle_after_commitrõ     s?  € õ *Ý3ðLÙ”t˜G HÕ-Ó.Ô/ô % WÓ-€GØ‚ä  Ó)×?Ð?¨W°YÕ-?ˆÜ" 7°t°f¸OÐ4LÔMÜ˜ÔØ×#Ñ#¨d°nÔ.D¡FÈ'ÐS[Ô\Ø×&Ñ& tØ*.°.Ô*@ñ <xØFuð 	'ô 	wä'¨×0Ò0ÜÔ# GÓ,Ô-Ø×6Ñ6°q¸T¸FÐBbÐ:cÔdÜ(¨Ó1ˆØÒ#¨¯©°IÓ(>À)Ô(K‰1ÐQR€DØˆq„yÜ  Ô)Ü" 7¸ÓGÐGøô% ô LÜÐDÀSÀEÐJ×KÒKûðLús   ŽD# Ä#EÄ.EÅEc               ó(   € V ^8„  d   QhRRRRRRRR/# ©r   r#   r   r1   r   r$   r	   r   r   )r   s   "r   r   r   @  s(   € ÷ 6ñ 6�dð 6¨$ð 6¸Tð 6Àcñ 6r   c                óæ  € ^ RI p^ RI Hp ^ RIHp ^ RIHpHp \        V R,          4      pV R,          R,          p	\        P                  R8X  dC   ^ R	I
Hp
 V
! V4      pVe1   \        R
VP                  ;'       g    RVP                   2 R24      h^ RIHpHp V! V4       ^ RIHp V! V4       VP)                  V	4      ;_uu_ 4         V! 4        VP+                  RVRR7       V! V4       VP-                  V	4      V R&   \/        W4        RRR4       \1        V! V4      4      RRRRRRRV R,           2\1        VR,          4      \1        V4      \1        V4      R.p^ RI
Hp \5        \6        P8                  ! WøV! V4      V! V4      R7      4      pVP;                  4       '       g   \=        WRRV R24      # V#   TP-                  T	4      T R&   \/        Y4       i ; i  + '       g   i     LÚ; i) r    N)r%   )Úensure_tools_for_sync)Úactivation_environmentÚproject_pythonrD   r%   r)   Úwin32)Ú_acquire_checkoutz+could not join the update's checkout lock (zheld by process ri   )rà   Úcollect_superseded_generations)Úconvert_treeless_checkout_firstT)ÚexplicitÚproject_rootÚevict_incompatible_pluginsr,   rF   rG   rT   rU   rV   rW   rS   rX   ú
--prepared)rZ   )rH   r[   r^   râ   zthe completion process exited z without a result)Úpmr%   Ú	pm.clientrù   Úpm.environmentsrú   rû   r   rm   rn   r9   rý   ÚRuntimeErrorrÍ   r‰   rç   rà   rþ   Úhermes_cli.gitlockrÿ   Úworker_contextÚ	sync_venvÚlast_for_updater   rs   rZ   r!   rp   ÚcallÚexistsrõ   )r#   r1   r$   r  r%   rù   rú   rû   r•   r)   rý   Úrefusedrà   rþ   rÿ   r˜   rZ   r   s   &&&               r   Ú_preparer  @  sÝ  € ÛÝÝ/ßFä�˜Õ!Ó"€DØ˜	Õ" ;Õ/€IÜ
‡|�|�wÔõ 	=á# DÓ)ˆØÒÜð  #Ø#*§>¡>×#UÐ#UÐ7GÈÏÉÀ}Ð5UÐ"VÐVWð Yó Zð ZçSñ �4ÔÝBÙ# DÔ)Ø	×	Ñ	 	×	*Õ	*ð		/ñ "Ô#à�L‰L $°TÐVZˆLÔ[Ù*¨4Ô0à$+×$;Ñ$;¸IÓ$FˆG�LÑ!Ü˜Õ.÷ 
+ô ‘> $Ó'Ó(Ø�T˜4  v¨t°ÀwÐO_ÕG`ÐFaÐ5bÜ�4Ð;Õ;Ó<Ü�<Ó ¤# kÓ"2°LðB€Gõ 9ô œ
Ÿš¨Ñ?UÐVZÓ?[Ù1BÀ4Ó1HôJó K€Dà×Ñ×ÒÜ# G¸,Ø&DÀTÀFÐJ[Ð$\ó^ð 	^à€Køð% %,×$;Ñ$;¸IÓ$FˆG�LÑ!Ü˜Õ.ú÷ 
+×	*ús$   Ã	G Ã#F<Ã.G Æ<!GÇG Ç G0	c               ó    € V ^8„  d   QhRRRR/# r¼   r   )r   s   "r   r   r   y  s   € ÷ Mñ M ð M¨ñ Mr   c                ód  a a€ ^ RI HpHpHp ^ RIHp ^ RIHpHp ^ RI	H
oHpHpHp	Hp
 \        S R,          4      pW±n        \#        S 4      pS R,          Vn        S R,          pVf   RM2T! R)/ / VCR	VP'                  R	. 4       Uu. uF
  qå! R)/ VB NK  	  up/CB pVP)                  S R
,          4       . pRp T! TS R,          S R,          S R,          S R,          S R,          S P'                  R4      S P'                  R4      '       d   RMRVV 3R lR7
      p\8        ;QJ d    V3R lV 4       F  '       g   K   RM	  RM! V3R lV 4       4      pV! V4       V'       g   ^ RIHp V! V4       S R,          '       d   VP?                  V4       S P'                  RR4      '       d    V	! RR4       V
! RR4       \A        R4       V# VPC                  V4      pV'       d(   VPE                  4       '       d   \A        R V R!24       RpV'       d$   V	! RV4       V
! RR4       \A        R"V R#24       V# VPG                  VS R,          4      pT
! R\I        VR$R4      '       d   R%MR&4       VPK                  VS R',          S R,          4       TPM                  TTS R',          \O        V4      ;'       d    TR(7       V# u upi   \*        \,        3 d]   p\/        T4      ;'       g    \1        T4      P2                  p\5        S RR4       T! RT4       TP7                  RT34        Rp?ELRp?ii ; i)*u  Everything after the commit point. No step failure fails the update (contract C3).

Each step is independent; a failed one prints ``âš ``, lands on the receipt as a follow-up
and keeps its own obligation armed (``source-completion-pending`` for the tail, the fleet
restart obligation for gateways), so the next launch or ``hermes update`` retries it.
Returns False only when the user's local changes were left parked in the stash: nothing
retries that, so the run is ``partial`` and exits 1 (#122557), never "Update complete".
)ÚmainÚ
update_cmdÚupdate_cmd_config)Úcomplete_source_checkout)ÚRuntimeRecordÚ
UpdatePlan)ÚTAIL_FOLLOWUPSÚrecord_build_stagerê   Úrecord_skiprô   rD   Úsibling_snapshotsÚplanNÚruntimesÚbranchFrÏ   Ú
assume_yesrÆ   Úsnapshot_idÚpre_update_versionr·   u   
âœ“ Code updated!c                 ó   <€ \        S 4      # ©N)Ú_resume_paused_before_build)r#   s   €r   Ú<lambda>Ú$_complete_selected.<locals>.<lambda>Ÿ  s   ø€ Ô6QÐRYÔ6Zr   )	rÏ   r  rÆ   Úpre_update_snapshot_idr!  r·   ÚannounceÚ	followupsÚbefore_buildz"the source-update tail did not runrâ   c              3  ó2   <"  € T F  w  rVS9   x € K  	  R # 5ir#  r   )rÓ   rï   Ú_r  s   &  €r   rÕ   Ú%_complete_selected.<locals>.<genexpr>¦  s   øé € ÐD¹)©w¨t�D˜NÖ*»)ùs   ƒT)Úclear_completionÚno_gateway_restartÚgateway_restartz+--no-gateway-restart: deferred, marker keptÚrestartÚskippeduQ   â†’ Gateway restart deferred (--no-gateway-restart); restart gateways separately.u#     â†’ Gateway restart not skipped (z,): gateways are still off the checkout code.u     âœ“ Gateway restart skipped: Ú.Ú
incompleteró   rg   r+   )Ú_pre_update_planÚ_windows_gateway_resumeÚupdate_completer   )(r8   r  r  r  Úhermes_cli.source_completionr  Úhermes_cli.update_inventoryr  r  r³   r  r  rê   r  rô   r   ÚPROJECT_ROOTrÂ   Ú_LAST_SIBLING_SNAPSHOTSr-   Ú_sweep_bytecode_after_updaterè   Ú
SystemExitrs   ÚtypeÚ__name__rÜ   ÚappendrÚ   rç   r.  Ú_write_gateway_update_exit_coder:   Ú_fleet_restart_skip_reasonÚ_pending_fleet_restart_neededÚ#_restart_gateway_fleet_after_updateÚgetattrÚ*_resume_windows_gateways_and_merge_outcomeÚ_verify_fleet_after_updater½   )r#   r  r  r  r  r  r  r  rê   r  rô   r•   ÚcompleteÚ	plan_dataÚrowr  r)  Úruntime_safer›   rÍ   Ú	tail_owedr.  Úskipr1  r  s   f                       @r   Ú_complete_selectedrN  y  s  ù€ ÷ ?Ñ>ÝEßE÷Xõ Xô �˜Õ!Ó"€DØÔÜ'¨Ó0€HØ07Ð8KÕ0LÐÔ-Ø˜•€IØÒ$‰4©*ñ +cð 8bØ
ð8bØÀ)Ç-Á-ÐPZÐ\^ÔB_Ó!`ÑB_¸3 -Ñ"6°#Ô"6ÑB_Ñ!`ñ8bñ +c€Dà×+Ñ+¨G°HÕ,=Ô>ð (*€Ið
 €Lð1Ù/Ø˜' )Õ,¸ÀÕ9NØ  Õ0ÈÐQ^ÕI_Ø&Ð';Õ<Ø&Ÿ{™{Ð+?Ó@Ø$Ÿ[™[Ð)=×>Ò>‘TÐDYØÔ.Zô\ˆ÷ “ÔD¹)ÓD——’ÔD¹)ÓDÓD€IÙ�yÔ!ßÝ9Ù˜Ôð ˆ~×ÔØ×2Ñ2°8Ô<Ø‡{�{Ð'¨×/Ò/ÙÐ%Ð'TÔUÙ�Y 	Ô*ÜÐaÔbØˆØ×0Ñ0°Ó6€Dß�
×8Ñ8×:Ò:ô 	Ð3°D°6Ð9eÐfÔgØˆßÙÐ% tÔ,Ù�Y 	Ô*ÜÐ/°¨v°QÐ7Ô8ØˆØ×<Ñ<¸TÀ7È>ÕCZÓ[€GÙ�¬°¸Àu×(MÒ(M™HÐS\Ô]Ø×9Ñ9¸'À7ÐK[ÕC\Ð^eÐftÕ^uÔvØ×)Ñ)Ø $ÀÐHXÕ@YÜ˜\Ó*×7Ð7¨xð *ô 9ð €Oùòq "aøô$ ”zÐ"ô 1Ü�S“×/Ð/œT #›Y×/Ñ/ˆä" 7¨DÐ2VÔWÙ˜ fÔ-Ø×Ñ˜,¨Ð/×0Ò0ûð1ús&   ÂJ=Â9AK ÄK ËL/ËAL*Ì*L/c               ó    € V ^8„  d   QhRRRR/# rÄ   r   )r   s   "r   r   r   É  s   € ÷ \ñ \¨ð \°$ñ \r   c                ó   € V P                  R4      pV'       d.   VP                  R4      '       d   VP                  R4      R8w  d   R# ^ RIHp  V! 4       P                  V4       R#   \         d   p\        RT R24        Rp?R# Rp?ii ; i)	aÂ  Restart the gateways the POSIX pause stopped: the dependencies are synced and the launchers
published, the product builds (minutes) have not started. A gateway needs nothing later to
boot. A failure stays owed: the post-build resume retries it and records the outcome.

POSIX only: the fleet restart skips what this restarted (``already_restarted``). A Windows set
keeps resuming after the fleet restart, which would otherwise drain it a second time.r+   Úresume_neededrn   r\   N)Ú_mu)     âš  Paused gateway restart incomplete (z); retrying after the build)r-   Úhermes_cli.update_cmdrR  Ú%_resume_windows_gateways_after_updaterè   r:   )r#   ÚtokenrR  r›   s   &   r   r$  r$  É  sx   € ð �K‰KÐ(Ó)€Eß˜Ÿ	™	 /×2Ò2°e·i±iÀ
Ó6KÈwÔ6VÙÝ(ð\Ù
‹×2Ñ2°5Ö9øÜô \ÜÐ9¸#¸Ð>YÐZ×[Ò[ûð\ús   ÁA( Á(BÁ3BÂBc                  ó2   € ] tR tRtRtR R ltR tR tRtR# )	Ú_ForwardedOutputiÚ  zHThe parent's pipe preserves its terminal's prompt policy and log mirror.c               ó   € V ^8„  d   QhRR/# )r   rz   r½   r   )r   s   "r   r   Ú_ForwardedOutput.__annotate__Ý  s   € ÷ 4ñ 4 tñ 4r   c                	ó"   € WuV n         V n        R # r#  ©ÚstreamÚterminal)Úselfr\  rz   s   &&&r   Ú__init__Ú_ForwardedOutput.__init__Ý  s   € Ø%+Ð"ˆŒ�T–]r   c                	ó   € V P                   # r#  )r]  )r^  s   &r   rz   Ú_ForwardedOutput.isattyà  s   € Ø�}‰}Ðr   c                	ó.   € \        V P                  V4      # r#  )rE  r\  )r^  r~   s   &&r   Ú__getattr__Ú_ForwardedOutput.__getattr__ã  s   € Ü�t—{‘{ DÓ)Ð)r   r[  N)	r?  Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r_  rz   rd  Ú__static_attributes__r   r   r   rW  rW  Ú  s   † ÙRõ4òö*r   rW  c               ó    € V ^8„  d   QhRRRR/# rÄ   r   )r   s   "r   r   r   ç  s   € ÷ cñ c Tð c¨dñ cr   c                ó~   € ^ RI Hp VP                  P                  4       pVe   \	        WP
                  R4       R# R# )z[The tail raised out of ``_complete_selected``: before the build stage, the build never ran.r3   Nz%the source-update tail did not finish)r8   r4   r<   r-   rÜ   r   )r#   r4   r@   s   &  r   Ú_report_unbuilt_desktoprm  ç  s3   € å)à×%Ñ%×)Ñ)Ó+€GØÒÜ" 7¯L©LÐ:aÖbñ r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r#   r   r$   r   r	   r   r   )r   s   "r   r   r   ð  s!   € ÷ 1ñ 1�Tð 1¨ð 1°ñ 1r   c                óv  € ^ RI Hp ^ RIHp \	        V R,          4       V! V P                  R4      V R,          R,          4       VP                  RR4       ^ RrT \        V 4      '       g   ^R	rT\"        P$                  P                  R4      pT'       d   Te   TP'                  4       MRpT'       d   \)        T4        ^ RIHp	 T	! T R,          4       TP3                  YE4       \5        T 4      p
T
'       d   T
P                  R4      R8X  d   ^ pT'       d   T R,          '       d   ^ RIHp T! R4       T
'       g   T;'       g    ^p\9        TR^RT R,          R,          RTRT
RT R,          /4       T#   \         d    ^‚R
rTTP                  YTR7        EL+\         dG   pTP                  R9  d+   \        T 4       TP                  RRTP                   24        Rp?ELvRp?i\         dA   p\        T 4       TP                  R\        T4      P                    RT 24        Rp?EL¿Rp?ii ; i  \.         d0   pTP1                  T R,          R,          RRT 24        Rp?EL–Rp?ii ; i  \"        P$                  P                  R4      pT'       d   Te   TP'                  4       MRpT'       d   \)        T4        ^ RIHp	 T	! T R,          4       M<  \.         d/   pTP1                  T R,          R,          RRT 24        Rp?MRp?ii ; iTP3                  YE4       \5        T 4      p
T
'       d   T
P                  R4      R8X  d   ^ pT'       d   T R,          '       d   ^ RIHp T! R4       T
'       g   T;'       g    ^p\9        TR^RT R,          R,          RTRT
RT R,          /4       i ; i)r    r3   )Úaccept_worker_receiptr%   r,   r)   rò   rg   zsource update completionz6local changes left in the stash; re-apply them by handz9KeyboardInterrupt: interrupted after the code was updated©r*   Nrâ   zcompletion exited z: zhermes_cli.update_custody)rT  r+   z!Windows gateway recovery failed: rf   rÆ   )rA  Fr(   r*   )r    N)r8   r4   Ú
pm.receiptrp  r§   r-   rô   rN  ÚKeyboardInterruptÚ#finalize_interrupted_update_receiptr=  r   rm  rê   r‡   r>  r?  rm   ÚmodulesÚrefusal_noticer:   rS  rT  rè   Úowe_followuprë   r®   rA  r   )r#   r$   r4   rp  r   rÍ   r›   Úcustodyr>   rT  Úterminal_receiptrA  s   &&          r   Ú_finishrz  ð  sT  € Ý)Ý0ä�G˜IÕ&Ô'Ù˜'Ÿ+™+ lÓ3°W¸YÕ5GÈÕ5TÔUØ×Ñ ¨	Ô2ØÐ0ˆ&ð(Ü! '×*Ò*ØÐV�&ô —+‘+—/‘/Ð"=Ó>ˆß.2°wÒ7J�'×(Ñ(Ô*ÐPTˆßÜ�'ŒNð	SÝSÙ1°'Ð:JÕ2KÔLð 	×6Ñ6°tÔDÜ1°'Ó:ÐßÐ 0× 4Ñ 4°YÓ ?À9Ô LØˆDß�G˜N×+Ô+ÝMÙ+¨EÔ2ßØ—9�9˜1ˆDÜ�KØ�a˜ g¨iÕ&8¸Õ&EÀ{ÐTXØÐ'Ð)9¸7ÐCSÕ;Tð"
ô 	ð €KøôM ô Sð ÐWˆfØ×:Ñ:¸6Ð:×RÜô ZØ�8‰8˜9Ô$Ü# GÔ,Ø×*Ñ*¨<Ð;MÈcÏhÉhÈZÐ9XÔYÿùÜô UÜ Ô(Ø×&Ñ& |¼¸S»	×8JÑ8JÐ7KÈ2ÈcÈUÐ5S×TÒTûðUûô ô 	SØ×'Ñ'¨°	Õ(:¸;Õ(GÐIYØ*KÈCÈ5Ð(Q÷Sò Sûð	Sûô —+‘+—/‘/Ð"=Ó>ˆß.2°wÒ7J�'×(Ñ(Ô*ÐPTˆßÜ�'ŒNð	SÝSÙ1°'Ð:JÕ2KÕLøÜô 	SØ×'Ñ'¨°	Õ(:¸;Õ(GÐIYØ*KÈCÈ5Ð(Q÷Sñ Sûð	Súð 	×6Ñ6°tÔDÜ1°'Ó:ÐßÐ 0× 4Ñ 4°YÓ ?À9Ô LØˆDß�G˜N×+Ô+ÝMÙ+¨EÔ2ßØ—9�9˜1ˆDÜ�KØ�a˜ g¨iÕ&8¸Õ&EÀ{ÐTXØÐ'Ð)9¸7ÐCSÕ;Tð"
õ 	ús¶   ÁE7 Ã H6 Å7 H3ÆI3 ÆH3Æ#H3Æ$;G%ÇI3 Ç%H3Ç2H3Ç35H.È(I3 È.H3È3I3 È6I0É$I+É+I0É3AN8Ê9N8ËKËN8ËLË&$LÌ
N8ÌLÌAN8ÍN8Í*N8Î N8Î	/N8c               ó   € V ^8„  d   QhRR/# )r   r	   r   r   )r   s   "r   r   r   $  s   € ÷ :ñ :ˆcñ :r   c                 óÄ  € \        \        \        P                  R ,          4      w  r\        P
                  ! V P                  RR7      4      pVR,          ^8w  d   \        R4      h\        \        4      P                  4       P                  ^,          pV\        VR,          4      P                  4       8w  d   \        R4      h\        P                  P                  ^ \        V4      4       \        \        P                  VP!                  RR4      4      \        n        R	\        P                  R
,          9   d   ^ RIHp V! V4       \'        W!4      # \)        W V4      # ):é   é   Nrd   r   r(   z%unsupported source completion requestrD   z*completion checkout does not match requestrQ   Fr  :r~  NN)Úactivate_dependencies)Úmapr   rm   Úargvr   r=   r�   r‘   Ú__file__ÚresolveÚparentsr   Úinsertrs   rW  rI   r-   r  r  rz  Ú
_bootstrap)r1   r$   r#   r•   r  s        r   r  r  $  sú   € Ü #¤D¬#¯(©(°3­-Ó 8Ñ€LÜ�jŠj˜×/Ñ/¸Ð/ÓEÓF€GØˆxÕ˜AÔÜÐ@ÓAÐAÜ”‹>×!Ñ!Ó#×+Ñ+¨AÕ.€DØŒt�G˜HÕ%Ó&×.Ñ.Ó0Ô0ÜÐEÓFÐFä‡H�H‡O�O�A”s˜4“yÔ!Ü!¤#§*¡*¨g¯k©k¸/È5Ó.QÓR„C„JØ”s—x‘x •|Ô#õ 	:Ù˜dÔ#Ü�wÓ,Ð,Ü�g¨[Ó9Ð9r   c               ó(   € V ^8„  d   QhRRRRRRRR/# r÷   r   )r   s   "r   r   r   8  s.   € ÷ jñ j˜ð j¨Dð j¸tð jÈñ jr   c           	     óX  €  \        WV4      #   \         dE    \        T R,          4       ^ RIHp TP                  R^‚R7       \        Y^‚\        T 4      4      u # \        \        3 d>   p\        YR\        T4      ;'       g    \        T4      P                  4      u Rp?# Rp?ii ; i)zTDependency preparation in the parent's interpreter; its failure is a follow-up (A6).r%   r3   z<KeyboardInterrupt: interrupted while installing dependenciesrq  rñ   N)r  rs  r§   r8   r4   rt  r.   r®   rè   r=  rõ   rs   r>  r?  )r#   r1   r$   r4   r›   s   &&&  r   r†  r†  8  sŸ   € ðjÜ˜¨{Ó;Ð;øÜô cÜ˜ 	Õ*Ô+Ý-Ø×:Ñ:ØJÐVYð 	;ô 	[ä& w¸SÔBXÐY`ÓBaÓbÒbÜ”zÐ"ô jô $ G¸.Ì#ÈcË(×JhÐJhÔVZÐ[^ÓV_×VhÑVhÓiÕiûðjús(   ‚ ŽAB)ÁB)Á+B)Á,2B$ÂB)Â$B)Ú__main__)%ri  Ú
__future__r   r€   r   ru   rŠ   Úpathlibr   rp   rm   rx   r   r!   r.   rA   rž   r§   r®   r´   rº   rÂ   rÊ   rÛ   rÜ   rí   rõ   r  rN  r$  rW  rm  rz  r  r†  r?  r=  r   r   r   Ú<module>rŒ     sÎ   ðñõ #ã Û Û 	Û Ý Û Û 
Û õõ-õõ!õ2\õ~Aõ	7õõJõõMð, /Ð õ:õ!_õHHõD6õrMõ`\÷"
*ñ 
*õcõ1õh:õ(jð  ˆzÔÙ
‘T“VÓ
Ðñ r   