The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: adapt execute_code cell authority to the widened prompt-callback table
Tekniumb51da65258a7
diff --git a/tests/tools/test_code_kernel.py b/tests/tools/test_code_kernel.pyindex bba51638443..1e48192bd36 100644--- a/tests/tools/test_code_kernel.py+++ b/tests/tools/test_code_kernel.py@@ -367,7 +367,7 @@ class TestPerCellRpcAuthority(unittest.TestCase):def _handle(tool_name, tool_args, task_id=None):from tools.thread_context import _callback_api- get_approval, _get_sudo, _set_a, _set_s = _callback_api()+ (get_approval, _set_a), *_rest = _callback_api()seen.append({"tool": tool_name,diff --git a/tools/code_kernel.py b/tools/code_kernel.pyindex 86d9966f812..d2307d2873b 100644--- a/tools/code_kernel.py+++ b/tools/code_kernel.py@@ -241,15 +241,14 @@ class CellAuthority:self.task_id = task_idself.ctx = contextvars.copy_context()self.active = True- self._api = None # (get_approval, get_sudo, set_approval, set_sudo)- self._callbacks = (None, None)+ # ((getter, setter), captured value) per thread-local prompt callback (approval, sudo, vault unlock…)+ self._callbacks: list = []try:from tools.thread_context import _callback_api- self._api = _callback_api()- self._callbacks = (self._api[0](), self._api[1]())+ self._callbacks = [(pair, pair[0]()) for pair in _callback_api()]except Exception:# Fail-closed like propagate_context_to_thread: no callbacks → dangerous approvals deny.- self._api = None+ self._callbacks = []def retire(self) -> None:self.active = False@@ -265,12 +264,11 @@ class CellAuthority:def _invoke(self, tool_name: str, tool_args: dict) -> str:from model_tools import handle_function_callprevious = None- if self._api is not None:- get_approval, get_sudo, set_approval, set_sudo = self._api+ if self._callbacks:try:- previous = (get_approval(), get_sudo())- set_approval(self._callbacks[0])- set_sudo(self._callbacks[1])+ previous = [(setter, getter()) for (getter, setter), _cb in self._callbacks]+ for (_getter, setter), cb in self._callbacks:+ setter(cb)except Exception:previous = Nonetry:@@ -278,8 +276,8 @@ class CellAuthority:finally:if previous is not None:try:- set_approval(previous[0])- set_sudo(previous[1])+ for setter, cb in previous:+ setter(cb)except Exception:passdiff --git a/ui-tui/src/app/interfaces.ts b/ui-tui/src/app/interfaces.tsindex 55459932f70..5d9c050a7f6 100644--- a/ui-tui/src/app/interfaces.ts+++ b/ui-tui/src/app/interfaces.ts@@ -25,12 +25,12 @@ import type {Msg,PanelSection,SecretReq,- VaultUnlockReq,SectionVisibility,SessionInfo,SlashCatalog,SudoReq,- Usage+ Usage,+ VaultUnlockReq} from '../types.js'export interface StateSetter<T> {