Repository navigation
Description
Summary
Setting ARTEMIS_VIDEO_RECORDING_ENABLED=false does not disable automatic screen recording when ARTEMIS_WITH_VIDEO_RECORDING_TOOLS is unset. The explicit false value resolves to None, and the runtime builder falls back to tool availability. If scrcpy and FFmpeg are available, recording remains enabled. This also leaves an explicit video_analyzer.enabled=true configuration unchanged instead of applying the environment override.
Steps to reproduce
Use the source baseline below with its Python dependencies installed. Run this synthetic probe from the repository root. It loads the real unified JSON configuration and runtime builder, mocks only the availability detector to represent installed video tools, and does not connect to a device or record anything.
import json
import os
from pathlib import Path
import tempfile
from unittest.mock import patch
from artemis.config.agent import load_agent_config
from artemis.sdk.builders import agent_config_builder as builders
first = "ARTEMIS_VIDEO_RECORDING_ENABLED"
second = "ARTEMIS_WITH_VIDEO_RECORDING_TOOLS"
cases = [
("default", None, None, None, None),
("false_unset", "false", None, None, None),
("false_true", "false", "true", None, None),
("false_false", "false", "false", None, None),
("true_unset", "true", None, None, None),
("true_false", "true", "false", None, None),
("false_unset_config_true", "false", None, True, None),
("config_false", None, None, False, None),
("false_unset_cli_false", "false", None, None, False),
]
for label, a, b, configured, explicit in cases:
env = {k: v for k, v in [(first, a), (second, b)] if v is not None}
with patch.dict(os.environ, env, clear=True), tempfile.TemporaryDirectory() as scratch:
path = Path(scratch) / "config.json"
data = {} if configured is None else {"video_analyzer": {"enabled": configured}}
path.write_text(json.dumps({"agent": data}))
cfg = load_agent_config(path)
with patch.object(builders, "load_agent_config", return_value=cfg), patch.object(
builders, "detect_video_tools_enabled", return_value=True
):
builder = builders.AgentConfigBuilder()
if explicit is not None:
builder.with_video_recording_tools(explicit)
enabled = builder._extra_config_fields()["video_recording_tools_enabled"]
print(f"{label}: root={cfg.video_analyzer.enabled} pro={cfg.pro.video_analyzer.enabled} runtime={enabled}")The false_unset_cli_false control applies the same builder method that the CLI calls for --without-video-recording-tools; it does not launch the full CLI.
Expected behavior
An explicit false recording environment override with the alias absent should resolve both root and Pro video settings to False and produce video_recording_tools_enabled=False, independent of automatic tool detection or a true value in the JSON file. The model validator describes these environment variables as highest-precedence runtime switches, accepts false as a valid boolean, and applies an explicit parsed value to both video settings. When neither variable is set and no explicit JSON value exists, automatic detection should remain available. An explicit true value should still enable the feature.
The conflicting-alias rows characterize current behavior; this report does not assume a documented precedence contract when both variables are explicitly set to different values.
Actual behavior
The executed configuration-and-builder probe produced:
default: root=None pro=None runtime=True
false_unset: root=None pro=None runtime=True
false_true: root=True pro=True runtime=True
false_false: root=False pro=False runtime=False
true_unset: root=True pro=True runtime=True
true_false: root=True pro=True runtime=True
false_unset_config_true: root=True pro=True runtime=True
config_false: root=False pro=False runtime=False
false_unset_cli_false: root=None pro=None runtime=False
The false/unset case loses the false value, whereas both-false and the explicit builder control disable recording. The current source combines the two parsed booleans with Python or; False or None evaluates to None, so the override block is skipped. The runtime builder then uses automatic tool detection if the configured video value is None.
A supplied earlier standalone CLI run on the same source baseline, with the first variable false and the alias unset, logged Starting automated screen recording... and Started scrcpy recording. A supplied CLI control using --without-video-recording-tools did not log those recording starts. Those device runs were not repeated for this report; the new execution is limited to the synthetic configuration-and-builder probe above.
Evidence
- Expected source:
artemis/config/agent.py:37-45defines the video switch and automatic fallback;AgentGlobalConfig.synchronize_profiles_and_components, lines 975-1013, defines highest-precedence environment overrides and parses false values. - Failure source: The executed inline probe output above;
artemis/config/agent.py:1008-1013loses false when the alias is absent, andartemis/sdk/builders/agent_config_builder.py:40-55,428carries the resulting automatic value into runtime configuration. - Evidence provenance: observed
- Local verification: reproduced
- Reproduction completeness: complete
The primary observed violation is the fresh-source configuration and builder result. The earlier CLI recording logs are supplied evidence, and the downstream recording gate is static evidence. Local reproduction is complete for the false environment override being ignored in runtime configuration; no new device or recording run was performed.
The supported CLI path creates the default builder in third_party/mobile_use/main.py:new_default_config_builder, then applies a video override only when the CLI option is explicit in artemis/interfaces/cli/commands/run.py:99-103. The automatic recording branch checks self._config.video_recording_tools_enabled in third_party/mobile_use/sdk/agent.py:533-547 before calling the controller's recording method. This report concerns environment resolution, independently of daemon argument forwarding.
Restoration check
With the alias absent, the false environment value must yield root=False, pro=False, and runtime=False for both an unspecified JSON video setting and an explicitly true JSON video setting. Retain the unset/unset automatic-detection behavior and the true/unset enabling control. Both-false and explicit disabling controls should continue to disable recording. These checks restore the same environment override contract without requiring a particular implementation.
Runtime or environment
- Current default-branch source:
google/artemismain at351ca8422f7b5b54e80a9c1ce03a222e02415b6b, freshly shallow-cloned for this verification. The repository has no published releases or tags at verification. - New synthetic verification: Python 3.12.15; imported configuration and builder modules were checked to resolve inside the fresh clone. The existing compatible dependencies were reused read-only after confirming the source lockfiles match.
- Supplied earlier CLI observation: macOS host, Artemis host metadata 1.0, scrcpy 4.1, FFmpeg 9.0.2. The new probe models available recording tools without launching those programs.
Triage assessment
- Impact level: P2
- Assessment status: supported
- Impact basis: A supported explicit false environment switch fails to disable recording, so environments with available video tools can start recording despite the requested setting. The bounded configuration probe reproduces the enabling decision, and the supplied standalone CLI logs show recording starts under that condition; broader platform frequency was not measured.
- Workaround status: available
- Workaround basis: Both environment variables set to false produce a false runtime value in the synthetic probe. An explicit false JSON value with both variables unset also produces a false runtime value, and the explicit CLI disabling path is supported by the builder control and the supplied CLI observation.
Activity