+
    iHàjô4 ã                  ó¦  a € 0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	H
t
Ht ^ RIHtHt ^ RIHtHtHtHtHtHt ^ RIHt ^ RIHt ^ RIHt ]P8                  ! ]4      tR	t ! R
 R4      t ]
R R l4       t!R R lt"R R lt#RRRR/R R llt$RRRR/R R llt%^t&Rt'Rt(Rt)R R lt*R‰R R  llt+R‰R! R" llt,RŠR# R$ llt-R% R& lt.R‰R' R( llt/R) R* lt0R+ R, lt1R- R. lt2R‹R/ R0 llt3R1t4R2]4,           R3,           t5R4t6R5t7R6]6,           R7,           ]7,           R8,           t8R9]4,           R:,           ]6,           R;,           ]7,           R<,           t9R= R> lt:R?RŒR@R�RAR�RBRŽ/t;RC]<RD&   RE RF lt=RG RH lt>RI RJ lt?R�t@RK RL ltARM RN ltBRO RP ltCRQ RR ltDR�RS RT lltERURRVRRWRRXR/RY RZ lltFR‘tGR[ R\ ltHR] R^ ltIR_ R` ltJRa Rb ltKR’tLRc Rd ltMR‰Re Rf lltNRg Rh ltORi Rj ltPR‰Rk Rl lltQRmtRRn Ro ltSR‰RURp/Rq Rr llltTRs tURt Ru ltVRv Rw ltWR“Rx Ry lltX] ! Rz R{4      4       tYR| R} ltZR”R~ R llt[R€ R� lt\R•R‚ Rƒ llt]R–R„R—R…R˜R†R”R†/t^R™R‡ Rˆ llt_. RšOt`R# )›u)  Background memory/skill review â€” fork the agent to evaluate the turn. After every turn
``AIAgent.run_conversation`` may spawn a daemon thread that replays the conversation snapshot in a
forked :class:`AIAgent` and asks "should any skill/memory be saved or updated?". Writes go
straight to the memory + skill stores; the main conversation and prompt cache are never touched.
The fork inherits the parent's live runtime (provider, model, credentials, cached system prompt)
so it hits the same prefix cache, and runs under a dispatch-side tool whitelist.)ÚannotationsN)ÚcontextmanagerÚsuppress)Ú	dataclassÚfield)ÚAnyÚDictÚIteratorÚListÚOptionalÚTuple)Út)Úresolve_prompt_cache_scope_safe)Úthread_scoped_silenceg       @c                  óJ   € ] tR t^tRtR R ltR R ltR R ltR R	 ltR
t	R# )Ú_BackgroundReviewRunz9Per-review cancellation and request-completion handshake.c               ó   € V ^8„  d   QhRR/# ©é   ÚreturnÚNone© )Úformats   "Ú</home/ubuntu/.hermes/hermes-agent/agent/background_review.pyÚ__annotate__Ú!_BackgroundReviewRun.__annotate__   s   € ÷ Añ A˜$ñ Aó    c                	óÌ   € \         P                  ! 4       V n        \         P                  ! 4       V n        \         P                  ! 4       V n        R V n        R;V n        V n        R # )NF)	Ú	threadingÚEventÚcancel_requestedÚrequest_doneÚLockÚ_lockÚ_review_agentÚ_request_finishedÚ_cancel_dispatched©Úselfs   &r   Ú__init__Ú_BackgroundReviewRun.__init__   sF   € Ü )§¢Ó 1ˆÔÜ%ŸOšOÓ-ˆÔÜ—^’^Ó%ˆŒ
Ø!ˆÔØ;@Ð@ˆÔ Ö!8r   c               ó    € V ^8„  d   QhRRRR/# )r   Úreview_agentr   r   Úboolr   )r   s   "r   r   r   &   s   € ÷ ñ ¨#ð °$ñ r   c                óð   € V P                   ;_uu_ 4        V P                  P                  4       '       g   V P                  '       d    RRR4       R# Wn         RRR4       R#   + '       g   i     R# ; i)z9Atomically admit the first provider-capable review phase.NFT)r#   r    Úis_setr%   r$   )r(   r,   s   &&r   Úbegin_requestÚ"_BackgroundReviewRun.begin_request&   sL   € à�Z�Z‹ZØ×$Ñ$×+Ñ+×-Ò-°×1G×1GÐ1GØ÷ ‰Zð ".ÔØ÷	 �Z�ZŠZús   •2A$ÁA$ÁA$Á$A5	c               ó   € V ^8„  d   QhRR/# )r   r   r   r   )r   s   "r   r   r   .   s   € ÷ &ñ &˜ñ &r   c                ó  € V P                   ;_uu_ 4        V P                  P                  4        V P                  e   V P                  '       d    RRR4       R# RV n        V P                  uuRRR4       #   + '       g   i     R# ; i)z?Fence startup and return the running fork, if one was admitted.NT)r#   r    Úsetr$   r&   r'   s   &r   ÚcancelÚ_BackgroundReviewRun.cancel.   s]   € à�Z�Z‹ZØ×!Ñ!×%Ñ%Ô'Ø×!Ñ!Ò)¨T×-D×-DÐ-DØ÷ ‰Zð '+ˆDÔ#Ø×%Ñ%÷ �Z�Z‹Zús   •:A8ÁA8ÁA8Á8B		c               ó   € V ^8„  d   QhRR/# )r   r   r-   r   )r   s   "r   r   r   7   s   € ÷ ñ  tñ r   c                óÂ   € V P                   ;_uu_ 4        V P                  '       d    RRR4       R# RRuV n        V n         RRR4       R#   + '       g   i     R# ; i)z>Latch request completion once; the caller publishes the event.NFT)r#   r%   r$   r'   s   &r   Úmark_request_finishedÚ*_BackgroundReviewRun.mark_request_finished7   sD   € à�Z�Z‹ZØ×%×%Ð%Ø÷ ‰Zð :>¸tÐ6ˆDÔ" DÔ$6Ø÷	 �Z�ZŠZús   •A³AÁA	)r&   r#   r%   r$   r    r!   N)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r)   r0   r5   r9   Ú__static_attributes__r   r   r   r   r      s   † ÙCõAõõ&÷ñ r   r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úagentr   ÚattrÚstrr   zIterator[None]r   )r   s   "r   r   r   A   s!   € ÷ ñ ˜#ð  Sð ¨^ñ r   c              #  ó�   "  € \        WR4      pVf   Rx € R# V;_uu_ 4        Rx € RRR4       R#   + '       g   i     R# ; i5i)zF``with`` over a lock attribute that may be absent (direct test stubs).N)Úgetattr)rB   rC   Úlocks   && r   Ú_optional_lockrH   @   s1   é € ô �5 Ó%€DØ‚|ÛÙß	ŠÛ÷ 
��Šüs   ‚!A£2¨
A²A	½	Ac               ó    € V ^8„  d   QhRRRR/# )r   rB   r   r   úOptional[_BackgroundReviewRun]r   )r   s   "r   r   r   K   s   € ÷ ñ ¨ð Ð1Oñ r   c                óv  € \        4       p \        V RR4      pVf   \        P                  ! 4       ;q n        T;_uu_ 4        \        V RR4      pVe,   VP
                  P                  4       '       g    RRR4       R# Wn        RRR4       V#   + '       g   i     T# ; i  \        \        3 d     R# i ; i)zCInstall a unique run token on the parent before ``Thread.start()``.Ú_background_review_lockNÚ_background_review_run)
r   rF   r   r"   rL   r!   r/   rM   ÚAttributeErrorÚ	TypeError)rB   ÚrunrG   Úcurrents   &   r   Úprepare_background_review_runrR   K   s¨   € ä
Ó
 €Cð
Ü�uÐ7¸Ó>ˆØŠ<Ü3<·>²>Ó3CÐCˆDÔ0ßŠTÜ˜eÐ%=¸tÓDˆGØÒ"¨7×+?Ñ+?×+FÑ+F×+HÒ+HØ÷ ‰Tð ,/Ô(÷	 ð €J÷ ŽTð €Jûô œIÐ&ô ÚðúsA   Œ6B# Á1BÁ4BÁ5B# Á?BÂB# ÂB 	ÂB# Â B# Â#B8Â7B8c               ó$   € V ^8„  d   QhRRRRRR/# )r   rB   r   rP   rJ   r   r   r   )r   s   "r   r   r   \   s#   € ÷ ñ ¨ð Ð2Pð ÐUYñ r   c                ó  € Ve   VP                  4       '       g   R# \        V R4      ;_uu_ 4        \        V RR4      VJ d   RV n        RRR4       VP                  P                  4        R#   + '       g   i     L,; i)zGPublish one run's request exit without clearing a successor (ABA-safe).NrL   rM   )r9   rH   rF   rM   r!   r4   )rB   rP   s   &&r   Úfinish_background_review_runrU   \   sb   € à
‚{˜#×3Ñ3×5Ò5ÙÜ	˜Ð8×	9Õ	9Ü�5Ð2°DÓ9¸SÓ@Ø+/ˆEÔ(÷ 
:ð ×Ñ×ÑÖ÷ 
:×	9ús   ±A.Á.A>	Úmessagezsuperseded by a new live turnÚtool_reasonzbackground review supersededc               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r,   r   rV   rD   rW   r   r   r   )r   s   "r   r   r   f   s8   € ÷ ]ñ ]Øð]ð ð]ð ð	]ð
 
ñ]r   c               óÄ   a aa€ R VV V3R llp \         P                  ! VRRR7      P                  4        R#   \         d    \        P                  RRR7        R# i ; i)	a›  Request abort off-thread so a wedged abort hook cannot stall the live turn (the bounded
``request_done`` wait in the canceller relies on this returning fast).

``message``/``tool_reason`` default to the original live-turn-preemption wording; callers
cancelling for a different reason (e.g. the owning session itself is ending, #102895) should
pass their own so logs/diagnostics describe what actually happened.
c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   Ú2_interrupt_background_review.<locals>.__annotate__s   s   € ÷ fñ f˜ñ fr   c                 ó€   <€  ^ RI Hp  V ! SSSR7       R#   \         d    \        P	                  RSRR7        R# i ; i)é    )Úrequest_hard_interrupt)rW   z1Failed to cancel in-flight background review (%s)T©Úexc_infoN)Úagent.interrupt_compatr^   Ú	ExceptionÚloggerÚdebug)r^   rV   r,   rW   s    €€€r   Ú
_interruptÚ0_interrupt_background_review.<locals>._interrupts   s=   ø€ ð	fÝEá" <°Àk×RøÜô 	fÜ�L‰LÐLÈgÐ`dˆL×eð	fús   ƒ –#=¼=Tzbg-review-cancel)ÚtargetÚdaemonÚnamez5Failed to start background-review cancellation threadr_   N)r   ÚThreadÚstartrb   rc   rd   )r,   rV   rW   re   s   fdd r   Ú_interrupt_background_reviewrl   f   sT   ú€ ÷fò fð]Ü×Ò 
°4Ð>PÔQ×WÑWÖYøÜô ]Ü�‰ÐLÐW[ˆ×\ð]ús   �'9 ¹"AÁAc               ó(   € V ^8„  d   QhRRRRRRRR/# )r   rB   r   rV   rD   rW   r   r   r   )r   s   "r   r   r   �   s2   € ÷ &
ñ &
Øð&
ð ð&
ð ð	&
ð
 
ñ&
r   c               óz  € \        V R4      ;_uu_ 4        \        V RR4      p\        V RR4      pRRR4       Xf   XMVP                  4       pVe   \        WQVR7       Vf   R# VP                  P                  \        R7      '       g   \        P                  R\        V4       R# R#   + '       g   i     L‚; i)u>  Cancel the current review and await its request-phase acknowledgement. Foreground priority:
past the bounded deadline, warn and let the live turn proceed â€” self-improvement work must
never block a user-facing turn.

Foreground priority is preserved: if the review does not acknowledge within the bounded deadline, a
warning is logged and the live turn proceeds anyway. See #84423.

Despite the name, this is also the session-teardown/interrupt cancellation path
(``tui_gateway.session_lifecycle._finalize_session`` and ``_interrupt_session_turn``, #102895): a
session ending or being explicitly stopped while its background review is still running must
cancel that review the same way a new live turn preempts one â€” the review fork is invisible to
every other interrupt/teardown mechanism (not tracked on ``session["running"]``, not joined by
the run-thread wait), so this is the only thing that ever sets its ``_interrupt_requested``. Pass
a reason-appropriate ``message``/``tool_reason`` when the caller isn't the live-turn-preemption
path so diagnostics describe the real cause.
rL   rM   NÚ_background_review_agent)rV   rW   )ÚtimeoutzPBackground review did not acknowledge cancellation within %.1fs; proceeding (%s))	rH   rF   r5   rl   r!   ÚwaitÚ)_BACKGROUND_REVIEW_CANCEL_TIMEOUT_SECONDSrc   Úwarning)rB   rV   rW   rP   Úlegacy_agentr,   s   &$$   r   Ú&cancel_background_review_for_live_turnru   �   s¢   € ô, 
˜Ð8×	9Õ	9Ü�eÐ5°tÓ<ˆÜ˜uÐ&@À$ÓGˆ÷ 
:ð $'¢;‘<°C·J±J³L€Lð ÒÜ$ \ÐP[Õ\Ø
‚{ÙØ×Ñ× Ñ Ô)RÐ ×SÒSÜ�‰Ø^Ü5Øö	
ñ T÷ 
:×	9ús   •B*Â*B:	iÀ'	 g      è?iÀÔ c               ó    € V ^8„  d   QhRRRR/# )r   Úcfgr   r   údict[str, Any]r   )r   s   "r   r   r   ¹   s   € ÷ 2ñ 2�Sð 2˜^ñ 2r   c                óÌ   € \        V P                  R4      \        4      '       d   V P                  R/ 4      M/ pVP                  R/ 4      p\        V\        4      '       d   V# / # )zS``cfg["auxiliary"]["background_review"]`` as a dict (``{}`` on any shape mismatch).Ú	auxiliaryÚbackground_review)Ú
isinstanceÚgetÚdict)rw   ÚauxÚtasks   &  r   Ú_task_blockr�   ¹   sR   € ä&0°·±¸Ó1EÄt×&LÒ&Lˆ#�'‰'�+˜rÔ
"ÐRT€CØ�7‰7Ð&¨Ó+€DÜ˜d¤D×)Ò)ˆ4Ð1¨rÐ1r   c               ó    € V ^8„  d   QhRRRR/# )r   Útask_cfgúOptional[dict[str, Any]]r   rx   r   )r   s   "r   r   r   À   s   € ÷ 	ñ 	Ð-Eð 	ÐQ_ñ 	r   c                ó’   € V e   \        V \        4      '       d   V # / #  ^ RIHp \	        V! 4       4      #   \
         d    / u # i ; i)z¥``auxiliary.background_review`` (or ``{}`` on any failure); pass a pre-loaded ``task_cfg``
so the spawn / resolve / prompt paths do not re-read config on every turn.©Úload_config_readonly)r|   r~   Úhermes_cli.configr‡   r�   rb   )rƒ   r‡   s   & r   Ú_background_review_task_configr‰   À   sL   € ð ÒÜ% h´×5Ò5ˆxÐ=¸2Ð=ðÝ:ÜÑ/Ó1Ó2Ð2øÜô ØŠ	ðús    6 ¶AÁAc               ó    € V ^8„  d   QhRRRR/# )r   r,   r   r   Úintr   )r   s   "r   r   r   Ì   s   € ÷ kñ k°sð kÀcñ kr   c           
     ó   € \        \        V RR4      RR4      p\        V\        4      '       d   \        V\        4      '       g   V^ 8:  d   \        # \        \        \        ^\        V\        ,          4      4      4      # )uf  Default budget: 75% of the review fork's resolved context window, capped at the historical
600k ceiling. The fork's ``context_compressor.context_length`` is already resolved by
``AIAgent.__init__`` (config overrides, catalog, endpoint probe) â€” no second lookup here.
Unknown window â†’ a conservative fixed fallback so unattended review work stays bounded.Úcontext_compressorNÚcontext_length)	rF   r|   r‹   r-   Ú!_REVIEW_MAX_INPUT_TOKENS_FALLBACKÚminÚ_REVIEW_MAX_INPUT_TOKENS_CAPÚmaxÚ_REVIEW_INPUT_CONTEXT_FRACTION)r,   Úcontext_windows   & r   Ú$_context_derived_review_input_budgetr•   Ì   sf   € ô
 œW \Ð3GÈÓNÐP`ÐbfÓg€NÜ�n¤c×*Ò*¬j¸Ì×.NÒ.NÐR`ÐdeÔReÜ0Ð0ÜÔ+¬S°´C¸ÔIgÕ8gÓ4hÓ-iÓjÐjr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   rƒ   r„   r,   r   r   zOptional[int]r   )r   s   "r   r   r   ×   s$   € ÷ 
*ñ 
*Ø&ð
*Ø=@ð
*àñ
*r   c                ó¢   € \        V 4      p \        VR,          4      pT^ 8”  d   T# R#   \        \        \        3 d    \        T4      u # i ; i)u¯   Aggregate input-token budget for one review fork (None = unlimited; <= 0 disables). Unset
or malformed ``max_input_tokens`` â†’ derived from ``review_agent``'s context window.Úmax_input_tokensN)r‰   r‹   ÚKeyErrorrO   Ú
ValueErrorr•   )rƒ   r,   r€   Úbudgets   &&  r   Ú_review_input_token_budgetrœ   ×   s\   € ô
 *¨(Ó3€DðBÜ�TÐ,Õ-Ó.ˆð ˜a”Zˆ6Ð) TÐ)øô ”i¤Ð,ô BÜ3°LÓAÒAðBús   �* ª!AÁAc               ó   € V ^8„  d   QhRR/# )r   r   ztuple[bool, dict[str, Any]]r   )r   s   "r   r   r   ä   s   € ÷ ñ Ð)Dñ r   c                 ó  € ^ RI Hp  ^ RIHp V ! 4       '       g   V! 4       RJ d   R/ 3#  ^ RIHp ^ RIHp \        V! 4       4      pV! VP                  R4      RR7      V3#   \         d    \        P                  R	RR
7       R/ 3u # i ; i)u£   Single config read -> ``(enabled, task_cfg)``. Fail-open (``enabled=True``) so a broken
config never silently disables reviews â€” but WARN so the cost is visible.)Úsafe_worker_enabled)Úfinite_turn_requiredTFr†   )Úis_truthy_valueÚenabled)ÚdefaultzVFailed to read background_review.enabled; leaving automatic review enabled (fail-open)r_   )Úagent.safe_worker_policyrŸ   Úgateway.session_finiter    rˆ   r‡   Úutilsr¡   r�   r}   rb   rc   rs   )rŸ   r    r‡   r¡   r€   s        r   Úload_background_review_settingsr§   ä   s‘   € õ =Ý;ñ
 ×ÒÑ 4Ó 6¸$Ó >Ø�bˆyÐðÝ:Ý)ÜÑ/Ó1Ó2ˆÙ˜tŸx™x¨	Ó2¸DÔAÀ4ÐGÐGøÜô Ü�‰ð)àð 	ô 	
ð
 �RˆxŠðús   ª6A! Á!&B
Â	B
c               ó$   € V ^8„  d   QhRRRRRR/# )r   rB   r   rƒ   r„   r   rx   r   )r   s   "r   r   r   ý   s#   € ÷ &ñ & 3ð &Ð2Jð &ÐVdñ &r   c                ór  a€ V P                  4       pVP                  R4      ;'       g    RpRV P                  RV P                  RVP                  R4      ;'       g    RRVP                  R4      ;'       g    RRVR8X  d   RMTR	\	        V R
R4      R\        \	        V R/ 4      ;'       g    / 4      R\	        V RR4      R\	        V RR4      R\        \	        V R. 4      ;'       g    . 4      RR/p\        V4      oV3R lR 4       w  rVrxV'       dD   VR8w  d=   V'       d5   YPP                  ;'       g    R8X  d   Y`P                  ;'       g    R8X  d   V#  ^ RIH	p	 V	! WVW‡R7      p
RV
P                  R4      ;'       g    TRV
P                  R4      ;'       g    T/R Uu/ uF  q»V
P                  V4      bK  	  upCR\        V
P                  R4      ;'       g    / 4      R\        V
P                  R4      ;'       g    . 4      RR/C# u upi   \         d   p\        YYl4       Tu Rp?# Rp?ii ; i)aO  Resolve provider/model/credentials for the review fork. Default (auto / unset / same as
parent): the parent's live runtime with ``routed=False`` (codex_app_server -> codex_responses
downgrade applied). When ``auxiliary.background_review.{provider,model}`` names a different
concrete model, resolve that runtime and set ``routed=True``.Úapi_modeNÚproviderÚmodelÚapi_keyÚbase_urlÚcodex_app_serverÚcodex_responsesÚcredential_poolÚ_credential_poolÚrequest_overridesÚ
max_tokensÚcommandÚacp_commandÚargsÚacp_argsÚroutedFc              3  óŠ   <"  € T F8  p\        SP                  VR 4      4      P                  4       ;'       g    Rx € K:  	  R# 5i)Ú N)rD   r}   Ústrip)Ú.0Úkeyr€   s   & €r   Ú	<genexpr>Ú*_resolve_review_runtime.<locals>.<genexpr>  s9   øé € ð >Ù:f°3ŒˆD�H‰H�S˜"ÓÓ×$Ñ$Ó&×.Ð.¨$Ô.Ó:fùs
   ƒ4A¸AÚautor»   )Úresolve_runtime_provider)Ú	requestedÚtarget_modelÚexplicit_api_keyÚexplicit_base_urlT)r«   r¬   r®   r­   )r­   r®   rª   r±   rµ   )Ú_current_main_runtimer}   r«   r¬   rF   r~   Úlistr‰   Úhermes_cli.runtime_providerrÂ   rb   Ú_warn_review_routing_fallback)rB   rƒ   Úparent_runtimeÚparent_api_modeÚparentÚtask_providerÚ
task_modelÚtask_base_urlÚtask_api_keyrÂ   Úrpr¾   Úer€   s   &&           @r   Ú_resolve_review_runtimerÔ   ý   s  ø€ ð
 ×0Ñ0Ó2€NØ$×(Ñ(¨Ó4×<Ð<¸€Oà�E—N‘N G¨U¯[©[Ø�>×%Ñ% iÓ0×8Ð8°D¸*Àn×FXÑFXÐYcÓFd×FlÐFlÐhlØ¨Ð<NÔ)NÑ%ÐTcØœ7 5Ð*<¸dÓCØœT¤'¨%Ð1DÀbÓ"I×"OÐ"OÈRÓPØ”g˜e \°4Ó8¸)ÄWÈUÐTaÐcgÓEhØ””W˜U J°Ó3×9Ð9°rÓ:¸HÀeð€Fô *¨(Ó3€Dô>Ù:fó>Ñ:€M˜}÷ ˜m¨vÔ5¿*ØŸ.™.×.Ð.¨BÔ/°JÇ;Á;×CTÐCTÐRTÔ4UàˆðÝHÙ%Ø#Ø)ô
ˆð
 ˜Ÿ™˜zÓ*×;Ð;¨m¸WÀbÇfÁfÈWÃo×FcÐFcÐYcð
á+lÓmÑ+l C�B—F‘F˜3“KÒÑ+lÑmð
ð  ¤ b§f¡fÐ-@Ó&A×&GÐ&GÀRÓ!HØ”D˜Ÿ™ ›×-Ð-¨2Ó.°¸$ñ	
ð 	
ùâmøô ô Ü% e¸JÔJØ�ûðúsH   Å(H ÆH ÆH Æ$HÆ> H Ç#H È
H ÈH ÈH6ÈH1È+H6È1H6c          
     ó,   € V ^8„  d   QhRRRRRRRRRR	/# )
r   rB   r   rÎ   rD   rÏ   Úerrorrb   r   r   r   )r   s   "r   r   r   &  s1   € ÷ ñ ¨ð ¸Sð Ècð ÐZcð Ðhlñ r   c           	     óú  € \        V4      '       d!   \        V4      P                  4       ^ ,          MRp\        P                  RWW@P                  V P
                  4       \        RWW@P                  V P
                  R7      p\        V RR4      '       d   R# RV n        \        V R	R4      p\        V4      '       d+   \        \        4      ;_uu_ 4        V! V4       RRR4       R# R#   + '       g   i     R# ; i)
a  The configured review route could not be resolved, so the fork runs on the main model. That
was a debug-level line nobody saw (#116055): the misrouted model never ran and nothing said so.
User-visible notice once per agent (same rail as the reasoning_effort notice); log every time.r»   uˆ   auxiliary.background_review.provider=%r (model %r) could not be resolved: %s â€” background reviews run on the main model %s/%s instead.z'display.review.routing_fallback_warning)rÎ   rÏ   rÖ   r«   r¬   Ú_warned_bg_review_routingFNTÚ_emit_warning)rD   Ú
splitlinesrc   rs   r«   r¬   r   rF   rØ   Úcallabler   rb   )rB   rÎ   rÏ   rÖ   Ú
error_linerV   Úemits   &&&&   r   rÊ   rÊ   &  sÅ   € ô 03°5¯zªz”�U“×&Ñ&Ó(¨Ö+¸r€JÜ
‡N�Nð	/Ø0=È:×WeÑWeÐgl×grÑgrôtô Ð9ÈØ ¯>©>ÀÇÁôN€GäˆuÐ1°5×9Ò9ÙØ&*€EÔ#Ü�5˜/¨4Ó0€DÜ�‡~‚~Ü”i× Õ Ù�ŒM÷ !Ñ ñ ß × Ð ús   Ã	C)Ã)C:	c               ó    € V ^8„  d   QhRRRR/# )r   rB   r   r   r-   r   )r   s   "r   r   r   9  s   € ÷ 	ñ 	 sð 	¨tñ 	r   c                óš   € \        V RR4      pYe   \        V4      MR3 F'  p\        VRR4      pVf   K  Vf   K  \        V4      u # 	  R# )u  Whether a fork inheriting ``agent``'s runtime could act at all: an agent-as-provider client
shim declaring ``SUPPORTS_HERMES_TOOL_CALLS = False`` (instance or class) is skipped â€” the fork
would be a guaranteed no-op that still pays a full spawn. Silence means capable.ÚclientNÚSUPPORTS_HERMES_TOOL_CALLST)rF   Útyper-   )rB   rà   Ú	candidateÚ	supporteds   &   r   Ú_parent_can_emit_tool_callsrå   9  sT   € ô �U˜H dÓ+€FØÒ.@œd 6œlÀdÓKˆ	Ü˜IÐ'CÀTÓJˆ	ØÔ  YÔ%:Ü˜	“?Ò"ñ Lñ r   c               ó    € V ^8„  d   QhRRRR/# )r   Úmr~   r   rD   r   )r   s   "r   r   r   E  s   € ÷ 3ñ 3�ð 3˜#ñ 3r   c                óÐ   € V P                  R 4      p\        V\        4      '       d   RP                  R V 4       4      p\        V\        4      '       d   VP                  4       # R# )ÚcontentÚ c              3  óv   "  € T F/  p\        V\        4      '       g   K  VP                  R R4      x € K1  	  R# 5i)Útextr»   N©r|   r~   r}   )r½   Úbs   & r   r¿   Ú_msg_text.<locals>.<genexpr>H  s*   é € ÐI±¨1´ZÀÄ4×5HÔ&�Q—U‘U˜6 2×&Ð&³ùs   ‚9Ÿ9r»   )r}   r|   rÈ   ÚjoinrD   r¼   )rç   Úcs   & r   Ú	_msg_textrò   E  sN   € Ø	�‰ˆiÓ€AÜ�!”T×ÒØ�H‰HÑI±ÓIÓIˆÜ" 1¤c×*Ò*ˆ1�7‰7‹9Ð2°Ð2r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úmessages_snapshotú
list[dict]Útailr‹   r   r   )r   s   "r   r   r   L  s!   € ÷ 8ñ 8 zð 8¸ð 8Àjñ 8r   c                óÔ  € \        T ;'       g    . 4      p\        V4      V8”  dL   W!) R p\        V^ ,          \        4      '       d   V^ ,          P	                  R4      R8X  g   MV^,          pK[  V# . pVR\        V4      )   EF6  p\        V\        4      '       g   K  VP	                  R4      \        V4      P                  RR4      rvVR8X  d&   V'       d   VP                  RVR,           24       Ks  VR	8X  g   K|  VP	                  R
4      '       d~   VR
,           Uu. uFF  p\        V\        4      '       g   K  VP	                  R4      ;'       g    / P	                  RR4      NKH  	  p	pVP                  RRP                  V	4       R24       V'       g   EK  VP                  RVR,           24       EK9  	  RRP                  V4      ,           p
RRRV
/.V,           # u upi )zùCompact replay for the routed (different-model) path only: keep the recent ``tail``
messages verbatim (extended so the kept run never starts on a tool result) and collapse older
turns into one synthetic user-role digest, preserving role alternation.NÚroleÚtoolÚ
rê   ÚuserzUSER: :Ni,  NÚ	assistantÚ
tool_callsÚfunctionri   Ú?zASSISTANT[tools: ú, Ú]zASSISTANT: :NéÈ   Nuœ   [Earlier conversation digest â€” older turns summarised to bound the review's cold-write cost on the routed aux model. Recent turns follow verbatim below.]
ré   )	rÈ   Úlenr|   r~   r}   rò   ÚreplaceÚappendrð   )rô   rö   ÚmsgsÚkeepÚlinesrç   rø   rì   ÚtcÚnamesÚdigests   &&         r   Ú_digest_historyr  L  s£  € ô Ð!×'Ð' RÓ(€DÜ
ˆd‹)�dÔ
Ø�E�Fˆ|ˆÜ˜4 �7¤D×)Ò)¨d°1­g¯k©k¸&Ó.AÀVÔ.KØØ��	ŠàˆØ€EØ�+”C˜“I�:ÔˆÜ˜!œT×"Ò"ÙØ—U‘U˜6“]¤I¨a£L×$8Ñ$8¸¸sÓ$CˆdØ�6Œ>ŸdØ�L‰L˜6 $ t¥* Ð.Ö/Ø�[Ö Ø�u‰u�\×"Ò"ØOPÐQ]ÎÓwÉÈÔblÐmoÔqu×bvÔD˜"Ÿ&™& Ó,×2Ð2°×7Ñ7¸ÀÖDÉ�ÐwØ—‘Ð0°·±¸5Ó1AÐ0BÀ!ÐDÔEßŠtØ—‘˜{¨4°­:¨,Ð7×8ñ ð	$à&*§i¡i°Ó&6õ	7ð ð
 �V˜Y¨Ð/Ð0°4Õ7Ð7ùò xs   Ä"G%Ä?G%ÅG%uì  TWO distinct stores â€” pick the right one for each fact:
  â€¢ USER.md (memory tool, target='user'): who the user is â€” persona, preferences, communication and work style, personal details they revealed, and expectations about how you should behave.
  â€¢ MEMORY.md (memory tool, target='memory'): facts about the ENVIRONMENT you operate in â€” tool quirks, project conventions, config gotchas, paths and endpoints that matter.

One fact goes to ONE store, never both â€” writing it to both bloats both files until they hit their size limits and crowds out the facts that matter; misrouting it puts it where the next session won't look. If the tool schema lists only one target, that store is the only one enabled â€” use it and skip the other.

zXReview the conversation above and consider saving to memory if appropriate.

Memory has z¬If something stands out, save it once, in the right store, using the memory tool with the matching target. If nothing is worth saving, just say 'Nothing to save.' and stop.uH  What a skill IS: the instructions for doing a class of task the most efficient and correct way, to THIS user's specifications â€” the procedure, the tools and commands that work, the order, the user's preferences for how the result should look, and the pitfalls that cost time. A future session should be able to follow it and produce what the user wants on the first try. Everything below is about writing that well:
  â€¢ Procedure first: the steps in the order they are done, with the concrete commands, tool calls, and decision points. Lessons and pitfalls attach to the step they affect.
  â€¢ A pitfall is a generalizable rule + one clause of WHY (the mechanism), imperative. 'Grep the test tree for the SYMBOL before widening a helper signature â€” hand-rolled mocks reimplement the old shape and fail on a shard you did not run.' Not a narrative of what happened this session.
  â€¢ No PR/issue numbers, dates, ticket IDs, or quoted user text as content â€” the rule must stand without the incident behind it. Keep a short quote ONLY when the quote itself is the clearest statement of the rule.
  â€¢ The same lesson learned twice is ONE rule. Before adding, search the skill (and its references/) for the rule already stated; strengthen or clarify it rather than appending a second copy.
  â€¢ Not a duplicate of what the environment already teaches: repo AGENTS.md files, tool schema descriptions, and other always-loaded context. A skill carries the WORKFLOW and the pitfalls; it does not restate the codebase map or a tool's parameter list.
  â€¢ Always-on rules (standing user preferences, gates that apply to every instance of the task) live in SKILL.md itself, whole. references/ is for depth that is only needed sometimes: a decision table, a recipe, a domain note â€” each file topical and reusable, never '<date>-<incident>.md'. Prefer extending an existing references/ file over creating one; a skill with dozens of one-off references is the failure shape, not the goal.
  â€¢ Fix the skill in place when it is wrong: edit the sentence that misled, do not append 'UPDATE: actually...' underneath it.

u®   (these become persistent self-imposed constraints that bite you later when the environment changes):
  â€¢ Environment-dependent failures: missing binaries, fresh-install errors, post-migration path mismatches, 'command not found', unconfigured credentials, uninstalled packages. The user can fix these â€” they are not durable rules.
  â€¢ Negative claims about tools or features ('browser tools do not work', 'X tool is broken', 'cannot use Y from execute_code'). These harden into refusals the agent cites against itself for months after the actual problem was fixed.
  â€¢ Session-specific transient errors that resolved before the conversation ended. If retrying worked, the lesson is the retry pattern, not the original failure.
  â€¢ One-off task narratives. A user asking 'summarize today's market' or 'analyze this PR' is not a class of work that warrants a skill.

  â€¢ Unresolved failures: if the session ended WITHOUT actually finding a working method â€” you tried several things, none worked, and told the user to check manually â€” do NOT write those attempts up as a 'reliable workflow' or 'recommended approach'. That presents an untested sequence of failures as validated guidance a future session will trust and repeat. Either say 'Nothing to save', or, only if you are independently confident of a real working alternative (not something you are merely guessing might work), capture ONLY that alternative â€” never the dead ends, and never dressed up as best practice.

If a tool failed because of setup state, capture the FIX (install command, config step, env var to set) under an existing setup or troubleshooting skill â€” never 'this tool does not work' as a standalone constraint.

u  Review the conversation above and update the skill library. Be ACTIVE â€” most sessions produce at least one skill update, even if small. A pass that does nothing is a missed learning opportunity, not a neutral outcome.

Target shape of the library: CLASS-LEVEL skills, each with a SKILL.md of always-on rules and a small `references/` set of topical depth. Not a flat list of narrow one-session skills, and not an umbrella hoarding a references/ file per session. This shapes HOW you update, not WHETHER you update.

u§  Signals to look for (any one of these warrants action):
  â€¢ User corrected your style, tone, format, legibility, or verbosity. Frustration signals like 'stop doing X', 'this is too verbose', 'don't format like this', 'why are you explaining', 'just give me the answer', 'you always do Y and I hate it', or an explicit 'remember this' are FIRST-CLASS skill signals, not just memory signals. Update the relevant skill(s) to embed the preference so the next session starts already knowing.
  â€¢ User corrected your workflow, approach, or sequence of steps. Encode the correction as a pitfall or explicit step in the skill that governs that class of task.
  â€¢ Non-trivial technique, fix, workaround, debugging path, or tool-usage pattern emerged that a future session would benefit from. Capture it.
  â€¢ A skill that got loaded or consulted this session turned out to be wrong, missing a step, or outdated. Patch it NOW.

Preference order â€” prefer the earliest action that fits, but do pick one when a signal above fired:
  1. UPDATE A CURRENTLY-LOADED SKILL. Look back through the conversation for skills the user loaded via /skill-name or you read via skill_view. If any of them covers the territory of the new learning, PATCH that one first (re-load it with skill_view during this review â€” see Read-before-write below). It is the skill that was in play, so it's the right one to extend â€” whoever wrote it: hand-written, installed, bundled, and pinned skills are all yours to improve.
  2. UPDATE AN EXISTING UMBRELLA (via skills_list + skill_view). If no loaded skill fits but an existing class-level skill does, patch it. Add a subsection, a pitfall, or broaden a trigger.
  3. ADD A SUPPORT FILE under an existing umbrella. Skills can be packaged with three kinds of support files â€” use the right directory per kind:
     â€¢ `references/<topic>.md` â€” topical depth needed only sometimes: a decision table, a reproduction recipe, provider quirks, condensed domain notes or API excerpts. Name it by TOPIC and extend an existing file when one covers the topic; do not create a per-session or per-incident file, and do not paste error transcripts â€” distill them to the rule.
     â€¢ `templates/<name>.<ext>` â€” starter files meant to be copied and modified (boilerplate configs, scaffolding, a known-good example the agent can `reproduce with modifications`).
     â€¢ `scripts/<name>.<ext>` â€” statically re-runnable actions the skill can invoke directly (verification scripts, fixture generators, deterministic probes, anything the agent should run rather than hand-type each time).
     Add support files via skill_manage action=write_file with file_path starting 'references/', 'templates/', or 'scripts/'. The umbrella's SKILL.md should gain a one-line pointer to any new support file so future agents know it exists.
  4. CREATE A NEW CLASS-LEVEL UMBRELLA SKILL when no existing skill covers the class. The name MUST be at the class level. The name MUST NOT be a specific PR number, error string, feature codename, library-alone name, or 'fix-X / debug-Y / audit-Z-today' session artifact. If the proposed name only makes sense for today's task, it's wrong â€” fall back to (1), (2), or (3).

Read-before-write (ENFORCED â€” skill_manage refuses otherwise): before you patch or edit an existing skill's SKILL.md, call skill_view(name) for that skill during this review. Before you overwrite or remove an EXISTING supporting file, call skill_view(name, file_path=...) for that exact file. Content quoted earlier in the conversation transcript does NOT count â€” the guard requires a fresh load within this review, and your write must be based on what skill_view just returned. Creating a brand-new skill or adding a NEW supporting file needs no prior read. If a write is refused with a read-before-write error, call skill_view for the named target once and retry the write once; do not loop.

User-preference embedding (important): when the user expressed a style/format/workflow preference, the update belongs in the SKILL.md body, not just in memory. Memory captures 'who the user is and what the current situation and state of your operations are'; skills capture 'how to do this class of task for this user'. When they complain about how you handled a task, the skill that governs that task needs to carry the lesson.

If you notice two existing skills that overlap, note it in your reply â€” the background curator handles consolidation at scale. Never delete a skill here.

Do NOT capturezÇ'Nothing to save.' is a real option but should NOT be the default. If the session ran smoothly with no corrections and produced no new technique, just say 'Nothing to save.' and stop. Otherwise, act.zBReview the conversation above and update two things:

**Memory**: u¥  **Skills**: how to do this class of task. Be ACTIVE â€” most sessions produce at least one skill update. A pass that does nothing is a missed learning opportunity, not a neutral outcome.

Target shape of the skill library: CLASS-LEVEL skills with a SKILL.md of always-on rules and a small `references/` set of topical depth â€” not narrow one-session skills, and not an umbrella hoarding a references/ file per session.

uã  Signals that warrant a skill update (any one is enough):
  â€¢ User corrected your style, tone, format, legibility, verbosity, or approach. Frustration is a FIRST-CLASS skill signal, not just a memory signal. 'stop doing X', 'don't format like this', 'I hate when you Y' â€” embed the lesson in the skill that governs that task so the next session starts fixed.
  â€¢ Non-trivial technique, fix, workaround, or debugging path emerged.
  â€¢ A skill that was loaded or consulted turned out wrong, missing, or outdated â€” patch it now.

Preference order for skills â€” pick the earliest that fits:
  1. UPDATE A CURRENTLY-LOADED SKILL. Check what skills were loaded via /skill-name or skill_view in the conversation. If one of them covers the learning, PATCH it first (re-load it with skill_view during this review â€” see Read-before-write below). It was in play; it's the right place, whoever wrote it.
  2. UPDATE AN EXISTING UMBRELLA (skills_list + skill_view to find the right one). Patch it.
  3. ADD A SUPPORT FILE under an existing umbrella via skill_manage action=write_file. Three kinds: `references/<topic>.md` for topical depth (decision tables, recipes, quirks, condensed domain notes) â€” extend an existing topical file before creating one, never a per-session file; `templates/<name>.<ext>` for starter files meant to be copied and modified; `scripts/<name>.<ext>` for statically re-runnable actions (verification, fixture generators, probes). Add a one-line pointer in SKILL.md so future agents find them.
  4. CREATE A NEW CLASS-LEVEL UMBRELLA when nothing exists. Name at the class level â€” NOT a PR number, error string, codename, library-alone name, or 'fix-X / debug-Y' session artifact. If the name only fits today's task, fall back to (1), (2), or (3).

Read-before-write (ENFORCED â€” skill_manage refuses otherwise): before patching or editing an existing skill's SKILL.md, call skill_view(name) during this review; before overwriting or removing an EXISTING supporting file, call skill_view(name, file_path=...) for that exact file. Content quoted earlier in the transcript does NOT count â€” base the write on what skill_view just returned. New skills and NEW supporting files need no prior read. On a read-before-write refusal: view the named target once, retry the write once, do not loop.

User-preference embedding: when the user complains about how you handled a task, update the skill that governs that task rather than memory. Memory says 'who the user is and what the current situation and state of your operations are'; skills say 'how to do this class of task for this user'. A user-preference lesson lives in exactly ONE place: the skill that governs the task when one exists, USER.md only for cross-cutting preferences no skill owns â€” never both. Duplicating it is how a memory file ends up restating SKILL.md until both hit their size limits.

If you notice overlapping existing skills, mention it â€” the background curator handles consolidation. Never delete a skill here.

Do NOT capture as skillsu¸   Act on whichever of the two dimensions has real signal. If genuinely nothing stands out on either, say 'Nothing to save.' and stop â€” but don't reach for that conclusion as a default.c               ó$   € V ^8„  d   QhRRRRRR/# )r   rì   rD   Úlimitr‹   r   r   )r   s   "r   r   r   <  s!   € ÷ ?ñ ?�3ð ?˜sð ? sñ ?r   c                óJ   € V R V \        V 4      V8”  d	   R,           # R,           # )Nu   â€¦r»   )r  )rì   r  s   &&r   Ú_previewr  <  s&   € Ø��ˆ<¤C¨£I°Ô$5˜5Õ>Ð>¸2Õ>Ð>r   Úaddr  ÚpatchÚremovezdict[str, tuple[str, str, int]]Ú_MEMORY_OP_FORMATSc               ó(   € V ^8„  d   QhRRRRRRRR/# )r   ÚlabelrD   ÚactionÚfieldszdict[str, str]r   úOptional[str]r   )r   s   "r   r   r   G  s.   € ÷ yñ y˜3ð y¨ð y°^ð yÈñ yr   c           	     óÒ   € \         P                  V4      ;'       g    Rw  r4pV'       d   VP                  V4      ;'       g    RMRpV'       d   \        RW\        We4      R7      # R# )zMVerbose line for one memory add/replace/remove, or None when no preview text.Nr»   zdisplay.review.memory_op_line)r  ÚglyphÚpreview)Nr»   r]   )r  r}   r   r  )r  r  r  r  Ú
field_namer  rì   s   &&&    r   Ú_memory_op_liner  G  sY   € ä1×5Ñ5°fÓ=×NÐNÀÑ€E�uß+0ˆ6�:‰:�jÓ!×'Ð' Rø°b€DßjnŒ1Ð,°EÔPXÐY]ÓPeÔfÐxÐtxÐxr   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   Údatar~   ÚdetailrV   rD   r   r   )r   s   "r   r   r   N  s.   € ÷ Fñ F˜dð F¨Dð F¸3ð FÀ3ñ Fr   c                ó¢  € VP                  R R4      pVP                  RR4      pV P                  R4      p\        V\        4      '       d   TM/ pVP                  RR4      ;'       g    VP                  RR4      pVP                  RR4      ;'       g    VP                  RR4      pVR8X  d+   V'       g	   V'       d   R	 Wx3 4       w  rš\        R
WIV
R7      # RRRR/P                  V4      pV'       d:   VP                  R4      '       d#   \        RV\        RV 24      VR,          R7      # V'       d   \        RVR7      # \        RVR7      # )r  r»   ri   Ú_changeÚoldÚ
old_stringÚnewÚ
new_stringr  c              3  óZ   "  € T F!  p\        V^P4      P                  RR4      x € K#  	  R# 5i)éP   rú   rê   N)r  r  )r½   rì   s   & r   r¿   Ú&_verbose_skill_line.<locals>.<genexpr>W  s)   é € Ð#oÑVnÈd¤H¨T°2Ó$6×$>Ñ$>¸tÀS×$IÐ$IÓVnùs   ‚)+z$display.review.skill_patched_verbose)ri   r$  r&  ÚcreateÚcreatedÚeditÚ	rewrittenÚdescriptionz$display.review.skill_changed_verboseúdisplay.review.skill_verb.)ri   Úverbr/  z$display.review.skill_message_verbose)rV   zdisplay.review.skill_action)r  )r}   r|   r~   r   )r   r!  rV   r  Ú
skill_nameÚ
change_rawÚchanger%  r'  Úold_previewÚnew_previewÚverb_keys   &&&         r   Ú_verbose_skill_liner8  N  s9  € Ø�Z‰Z˜ "Ó%€FØ—‘˜F BÓ'€Jà—‘˜)Ó$€JÜ!+¨J¼×!=Ò!=‘:À2€FØ—‘˜E 2Ó&×FÐF¨&¯*©*°\À2Ó*F€JØ—‘˜E 2Ó&×FÐF¨&¯*©*°\À2Ó*F€JØ�ÔŸj¯JÙ#oÐWaÑVnÓ#oÑ ˆÜÐ7¸jÐ_jÔkÐkØ˜) V¨[Ð9×=Ñ=¸fÓE€Hß�F—J‘J˜}×-Ò-ÜÐ7¸jÌqÐSmÐnvÐmwÐQxÓOyØ# MÕ2ô4ð 	4çIPŒ1Ð3¸WÔEð  FÔVWÐXuð  Eô  WFð  Fr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r  rD   r!  r~   r   ú	list[str]r   )r   s   "r   r   r   `  s&   € ÷ xñ x ð x¨dð x°yñ xr   c           
     ó”  € VP                  R 4      p\        V\        4      '       dg   V'       d_   V Uu. uF7  p\        V\        4      '       g   K  \	        WP                  RR4      V4      NK9  	  ppV Uu. uF  qU'       g   K  VNK  	  up# \	        WP                  RR4      V4      ;'       g    \        RV R7      .# u upi u upi )Ú
operationsr  r»   údisplay.review.label_updated©r  )r}   r|   rÈ   r~   r  r   )r  r!  Úops_rawÚopr  Úlines   &&    r   Ú_verbose_memory_linesrB  `  s¢   € à�j‰j˜Ó&€GÜ�'œ4× Ò §WÙLSÓlÉGÀbÔWaÐbdÔfj×WkÔA” ¯©¨x¸Ó(<¸bÖAÉGˆÐlÙ!&Ó/¡˜«$—�¡Ñ/Ð/Ü˜E§:¡:¨h¸Ó#;¸VÓD×vÐvÌÐJhÐpuÔHvÐwÐwùò mùÚ/s   ´C Á C Á7	CÂCc               ó    € V ^8„  d   QhRRRR/# )r   Úreview_messagesrõ   r   ztuple[set, dict]r   )r   s   "r   r   r   p  s   € ÷ +ñ +°*ð +ÐAQñ +r   c                ó(  € RR0p\        4       p/ pT ;'       g    .  EFF  p\        V\        4      '       d   VP                  R4      R8w  d   K2  VP                  R. 4      ;'       g    .  Fô  p\        V\        4      '       g   K  VP                  R/ 4      ;'       g    / pVP                  RR4      pVP                  R	4      pV'       d   VP	                  V4       Wq9  g	   V'       g   Kƒ   \
        P                  ! VP                  R
R4      4      p	RTRV	P                  R4      ;'       g    . /\         U
Uu/ uF  w  r«W©P                  W«4      bK  	  upp
CW8&   Kö  	  EKI  	  W#3#   \
        P                  \        3 d    / p	 Lui ; iu upp
i )a  Map review-agent tool_call ids -> parsed call arguments for notify tools. Result JSON only
says "Entry added"; the call arguments carry action, target and content previews. Restricting
to notify tools keeps helper tools from surfacing as memory work just because they succeeded.ÚmemoryÚskill_managerø   rü   rý   rþ   ri   r»   ÚidÚ	argumentsú{}rù   r<  )
r4   r|   r~   r}   r  ÚjsonÚloadsÚJSONDecodeErrorrO   Ú_CALL_DETAIL_DEFAULTS)rD  Únotify_toolsÚall_tool_call_idsÚcall_detailsÚmsgr	  ÚfnÚfn_nameÚtcidr·   Úkr£   s   &           r   Ú_collect_review_call_detailsrW  p  sl  € ð ˜nÐ-€LÜ ›UÐØ€LØ×$Ð$ "Ó$ˆÜ˜#œt×$Ò$¨¯©°«¸;Ô(FÙØ—'‘'˜,¨Ó+×1Ð1¨rÒ1ˆBÜ˜b¤$×'Ò'ÙØ—‘˜
 BÓ'×-Ð-¨2ˆBØ—f‘f˜V RÓ(ˆGØ—6‘6˜$“<ˆDßØ!×%Ñ% dÔ+ØÔ*·$ÙðÜ—z’z "§&¡&¨°dÓ";Ó<�ð ˜ ¨t¯x©x¸Ó/E×/KÐ/KÈð"å=RÔSÑ=R©z¨q�1—h‘h˜qÓ*Ò*Ñ=RÒSð"ˆLÓô 2ñ %ð* Ð*Ð*øô ×(Ñ(¬)Ð4ô Ø’ðüó Ts   Ã/&E+Ä<FÅ+FÆ
Fc               ó    € V ^8„  d   QhRRRR/# )r   Úmessagesrõ   r   zIterator[dict]r   )r   s   "r   r   r   �  s   € ÷ Zñ Z˜Zð Z¨Nñ Zr   c                ó(   € R  T ;'       g    .  4       # )c              3  ó†   "  € T F7  p\        V\        4      '       g   K  VP                  R 4      R8X  g   K3  Vx € K9  	  R# 5i)rø   rù   Nrí   )r½   rç   s   & r   r¿   Ú!_tool_messages.<locals>.<genexpr>�  s-   é € ÐY‘~�!¬°A´t×)<ŒAÀÇÁÀvÃÐRXÑAX�AŠA“~ùs   ‚AŸA·
Ar   )rY  s   &r   Ú_tool_messagesr]  �  s   € ÙY�x—~�~ 2�~ÓYÐYr   c               ó    € V ^8„  d   QhRRRR/# )r   Úprior_snapshotrõ   r   útuple[set, set]r   )r   s   "r   r   r   “  s   € ÷ ñ  Zð °Oñ r   c                óR  € \        \        V 4      4      pV Uu0 uF$  q"P                  R4      '       g   K  VR,          kK&  	  ppV Uu0 uFK  q"P                  R4      '       d   K  \        VP                  R4      \        4      '       g   KB  VR,          kKM  	  ppW43# u upi u upi )zN``(tool_call_ids, contents)`` of tool messages already in the parent snapshot.Útool_call_idré   )rÈ   r]  r}   r|   rD   )r_  Úpriorsrç   ÚidsÚcontentss   &    r   Ú_prior_tool_keysrf  “  sˆ   € ä”. Ó0Ó1€FÙ&,Ó
F¡f ·±°n×0EÔˆ1ˆ^×Ð¡f€CÐ
FÙ&,Óp¡f ·E±E¸.×4I”ÌjÐYZ×Y^ÑY^Ð_hÓYiÔkn×No”��)—�¡f€HÐpØˆ=Ðùò GùÚps   ™B¶BÁ	B$Á&"B$ÂB$c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r   r~   r!  Úverboser-   r   r:  r   )r   s   "r   r   r   ›  s.   € ÷ &Kñ &K˜ð &K dð &K°Tð &K¸iñ &Kr   c                óF  a€ V P                  R4      '       d;   V P                  R4      '       d"   V P                  R4      '       d   V R,          .# . # V P                  RR4      pV P                  RR4      ;'       g    VP                  RR4      pVP                  R4      R8H  pV'       Ed+   RV 9   Ed#   R	R
RRRRRRRRRR/pV P                  R4      pV P                  R4      '       d   \        V\        4      '       g   . # . pV FÊ  p	\        V	\        4      '       d   V	P                  R4      RJd   K0  VP                  V	P                  R4      4      p
V
'       g   KZ  V	P                  R4      '       g   Ks  V	P                  R4      '       d   RV	R,           R2MRpVP	                  \        RV	R,          \        RV
 24      VR7      4       KÌ  	  V# VP                  4       oV'       gZ   R
S9   gP   R S9   gI   V'       dD   \        ;QJ d    V3R! lR+ 4       F  '       g   K   RM	  R"M! V3R! lR+ 4       4      '       d   V.# V'       g   V'       g   . # V'       d   R#MR$R$R%R%/P                  V4      pV'       d   \        R&V 24      MTpV'       d!   V'       d   \        WV4      .# \        WÑ4      # \        ;QJ d    V3R' lR, 4       F  '       g   K   RM	  R"M! V3R' lR, 4       4      ;'       g    T;'       d    R(S9   pV'       d   \        R)VR*7      .# . # )-zVSummary line(s) for one successful notify-tool result (``[]`` when nothing to report).ÚstagedÚproposal_stagedrV   r»   rg   rù   rG  Úresultsr+  r,  r  Úpatchedr-  r.  Ú
write_fileÚwrittenÚremove_fileÚremovedÚdeleteÚdeletedÚoperations_appliedÚsuccessTr  ri   Ú	file_pathz (Ú)zdisplay.review.skill_resultr0  )ri   r1  ÚpathÚupdatedc              3  ó,   <"  € T F	  qS9   x € K  	  R # 5i©Nr   )r½   ÚwordÚlowers   & €r   r¿   Ú _action_lines.<locals>.<genexpr>¸  s   øé € Ð)fÑDe¸D°%®-ÓDeùó   ƒFÚskillrF  rû   zdisplay.review.label.c              3  ó,   <"  € T F	  qS9   x € K  	  R # 5ir{  r   )r½   rV  r}  s   & €r   r¿   r~  À  s   øé € ÐNÑ"M˜Q�5ŽjÓ"Mùr  r  r=  r>  )rm  rs  ro  )ÚaddedÚreplacedrq  Úapplied)
r}   r|   rÈ   r~   r  r   r}  Úanyr8  rB  )r   r!  rh  rV   rg   Úis_skillÚverbsrl  r  Úresultr7  rx  Ú	label_keyr  Úhitr}  s   &&&            @r   Ú_action_linesr‹  ›  sš  ø€ à‡x�x�×Òð %)§H¡HÐ->×$?Ò$?ÀDÇHÁHÈY×DWÒDW��Y•Ð Ð_Ð]_Ð_Ø�h‰h�y "Ó%€GØ�X‰X�h Ó#×?Ð? v§z¡z°(¸BÓ'?€FØ�z‰z˜&Ó! ^Ñ3€Hß€x�I Õ%ð ˜9 g¨y¸&À+Ø˜y¨-¸ÀHÈiðYˆà—(‘(˜9Ó%ˆØ�x‰xÐ,×-Ò-´ZÀÌ×5NÒ5NØˆIØˆÛˆFÜ˜f¤d×+Ò+¨v¯z©z¸)Ó/DÈDÓ/PÙØ—y‘y §¡¨HÓ!5Ó6ˆHß‰x˜FŸJ™J v×.Ô.Ø6<·j±jÀ×6MÒ6M˜˜F ;Õ/Ð0°Ñ2ÐSU�Ø—‘œQÐ<À6È&Å>Ü$%Ð(BÀ8À*Ð&MÓ$NÐUYô[ö \ñ ð ˆØ�M‰M‹O€Eß˜	 UÔ*¨i¸5Ô.@ß!§c£cÔ)fÑDeÓ)f§c§c¢cÔ)fÑDeÓ)f×&fÒ&fØˆyÐßŸFØˆ	ß#‘¨(°H¸fÀfÐ)M×)QÑ)QÐRXÓ)Y€Iß6?ŒAÐ% i [Ð1Ô2ÀV€Eßß?GÔ# D°'Ó:Ð;ÐqÔMbÐchÓMqÐqß
‹#ÔNÑ"MÓN�#�#Š#ÔNÑ"MÓNÓ
N×
mÐ
mÐSY×SlÐSlÐ^cÐglÑ^l€Cß?BŒAÐ,°EÔ:Ð;ÐJÈÐJr   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   rD  rõ   r_  Únotification_moderD   r   r:  r   )r   s   "r   r   r   Ä  s,   € ÷ "ñ "Øð"Ø1;ð"ØPSð"àñ"r   c           	     óè  € \        T;'       g    R4      P                  4       pVR8X  d   . # VR8H  p\        V4      w  rV\        V 4      w  rx. p	\	        V 4       Fò  p
V
P                  R4      pV'       d   Wµ9   g   V'       d	   W¸9  d   K2  M5\        V
P                  R4      \         4      '       d   V
R,          V9   d   Kh   \        P                  ! V
P                  RR4      4      p\        T\        4      '       d   TP                  R4      '       g   K¾  T	P                  \        YÈP                  T4      ;'       g    / T4      4       Kô  	  V	#   \        P                  \        3 d     EK  i ; i)a®  Human-facing action summary for a background review pass: successful memory /
skill-management tool results from the review agent's messages, skipping tool messages already
present in ``prior_snapshot`` so inherited results are not re-surfaced as fresh work.
``notification_mode``: ``off`` -> no actions; ``on`` -> generic "Memory updated"/tool messages;
``verbose`` -> content previews from the tool-call arguments.

See #14944.
ÚonÚoffrh  rb  ré   rJ  ru  )rD   r}  rf  rW  r]  r}   r|   rK  rL  rM  rO   r~   Úextendr‹  )rD  r_  r�  Úmoderh  Úexisting_tool_call_idsÚexisting_tool_contentsrP  rQ  ÚactionsrR  rU  r   s   &&&          r   Ú#summarize_background_review_actionsr–  Ä  s8  € ô Ð ×(Ð( DÓ)×/Ñ/Ó1€DØˆu„}Øˆ	Ø�iÑ€GÜ5EÀnÓ5UÑ2ÐÜ&BÀ?Ó&SÑ#ÐØ€GÜ˜oÖ.ˆØ�w‰w�~Ó&ˆßØÔ-×2CÈÔH`ÙøÜ˜Ÿ™ 	Ó*¬C×0Ò0°S¸µ^ÐG]Ô5]Ùð	Ü—:’:˜cŸg™g i°Ó6Ó7ˆDô
 ˜$¤×%Ò%¨T¯X©X°i×-@Ò-@ÙØ�‰”} T×+;Ñ+;¸DÓ+A×+GÐ+GÀRÈÓQÖRñ /ð  €Nøô ×$Ñ$¤iÐ0ô 	Ûð	ús   Ã&EÅE1Å0E1Úwrite_originÚexecution_contextÚtask_idrb  c               ó0   € V ^8„  d   QhRRRRRRRRRRRR	/# )
r   rB   r   r—  r  r˜  r™  rb  r   rx   r   )r   s   "r   r   r   é  sF   € ÷ Fñ FØðFØ!.ðFØJWðFàðFà1>ðFð ñFr   c               ó¼  € RT;'       g    \        V RR4      RT;'       g    \        V RR4      RV P                  ;'       g    RR	V P                  ;'       g    RR
V P                  ;'       g!    \        P
                  P                  RR4      RRRT;'       g    RRT;'       g    R/pVP                  4        UUu/ uF  w  rgVR9  g   K  WgbK  	  upp# u uppi )z?Build provenance metadata for external memory-provider mirrors.r—  Ú_memory_write_originÚassistant_toolr˜  Ú_memory_write_contextÚ
foregroundÚ
session_idr»   Úparent_session_idÚplatformÚHERMES_SESSION_SOURCEÚcliÚ	tool_namerF  r™  Nrb  >   Nr»   )rF   r   Ú_parent_session_idr¢  ÚosÚenvironr}   Úitems)rB   r—  r˜  r™  rb  ÚmetadatarV  Úvs   &$$$$   r   Úbuild_memory_write_metadatar¬  é  sÐ   € ð 	˜×`Ð`¬°Ð7MÐO_Ó(`ØÐ.×gÐg´'¸%ÐAXÐZfÓ2gØ�e×&Ñ&×,Ð,¨"Ø˜U×5Ñ5×;Ð;¸Ø�E—N‘N×TÐT¤b§j¡j§n¡nÐ5LÈeÓ&TØ�XØ�7—?�?˜dØ˜×,Ð,¨ð	 €Hð &Ÿ^™^Ô-ÔEÑ-‘T�Q°¸*Ñ1DŒDˆAŠDÑ-ÒEÐEùÓEs   Â>CÃCc               ó    € V ^8„  d   QhRRRR/# )r   r,   r   r   rx   r   )r   s   "r   r   r      s   € ÷ ñ ¨ð °ñ r   c                óÞ   € / R Uu/ uF  q\        WR4      bK  	  upC\         Uu/ uF&  q\        \        V RV 2^ 4      ;'       g    ^ 4      bK(  	  upCR\        V RR4      /C# u upi u upi )zASnapshot in-memory usage counters from a review fork (pre-close).NÚsession_Úestimated_cost_usdÚsession_estimated_cost_usd)r¬   r«   r®   )rF   Ú_USAGE_COUNTERSr‹   )r,   r¾   s   & r   Ú_snapshot_review_usager³     s…   € ðÙ<]Ó
^Ñ<]°S”˜¨4Ó0Ò0Ñ<]Ñ
^ðåP_Ó
`ÑP_È””G˜L¨H°S°EÐ*:¸AÓ>×CÐCÀ!ÓDÒDÑP_Ñ
`ðð 	œg lÐ4PÐRVÓWñð ùÚ
^ùÚ
`s
   †A%¦,A*c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úparent_agentr   Úusagerx   r   r   r   )r   s   "r   r   r   	  s'   € ÷ Tñ T°ð T¸^ð TÐPTñ Tr   c                ó@  €  \        V RR4      p\        V RR4      p\         Uu/ uF'  qD\        VP                  V4      ;'       g    ^ 4      bK)  	  ppVe(   V'       d    \	        VP                  4       4      '       g   R# VP                  ! V3RRRVP                  R4      RVP                  R4      R	VP                  R
4      RVP                  R4      RVP                  R4      /VB  R# u upi   \         d"   p\        P                  RT4        Rp?R# Rp?ii ; i)u<  Record a fork's usage against the parent session (best-effort, never raises). The fork has
``_session_db = None`` so conversation_loop's DB-gated accounting never sees its calls; route
them through the aux-accounting chokepoint, which writes only ``session_model_usage`` â€” never
the transcript or ``sessions`` row.Ú_session_dbNr   r€   r{   r¬   Úbilling_providerr«   Úbilling_base_urlr®   r°  Úapi_call_countÚ	api_callsz8Background review usage recording failed (non-fatal): %s)rF   r²  r‹   r}   r…  ÚvaluesÚrecord_auxiliary_usageÚpoprb   rc   rd   )rµ  r¶  Ú
session_dbr   r¾   ÚcountsrÓ   s   &&     r   Ú_record_review_usage_to_parentrÂ  	  s  € ð
TÜ˜\¨=¸$Ó?ˆ
Ü˜\¨<¸Ó>ˆ
Ý;JÓK¹?°C”s˜5Ÿ9™9 S›>×.Ð.¨QÓ/Ò/¹?ˆÐKØÒ§Z´s¸6¿=¹=»?×7KÒ7KÙØ×)Ò)Øñ	
Ø0ð	
Ø8=¿	¹	À'Ó8Jð	
à"ŸY™Y zÓ2ð	
àEJÇYÁYÈzÓEZð	
ð  %Ÿy™yÐ)=Ó>ð	
ð "Ÿ:™: kÓ2ð		
ð 7=ô		
ùò Løô ô TÜ�‰ÐOÐQR×SÒSûðTús;   ‚"C1 ¤!C,ÁC,ÁC1 ÁC1 Â A*C1 Ã,C1 Ã1DÃ<DÄDc               ó    € V ^8„  d   QhRRRR/# )r   r•  r:  r   rD   r   )r   s   "r   r   r     s   € ÷ kñ k Yð k°3ñ kr   c                ó   aa€ T ;'       g    .  Uu. uFG  p\        V4      P                  4       P                  R4      P                  4       P                  4       NKI  	  ppR\	        R4      P                  4       3oRR\	        R4      P                  4       \	        R4      P                  4       3o\
        ;QJ d    V3R lV 4       F  '       g   K   R	M	  R
M! V3R lV 4       4      p\
        ;QJ d    V3R lV 4       F  '       g   K   R	M	  R
M! V3R lV 4       4      pRP                  R RV3RV33 4       4      ;'       g    R# u upi )u9  Map a review action summary to ``none`` / ``skill`` / ``memory`` / ``skill+memory``.
Prefix-based on the formats :func:`summarize_background_review_actions` emits (``Skill â€¦``,
``ðŸ“� Skill â€¦``, ``Memory â€¦``, ``User profile â€¦``), so a free-text line like ``Skipped: no
skill worth saving`` stays ``none``.u   ðŸ“�r€  zdisplay.review.label.skillrF  zuser profilezdisplay.review.label.memoryzdisplay.review.label.userc              3  óD   <"  € T F  qP                  S4      x € K  	  R # 5ir{  ©Ú
startswith)r½   rA  Úskill_prefixess   & €r   r¿   Ú*_classify_review_result.<locals>.<genexpr>(  s   øé € ÐGÁ¸—O‘O N×3Ð3Ãùó   ƒ TFc              3  óD   <"  € T F  qP                  S4      x € K  	  R # 5ir{  rÆ  )r½   rA  Úmemory_prefixess   & €r   r¿   rÉ  )  s   øé € ÐIÁ&¸$—_‘_ _×5Ð5Ã&ùrÊ  Ú+c              3  ó>   "  € T F  w  rV'       g   K  Vx € K  	  R # 5ir{  r   )r½   ÚkindrŠ  s   &  r   r¿   rÉ  *  s   é € Ð`Ñ*X™Y˜TÔ\_—D’DÓ*Xùs   ‚“
Únone)rD   ÚlstripÚremoveprefixr}  r   r…  rð   )r•  r  ÚlowersÚ	has_skillÚ
has_memoryrÌ  rÈ  s   &    @@r   Ú_classify_review_resultrÖ    s  ù€ ð
 X_×WdÐWdÐbdÐWdÓeÑWdÈVŒc�&‹k× Ñ Ó"×/Ñ/°Ó7×>Ñ>Ó@×FÑFÖHÑWd€FÐeàœqÐ!=Ó>×DÑDÓFÐG€NØ ´Ð3PÓ1Q×1WÑ1WÓ1YÜÐ4Ó5×;Ñ;Ó=ð?€Oç“ÔGÁÓG——’ÔGÁÓGÓG€Iß“ÔIÁ&ÓI——’ÔIÁ&ÓIÓI€JØ�8‰8Ñ`¨G°YÐ+?À(ÈJÐAWÑ*XÓ`Ó`×jÐjÐdjÐjùò fs   ‘AEc               ó$   € V ^8„  d   QhRRRRRR/# )r   r¶  rx   rˆ  rD   r   r   r   )r   s   "r   r   r   -  s!   € ÷ ñ  .ð ¸#ð À$ñ r   c                óP   a € \         P                  ! R.V 3R lR 4       OVN5!   R# )zHEmit a per-fork completion line so cost is visible where it is incurred.zZBackground review complete: thread=bg-review calls=%d in=%d out=%d cache_read=%d result=%sc              3  ól   <"  € T F)  p\        SP                  V4      ;'       g    ^ 4      x € K+  	  R# 5i)r]   N)r‹   r}   )r½   rV  r¶  s   & €r   r¿   Ú)_log_review_completion.<locals>.<genexpr>2  s+   øé € Ð	nÑ*m QŒ#ˆe�i‰i˜‹l×Ð˜a×
 Ð
 Ó*mùs   ƒ!4¥4N)r¼  Úinput_tokensÚoutput_tokensÚcache_read_tokens)rc   Úinfo)r¶  rˆ  s   f&r   Ú_log_review_completionrß  -  s/   ø€ ä
‡K‚Kð	"ðô 
oÑ*mÓ	nðð 	ö	r   c               ó    € V ^8„  d   QhRRRR/# )r   rB   r   r   rx   r   )r   s   "r   r   r   @  s   € ÷ ñ  Sð ¨^ñ r   c           	     ó  € R\        V RR4      R\        V RR4      /\         Uu/ uF  p\        WR4      ;p'       g   K  WbK  	  upCp\        P                  ! \        V RR4      ;'       g    . 4      ;p'       d   WCR&   V# u upi )af  AIAgent kwargs that keep a SAME-model fork's request bytes identical to the parent's. Only
for the un-routed path: on a different model the cache is cold anyway, and the parent's
reasoning-effort vocabulary may be invalid for the routed provider (OpenRouter forwards
``reasoning.effort`` unclamped; codex_responses passes ``max``/``ultra`` through unmapped).Úreasoning_configNÚephemeral_system_promptÚprefill_messages)rF   Ú_PROVIDER_PIN_ATTRSÚcopyÚdeepcopy)rB   rC   ÚvalÚkwargsÚparent_prefills   &    r   Ú_same_model_parity_kwargsrë  @  s—   € ð 	œG EÐ+=¸tÓDØ!¤7¨5Ð2KÈTÓ#Rð	õ
 "5Ó
\Ñ!4˜ÄÈÐUYÓ@ZÐ9Z¸Ó9ZŒ9ˆ4Š9Ñ!4Ñ
\ð€Fô Ÿš¤w¨uÐ6HÈ$Ó'O×'UÐ'UÐSUÓVÐV€~ÖVØ%3Ð!Ñ"Ø€Mùò ]s
   ¤B¿Bc               ó$   € V ^8„  d   QhRRRRRR/# )r   rB   r   rƒ   r„   r   r   r   )r   s   "r   r   r   T  s#   € ÷ "ñ "¨#ð "Ð9Qð "Ð]añ "r   c                ó¼  € \        \        V4      P                  R4      ;'       g    R4      P                  4       pV'       d   \	        V RR4      '       d   R# RV n        \        RVR7      p\	        V R	R4      p\        V4      '       d)   \        \        4      ;_uu_ 4        V! V4       RRR4       \        P                  R
V4       R#   + '       g   i     L(; i)aõ  One-shot user-visible notice: ``auxiliary.background_review.reasoning_effort`` is IGNORED on
the same-model path (#104116). The fork inherits the parent's ``reasoning_config`` verbatim so
its request bytes keep the parent's prompt-cache prefix (#30532: a diverged ``thinking`` field
on the fork-birth request re-created a large share of the cache); the no-op used to be silent,
so a user who set the key saw no feedback at all. Gated on the parent so a nudge-per-turn
session warns once, not per fork.Úreasoning_effortr»   Ú"_warned_bg_review_reasoning_effortFNTz'display.review.reasoning_effort_warning)ÚeffortrÙ   z%s)rD   r‰   r}   r¼   rF   rï  r   rÛ   r   rb   rc   rs   )rB   rƒ   rð  rV   rÝ   s   &&   r   Ú_warn_ignored_reasoning_effortrñ  T  s¡   € ô Ô/°Ó9×=Ñ=Ð>PÓQ×WÐWÐUWÓX×^Ñ^Ó`€Fß”W˜UÐ$HÈ%×PÒPÙØ/3€EÔ,ÜÐ9À&ÔI€GÜ�5˜/¨4Ó0€DÜ�‡~‚~Ü”i× Õ Ù�ŒM÷ !ä
‡N�N�4˜Ö!÷ !× ús   Â"	CÃC	c               ó    € V ^8„  d   QhRRRR/# ©r   r,   r   r   r   r   )r   s   "r   r   r   g  s   € ÷ Kñ K¨3ð K°4ñ Kr   c                ó  € \        \        V RR4      RR4      pRp\        V4      '       d    V! RRR7       RpRV n        W n        V'       d
   RV n        R# R#   \         d    \        P	                  RRR	7        LDi ; i)
uQ  Detached in-memory compaction for a fork sharing the parent's session_id. Disabling
compression (the old guard against compacting the parent's live session) removed the only
bound on the review's snapshot. Persistence is already off, so compaction can only rewrite the
fork's transcript â€” but the compressor's own SessionDB/session_id binding must be severed too,
or cooldown/streak counters land on the parent's row. Force in-place mode and re-enable
compression ONLY after the rebind succeeded (fail-closed); gates stay deferred until the first
response so request #1 is a warm cache read.r�   NÚbind_session_stateFr»   )rÀ  r   Tz…background-review compressor detachment failed; keeping compression DISABLED on this review fork (fail-closed, issue #93057 / #38727)r_   )rF   rÛ   rb   rc   rs   Úcompression_in_placeÚcompression_enabledÚ._review_defer_compaction_before_first_response)r,   ÚbindÚdetacheds   &  r   Ú_detach_fork_compressionrû  g  s�   € ô ”7˜<Ð)=¸tÓDÐFZÐ\`Óa€DØ€HÜ�‡~‚~ð	ñ ˜D¨RÕ0ØˆHð )-€LÔ%Ø'/Ô$ßØFJˆÖCñ øô ô 	ô �N‰Nð7ð ð	 ö ð	ús   ­A Á"A>Á=A>c               ó    € V ^8„  d   QhRRRR/# )r   rƒ   r„   r   r   )r   s   "r   r   r   †  s   € ÷ ñ Ð'?ð ÐD\ñ r   c                óÈ   € \        V 4      P                  R4      pVe   VR8X  d   R# ^ RIHpHp V! V4      pVf'   \
        P                  RVRP                  V4      4       V# )a×  ``reasoning_config`` for a ROUTED fork from ``auxiliary.background_review.reasoning_effort``
(#94825). The routed branch never inherits the parent's effort (its vocabulary may be invalid for
the routed provider), but an explicit per-task pin is the user's choice for THAT model and must
win over provider defaults, as every other aux task already does via ``_get_task_extra_body``.
None = unset (provider default); an unknown level warns and falls through to the default.rî  Nr»   )ÚVALID_REASONING_EFFORTSÚparse_reasoning_effortuw   auxiliary.background_review.reasoning_effort %r is not a valid level (none, %s) â€” using the routed provider's defaultr   )r‰   r}   Úhermes_constantsrþ  rÿ  rc   rs   rð   )rƒ   rð  rþ  rÿ  Úparseds   &    r   Ú_routed_reasoning_configr  †  sa   € ô ,¨HÓ5×9Ñ9Ð:LÓM€FØ‚~˜ 2œÙßPÙ# FÓ+€FØ‚~Ü�‰ð,Ø-3°T·Y±YÐ?VÓ5Wô	
ð €Mr   c               ó0   € V ^8„  d   QhRRRRRRRRR	R
RR/# )r   rB   r   Úrtrx   r¹   r-   Úmax_iterationsr‹   rƒ   r„   r   r   )r   s   "r   r   r   ™  s9   € ÷ ñ ˜Sð  nð ¸dð ÐTWð Ø 8ðØDRñr   c                ó’  € RVP                  R4      ;'       g    V P                  RTRRRV P                  RVP                  R4      ;'       g    V P                  RVP                  R4      RVP                  R4      ;'       g    R	R
VP                  R
4      ;'       g    R	RVP                  R4      RVP                  R4      ;'       g    / RV P                  R\        V RR	4      R\        V RR	4      RR/p\        VP                  R4      \        4      '       d   VR,          VR&   \        VP                  R4      \        4      '       dC   VR,          '       d4   TP                  VR,          VP                  R4      ;'       g    . R7       V'       g   VP                  \        V 4      4       V# \        V4      ;pe   WeR&   V# )aˆ  AIAgent constructor kwargs for the review fork. skip_memory=True: an external memory plugin
scoped to the parent's session_id would leak the harness prompt into the user's real memory
namespace; built-in MEMORY.md/USER.md state is re-bound by the caller. Toolsets match the
parent so ``tools[]`` is byte-identical (Anthropic's cache key includes it); the runtime
whitelist restricts dispatch.r¬   r  Ú
quiet_modeTr¢  r«   rª   r®   Nr­   r±   r³   r¡  Úenabled_toolsetsÚdisabled_toolsetsÚskip_memoryr´   rµ   r·   )r¶   r¸   râ  )r}   r¬   r¢  r«   r   rF   r|   r‹   rD   Úupdaterë  r  )rB   r  r¹   r  rƒ   ré  Ú
routed_cfgs   &&&&&  r   Ú_fork_init_kwargsr  ™  s„  € ð 	�—‘˜“×/Ð/ E§K¡KÐ1AÀ>ÐS_ÐaeØ�E—N‘N J°·±°zÓ0B×0TÐ0TÀeÇnÁnØ�B—F‘F˜:Ó&¨
°B·F±F¸:Ó4F×4NÐ4NÈ$Ø�2—6‘6˜)Ó$×,Ð,¨Ð.?ÀÇÁÐHYÓAZØ˜RŸV™VÐ$7Ó8×>Ð>¸BÐ@SÐUZ×UeÑUeØœG EÐ+=¸tÓDØœW UÐ,?ÀÓFÈÐW[ð€Fô �"—&‘&˜Ó&¬×,Ò,Ø! ,Õ/ˆˆ|ÑÜ�"—&‘&˜Ó#¤S×)Ò)¨b°¯m¬mØ�‰ " Y¥-¸"¿&¹&À».×:NÐ:NÈBˆÔOßØ�‰Ô/°Ó6Ô7ð €Mô 1°Ó:Ð
:ˆ*Ò	GØ%/Ð!Ñ"Ø€Mr   iÿÿÿc               ó$   € V ^8„  d   QhRRRRRR/# )r   r,   r   rB   r   r   r   )r   s   "r   r   r   º  s&   € ÷ Nñ N¨sð N¸3ð NÀ4ñ Nr   c                óâ   € \         P                  ! \        VRR4      ;'       g    . 4      V n        V P                   Uu0 uF  q"R,          R,          kK  	  upV n        \
        V n        R# u upi )u	  Same-model fork: advertise the parent's exact tools[] (its last outbound payload â€” an
empty list included) so the request prefix matches byte-for-byte, then freeze the snapshot
generation. Dispatch stays behind the review whitelist; advertising is not permission.ÚtoolsNrþ   ri   )ræ  rç  rF   r  Úvalid_tool_namesÚ _FROZEN_TOOL_SNAPSHOT_GENERATIONÚ_tool_snapshot_generation)r,   rB   rù   s   && r   Ú_inherit_parent_tool_surfacer  º  s^   € ô
 Ÿš¤w¨u°g¸tÓ'D×'JÐ'JÈÓK€LÔØJV×J\ÒJ\Ó$]ÑJ\À$¨*Õ%5°f×%=Ð%=ÑJ\Ñ$]€LÔ!Ü-M€LÖ*ùò %^s   ¿A,r{   c          
     ó,   € V ^8„  d   QhRRRRRRRRR	R
/# )r   rB   r   rƒ   r„   r  r‹   r—  rD   r   z tuple[Any, dict[str, Any], bool]r   )r   s   "r   r   r   Å  s=   € ÷ P&ñ P&ØðP&Ø2ðP&ØNQðP&àðP&ð &ñP&r   c               óä  € ^ RI Hp \        W4      p\        VP	                  R4      4      pV'       g   VR8X  d   \        W4       V! R/ \        WWbV4      B pV;Vn        Vn        W7n	        V P                  Vn
        V P                  Vn        V P                  Vn        ^ ;Vn        Vn        R;Vn        ;Vn        Vn        RVn        RVn        V P(                  Vn        V'       gj   V P*                  Vn        V P,                  Vn        \/        V 4      pV'       d   W‡n        VR8X  d   RVn        V P5                  4       Vn        \9        Wp4       \;        V4       \=        W4      Vn        WuV3# )	u4  Construct a detached AIAgent fork with warm prompt-cache parity (shared with ``/btw``): same
runtime/credentials as the parent, byte-identical system prompt / tools[] / reasoning config on
the same-model path, shared session_id for prefix warmth, full persistence detachment (no
state.db writes, rotation, or external memory providers; in-place-only compaction). Returns
``(fork_agent, runtime_dict, routed)``; ``routed`` means a different model (cache cold â€”
replay a digest). The caller owns registration, whitelisting, running, usage attribution and
teardown.)ÚAIAgentr¹   r{   TFNÚreviewr   )Ú	run_agentr  rÔ   r-   r}   rñ  r  rœ  rž  Ú_turn_originÚ_memory_storeÚ_memory_enabledÚ_user_profile_enabledÚ_memory_nudge_intervalÚ_skill_nudge_intervalÚ_skip_mcp_refreshÚ_persist_disabledÚsuppress_status_outputÚ_end_session_on_closer¸  r   Ú_cached_system_promptÚsession_startr   Ú_inherited_cache_scopeÚ_prompt_cache_fork_tagÚ_conversation_root_idÚ_cached_conversation_rootr  rû  rœ   )	rB   rƒ   r  r—  r  Ú_rtÚ_routedr,   Úinherited_scopes	   &&$$     r   Úbuild_cache_parity_forkr-  Å  sf  € õ "ô " %Ó
2€CÜ�3—7‘7˜8Ó$Ó%€G÷ �|Ð':Ô:Ü& uÔ7ÙÑ^Ô.¨u¸7ÐT\Ó]Ñ^€LØMYÐY€LÔ%¨Ô(Jð !-ÔØ!&×!4Ñ!4€LÔØ#(×#8Ñ#8€LÔ Ø).×)DÑ)D€LÔ&ØOPÐP€LÔ'¨,Ô*Lð mqÐp€LÔ"Ðp \Ô%CÀlÔFiØ).€LÔ&Ø#€LÔØ#×.Ñ.€LÔ÷ Ø-2×-HÑ-HˆÔ*Ø%*×%8Ñ%8ˆÔ"ô :¸%Ó@ˆßØ2AÔ/ð Ð.Ô.Ø2:ˆLÔ/ð 27×1LÑ1LÓ1NˆÔ.Ü$ \Ô9Ü˜\Ô*ô /IÈÓ.`€LÔ+Ø˜gÐ%Ð%r   c                ó2   € \         P                  RW4       R# )z‡Non-interactive approval: dangerous-command guards resolve to "deny" instead of input(),
which would deadlock against the parent's TUI.z8Background review auto-denied dangerous command: %s (%s)Údeny)rc   rs   )rµ   r/  ré  s   &&,r   Ú_bg_review_auto_denyr0    s   € ô ‡N�NÐMÈwÔdÙr   c               ó    € V ^8„  d   QhRRRR/# )r   Úcallbackr   r   r   r   )r   s   "r   r   r   "  s   € ÷ (ñ (¨Cð (°Dñ (r   c                óŠ   € ^ RI Hp \        \        4      ;_uu_ 4        V! V 4       RRR4       R#   + '       g   i     R# ; i)r]   )Úset_approval_callbackN)Útools.terminal_toolr4  r   rb   )r2  r4  s   & r   Ú_set_thread_approval_callbackr6  "  s'   € Ý9ä	”)×	Õ	Ù˜hÔ'÷ 
×	×	Ò	ús	   ž	1±A	c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   rB   r   r,   Úregisterr-   r   r   r   )r   s   "r   r   r   )  s.   € ÷ @ñ @˜cð @°ð @À4ð @ÈDñ @r   c          	     óZ  € Vf   R# \        V R4      '       dD   \        V R4      ;_uu_ 4        V'       d   Wn        MV P                  VJ d   RV n        RRR4       \        V R4      '       d„   \        V R4      ;_uu_ 4        V'       d   V P                  P	                  V4       M@\        \        \        4      ;_uu_ 4        V P                  P                  V4       RRR4       RRR4       R# R#   + '       g   i     L§; i  + '       g   i     L/; i  + '       g   i     R# ; i)u`  Add (``register=True``) or remove the fork on the PARENT's tracking slots:
``_background_review_agent`` (direct pointer the next live turn interrupts) and
``_active_children`` (interrupt() fan-out). Removal is identity-scoped and idempotent; both
are best-effort for direct test stubs â€” the prepared run token is the live-turn cancellation
authority.Nro   rL   Ú_active_childrenÚ_active_children_lock)	ÚhasattrrH   ro   r:  r  r   rš   rN   r  )rB   r,   r8  s   &&$r   Ú_track_review_forkr=  )  sÓ   € ð ÒÙÜˆuÐ0×1Ò1Ü˜EÐ#<×=Õ=ßØ1=Õ.Ø×/Ñ/°<Ó?Ø15�Ô.÷	 >ô
 ˆuÐ(×)Ò)Ü˜EÐ#:×;Õ;ßØ×&Ñ&×-Ñ-¨lÕ;äœj¬.×9Õ9Ø×*Ñ*×1Ñ1°,Ô?÷ :÷	 <Ñ;ñ *÷ >×=ú÷ :×9ú÷	 <×;Ð;ús0   ­'C3ÂADÃD	ÃDÃ3D	ÄDÄDÄD*	c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   r,   r   rƒ   r„   Úreview_memoryr-   r   r`  r   )r   s   "r   r   r   @  s2   € ÷ (Fñ (FØð(FØ!9ð(FØJNð(Fàñ(Fr   c                ól  € ^ RI Hp V P                  ;'       g    V P                  pV'       d   V'       d   RR.MR.pV! VRR7       Uu0 uF  qfR,          R,          kK  	  ppVRR	0,          p\	        4       p \        V4      P                  R
. 4      p	\        V	\        4      '       dP   V	 U
u0 uFC  p
\        V
\        4      '       g   K  V
P                  4       '       g   K3  V
P                  4       kKE  	  pp
Yx,          T3# u upi u up
i   \         d    \        P                  RRR7        L8i ; i)u­   ``(whitelist, configured_extra_tools)`` for the review fork â€” DISPATCH-side only, so the
advertised ``tools[]`` stays byte-identical to the parent's (prompt-cache parity).)Úget_tool_definitionsrF  ÚskillsT)r  r  rþ   ri   Ú	read_fileÚsearch_filesÚextra_toolsz*background_review extra_tools parse failedr_   )Úmodel_toolsrA  r  r  r4   r‰   r}   r|   rÈ   rD   r¼   rb   rc   rd   )r,   rƒ   r?  rA  Ú	memory_onÚreview_toolsetsr   Ú	whitelistÚconfigured_extra_toolsÚ	extra_rawri   s   &&&        r   Ú_review_tool_whitelistrL  @  s  € õ
 1ð ×,Ñ,×RÐR°×0RÑ0R€Iß.7¿M�x Ñ*ÐPXÈz€OÙ0DÐVeÐrvÕ0wÓxÑ0w¨1�:•˜v×&Ð&Ñ0w€IÐxð �+˜~Ð.Õ.€Iô$ #&£%ÐðRÜ2°8Ó<×@Ñ@ÀÐPRÓSˆ	Ü�i¤×&Ò&Ù?HÓ%s¹y°tÌJÐW[Ô]`×La¤lÐfj×fpÑfp×fr¤l d§j¡j¦l¹yÐ"Ð%sð Õ-Ð/EÐEÐEùò; yùò4 &tøÜô RÜ�‰ÐAÈDˆÖQðRús6   Á
DÁ:5D Â/D	ÃD	Ã$D	Ã8D Ä	D Ä"D3Ä2D3c                  ób   € ] tR tRt$ RtRtR]R&   ]! ]R7      t	R]R&   ]! ]
R7      tR	]R
&   RtR# )Ú_ReviewForkStateik  zSMutable hand-off between the fork phase and the outer worker's error/cleanup paths.Nr   r,   )Údefault_factoryrõ   rD  rx   Úreview_usager   )r;   r<   r=   r>   r?   r,   Ú__annotations__r   rÈ   rD  r~   rP  r@   r   r   r   rN  rN  k  s-   ‡ á]à€L�#ÓÙ"'¸Ô"=€O�ZÓ=Ù#(¸Ô#>€L�.×>r   rN  c               ó    € V ^8„  d   QhRRRR/# ró  r   )r   s   "r   r   r   t  s   € ÷ 'ñ '¨ð '°ñ 'r   c                óŽ   € \        \        4      ;_uu_ 4        V P                  4        RRR4       R#   + '       g   i     R# ; i)z­The fork shares the foreground session ID: close() / shutdown_memory_provider() are
session-bound (close() kills that session's terminal processes), so release only clients.N)r   rb   Úrelease_clients)r,   s   &r   Ú_release_fork_clientsrU  t  s*   € ô 
”)×	Õ	Ø×$Ñ$Ô&÷ 
×	×	Ò	ús	   ˜3³A	c               ó<   € V ^8„  d   QhRRRRRRRRR	R
RRRRRRRR/	# )r   rB   r   rô   rõ   ÚpromptrD   rƒ   r„   Ú
review_runrJ   ÚstrN  r?  r-   Úexplicitr   r   r   )r   s   "r   r   r   {  sX   € ÷ =ñ =Øð=Ø#-ð=Ø7:ð=ØF^ð=à.ð=à4Dð=àUYð=ð ð=ð 
ñ	=r   c                óŒ  € \        W\        R7      w  Vn        r‰WuP                  n        \	        WP                  RR7       ^ RIHp
Hp \        VP                  W64      w  rÍRP                  \        V4      4      pV'       d   RV R2MRpV'       d   R	V R2MRpR
V9   d   RMRpR
V9   d   RMRpV
! VRV,           R,           V,           R,           R7       \        \        4      ;_uu_ 4        ^ RIHp V! 4        RRR4        Ve"   VP                  VP                  4      '       dM   VP                  P!                  VR,           V,           R,           V,           V	'       d   \#        V4      MTR7       V! 4        VP                  eD   VP$                  P'                  \)        VP                  4      4       \+        WP$                  4       \	        WP                  RR7       \-        W4       \/        \1        VP                  R. 4      4      Vn        \5        VP                  4       RVn        R#   + '       g   i     EL@; i  T! 4        TP                  eD   TP$                  P'                  \)        TP                  4      4       \+        YP$                  4       \	        YP                  RR7       \-        Y4       i ; i)aÍ  Fork phase (inside thread-scoped silence): build the fork, run the prompt under the tool
whitelist, snapshot its messages/usage, release its clients. Partial progress lands on ``st``
so the caller's error path still sees usage and the fork to clean up. ``explicit`` (/refine)
keeps the ``background_review`` origin (curator/skill guards still apply) but marks the fork
attended, so the unattended-only memory delete gate leaves the full operation set available.)r  T©r8  )Úset_thread_tool_whitelistÚclear_thread_tool_whitelistr   z& Configured extra tools also allowed: Ú.r»   u8    Exception â€” these configured tools are also allowed: rF  z  and memory for notes (add only)zmemory and skill zskill z²Background review denied non-whitelisted tool: {tool_name}. Allowed here: skill_view/skills_list/read_file/search_files to read, skill_manage(action='patch'|...) to change skillsz Do not retry {tool_name}.)Údeny_msg_fmt)Ú#_reset_background_review_read_marksNz

You can only call uP   management tools. Other tools will be denied at runtime â€” do not attempt them.)Úuser_messageÚconversation_historyFÚ_session_messages)r-  Ú_REVIEW_MAX_ITERATIONSr,   Ú_review_attendedr=  Úhermes_cli.pluginsr]  r^  rL  rð   Úsortedr   rb   Útools.skill_manager_guardsra  r0   Úrun_conversationr  rP  r  r³  rÂ  rU   rÈ   rF   rD  rU  )rB   rô   rW  rƒ   rX  rY  r?  rZ  r*  r+  r]  r^  Úreview_whitelistrJ  Ú
extra_listÚ
deny_extraÚprompt_extraÚmemory_phrase_denyÚmemory_phrase_promptra  s   &&&&&&&&            r   Ú_run_review_forkrq  {  sT  € ô %<ØÔ(>ô%@Ñ!€B„O�Sà'/‡O�OÔ$Ü�uŸo™o¸Õ=ßYÜ/EÀbÇoÁoÐW_Ó/oÑ,ÐØ—‘œ6Ð"8Ó9Ó:€JßKaÐ9¸*¸ÀQÑGÐgi€Jß_uÐMÈjÈ\ÐYZÑ[Ð{}€Lð @HÐK[Ô?[Ñ;ÐacÐØ2:Ð>NÔ2NÑ.ÐT\ÐÙØð@ð !õ!ð $'õ'ð *4õ4ð 7SõSõô 
”)×	Õ	ÝRá+Ô-÷ 
ð8ØÒ ×!9Ñ!9¸"¿/¹/×!JÒ!Jà�O‰O×,Ñ,àÐ5Õ5Ð8LÕLð:õ:à<HõI÷ LS¤_Ð5FÔ%GÐXið -ô ñ 	$Ô%ð �?‰?Ò&Ø�O‰O×"Ñ"Ô#9¸"¿/¹/Ó#JÔKÜ*¨5·/±/ÔBô 	˜5§/¡/¸EÕBÜ$ UÔ7Üœg b§o¡oÐ7JÈBÓOÓP€BÔÜ˜"Ÿ/™/Ô*Ø€B†O÷; 
×	Ð	ûñ  	$Ô%ð �?‰?Ò&Ø�O‰O×"Ñ"Ô#9¸"¿/¹/Ó#JÔKÜ*¨5·/±/ÔBô 	˜5§/¡/¸EÕBÜ$ UÕ7ús%   Ã.H3Ä$I Ä*9I Å$I È3I	ÉA<Kc               ó$   € V ^8„  d   QhRRRRRR/# )r   rB   r   r•  r:  r   r   r   )r   s   "r   r   r   »  s&   € ÷ dñ d 3ð d°ð d¸tñ dr   c           	     óN  € R P                  \        P                  V4      4      pV P                  \	        RVR7      4       V P
                  '       d?   \        \        4      ;_uu_ 4        V P                  \	        RVR7      4       RRR4       R# R#   + '       g   i     R# ; i)u    Â· zdisplay.review.summary_cli)Úsummaryzdisplay.review.summary_callbackN)rð   r~   ÚfromkeysÚ_safe_printr   Úbackground_review_callbackr   rb   )rB   r•  rt  s   && r   Ú_publish_review_summaryrx  »  st   € Ø�k‰kœ$Ÿ-™-¨Ó0Ó1€GØ	×Ñ”aÐ4¸gÔFÔGØ×'×'Ð'Ü”i× Õ Ø×,Ñ,¬QÐ/PÐZaÔ-bÔc÷ !Ñ ñ (ß × Ð ús   Á*BÂB$	c               ó8   € V ^8„  d   QhRRRRRRRRR	R
RRRRRR/# )r   rB   r   rô   rõ   rW  rD   rƒ   r„   rX  rJ   r?  r-   rZ  r   r   r   )r   s   "r   r   r   Ã  s\   € ÷ Q,ñ Q,ØðQ,Ø#-ðQ,Ø7:ðQ,à&ðQ,à;YðQ,ð ðQ,ð ,0ðQ,ð 
ñ	Q,r   c                ó”  € Ve.   VP                   P                  4       '       d   \        W4       R# \        \        4       \        V 4      '       gO   \        W4      P                  R4      '       g/   \        P                  R\        V RR4      4       \        R4       R# \        4       p \        4       ;_uu_ 4        \        WW#WGWV4       RRR4        \        VP                  V\        V RR4      R7      p\#        VP$                  \'        V4      4       V'       d   \)        W4       \/        YP0                  RR7       \        Y4       TP0                  eQ   \3        \         4      ;_uu_ 4        \        4       ;_uu_ 4        \5        TP0                  4       RRR4       RRR4       \        R4       R#   + '       g   i     Ló; i  \          d#   p	\        P                  R	T	4       . p Rp	?	LúRp	?	ii ; i  \          de   p	\        P                  R
T	4       TP$                  '       d   \#        TP$                  R4       T P+                  \-        R4      T	4        Rp	?	EL:Rp	?	ii ; i  + '       g   i     LÚ; i  + '       g   i     Lå; i  \/        YP0                  RR7       \        Y4       TP0                  ey   \3        \         4      ;_uu_ 4        \        4       ;_uu_ 4        \5        TP0                  4       RRR4       M  + '       g   i     M; iRRR4       M  + '       g   i     M; i\        R4       i ; i)a/  Daemon-thread worker: build the fork, run the prompt, surface the action summary via
``agent._safe_print`` / ``background_review_callback``. ``review_run`` (from
:func:`prepare_background_review_run`) cancelled before the first provider call aborts
without entering ``run_conversation()``.

See #84423.
Nr¹   zÔBackground review skipped: provider %r cannot emit Hermes tool calls, so the review fork could not write memories or skills. Set auxiliary.background_review.{provider,model} to route the review to a normal model.r«   rÿ   Úmemory_notificationsr�  )r�  z³summarize_background_review_actions returned partial results after exception (treating as empty); suppressing AttributeError that previously aborted the entire review (#59437): %sz)Background memory/skill review failed: %srÖ   z display.review.aux_failure_labelFr\  )r    r/   rU   r6  r0  rå   rÔ   r}   rc   rs   rF   rN  r   rq  r–  rD  rb   rß  rP  rÖ  rx  Ú_emit_auxiliary_failurer   r=  r,   r   rU  )
rB   rô   rW  rƒ   rX  r?  rZ  rY  r•  rÓ   s
   &&&&&&&   r   Ú_run_review_in_threadr}  Ã  sR  € ð Ò *×"=Ñ"=×"DÑ"D×"FÒ"FÜ$ UÔ7ÙÜ!Ô"6Ô7ô ' u×-Ò-Ô6MÈeÓ6^×6bÑ6bÐck×6lÒ6lÜ�‰ðbô �E˜: sÓ+ô		
ô 	& dÔ+ÙÜ	Ó	€Bð4,ô #×$Õ$Ü˜U°vÈÐYfÔq÷ %ð	ô :Ø×"Ñ"Ð$5Ü")¨%Ð1GÈÓ"NôˆGô 	˜rŸ™Ô0GÈÓ0PÔQßÜ# EÔ3ô 	˜5§/¡/¸EÕBÜ$ UÔ7Ø�?‰?Ò&Üœ)×$Õ$Ô&;×&=Õ&=Ü% b§o¡oÔ6÷ '>×$ô 	& dÖ+÷Y %×$ûô$ ô 	Ü�N‰NðIð ô	ð �Gûð	ûô ô PÜ�‰ÐBÀAÔFØ�?�?ˆ?Ü" 2§?¡?°GÔ<Ø×%Ñ%¤aÐ(JÓ&KÈQ×OÒOûð	Pú÷ '>×&=ú×$×$ûô 	˜5§/¡/¸EÕBÜ$ UÔ7Ø�?‰?Ò&Üœ)×$Õ$Ô&;×&=Õ&=Ü% b§o¡oÔ6÷ '>×&=×&=Ð&=ú×$×$×$Ð$úô 	& dÕ+úsÂ   Â+G: Â=F7ÃG: Ã#G
 Ã82G: Å1I?ÆI,	ÆI?Æ7G	ÇG: Ç
G7ÇG2Ç-G: Ç2G7Ç7G: Ç:I)ÈAI$ÉJ É$I)É)J É,I<É7I?É?J	ÊAMËL(	Ë-LÌ	L(	ÌLÌL(	Ì	MÌ(L8Ì3MÚ_COMBINED_REVIEW_PROMPTÚ_MEMORY_REVIEW_PROMPTÚ_SKILL_REVIEW_PROMPTc               ó8   € V ^8„  d   QhRRRRRRRRRR	R
RRRRR/# )r   rB   r   rô   rõ   r?  r-   Úreview_skillsÚfocusr  rƒ   r„   rX  rJ   rZ  r   )r   s   "r   r   r     sS   € ÷ ñ ØðØ#-ðØ>Bðàðà(5ðð 'ðð <Zðð ñ	r   c                óú   a aaaaaa
€ Sf   \        4       o\        SV3,          p\        S V\        4       V,          4      o
T;'       g    RP	                  4       ;p'       d   S
 RV 2o
R V VVV
VVV3R llp	V	S
3# )aÕ  Return ``(target, prompt)``; the caller builds the ``threading.Thread`` so test patches of
``run_agent.threading.Thread`` keep working. ``focus`` (``/refine [instructions]``) is appended
to the chosen prompt; automatic reviews pass ``None``. ``task_cfg`` is the pre-loaded
``auxiliary.background_review`` block; when omitted it is read once here. ``explicit``
(/refine) propagates to the fork's write origin so user-requested reviews keep the full
memory operation set.r»   u|   

The user explicitly requested this review with the following focus â€” prioritize it over the general instructions above:
c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   Ú4spawn_background_review_thread.<locals>.__annotate__5  s   € ÷ <ñ <�Tñ <r   c            
     ó,   <€ \        S SSSSSSR 7       R# ))rƒ   rX  r?  rZ  N)r}  )rB   rZ  rô   rW  r?  rX  rƒ   s   €€€€€€€r   Ú_targetÚ/spawn_background_review_thread.<locals>._target5  s   ø€ ÜØÐ$ f°xÈJØ'°(÷	<r   )r‰   Ú_PROMPT_NAME_BY_SCOPErF   Úglobalsr¼   )rB   rô   r?  r‚  rƒ  rƒ   rX  rZ  ri   rˆ  rW  s   fff&&fff  @r   Úspawn_background_review_threadrŒ    s�   þ€ ð ÒÜ1Ó3ˆä  -°Ð!?Õ@€DÜ�U˜D¤'£)¨D¥/Ó2€FØ—�˜"×#Ñ#Ó%Ð%€uÖ%àˆhð MØMRÈGðUð 	÷
<ö <ð
 �Fˆ?Ðr   r{  )NN)é   )u   âž•ré   éx   )u   âœ�ï¸�ré   rŽ  )u   âž–Úold_texté<   ))r  rÿ   )rg   rF  )ré   r»   )r�  r»   )ri   r»   )r%  r»   )r'  r»   )r�  )rÛ  rÜ  rÝ  Úcache_write_tokensÚreasoning_tokensr¼  )Úproviders_allowedÚproviders_ignoredÚproviders_orderÚprovider_sortÚprovider_require_parametersÚprovider_data_collection)F)FF)NNFF)TT)TF)FT)FFNNNF)r~  r  r€  r¬  r§   rŒ  r–  )aÚ__conditional_annotations__r?   Ú
__future__r   ræ  rK  Úloggingr§  r   Ú
contextlibr   r   Údataclassesr   r   Útypingr   r   r	   r
   r   r   Ú
agent.i18nr   Úagent.prompt_cache_scoper   Úagent.thread_scoped_outputr   Ú	getLoggerr;   rc   rr   r   rH   rR   rU   rl   ru   re  r‘   r“   r�   r�   r‰   r•   rœ   r§   rÔ   rÊ   rå   rò   r  Ú_MEMORY_ROUTING_BLOCKr  Ú_LESSON_LAYER_BLOCKÚ_DO_NOT_CAPTURE_BLOCKr€  r~  r  r  rQ  r  r8  rB  rN  rW  r]  rf  r‹  r–  r¬  r²  r³  rÂ  rÖ  rß  rå  rë  rñ  rû  r  r  r  r  r-  r0  r6  r=  rL  rN  rU  rq  rx  r}  rŠ  rŒ  Ú__all__)r™  s   @r   Ú<module>r§     s$  øðôTõ #ã Û Û Û 	Û ß /ß (ß =× =å Ý DÝ <à	×	Ò	˜8Ó	$€à,/Ð )÷!ñ !ðH ôó ðõõ"ð]ð 3ð]ð 6÷	]ð6&
ð 3ð&
ð 6÷	&
ðX Ð ð  'Ð Ø!%Ð Ø$+Ð !õ2÷	÷k÷
*õ÷2&õRõ&	õ3÷8ðN	Tð ðØ)õ*ðYõYð ð/ð ð>,ð ð4ð !4õ4ð9õ@ð@ -õA@-ðBõCCð ðPØ*õ+ð3õ3ð 6IõIð&õ.ð\ "7õ].7ð^dõ_0dð õj?ð 
Ð" IÐ/IÈ7ÐTnØÐ%ð7Ð Ð3ó õyõFõ$xðÐ õ+õ>Zõõ&K÷R"ðJFØ15ðFØZ^ðFà!ðFàAE÷Fð$€õ
õTõ*kõðÐ õ÷("õ&Kõ>÷&ð< $1Ð  õNñP&à+÷P&ð P&òlõ(õ@÷.(FðV ÷?ð ?ó ð?õ'÷=õ@d÷Q,ðl Ð+¨]Ð<SØÐ)¨>Ð;QðÐ ÷ò>‚r   