mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-07-09 16:08:31 +00:00
* feat: emit structured runtime metadata * fix: avoid subagent import cycle in replay gateway * fix: preserve legacy subtask result parsing * refactor: tighten runtime metadata contracts * fix(middleware): keep recovery hint on task exception wrapper content The structured-metadata stamp overwrote the wrapper text with the bare task-failure message, dropping the model-facing 'Continue with available context, or choose an alternative tool.' guidance that every other tool exception keeps. Append the shared hint after the formatted message. * fix(subagents): require lowercase hex for result_sha256 reader Length-only validation accepted any 64-char string; a faulty serializer or relaying wrapper could store a non-digest value in the delegation ledger. Enforce the producer's hexdigest shape with a fullmatch. --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
41 lines
1.6 KiB
Python
41 lines
1.6 KiB
Python
"""Regression tests for the skills sandbox container root default."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import ast
|
|
from pathlib import Path
|
|
|
|
|
|
def test_mnt_skills_literal_is_owned_by_skill_constants_module():
|
|
package_root = Path(__file__).parents[1] / "packages" / "harness" / "deerflow"
|
|
allowed = {package_root / "constants.py"}
|
|
offenders: list[str] = []
|
|
|
|
for path in package_root.rglob("*.py"):
|
|
if path in allowed:
|
|
continue
|
|
tree = ast.parse(path.read_text(encoding="utf-8"), filename=str(path))
|
|
for node in ast.walk(tree):
|
|
if isinstance(node, ast.Constant) and node.value == "/mnt/skills":
|
|
offenders.append(str(path.relative_to(package_root)))
|
|
|
|
assert offenders == []
|
|
|
|
|
|
def test_runtime_middlewares_use_top_level_skills_container_constant():
|
|
package_root = Path(__file__).parents[1] / "packages" / "harness" / "deerflow"
|
|
offenders: list[str] = []
|
|
|
|
for relative_path in (
|
|
Path("agents/middlewares/durable_context_middleware.py"),
|
|
Path("agents/middlewares/tool_error_handling_middleware.py"),
|
|
):
|
|
path = package_root / relative_path
|
|
tree = ast.parse(path.read_text(encoding="utf-8"), filename=str(path))
|
|
for node in ast.walk(tree):
|
|
if isinstance(node, ast.ImportFrom) and node.module == "deerflow.config.skills_config":
|
|
imported_names = {alias.name for alias in node.names}
|
|
if "DEFAULT_SKILLS_CONTAINER_PATH" in imported_names:
|
|
offenders.append(str(relative_path))
|
|
|
|
assert offenders == []
|