refactor(execute_code): schema diet — persistence woven in, not bolted on (712 → 654 tok/call) (#96997)

* refactor(execute_code): integrate kernel persistence into the core description (712 -> 654 tok/call, -8%)

* fix(execute_code): honest interpreter note — Hermes's own python is the common case; project venv only when VIRTUAL_ENV/CONDA_PREFIX is active
This commit is contained in:
Teknium
2026-08-28 03:04:51 -07:00
committed by GitHub
parent 547f4c952d
commit 2f57cd95b2
2 changed files with 37 additions and 35 deletions
+9 -8
View File
@@ -159,17 +159,18 @@ class TestSchemaSurface(unittest.TestCase):
schema = build_execute_code_schema(mode="strict")
self.assertIn("reset", schema["parameters"]["properties"])
def test_session_note_is_always_present(self):
"""The schema's kernel note is unconditional now — session kernels
are always on for local execution (kernel_mode retired), so every
session is told about persistence and reset=true."""
def test_kernel_persistence_is_taught_unconditionally(self):
"""Persistence is woven into the tool's main description (always-on
since #96787, integrated in the schema diet) — every session must be
told state survives across calls, in strict and project mode alike,
regardless of any stale kernel_mode key in config."""
with _kernel_config():
session_schema = build_execute_code_schema(mode="strict")
self.assertIn("Session kernel is active", session_schema["description"])
# Even with a stale per-call key in config, the note stays.
schema = build_execute_code_schema(mode="strict")
self.assertIn("persistent session kernel", schema["description"])
self.assertIn("reset", schema["parameters"]["properties"])
with _kernel_config(kernel_mode="per-call"):
stale_schema = build_execute_code_schema(mode="strict")
self.assertIn("Session kernel is active", stale_schema["description"])
self.assertIn("persistent session kernel", stale_schema["description"])
if __name__ == "__main__":