+
    5mjIU  c                      ^ RI t^ RIHu Ht ^ RI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HtHtHtHtHtHt ]P,                  t ! R R4      t]P2                  ! RR7      R 4       t]P2                  ! RR7      R	 4       t]P2                  ! RR7      R
 4       tR tR tR tR t R t!R t"R t#R t$ ! R R4      t% ! R R4      t&R t'R t(R t)R t*R t+R t,R t-R R lt.R  t/R! t0R" t1R# t2R$ t3R% t4R& t5R# )'    N)Path)AccountHealthClientAccountSnapshotExtraUsageSummaryHealthStatus
NamedLimitSpendSummaryc                   F   a  ] tR t^t o RR ltR tR tR tRR ltRt	V t
R# )	_FakeProcessNc                    \         P                  ! R P                  T;'       g    . 4      4      V n        \         P                  ! 4       V n        RV n        RV n        . V n        . V n        R# ) ?KL FN)	ioStringIOjoinstdoutstdinpid
terminatedsignals
wait_calls)selfstdout_liness   &&c/home/user/overdeck-private-tests/workstation-ai-broad2/modules/systray/tests/test_health_client.py__init___FakeProcess.__init__   sL    kk"'',*<*<""=>[[]
    c                x    V P                   P                  V4       V\        P                  8X  d
   R V n        R# R# TN)r   appendsignalSIGTERMr   r   sigs   &&r   send_signal_FakeProcess.send_signal    s,    C &.. "DO !r   c                D    V P                  \        P                  4       R # N)r$   r    r!   r   s   &r   	terminate_FakeProcess.terminate%       (r   c                D    V P                  \        P                  4       R # r'   r$   r    SIGKILLr(   s   &r   kill_FakeProcess.kill(   r+   r   c                <    V P                   P                  V4       ^ # r   )r   r   r   timeouts   &&r   wait_FakeProcess.wait+   s    w'r   )r   r   r   r   r   r   r'   )__name__
__module____qualname____firstlineno__r   r$   r)   r/   r5   __static_attributes____classdictcell____classdict__s   @r   r
   r
      s#     #
)) r   r
   T)autousec                 H    V P                  \        R \        R 4      4       R# )_codex_executablec                      R # )z/usr/bin/codex rC   r   r   <lambda>)_fixed_codex_executable.<locals>.<lambda>5   s    -r   N)setattrr   staticmethodmonkeypatchs   &r   _fixed_codex_executablerJ   0   s    -.r   c                 0    R  pV P                  RV4       R# )c                     \        V 4      hr'   )ProcessLookupError)pgidr#   s   &&r   _refuse _no_real_killpg.<locals>._refuse;   s     &&r   zhealth_client.os.killpgNrF   )rI   rO   s   & r   _no_real_killpgrR   9   s    ' 17;r   c                 4    V P                  \        R R4       R# )_scope_availableFN)rF   r   rH   s   &r   _no_user_scoperU   A   s    +-?Gr   c                 	  aa \        \        P                  ! R ^RRR//4      R,           \        P                  ! R ^RRR^*RR/R	R^R
R///4      R,           .R7      oVV3R lpV P                  RV4       V P                  RR 4       \	        4       P                  S4      p\        P                  p^*p^pRpRp\        VVVVVR7      qV	8H  q'       Eg   \        P                  ! R,V
3R-W934      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRRR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V	4      /	,          pR R!V/,          p\        \        P                   ! V4      4      hR";p
;p;p;p;p;rSP"                  qP$                  q! 4       qP&                  q! 4       pR#R$.pVV8H  pV'       Eg    \        P                  ! R,V3R.VV34      RR%\        P                  ! 4       9   g   \        P                  ! S4      '       d   \        P                  ! S4      MR%R\        P                  ! V
4      R&\        P                  ! V4      R'\        P                  ! V4      R(\        P                  ! V4      R)\        P                  ! V4      R\        P                  ! V4      /,          pR*RV/,          p\        \        P                   ! V4      4      hR";p
;p;p;p;p;ppSP(                  p
RqJVJ q'       g   \        P                  ! R/V3R0W34      RR%\        P                  ! 4       9   g   \        P                  ! S4      '       d   \        P                  ! S4      MR%R\        P                  ! V
4      R\        P                  ! V4      /,          pR+RV/,          p\        \        P                   ! V4      4      hR";p
;rR"# )1idresultokT
primaryusedPercentresetSeconds,  	secondaryresetsAt Ikr   c                 D  < \         P                  ! 4       R R.q V8H  q3'       g   \        P                  ! RV3RW34      RR\        P
                  ! 4       9   g   \        P                  ! V 4      '       d   \        P                  ! V 4      MRR\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;r2VR,          R	,          p\        S4      qvV8H  q"'       Eg   \        P                  ! RV3RWg34      R
\        P                  ! V4      RR\        P
                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\        P
                  ! 4       9   g   \        P                  ! S4      '       d   \        P                  ! S4      MRR\        P                  ! V4      /,          pRRV/,          p	\        \        P                  ! V	4      4      hR;p;r'S
# 
app-server--stdiopy0argvpy3assert %(py5)spy5Nenv
CODEX_HOMEpy1strpy4tmp_pathpy6assert %(py8)spy8==z%(py0)s == %(py3)s)z0%(py1)s == %(py6)s
{%(py6)s = %(py3)s(%(py4)s)
}r   rA   
@pytest_ar_call_reprcompare@py_builtinslocals_should_repr_global_name	_safereprAssertionError_format_explanationro   rh   kwargs@py_assert2@py_assert1@py_format4@py_format6@py_assert0@py_assert5@py_format7@py_format9processrq   s   &,        r   
fake_popenItest_fetch_returns_ok_snapshot_from_rate_limit_result.<locals>.fake_popenW      +==?yYYYYYYYYtYYYYYYtYYYYtYYYYYYYYYYYYe}\*;c(m;m;;;;;*;;;*;;;;;;c;;;;c;;;;;;;(;;;;(;;;m;;;;;;;;r   health_client.subprocess.Popenhealth_client.time.timec                      R # g   @TArC   rC   r   r   rD   Gtest_fetch_returns_ok_snapshot_from_rate_limit_result.<locals>.<lambda>]       ?r      TA   tAstatusprimary_used_pctsecondary_used_pctprimary_reset_atsecondary_reset_atrg   snapshotpy2r   ri   r   rk   py7py9py11py13py15assert %(py17)spy17Nz\{"id":1,"method":"initialize","params":{"clientInfo":{"name":"codex-tray","version":"1.0"}}}z7{"id":2,"method":"account/rateLimits/read","params":{}}r   rp   rr   rt   py10assert %(py15)sassert %(py7)sru   z%(py0)s == %(py15)s
{%(py15)s = %(py2)s(status=%(py5)s
{%(py5)s = %(py3)s.OK
}, primary_used_pct=%(py7)s, secondary_used_pct=%(py9)s, primary_reset_at=%(py11)s, secondary_reset_at=%(py13)s)
})z%(py10)s
{%(py10)s = %(py8)s
{%(py8)s = %(py6)s
{%(py6)s = %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.stdin
}.getvalue
}()
}.splitlines
}()
} == %(py13)sisz2%(py2)s
{%(py2)s = %(py0)s.terminated
} is %(py5)s)r
   jsondumpsrF   r   fetchr   OKr   ry   rz   r{   r|   r}   r~   r   r   r   getvalue
splitlinesr   )rI   rq   r   r   @py_assert4@py_assert6@py_assert8@py_assert10@py_assert12@py_assert14r   @py_format16@py_format18@py_assert3r   @py_assert7@py_assert9@py_assert11@py_format14r   @py_format8r   s   &f                   @r   5test_fetch_returns_ok_snapshot_from_rate_limit_resultr   F   sY   JJaD$<89D@JJ!!M2~s#K#mQ
M%R 	
G 
 8*E13JK"$**84H   )	
 +(*      8     8   8                         )	  
 +            == !! !# .. .0 fA5 0 5    0 5     7   7   =   !   #   .   0    5          %%%%%%%%%%%%%7%%%%7%%%%%%%%%%%%%%r   c                 ^  aa \        \        P                  ! R ^RRR//4      R,           \        P                  ! R ^RRR^*RR/R	R^R
R///4      R,           .R7      oVV3R lpV P                  RV4       V P                  RR 4       \	        4       P                  S4      p\        P                  p^*p^pRpRp\        VVVVVR7      qV	8H  q'       Eg   \        P                  ! R#V
3R$W934      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRRR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V	4      /	,          pR R!V/,          p\        \        P                   ! V4      4      hR";p
;p;p;p;p;rR"# )%rW   rX   rY   TrZ   r[   r\   r`   z2026-07-01T12:00:00Zr_   resetAtz2026-07-07T00:00:00Zrb   c                 D  < \         P                  ! 4       R R.q V8H  q3'       g   \        P                  ! RV3RW34      RR\        P
                  ! 4       9   g   \        P                  ! V 4      '       d   \        P                  ! V 4      MRR\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;r2VR,          R	,          p\        S4      qvV8H  q"'       Eg   \        P                  ! RV3RWg34      R
\        P                  ! V4      RR\        P
                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\        P
                  ! 4       9   g   \        P                  ! S4      '       d   \        P                  ! S4      MRR\        P                  ! V4      /,          pRRV/,          p	\        \        P                  ! V	4      4      hR;p;r'S
# rd   rx   r   s   &,        r   r   :test_fetch_parses_iso_timestamp_resets.<locals>.fake_popen   r   r   r   r   c                      R # r   rC   rC   r   r   rD   8test_fetch_parses_iso_timestamp_resets.<locals>.<lambda>   r   r   g   P@Ag   `Ar   rg   r   r   r   ri   r   rk   r   r   r   r   r   r   r   Nru   r   r
   r   r   rF   r   r   r   r   r   ry   rz   r{   r|   r}   r~   r   r   )rI   rq   r   r   r   r   r   r   r   r   r   r   r   r   s   &f           @r   &test_fetch_parses_iso_timestamp_resetsr   o   s   JJaD$<89D@JJ!!)2&(>$ $)1%'=&	 
G,
 8*E13JK"$**84H   &	
 (%'      8     8   8                         &	  
 (            r   c                   a
 \        \        P                  ! R ^RRR//4      R,           \        P                  ! R ^RRRR^A/RR^;////4      R,           .R	7      o
V P                  R
V
3R l4       \	        4       P                  V4      p\        P                  p^Ap^;p\        VVVR7      qbV8H  qw'       Eg   \        P                  ! RV3RW&34      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRRR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p	\        \        P                   ! V	4      4      hR;p;p;p;rVR# )rW   rX   rY   TrZ   
rateLimitsr[   r\   r_   rb   r   c                     < S# r'   rC   argsr   r   s   *,r   rD   Otest_fetch_returns_ok_snapshot_from_nested_rate_limits_result.<locals>.<lambda>       RYr   r   r   r   rg   r   r   r   ri   r   rk   r   r   r   assert %(py13)sr   Nru   )z%(py0)s == %(py11)s
{%(py11)s = %(py2)s(status=%(py5)s
{%(py5)s = %(py3)s.OK
}, primary_used_pct=%(py7)s, secondary_used_pct=%(py9)s)
}r   rI   rq   r   r   r   r   r   r   @py_format12r   r   s   &&        @r   =test_fetch_returns_ok_snapshot_from_nested_rate_limits_resultr      s!   JJaD$<89D@JJ!$%r':'-)<'
 
G" 8:YZ"$**84H        	8   	  	8   	8   	  	   	   	  	  	  	  	  	   	       	  r   c                   a
 \        \        P                  ! R ^RRR//4      R,           \        P                  ! R ^RR/ //4      R,           .R7      o
V P                  RV
3R l4       \	        4       P                  V4      p\        P                  pR	pR	p\        VVVR
7      qbV8H  qw'       Eg   \        P                  ! RV3RW&34      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRRR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p	\        \        P                   ! V	4      4      hR	;p;p;p;rVR	# )rW   rX   rY   TrZ   r   rb   r   c                     < S# r'   rC   r   s   *,r   rD   Ltest_fetch_returns_unknown_when_rate_limits_are_not_loaded.<locals>.<lambda>   r   r   Nr   rg   r   r   r   ri   r   rk   r   r   r   r   r   ru   z%(py0)s == %(py11)s
{%(py11)s = %(py2)s(status=%(py5)s
{%(py5)s = %(py3)s.UNKNOWN
}, primary_used_pct=%(py7)s, secondary_used_pct=%(py9)s)
})r
   r   r   rF   r   r   r   UNKNOWNr   ry   rz   r{   r|   r}   r~   r   r   r   s   &&        @r   :test_fetch_returns_unknown_when_rate_limits_are_not_loadedr      s   JJaD$<89D@JJaL"+=>?$F
G 8:YZ"$**84H ##  #      	8   	  	8   	8   	  	   	   	  	  	  	#  	  	    	       	  r   c                 0  a \        \        P                  ! R ^RRR//4      R,           \        P                  ! R ^RRRR^VRR	R
R/RR///4      R,           .R7      oV P                  RV3R l4       \	        4       P                  V4      p\        P                  pRp^VpRpRp\        VVVVVR7      qV8H  q'       Eg   \        P                  ! R!V	3R"W(34      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRRR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /	,          p
RR V
/,          p\        \        P                   ! V4      4      hR;p	;p;p;p;p;rxR# )#rW   rX   rY   TrZ   r   r[   r\   windowDurationMinsi`'  r`   ra   r_   Nrb   r   c                     < S# r'   rC   r   s   *,r   rD   Ptest_fetch_maps_duration_aware_weekly_only_window_to_secondary.<locals>.<lambda>   r   r   r   r   rg   r   r   r   ri   r   rk   r   r   r   r   r   r   r   ru   r   r   rI   rq   r   r   r   r   r   r   r   r   r   r   r   s   &&          @r   >test_fetch_maps_duration_aware_weekly_only_window_to_secondaryr      sz   JJaD$<89D@JJ!$% -r 4f *M(
 ('	 
G* 8:YZ"$**84H   	
 +*      8     8   8                         	  
 +            r   c                 4  a \        \        P                  ! R ^RRR//4      R,           \        P                  ! R ^RRRR^ZRR	/R
R^0RR////4      R,           .R7      oV P                  RV3R l4       \	        4       P                  V4      p\        P                  p^Zp^0pRpRp\        VVVVVR7      qV8H  q'       Eg   \        P                  ! R!V	3R"W(34      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRRR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /	,          p
RRV
/,          p\        \        P                   ! V4      4      hR ;p	;p;p;p;p;rxR # )#rW   rX   rY   TrZ   r   r[   r\   r`   i0Ejr_   i]Ljrb   r   c                     < S# r'   rC   r   s   *,r   rD   Otest_fetch_reads_nested_rate_limits_payload_with_epoch_resets.<locals>.<lambda>   r   r   g  -LAg  DAr   rg   r   r   r   ri   r   rk   r   r   r   r   r   r   r   Nru   r   r   r   s   &&          @r   =test_fetch_reads_nested_rate_limits_payload_with_epoch_resetsr      sx   JJaD$<89D@JJ!$%r:z'R'-Z)T'
 
G" 8:YZ"$**84H   &	
 (%'      8     8   8                         &	  
 (            r   c                 p  a
 \        \        P                  ! R ^RRRRR//4      R,           .R7      o
V P                  RV
3R l4       \	        4       P                  V4      p\        P                  pR	pR	p\        VVVR
7      qbV8H  qw'       Eg   \        P                  ! RV3RW&34      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRRR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p	\        \        P                   ! V	4      4      hR	;p;p;p;rVR	# )rW   errorcodemessagetoken_revokedrZ   rb   r   c                     < S# r'   rC   r   s   *,r   rD   =test_fetch_returns_broken_on_json_rpc_error.<locals>.<lambda>  r   r   Nr   rg   r   r   r   ri   r   rk   r   r   r   r   r   iru   )z%(py0)s == %(py11)s
{%(py11)s = %(py2)s(status=%(py5)s
{%(py5)s = %(py3)s.BROKEN
}, primary_used_pct=%(py7)s, secondary_used_pct=%(py9)s)
})r
   r   r   rF   r   r   r   BROKENr   ry   rz   r{   r|   r}   r~   r   r   r   s   &&        @r   +test_fetch_returns_broken_on_json_rpc_errorr   
  s   JJa669o*VWX
G 8:YZ"$**84H ""  "      	8   	  	8   	8   	  	   	   	  	  	  	"  	  	    	       	  r   c                 :  aa \        . R 7      oV P                  RV3R l4       \        RR.4      oV P                  RV3R l4       \        4       P	                  VRR7      p\
        P                  pR	pR	p\        VVVR
7      qbV8H  qw'       Eg   \        P                  ! RV3RW&34      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRRR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\        P                  ! 4       9   g!   \        P                  ! \
        4      '       d   \        P                  ! \
        4      MRR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p	\        \        P                  ! V	4      4      hR	;p;p;p;rVSP                   pRq7VJ q'       g   \        P                  ! RV
3RWs34      RR\        P                  ! 4       9   g   \        P                  ! S4      '       d   \        P                  ! S4      MRR\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR	;p;rR	# )rb   r   c                     < S# r'   rC   r   s   *,r   rD   7test_fetch_returns_unknown_on_timeout.<locals>.<lambda>  r   r   g        g      &@zhealth_client.time.monotonicc                     < \        S 4      # r'   )next)timeoutss   r   rD   r      s	    Xr         $@timeout_secsNr   rg   r   r   r   ri   r   rk   r   r   r   r   r   Tr   r   ru   r   r   r   )r
   rF   iterr   r   r   r   r   ry   rz   r{   r|   r}   r~   r   r   r   )rI   rq   r   r   r   r   r   r   r   r   r   r   r   r   r   s   &&           @@r   %test_fetch_returns_unknown_on_timeoutr     sW   +G8:YZS$K H68NO"$**8$*GH ##  #      	8   	  	8   	8   	  	   	   	  	  	  	#  	  	    	       	  
 %%%%%%%%%%%%%7%%%%7%%%%%%%%%%%%%%r   c                   N   a  ] tR tRt o RtV 3R lR ltR tV 3R lR ltRtV t	R	# )
_NeverEmitsStdoutr^   z{Simulates a subprocess.stdout that never yields a newline-terminated
line (the subprocess is alive but produces no output).c                   < V ^8  d   QhRR/#    returnNrC   )formatr>   s   "r   __annotate___NeverEmitsStdout.__annotate__0  s     * *$ *r   c                :    \         P                  ! 4       V n        R # r'   )	threadingEvent_unblockr(   s   &r   r   _NeverEmitsStdout.__init__0  s    !)r   c                :    V P                   P                  4        R # )r   )r  r5   r(   s   &r   readline_NeverEmitsStdout.readline3  s    r   c                   < V ^8  d   QhRR/# r   rC   )r   r>   s   "r   r  r  7  s       r   c                :    V P                   P                  4        R # r'   )r  setr(   s   &r   release_NeverEmitsStdout.release7  s    r   )r  N)
r7   r8   r9   r:   __doc__r   r	  r  r;   r<   r=   s   @r   r   r   ,  s#     >* * r   r   c                   T   a  ] tR tRt o V 3R lR ltR tR tR tRR ltR	 t	R
t
V tR# )_NeverTerminatingProcessi;  c                   < V ^8  d   QhRR/# r   rC   )r   r>   s   "r   r  %_NeverTerminatingProcess.__annotate__<  s        $  r   c                t    \        4       V n        \        P                  ! 4       V n        R V n        RV n        R# )r   FN)r   r   r   r   r   r   r   r(   s   &r   r   !_NeverTerminatingProcess.__init__<  s'    ')[[]
r   c                T    V\         P                  8X  d   V P                  4        R # R # r'   )r    r!   r)   r"   s   &&r   r$   $_NeverTerminatingProcess.send_signalB  s    &.. NN !r   c                D    V P                  \        P                  4       R # r'   r-   r(   s   &r   r/   _NeverTerminatingProcess.killF  r+   r   c                H    R V n         V P                  P                  4        R# r   )r   r   r  r(   s   &r   r)   "_NeverTerminatingProcess.terminateI  s    r   Nc                    ^ # r2   rC   r3   s   &&r   r5   _NeverTerminatingProcess.waitM  s    r   c                    R # r'   rC   r(   s   &r   poll_NeverTerminatingProcess.pollP  s    r   )r   r   r   r   r'   )r7   r8   r9   r:   r   r$   r/   r)   r5   r   r;   r<   r=   s   @r   r  r  ;  s-        ) r   r  c                   a \        4       oV P                  R V3R l4       \        P                  ! 4       p\	        4       P                  VRR7      p\        P                  ! 4       V,
          p\        P                  pRpRp\        VVVR7      qV8H  q'       Eg   \        P                  ! RV	3RW834      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRRR	\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MR	R
R\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          p
RRV
/,          p\        \        P                   ! V4      4      hR;p	;p;p;rxRqV8  q'       g   \        P                  ! RV	3RWL34      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR
\        P                  ! V4      /,          pRRV/,          p\        \        P                   ! V4      4      hR;rSP"                  p	RqYVJ q'       g   \        P                  ! RV3RW34      RR\        P                  ! 4       9   g   \        P                  ! S4      '       d   \        P                  ! S4      MRR\        P                  ! V	4      R\        P                  ! V4      /,          pRRV/,          p\        \        P                   ! V4      4      hR;p	;rR# )r   c                     < S# r'   rC   r   s   *,r   rD   Itest_fetch_times_out_when_subprocess_never_emits_a_line.<locals>.<lambda>V  r   r   g?r   Nr   rg   r   r   r   ri   r   rk   r   r   r   r   r   g      @elapsedrj   Tr   r   ru   r   )<)z%(py0)s < %(py3)sr   r   )r  rF   time	monotonicr   r   r   r   r   ry   rz   r{   r|   r}   r~   r   r   r   )rI   rq   startr   r%  r   r   r   r   r   r   r   r   r   r   r   r   r   s   &&               @r   7test_fetch_times_out_when_subprocess_never_emits_a_liner*  T  s   &(G8:YZNNE"$**8#*FHnn&G ##  #      	8   	  	8   	8   	  	   	   	  	  	  	#  	  	    	       	  
 S=777S%%%%%%%%%%%%%7%%%%7%%%%%%%%%%%%%%r   c                    R  pV P                  RV4       \        4       P                  V4      p\        P                  pRpRp\        VVVR7      qsV8H  q'       Eg   \        P                  ! RV3RW734      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRRR\        P                  ! 4       9   g!   \        P                  ! \
        4      '       d   \        P                  ! \
        4      MRRR	\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MR	R
\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          p	RRV	/,          p
\        \        P                  ! V
4      4      hR;p;p;p;rgR# )c                      \        R 4      h)zcodex missing)FileNotFoundErrorr   r   s   *,r   r   ?test_fetch_returns_unknown_on_spawn_failure.<locals>.fake_popenf  s    00r   r   Nr   rg   r   r   r   ri   r   rk   r   r   r   r   r   ru   r   )rF   r   r   r   r   r   ry   rz   r{   r|   r}   r~   r   r   )rI   rq   r   r   r   r   r   r   r   r   r   s   &&         r   +test_fetch_returns_unknown_on_spawn_failurer0  e  s   1 8*E"$**84H ##  #      	8   	  	8   	8   	  	   	   	  	  	  	#  	  	    	       	  r   c                   aa VR ,          pVP                  RRR7       R\        \        P                  ^^RRR7      /p/ o\        P
                  oVV3R lpV P                  \        R	V4       \        4       P                  W#4       \        P                  ! VP                  RR7      4      pRR
RR^R^RRRRRRRRR. RRRR/
/qeV8H  qw'       g   \        P                  ! R&V3R'WV34      RR\        P                  ! 4       9   g   \        P                   ! V4      '       d   \        P"                  ! V4      MRR\        P"                  ! V4      /,          pRRV/,          p	\%        \        P&                  ! V	4      4      hR;rvSR,          p
RqV8H  qf'       gy   \        P                  ! R&V3R(W34      R\        P"                  ! V
4      R\        P"                  ! V4      /,          pRRV/,          p\%        \        P&                  ! V4      4      hR;p
;rk\        P                  pSR ,          q! V4      qV8H  q'       Eg3   \        P                  ! R&V3R)W34      RR!\        P                  ! 4       9   g!   \        P                   ! \        4      '       d   \        P"                  ! \        4      MR!R"\        P"                  ! V4      R\        P"                  ! V4      R\        P"                  ! V4      R#R\        P                  ! 4       9   g   \        P                   ! V4      '       d   \        P"                  ! V4      MR/,          pR$R%V/,          p\%        \        P&                  ! V4      4      hR;p;p;rR# )*health_cache.jsonz{"existing": true}utf-8encodingrafar   r   r   c                 z   < \        V4      P                  R R7      SR&   V P                  R R7      SR&   S! W4      # )r3  r4  target_before_replacetemp_payload)r   	read_text)r   targetcapturedreal_replaces   &&r   fake_replace=test_write_cache_writes_json_atomically.<locals>.fake_replace  s@    ,0L,B,BG,B,T()#'>>7>#C D))r   replacer   rY   r   r   r   r   
checked_atNdetailnamed_limitsextra_usagespendrg   datari   rj   rk   r8  rn   rp   assert %(py6)srr   r9  r   r   rt   zassert %(py10)sr   ru   rw   z%(py1)s == %(py4)s)zK%(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.loads
}(%(py4)s)
} == %(py8)s)
write_textr   r   r   r   r@  rF   r   write_cacher   loadsr:  ry   rz   r{   r|   r}   r~   r   r   )rI   rq   
cache_path	snapshotsr>  rF  r   r   r   r   r   r   @py_format5r   r   r   r   @py_format11r<  r=  s   &&                @@r   'test_write_cache_writes_json_atomicallyrP  t  s   //J.A??!,.
I H<<L*
 i6%%j<::j**G*<=Dd " /$dB4T
      4     4   4            +,D0DD0DDDDDD,DDD,DDD0DDDDDDDDD::7h~.7:./7477777/777777477774777:777.777/777777477774777777777r   c                   a \        \        P                  ! R ^RRR^*RRR//RR^RR.///4      R	,           .R
7      oV P                  RV3R l4       \	        4       P                  V4      p\        P                  p^*p^pRpRp\        VVVVVR7      qV8H  q'       Eg   \        P                  ! RV	3RW(34      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRRR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /	,          p
RRV
/,          p\        \        P                   ! V4      4      hR;p	;p;p;p;p;rxR# )rW   rX   r[   r\   r`   badTr_   r   rZ   rb   r   c                     < S# r'   rC   r   s   *,r   rD   =test_fetch_ignores_invalid_reset_timestamps.<locals>.<lambda>  r   r   Nr   rg   r   r   r   ri   r   rk   r   r   r   r   r   r   r   ru   r   r   r   s   &&          @r   +test_fetch_ignores_invalid_reset_timestampsrU    sX   JJ!!M2zE4=#Q#mQ	E7%K 	
G 8:YZ"$**84H   	
        8     8   8                         	  
              r   c                    V R ,          pVP                  \        P                  ! RRRR^R^RRRR	/R
RRR^R^/RRRRRRR//4      RR7       \        4       P	                  V4      pR\        \        P                  ^^RR	R7      R\        \        P                  RR4      /q2V8H  qD'       g   \        P                  ! RV3RW#34      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;rCR# )r2  r6  r   rY   r   r   r   r   r   r   z
bad-statusmissingzbad-pct13Nr3  r4  )r   r   rg   rM  ri   rj   rk   ru   rw   )rI  r   r   r   
read_cacher   r   r   ry   rz   r{   r|   r}   r~   r   r   )rq   rL  rM  r   r   r   r   s   &      r   =test_read_cache_returns_valid_snapshots_and_skips_bad_entriesrZ    sq   //J

d&("&(/ i&(!
 d&($	
* -  2 $%00<I 	OO,.
 	?<??D$?	 	 	 	 	 	 	9 	 	 	 	 	9 	 	 	9 	 	 	 	 	 	 	 	 	 	 	r   c                 r   \        4       qP                  pR q0V,          qB! V4      p/ qeV8H  qw'       Eg_   \        P                  ! RV3RWV34      RR\        P
                  ! 4       9   g!   \        P                  ! \         4      '       d   \        P                  ! \         4      MRR\        P                  ! V4      R\        P                  ! V4      RR\        P
                  ! 4       9   g   \        P                  ! V 4      '       d   \        P                  ! V 4      MRR\        P                  ! V4      R\        P                  ! V4      R	\        P                  ! V4      /,          pR
RV/,          p	\        \        P                  ! V	4      4      hR;p;p;p;p;p;rvV R,          p
V
P                  RRR7       \        4       qP                  q"! V
4      p/ qSV8H  qD'       EgI   \        P                  ! RV3RW534      RR\        P
                  ! 4       9   g!   \        P                  ! \         4      '       d   \        P                  ! \         4      MRR\        P                  ! V4      R\        P                  ! V4      RR\        P
                  ! 4       9   g   \        P                  ! V
4      '       d   \        P                  ! V
4      MRR\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p;p;p;rER# )zmissing.jsonrg   r   r   rp   rk   rq   r   r   r   r   r   Nzinvalid.jsonznot-jsonr3  r4  invalid_pathzassert %(py12)spy12ru   )zv%(py10)s
{%(py10)s = %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s()
}.read_cache
}((%(py5)s / %(py7)s))
} == %(py13)s)zh%(py7)s
{%(py7)s = %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s()
}.read_cache
}(%(py5)s)
} == %(py10)s)r   rY  ry   rz   r{   r|   r}   r~   r   r   rI  )rq   r   r   r   r   r   r   r   r   r   r\  rO  @py_format13s   &            r   8test_read_cache_returns_empty_on_missing_or_invalid_filer_    s    L++L~L~,EL+,EFL"L"LLLLLFLLLLLLLLLLLLL LLL+LLLLLLHLLLLHLLL~LLLFLLL"LLLLLLLLLn,LJ9 ?++?+L9?R?R?????9????????????? ???+??????L????L???9???R?????????r   c                    V R ,          pR\        \        P                  ^^RRRR\        RR^RR4      \        R	R
^RR4      3\	        RRRRR7      \        RRRRR7      R7
      /p\        4       pVP                  W4       VP                  qD! V4      qUV8H  qf'       Egc   \        P                  ! R!V3R"WR34      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MR/,          pRRV/,          p\        \        P                   ! V4      4      hR ;p;rVR # )#r2  r6  r   r   g  ^TAzlimits unavailable	five_hourr[   T	seven_dayr_   g      @r   hoursz3 / 10 hours)usedlimitunitdisplayg      )@g      I@USDz$12.50 / $50)amountre  currencyrg  )
r   r   r   r   r   rA  rB  rC  rD  rE  rg   clientr   ri   rL  rk   r   rM  assert %(py9)sr   Nru   )zP%(py5)s
{%(py5)s = %(py2)s
{%(py2)s = %(py0)s.read_cache
}(%(py3)s)
} == %(py7)s)r   r   r   r   r   r   r   rJ  rY  ry   rz   r{   r|   r}   r~   r   r   )	rq   rL  rM  rk  r   r   r   r   @py_format10s	   &        r   >test_write_and_read_cache_round_trips_extended_snapshot_fieldsrn    sa   //J??!,.&';	2M;R$O *&	 &	%
I8 !"F
z-5Z(5I55555(555555655556555555555Z5555Z555(555555I5555I55555555r   c                (    V ^8  d   QhR\         RR/# )r   warmingr   N)bool)r   s   "r   r  r    s     ^ ^$ ^4 ^r   c                Z   a V P                  R R 4       V P                  RV3R l4       R# )z&health_client.codex_state.needs_warmupc                     R # TrC   )homes   &r   rD   &_incomplete_backfill.<locals>.<lambda>  s    tr   z,health_client.codex_state.warmup_in_progressc                    < S# r'   rC   )ru  rp  s   &r   rD   rv    s    U\r   NrQ   )rI   rp  s   &dr   _incomplete_backfillrx    s'    @BSTFH\]r   c                 \   \        V R R7       V P                  RR 4       \        4       P                  VR R7      p\        P
                  pRpRpRp\        VVVVR7      qrV8H  q'       Eg   \        P                  ! RV3RW'34      RR	\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MR	R
R\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          p	RRV	/,          p
\        \        P                  ! V
4      4      hR;p;p;p;p;rgR# )Trp  r   c                  .    \         P                  ! R 4      # )z(probe must not race the running backfillpytestfailr.  s   *,r   rD   Ktest_fetch_reports_preparing_while_a_backfill_warmup_runs.<locals>.<lambda>  s    ,V Wr   )allow_warmupNpreparing account data)r   r   r   rB  rg   r   r   r   ri   r   rk   r   r   r   r   r   r   ru   )z%(py0)s == %(py13)s
{%(py13)s = %(py2)s(status=%(py5)s
{%(py5)s = %(py3)s.UNKNOWN
}, primary_used_pct=%(py7)s, secondary_used_pct=%(py9)s, detail=%(py11)s)
})rx  rF   r   r   r   r   r   ry   rz   r{   r|   r}   r~   r   r   )rI   rq   r   r   r   r   r   r   r   r   r   s   &&         r   9test_fetch_reports_preparing_while_a_backfill_warmup_runsr    s   d3(W
 #$**8$*GH ##   (	#'	     
 8  
  
 8  
 8  
  
   
   
  
  
  
 # 
  
    
  (	 
       
   r   c                 T  aa \        V R R7       . oV P                  RV3R l4       . oV3R lpV P                  \        RV4       \        4       P                  VRRR7      pV.pSV8H  qU'       g   \        P
                  ! RV3RSV34      R	R
\        P                  ! 4       9   g   \        P                  ! S4      '       d   \        P                  ! S4      MR
R\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;rT\        P                  .pSV8H  qU'       g   \        P
                  ! RV3RSV34      R	R\        P                  ! 4       9   g   \        P                  ! S4      '       d   \        P                  ! S4      MRR\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;rTVP                  p\        P                   qVJ q'       Eg   \        P
                  ! RV	3RWX34      R	R\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      RR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRR\        P                  ! V4      /,          p
RRV
/,          p\        \        P                  ! V4      4      hR;p;rRqQV,          qP"                  q! 4       q'       * q'       g   RR	R\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          p\        \        P                  ! V4      4      hR;p;p	;p;rR# )Frz  z0health_client.codex_state.release_orphaned_claimc                 :   < SP                  V 4      ;'       g    R # rt  r   )ru  releaseds   &r   rD   Ktest_fetch_gives_a_first_backfill_the_whole_warmup_budget.<locals>.<lambda>,  s    X__T*22d2r   c                   < SP                  V4       R q1V,          qDP                  qU! 4       qf'       g   RRR\        P                  ! 4       9   g   \        P
                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          p\        \        P                  ! V4      4      hR;p;p;rV\        \        P                  ^^4      # ).systray-backfill-workerzMassert %(py7)s
{%(py7)s = %(py5)s
{%(py5)s = (%(py0)s / %(py2)s).exists
}()
}rg   
codex_homer   rk   r   N)r   existsr{   r|   ry   r}   r~   r   r   r   r   r   )	r   r  r   r   r   r   r   r   budgetss	   &&&     r   
fake_probeMtest_fetch_gives_a_first_backfill_the_whole_warmup_budget.<locals>.fake_probe0  s    |$7A77A??A?AAAAAAAAA
AAAA
AAA7AAA?AAAAAAAAAAA|155r   _prober   T)r   r  rg   r  ri   rj   rk   Nr  r   r   rp   r   rr   rs   rt   r  zQassert not %(py7)s
{%(py7)s = %(py5)s
{%(py5)s = (%(py0)s / %(py2)s).exists
}()
}rq   r   ru   rw   r   zF%(py2)s
{%(py2)s = %(py0)s.status
} is %(py6)s
{%(py6)s = %(py4)s.OK
})rx  rF   r   r   ry   rz   r{   r|   r}   r~   r   r   codex_stateWARMUP_TIMEOUT_Sr   r   r   r  )rI   rq   r  r   r   r   r   r   r   r   r   r   r   r   r   r  r  s   &&             @@r   9test_fetch_gives_a_first_backfill_the_whole_warmup_budgetr  '  sQ   e4H:2 G6
 +XzB"$**8$UY*ZH z!8z!!!!!8z!!!!!!8!!!!8!!!z!!!!!!!!"3344744444474444444744447444444444444??-loo-o-----?------8----8---?------l----l---o--------5?55?==?=??????????????????5???=???????????r   c                    \        V R R7       V P                  RR 4       \        4       P                  V4      pVP                  pRqCV8H  qU'       g   \
        P                  ! RV3RW434      RR\        P                  ! 4       9   g   \
        P                  ! V4      '       d   \
        P                  ! V4      MRR\
        P                  ! V4      R\
        P                  ! V4      /,          pR	R
V/,          p\        \
        P                  ! V4      4      hR;p;rTVP                  p\        P                  qVJ qU'       Eg   \
        P                  ! RV3RW834      RR\        P                  ! 4       9   g   \
        P                  ! V4      '       d   \
        P                  ! V4      MRR\
        P                  ! V4      RR\        P                  ! 4       9   g!   \
        P                  ! \        4      '       d   \
        P                  ! \        4      MRR\
        P                  ! V4      /,          p	RRV	/,          p
\        \
        P                  ! V
4      4      hR;p;rXR# )Frz  r   c                  .    \         P                  ! R 4      # )z+a cli caller must not run the warm-up prober|  r.  s   *,r   rD   Otest_fetch_never_waits_on_a_backfill_for_a_synchronous_caller.<locals>.<lambda>C  s    ,Y Zr   r  rg   r   r   rk   r   r   Nrp   r   rr   rs   rt   ru   )z.%(py2)s
{%(py2)s = %(py0)s.detail
} == %(py5)sr   )zK%(py2)s
{%(py2)s = %(py0)s.status
} is %(py6)s
{%(py6)s = %(py4)s.UNKNOWN
})rx  rF   r   r   rB  ry   rz   r{   r|   r}   r~   r   r   r   r   r   )rI   rq   r   r   r   r   r   r   r   r   r   s   &&         r   =test_fetch_never_waits_on_a_backfill_for_a_synchronous_callerr  ?  sF   e4(Z
 #$**84H??666666666?666666866668666?666666666666??2l222222222?222222822228222?222222l2222l222222222222r   c                 .   VR ,          pVR,          pVP                  4        VP                  4        VR,          pVP                  RRR7       VP                  R4       VR,          P                  V4       VR,          pVP                  RRR7       VP                  R4       V P	                  RV R	V 24       \        4       qeP                  qw! 4       p\        V4      qV	8H  q'       Eg   \        P                  ! RV
3RWi34      R
R\        P                  ! 4       9   g!   \        P                  ! \
        4      '       d   \        P                  ! \
        4      MRR\        P                  ! V4      RR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V	4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p;p
;p;rR# )shimreal_tmpjail-shim.sh
#!/bin/sh
r3  r4    codexPATH:rg   _RESOLVE_CODEX_EXECUTABLEr   rp   ro   rk   r   r   r   r   r   Nru   z}%(py2)s
{%(py2)s = %(py0)s()
} == %(py11)s
{%(py11)s = %(py4)s(%(py9)s
{%(py9)s = %(py7)s
{%(py7)s = %(py5)s.resolve
}()
})
})mkdirrI  chmod
symlink_tosetenvr  resolvero   ry   rz   r{   r|   r}   r~   r   r   )rI   rq   shim_dirreal_dir	shim_bodyr  r   r   r   r   r   r   r   s   &&           r   2test_codex_executable_skips_the_agent_session_shimr  L  s   & H& HNNNN--I9OOE##I.gDOOMGO4JJuv(1XJ78$&=ll=ln=#n*==*======&======$====$===&======#====#=======d====d===l===n===*==========r   c                    VR ,          pVP                  4        VR,          pVP                  RRR7       VP                  R4       VR,          P                  V4       VR,          pVP                  RRR7       VP                  R4       V P	                  V4       V P                  RV R24       \        4       qTP                  qf! 4       p\        V4      qV8H  q'       Eg   \        P                  ! RV	3RWX34      R	R
\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MR
R\        P                  ! V4      RR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          p
RRV
/,          p\        \        P                   ! V4      4      hR;p;p	;p;rxR# )r  r  r  r3  r4  r  r  r  r  rg   r  r   rp   ro   rk   currentr   r   r   r   r   Nru   r  )r  rI  r  r  chdirr  r  r  ro   ry   rz   r{   r|   r}   r~   r   r   )rI   rq   r  r  r  r   r   r   r   r   r   r   s   &&          r   Etest_codex_executable_returns_an_absolute_path_for_empty_path_entriesr  ]  s    & HNN--I9OOE##I. G}w7MM%hv(1~.$&@oo@o.?@#.?*@@*@@@@@@&@@@@@@$@@@@$@@@&@@@@@@#@@@@#@@@@@@@g@@@@g@@@o@@@.?@@@*@@@@@@@@@@r   c                 J  aaa \        \        P                  ! R ^RRR//4      R,           \        P                  ! R ^RRR^/RR^///4      R,           .R7      o/ o. oVV3R	 lpV3R
 lpV P                  \        RR4       V P                  RV4       V P                  RV4       \	        4       P                  V4      pVP                  p\        P                  qeVJ qw'       Eg   \        P                  ! R+V3R,WV34      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      RR\        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRR\        P                  ! V4      /,          pRRV/,          p	\        \        P                   ! V	4      4      hR;p;rvSR,          p
V
R,          p. R-Oq{V8H  q'       gy   \        P                  ! R.V3R/W34      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p\        \        P                   ! V4      4      hR;p;rV
^,          qP"                  pRq! V4      q'       g   RR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          p\        \        P                   ! V4      4      hR;p;p;rR qV
9   q'       g   \        P                  ! R0V3R1W34      R\        P                  ! V4      RR\        P                  ! 4       9   g   \        P                  ! V
4      '       d   \        P                  ! V
4      MR/,          pR!RV/,          p\        \        P                   ! V4      4      hR;rR"qV
9   q'       g   \        P                  ! R0V3R1W34      R\        P                  ! V4      RR\        P                  ! 4       9   g   \        P                  ! V
4      '       d   \        P                  ! V
4      MR/,          pR!RV/,          p\        \        P                   ! V4      4      hR;rV
R2R p\        P$                  ! 4       R#R$.q{V8H  q'       gy   \        P                  ! R.V3R/W34      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p\        \        P                   ! V4      4      hR;p;r\'        S4      p^qlV8H  q'       Eg   \        P                  ! R.V3R3W34      RR%\        P                  ! 4       9   g!   \        P                  ! \&        4      '       d   \        P                  ! \&        4      MR%RR&\        P                  ! 4       9   g   \        P                  ! S4      '       d   \        P                  ! S4      MR&R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p	\        \        P                   ! V	4      4      hR;p;rS^ ,          pVR',          p. R4Oq{V8H  q'       gy   \        P                  ! R.V3R/W34      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p\        \        P                   ! V4      4      hR;p;rV^,          qP"                  pR(q! V4      q'       g   RR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          p\        \        P                   ! V4      4      hR;p;p;rV^,          qP(                  pR)q! V4      q'       g   R*R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          p\        \        P                   ! V4      4      hR;p;p;rR# )5rW   rX   rY   TrZ   r[   r\   r_   rb   c                    < V SR &   S# )rh   rC   )rh   r   r   spawneds   &,r   r   Ftest_probe_wraps_codex_in_named_scope_and_kills_it.<locals>.fake_popen  s    r   c                 H   < SP                  V 4        ! R  R4      pV! 4       # )c                       ] tR tRt^ tRtR# )Utest_probe_wraps_codex_in_named_scope_and_kills_it.<locals>.fake_run.<locals>._Resulti  rC   Nr7   r8   r9   r:   
returncoder;   rC   r   r   _Resultr    s    Jr   r  r  )rh   r   r  scope_killss   &, r   fake_runDtest_probe_wraps_codex_in_named_scope_and_kills_it.<locals>.fake_run  s%    4 	 	 yr   rT   r   health_client.subprocess.runrg   r   r   rp   r   rr   rs   rt   Nrh   :N   Nrn   rG  z--unit=codex-probe-zLassert %(py7)s
{%(py7)s = %(py3)s
{%(py3)s = %(py1)s.startswith
}(%(py5)s)
}ri   rk   r   zMemoryMax=2Grj   zMemoryHigh=1Gre   rf   lenr  :N   Nzcodex-probe-z.scopezJassert %(py7)s
{%(py7)s = %(py3)s
{%(py3)s = %(py1)s.endswith
}(%(py5)s)
}r   r  )zsystemd-run--userz--scopez	--collectz--quietz--slice=agent.sliceru   rH  )in)z%(py1)s in %(py3)s)z0%(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)s)	systemctlr  r/   z--kill-whom=allz--signal=SIGKILL)r
   r   r   rF   r   r   r   r   r   ry   rz   r{   r|   r}   r~   r   r   
startswithrA   r  endswith)rI   rq   r   r  r   r   r   r   r   r   rh   r   r   rN  r   r   r   r   r   	kill_argvr   r  r  s   &&                  @@@r   2test_probe_wraps_codex_in_named_scope_and_kills_itr  o  s   JJaD$<89D@JJ!!M1#5#mQ%7 	
G GK +-?F8*E6A"$**84H??-loo-o-----?------8----8---?------l----l---o--------6?D8        8   8            7443434444447444444344444444444!T!!!!!>!!!>!!!!!!T!!!!T!!!!!!!!"d"""""?"""?""""""d""""d""""""""9Z,>>@,PYZZZZZZZZ9ZZZ9ZZZZZZZZZZZZ{ q q           3    3       {    {      q        AIR=        =   =            Q<2""2>2">222222<222"222>22222222222Q<*  ** ******<*** **************r   c                   a	 V P                  \        R R4       V P                  RR 4       \        P                  q! 4       pRq2VJ qD'       g   \        P                  ! RV3RW#34      RR\
        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRR\        P                  ! V4      R\        P                  ! V4      R	\        P                  ! V4      /,          pR
RV/,          p\        \        P                  ! V4      4      hR;p;p;rCV P                  \        R R4       V P                  RR 4        ! R R4      o	V P                  RV	3R l4       \        P                  q! 4       pRq2VJ qD'       g   \        P                  ! RV3RW#34      RR\
        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRR\        P                  ! V4      R\        P                  ! V4      R	\        P                  ! V4      /,          pR
RV/,          p\        \        P                  ! V4      4      hR;p;p;rC\        P                  pRqqVJ q"'       g   \        P                  ! RV3RW34      RR\
        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRR\        P                  ! V4      R\        P                  ! V4      /,          pRR	V/,          p\        \        P                  ! V4      4      hR;p;r'R# )rT   Nzhealth_client.shutil.whichc                     R # r'   rC   names   &r   rD   Itest_user_scope_available_requires_working_user_manager.<locals>.<lambda>  s    4r   Frg   r   r   rp   r   rl  r   c                     R V  2# )z	/usr/bin/rC   r  s   &r   rD   r    s    YtfCUr   c                       ] tR tRt^ tRtR# )Htest_user_scope_available_requires_working_user_manager.<locals>._Resulti  rC   Nr  rC   r   r   r  r    s    
r   r  r  c                     < S! 4       # r'   rC   )akr  s   *,r   rD   r    s    	r   Trk   r   r   )zT%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s._user_scope_available
}()
} is %(py7)s)z8%(py2)s
{%(py2)s = %(py0)s._scope_available
} is %(py5)s)rF   r   _user_scope_availablery   rz   r{   r|   r}   r~   r   r   rT   )
rI   r   r   r   r   r   rm  r   r   r  s
   &        @r   7test_user_scope_available_requires_working_user_managerr    s   +-?F46GH44?46?%?%?????6?????????????4???6???%????????+-?F46UV  68QR44>46>$>$>>>>>6>>>>>>>>>>>>>4>>>6>>>$>>>>>>>>//747477777/7777777777777/777477777777r   )6builtinsr{   _pytest.assertion.rewrite	assertionrewritery   r   r   r    r  r'  pathlibr   r}  r  health_clientr   r   r   r   r   r   rA   r  r
   fixturerJ   rR   rU   r   r   r   r   r   r   r   r   r   r  r*  r0  rP  rU  rZ  r_  rn  rx  r  r  r  r  r  r  r  rC   r   r   <module>r     s.     	         0AA  2   < < H H&&R'T:$ F>$&   2&"(8V8&R@!6H^
"@0
3>"A$=+@8r   