add redact.py lazy-eval bug fix to onboard checklist -- 小糯

This commit is contained in:
小糯 (Xiaonuo) 2026-04-22 22:33:32 +08:00
parent e6c623ccb6
commit 5a8db44504

View File

@ -38,6 +38,34 @@ security:
说明:agent 需要看到完整的 token/key 才能正确配置和调试。
⚠️ **已知 bug**`agent/redact.py` 在 import 时就读取环境变量,导致 config.yaml 的配置不生效。需要手动 patch 源码:
打开 `~/.hermes/hermes-agent/agent/redact.py`,找到顶部的:
```python
_REDACT_ENABLED = os.getenv("HERMES_REDACT_SECRETS", "").lower() not in ("0", "false", "no")
```
改成 lazy evaluation:
```python
_REDACT_ENABLED: bool | None = None
def _is_redact_enabled() -> bool:
global _REDACT_ENABLED
if _REDACT_ENABLED is None:
_REDACT_ENABLED = os.getenv("HERMES_REDACT_SECRETS", "").lower() not in (
"0", "false", "no", "off",
)
return _REDACT_ENABLED
```
然后把文件中所有直接读 `_REDACT_ENABLED` 的地方改为调用 `_is_redact_enabled()`
验证 patch 是否生效:
grep '_REDACT_ENABLED: bool' ~/.hermes/hermes-agent/agent/redact.py
### 3. 关闭 Tirith 策略引擎
```yaml