|
21 | 21 | from frontier_agent.core.execution_context import ( |
22 | 22 | ExecutionScope, |
23 | 23 | chain_fallback_active, |
| 24 | + get_current_execution_scope, |
24 | 25 | reset_current_execution_scope, |
25 | 26 | set_current_execution_scope, |
26 | 27 | ) |
@@ -49,13 +50,26 @@ def _enter_scope( |
49 | 50 | phase_id=phase_id, |
50 | 51 | metadata=metadata, |
51 | 52 | ) |
| 53 | + # A loop entered from inside another (an in-process sub-agent) is that |
| 54 | + # loop's child: the parent may read the child's spill store, siblings not. |
| 55 | + from plugins.tools._overflow import register_child_scope |
| 56 | + |
| 57 | + register_child_scope(get_current_execution_scope(), scope) |
52 | 58 | return scope, set_current_execution_scope(scope) |
53 | 59 |
|
54 | 60 |
|
55 | 61 | def _body_has_spill_reference(body: str) -> bool: |
| 62 | + """Whether the trajectory recovery footer should stay quiet for ``body``. |
| 63 | +
|
| 64 | + True when the body already names a spill file (that file holds the full |
| 65 | + output), and also when this agent has no trajectory JSONL: the footer names |
| 66 | + ``recover_result``, which reads exactly that file, so without one it would |
| 67 | + hand the model a handle that can only answer "unavailable". |
| 68 | + """ |
56 | 69 | from plugins.tools._overflow import body_names_a_spill_file |
| 70 | + from plugins.tools.recover_result import trajectory_recovery_available |
57 | 71 |
|
58 | | - return body_names_a_spill_file(body) |
| 72 | + return body_names_a_spill_file(body) or not trajectory_recovery_available() |
59 | 73 |
|
60 | 74 |
|
61 | 75 | def _with_recovery_handle(body: str, result: Any, turn: int, *, enabled: bool) -> str: |
|
0 commit comments