Files
wehub-resource-sync 4b6817381b
Benchmark image — build + push to ECR (any adapter) / build + push (push) Waiting to run
CI / quality (ubuntu-latest) (push) Waiting to run
CI / test (tools-runtime) (push) Waiting to run
CI / test (e2e-general) (push) Waiting to run
CI / test (cli-runtime) (push) Waiting to run
CI / test (e2e-provider-and-openclaw) (push) Waiting to run
CI / test (integrations-and-misc) (push) Waiting to run
CI / coverage-report (push) Blocked by required conditions
CI / test-kubernetes (push) Waiting to run
CI / should-run-thorough (push) Waiting to run
CI / test-thorough (cloudwatch-demo) (push) Blocked by required conditions
CI / test-thorough (flink-ecs) (push) Blocked by required conditions
CI / test-thorough (upstream-lambda) (push) Blocked by required conditions
CI / test-thorough (prefect-ecs-fargate) (push) Blocked by required conditions
CodeQL / Analyze (python) (push) Waiting to run
Release / build-binaries (zip, opensre.exe, onefile, windows-latest, windows-x64) (push) Blocked by required conditions
Release / publish-release (push) Blocked by required conditions
Release / publish-main-release (push) Blocked by required conditions
Release / prepare (push) Waiting to run
Release / verify (push) Blocked by required conditions
Release / build-python-dist (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, macos-15-intel, darwin-x64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, macos-latest, darwin-arm64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04, linux-x64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04-arm, linux-arm64) (push) Blocked by required conditions
Synthetic Deterministic Tests / Synthetic offline (deterministic) (push) Waiting to run
Interactive Shell Live (PR + post-merge) / turn-checks (no-LLM) (push) Waiting to run
Interactive Shell Live (PR + post-merge) / turn-live shard ${{ matrix.shard_index }} (push) Waiting to run
CI (OpenClaw E2E) / openclaw test (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:10:45 +08:00

71 lines
2.1 KiB
Python

from __future__ import annotations
from surfaces.interactive_shell.utils.telemetry.config import PromptLogConfig
def _no_file_settings(monkeypatch) -> None:
monkeypatch.setattr(
"surfaces.interactive_shell.utils.telemetry.config.read_prompt_log_settings",
lambda: {},
)
def test_load_defaults_to_redact_on(monkeypatch) -> None:
"""Redaction must default on, matching HistoryPolicy — see issue #2804.
Prompt/response content can carry the same token shapes as typed command
history and additionally leaves the machine via the PostHog sink, so it
must not ship less guarded than history by default.
"""
_no_file_settings(monkeypatch)
for var in (
"OPENSRE_PROMPT_LOG_DISABLED",
"OPENSRE_PROMPT_LOG_LOCAL_DISABLED",
"OPENSRE_PROMPT_LOG_REDACT",
"OPENSRE_PROMPT_LOG_PATH",
):
monkeypatch.delenv(var, raising=False)
config = PromptLogConfig.load()
assert config.redact is True
assert config.posthog_enabled is True
def test_load_respects_env_opt_out_of_redaction(monkeypatch) -> None:
_no_file_settings(monkeypatch)
monkeypatch.setenv("OPENSRE_PROMPT_LOG_REDACT", "0")
config = PromptLogConfig.load()
assert config.redact is False
def test_load_respects_file_opt_out_of_redaction(monkeypatch) -> None:
monkeypatch.setattr(
"surfaces.interactive_shell.utils.telemetry.config.read_prompt_log_settings",
lambda: {"redact": False},
)
monkeypatch.delenv("OPENSRE_PROMPT_LOG_REDACT", raising=False)
config = PromptLogConfig.load()
assert config.redact is False
def test_env_redact_overrides_file_setting(monkeypatch) -> None:
monkeypatch.setattr(
"surfaces.interactive_shell.utils.telemetry.config.read_prompt_log_settings",
lambda: {"redact": False},
)
monkeypatch.setenv("OPENSRE_PROMPT_LOG_REDACT", "1")
config = PromptLogConfig.load()
assert config.redact is True
def test_dataclass_default_redact_is_on() -> None:
"""Direct construction (e.g. in other tests/callers) should also default-redact."""
assert PromptLogConfig().redact is True