oclaw/tests/test_prompt_hardcode_guard.py
oliver ba3836f00f 初始化:独立 oclaw 仓库首提交
- 在 oclaw/ 下重新初始化 Git 仓库
- 补齐子仓库 .gitignore,避免提交本地运行态数据(_local、node_modules、logs 等)
- 提交当前工程代码与配置

Made-with: Cursor
2026-04-24 22:31:22 +08:00

29 lines
1,007 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from __future__ import annotations
from pathlib import Path
from oclaw.platform.config.paths import PROJECT_ROOT
def _read(rel: str) -> str:
return (PROJECT_ROOT / rel).read_text(encoding="utf-8")
def test_no_legacy_inline_manager_prompts() -> None:
# Manager orchestrator was removed; keep this test as a smoke-guard for any new inline
# manager-style prompt leakage into the runtime entrypoints.
content = _read("oclaw/openclaw_runtime/gateway.py")
assert "【重要:只返回合法 JSON】" not in content
assert "你是 AI 助手的路由(Routing)智能体" not in content
def test_no_legacy_inline_specialist_prompts() -> None:
content = _read("oclaw/agents/specialists.py")
assert "【最高优先级执行规则(必须遵守)】" not in content
assert "【职责范围】" not in content
def test_no_legacy_inline_runtime_prompt() -> None:
content = _read("oclaw/chat/agent.py")
assert "你是一个通用 AI 助手。" not in content