+
    .pÐjˆ   ã                   óÊ   a € R t0 t R t^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RI	H
t
 ]P                  ! R4      tRt/ s] ^ k R R ltRRR/R	 lltR
 tR R ltRRR/R R llltR# )zLIn-process tick admission and dispatch; job execution stays in scheduler.py.N)Ústore_health)Úis_recurringzcron.schedulerg      ¬@c                ó(   € V ^8„  d   QhR\         RR/# )é   ÚreasonÚreturnN)Ústr)Úformats   "Ú"/opt/hermes/cron/scheduler_tick.pyÚ__annotate__r      s   € ÷ 4ñ 4¤ð 4¨ñ 4ó    c                ó   € \         P                  ! 4       p\        P                  R4      p\        P                  RR4      pW 8w  g   V\	        V4      ,
          \
        8¼  d   \        P                  RV 4       RV RV/sR# )z?Log the yield at error level once per episode (skew signature).r   Úatg        u³   Cron tick yielded: this process is running stale code (%s) and a fresher gateway owns the runtime lock â€” jobs will fire from that process. Restart this one to reclaim its ticks.N)ÚtimeÚ	monotonicÚ_last_yield_logÚgetÚfloatÚ_YIELD_LOG_INTERVAL_SECONDSÚloggerÚerror)r   ÚnowÚlast_reasonÚlast_ats   &   r
   Ú_log_tick_yield_oncer      so   € ô �.Š.Ó
€CÜ!×%Ñ% hÓ/€KÜ×!Ñ! $¨Ó,€GØÔ ¤u¨W£~Õ!5Ô:UÔ UÜ�‰ð>ð ô		ð
   ¨¨sÐ3‚Or   Úcan_dispatchc          
      ó¾   € ^ RI Hp VP                  4       ;_uu_ 4       pV'       g    RRR4       ^ # \        WW#VR7      uuRRR4       #   + '       g   i     R# ; i)é    )Ú
retirementN)r   )Úhermes_cli.backend_retirementr   ÚworkÚ_tick_admitted)ÚverboseÚadaptersÚloopÚsyncr   r   Úadmitteds   &&&&$  r
   Útickr'   !   sA   € Ý8ð 
�‰×	Ô	˜hßØ÷ 
Ñ	ô ˜g°È,ÔW÷ 
×	×	Ó	ús   Ÿ
A³AÁA	c                ó2  € V P                  4       w  rV P                  V4        V P                  V4      #   \         dV   pTP                  \
        P                  9  d   h \
        P                  ! TRRTR7       T P                  4         Rp?R# Rp?ii ; i)a  The tick lock fd, or None when this tick must not run: another ticker holds the lock, or
the store cannot be written (read-only/full/denied: the lock file cannot even be created), in
which case the store is marked degraded and the MCP orphan sweep still runs.ztick lock unavailableÚlock)Úcron_dirN)	Ú_get_lock_pathsÚ_ensure_cron_dirÚ_acquire_tick_lockÚOSErrorÚerrnor   ÚUNWRITABLE_ERRNOSÚnote_unwritableÚ_sweep_mcp_orphans)Ú_schedÚlock_dirÚ	lock_fileÚexcs   &   r
   Ú_acquire_tick_lock_or_degrader7   ,   sƒ   € ð !×0Ñ0Ó2Ñ€HØ
×Ñ˜HÔ%ðØ×(Ñ(¨Ó3Ð3øÜô Ø�9‰9œL×:Ñ:Ô:ØÜ×$Ò$ SÐ*AÀ6ÐT\Õ]Ø×!Ñ!Ô#Ýûðús   ¥6 ¶BÁA
BÂBc                ó0   € V ^8„  d   QhR\         R\         /# )r   Údue_jobsr   )Úlist)r	   s   "r
   r   r   <   s   € ÷ 
<ñ 
<´ð 
<¼$ñ 
<r   c                ó†  €  T P                  V Uu. uF  q"R,          NK  	  up4       V# u upi   \         d†   pT Uu. uF  p\        T4      '       g   K  TNK  	  Mu upi pp\        P                  ! TR\        T4       R2RT4       T Uu. uF  p\        T4      '       d   K  TNK  	  Mu upi upu Rp?# Rp?ii ; i)zìPersist the recurring jobs' advance before any runs; when the store refuses it, drop them
(no durable advance -> a crash mid-run would re-fire them, so skipping is the at-most-once
side). One-shots still go through their own fire claim.Úidzskipped z recurring job(s)ÚadvanceN)Úadvance_next_runsr.   r   r   r1   Úlen)r3   r9   Újobr6   ÚjÚskippeds   &&    r
   Ú_advance_or_drop_recurringrC   <   s£   € ð<Ø× Ñ ±xÓ!@±x° d§) )±xÑ!@ÔAØˆùò "Aøäô <Ù&Ó:™h˜¬,°q¯/—1�1šhùÒ:ˆÐ:Ü×$Ò$ S¨H´S¸³\°NÐBSÐ*TÐV_ÐahÔiÙ#Ó;™8�a¬<¸¯?—�š8ùÔ;Õ;ûð<úsI   ‚0 ‘+¢0 «0 °C »B;¿AÁAÁ2B;ÂB.Â'B.Â-B;Â5C Â;C c                ó0   € V ^8„  d   QhR\         R\         /# )r   r"   r%   )Úbool)r	   s   "r
   r   r   I   s    € ÷ o+ñ o+Üðo+Ü:>ño+r   c               ó‚	  a aaa€ ^ RI Ho SP                  4       pVe@   \        RV^ ,           RV^,           24       SP	                  V^ ,          V^,          4      h\        S4      pVf   ^ #  \        P                  ! \        4      ;_uu_ 4        ^ RI	H
p V! RSP                  4      '       d    RRR4       SP                  V4       ^ #  RRR4       Ve=   V! 4       '       g0   SP                  P                  R4        SP                  V4       ^ # ^ RIHpHp	 V'       d	   V! 4        MV	! 4        SP#                  4         SP%                  4        SP)                  4       pSP+                  V4       V'       g{   S '       d:   SP                  P-                  R
SP/                  4       P1                  R4      4       \2        P4                  ! 4        SP7                  4         SP                  V4       ^ # \2        P8                  ! V4      '       d%   SP7                  4         SP                  V4       ^ # S '       dD   SP                  P-                  RSP/                  4       P1                  R4      \;        V4      4       \=        SV4      pV'       g%   SP7                  4         SP                  V4       ^ # SP?                  4       pS '       d1   SP                  P-                  R\;        V4      V'       d   TMR4       R VVVV 3R llp. p. pSPA                  V4      pV FH  pSPC                  VVV4      pVf   K  VPE                  V4       V'       d   K7  VPE                  R4       KJ  	  V'       ds   \F        PH                  PK                  V4       F#  p VPE                  VPM                  4       4       K%  	  SP7                  4        \Q        V4      SP                  V4       # SPS                  V4       \Q        V4      SP                  V4       #   + '       g   i     ELU; i  \&         d(   p
SP                  P                  R	T
4        Rp
?
ELRp
?
ii ; i  \&         d:   pSP                  PO                  RT4       TPE                  R4        Rp?EK  Rp?ii ; i  SP                  T4       i ; i)a  Check and run all due jobs. File-locked so only one tick runs at a time (gateway ticker vs
standalone daemon / manual tick). ``can_dispatch``: optional gate; false leaves due jobs for the
next allowed tick. Returns the number of jobs executed (0 if another tick holds the lock).)Ú	schedulerNzboot=z disk=)Úcheck_pausedÚcronz7Cron dispatch paused while gateway drains existing work)ÚdrainÚdrain_in_backgroundz(Worktree maintenance dispatch failed: %sz%s - No jobs duez%H:%M:%Sz%s - %s job(s) duez.Running %d job(s) in parallel (max_workers=%s)Ú	unboundedc                ó0   € V ^8„  d   QhR\         R\        /# )r   r@   r   )ÚdictrE   )r	   s   "r
   r   Ú$_tick_admitted.<locals>.__annotate__›   s   € ÷ 	Iñ 	Iœdð 	I¤tñ 	Ir   c                 ó,   <€ SP                  V SSS4      # )N)Ú_process_due_job)r@   r3   r#   r$   r"   s   &€€€€r
   Ú_process_jobÚ$_tick_admitted.<locals>._process_job›   s   ø€ Ø×*Ñ*¨3°¸$ÀÓHÐHr   TzCron job future failed: %sF)*rI   rG   Ú#_should_yield_tick_to_fresh_gatewayr   ÚCronTickYieldedr7   Ú
contextlibÚsuppressÚImportErrorÚagent.estoprH   r   Ú_release_tick_lockÚdebugÚcron.bot_chat_deliveryrJ   rK   Ú_maybe_reap_dead_ownersÚ_maybe_run_worktree_maintenanceÚ	ExceptionÚget_due_jobsÚ_sweep_stale_inflight_for_tickÚinfoÚ_hermes_nowÚstrftimer   Úrecheck_idler2   Údispatch_blockedr?   rC   Ú_resolve_max_parallel_workersÚ_get_parallel_poolÚ_submit_with_guardÚappendÚ
concurrentÚfuturesÚas_completedÚresultr   ÚsumÚ _sweep_mcp_orphans_when_all_done)r"   r#   r$   r%   r   Ú_skewÚlock_fdÚ_estop_check_pausedrJ   rK   Ú_wt_excr9   Ú_max_workersrR   Ú_resultsÚ_all_futuresÚpoolr@   ÚfutÚfr6   r3   s   fff&$                @r
   r!   r!   I   sà  û€ õ
 )ð
 ×6Ñ6Ó8€EØÒÜ˜u U¨1¥X J¨f°U¸1µX°JÐ?Ô@Ø×$Ñ$ U¨1¥X¨u°Q­xÓ8Ð8ä+¨FÓ3€GØ‚Ùð\+ä× Ò ¤×-Õ-ÝGÙ" 6¨6¯=©=×9Ò9Ø÷ .ðt 	×!Ñ! 'Ö*ðq :÷ .ð
 Ò#©L¯NªNØ�M‰M×ÑÐ YÔZØðf 	×!Ñ! 'Ö*÷c 	FßÙ�GáÔ!Ø×&Ñ&Ô(ð	UØ×2Ñ2Ô4ð ×&Ñ&Ó(ˆØ×-Ñ-¨hÔ7ççð —‘×"Ñ"Ð#5°v×7IÑ7IÓ7K×7TÑ7TÐU_Ó7`ÔaÜ×%Ò%Ô'Ø×%Ñ%Ô'Øðn 	×!Ñ! 'Ö*ôk ×(Ò(¨×2Ò2ð ×%Ñ%Ô'Øðb 	×!Ñ! 'Ö*÷_ Ø�M‰M×ÑÐ3°V×5GÑ5GÓ5I×5RÑ5RÐS]Ó5^Ô`cÐdlÓ`mÔnô
 .¨f°hÓ?ˆßØ×%Ñ%Ô'ØðL 	×!Ñ! 'Ö*ðI ×;Ñ;Ó=ˆßØ�M‰M×ÑØ@Ü�H“ß ,‘°+ô?÷
	Ió 	Ið
 ˆØˆØ×(Ñ(¨Ó6ˆÛˆCØ×+Ñ+¨C°°|ÓDˆCØŠ{ÙØ×Ñ Ô$ß‘4Ø—‘ Ö%ñ ÷ Ü×'Ñ'×4Ñ4°\ÖB�ð+Ø—O‘O A§H¡H£JÖ/ñ Cð ×%Ñ%Ô'Ü�x“=ð
 	×!Ñ! 'Õ*ð 	×/Ñ/°Ô=Ü�8‹}à×!Ñ! 'Õ*÷u .×-Ð-ûô$ ô 	UØ�M‰M×ÑÐ JÈG×TÒTûð	Uûô~ !ô +Ø—M‘M×'Ñ'Ð(DÀcÔJØ—O‘O E×*Ó*ûð+ûð 	×!Ñ! 'Õ*úsÕ   Á0"R+ Â!PÂ3R+ ÃR+ Ã(R+ ÄR+ Ä'R+ ÅP/ Å(R+ Æ R+ ÆAR+ Ç:R+ ÈR+ È:R+ ÉA'R+ Ê=R+ ËBR+ ÍR+ Í<"R+ ÎQ$Î>R+ Ï.R+ ÐP,	Ð&	R+ Ð/Q!Ð:QÑR+ ÑQ!Ñ!R+ Ñ$R(Ñ/-R#ÒR+ Ò#R(Ò(R+ Ò+R>c                ób   € V ^8„  d   Qh/ ^ \         9   d   \        \        \        3,          ;R&   # )r   r   )Ú__conditional_annotations__rN   r   Úobject)r	   s   "r
   r   r      s$   € × RÑ R÷ (Ò '””cœ6�kÕ"Ñ 'ò Sr   )TNNT)r|   Ú__doc__Úconcurrent.futuresrk   rV   Úloggingr   rI   r   Úcron.constantsr   Ú	getLoggerr   r   r   r   r'   r7   rC   r!   r   )r|   s   @r
   Ú<module>rƒ      sn   øðÞ Rã Û Û Û å Ý 'à	×	Ò	Ð+Ó	,€ð %Ð Ø%'€Ó 'õ4ñXÈDõ Xòõ 
<ño+ØW[÷o+ò o+r   