Skip to content

fix(cli): preserve run verification and Explorer tuning on daemon dispatch #199

Open

Description

@coygeek

Summary

artemis run --profile pro --verification-level strict --explorer-pro-mode ultra accepts both tuning options, but the normal daemon dispatch omits them. The same command with --standalone forwards both. Consequently, daemon workers use their configured verification and Explorer settings rather than these requested per-run overrides; factory defaults are final and flash.

Steps to reproduce

Use the source baseline below with its locked Python dependencies. This is a synthetic forwarding probe through the registered Typer CLI: daemon availability, submission and completion are mocked, and standalone execution is intercepted. It does not start a daemon, contact a device/model, or run a strict assertion.

Save the following as repro.py in a fresh source checkout:

import importlib
import inspect
import json
import sys
from unittest.mock import AsyncMock, patch

# Reject accidental external work, including during imports.
def guard(event, args):
    if event in ("socket.connect", "subprocess.Popen", "os.system"):
        raise AssertionError("unexpected external operation")

sys.addaudithook(guard)
from artemis.interfaces.cli.main import app
import artemis.runtime as runtime
from typer.testing import CliRunner

command = importlib.import_module("artemis.interfaces.cli.commands.run")
runner = CliRunner()
args = [
    "run", "Synthetic forwarding probe", "--profile", "pro",
    "--device-serial", "synthetic-device",
    "--session-id", "00000000-0000-4000-8000-000000000001",
    "--disable-outputter", "--verification-level", "strict",
    "--explorer-pro-mode", "ultra",
]
with (
    patch.object(runtime, "ensure_daemon_running", return_value=(True, "http://daemon.invalid")),
    patch.object(runtime, "submit_task_to_daemon", return_value={"tasks": [{"status": "queued"}]}) as submit,
    patch.object(runtime, "wait_for_daemon_task", return_value={"status": "completed"}),
):
    result = runner.invoke(app, args)
    assert result.exit_code == 0, repr(result.exception)
    bound = inspect.signature(runtime.daemon_client.submit_task_to_daemon).bind_partial(**submit.call_args.kwargs)
    bound.apply_defaults()
    print("daemon", json.dumps({k: bound.arguments[k] for k in (
        "profile", "enable_outputter", "verification_level", "explorer_mode"
    )}))
    print("tuning keys submitted", sorted(set(submit.call_args.kwargs) & {
        "verification_level", "explorer_mode"
    }))
with (
    patch.object(command, "display_local_device_status"),
    patch.object(command, "execute_task", new_callable=AsyncMock) as execute,
):
    result = runner.invoke(app, args + ["--standalone"])
    assert result.exit_code == 0, repr(result.exception)
    print("standalone", json.dumps({k: execute.call_args.kwargs[k] for k in (
        "profile", "enable_outputter", "verification_level", "explorer_pro_mode"
    )}))

Run with an empty environment and disposable application state, using the checkout's dependency environment on PATH:

sandbox="$(mktemp -d)"
env -i PATH="$PATH" HOME="$sandbox" ARTEMIS_APP_DIR="$sandbox/app" PYTHONDONTWRITEBYTECODE=1 python repro.py

Expected behavior

Both paths should preserve the requested Pro verification preset and Explorer tier. The daemon request should receive verification_level="strict" and explorer_mode="ultra", which its existing API and worker invocation already support. --standalone should not be necessary for these declared options to take effect.

Actual behavior

The probe exits successfully and prints:

daemon {"profile": "pro", "enable_outputter": false, "verification_level": null, "explorer_mode": null}
tuning keys submitted []
standalone {"profile": "pro", "enable_outputter": false, "verification_level": "strict", "explorer_pro_mode": "ultra"}

--disable-outputter reaches both paths as a discriminating control. Neither tuning keyword is present in the daemon call; binding the real client signature shows its None defaults. The daemon client serializes those values as null. The queue's _build_worker_invocation() adds --verification-level and --explorer-pro-mode only for nonempty request values, so this path cannot carry the original CLI overrides into the worker. Actual device execution and assertion outcomes were not tested.

Evidence

  • Expected source: artemis/interfaces/cli/commands/run.py:253-275 declares the two Pro tuning options; :409-429 forwards both to embedded execution. artemis/runtime/daemon_client.py:210-244 accepts and serializes both daemon tuning fields.
  • Failure source: Executed registered-CLI probe and inline output above; artemis/interfaces/cli/commands/run.py:328-339 omits both keywords from daemon submission. apps/admin_console/services/task_queue_service.py:506-553 reads them from the queued request and conditionally adds the worker flags.
  • Evidence provenance: observed
  • Local verification: reproduced
  • Reproduction completeness: complete

The CLI forwarding contrast was executed with inert boundaries. Worker propagation and configured-default consequences are source-derived.

Runtime or environment

Fresh default-branch source at 351ca8422f7b5b54e80a9c1ce03a222e02415b6b, project metadata version 1.0, Python 3.12.15. The repository publishes no GitHub releases or tags. The dependency environment's uv.lock matched the fresh checkout byte-for-byte; imports were verified to resolve to the fresh source. No device, daemon, model credentials or network connection was used by the probe.

Restoration check

Repeat the synthetic CLI probe: normal daemon dispatch must carry strict and ultra while preserving the outputter control, and standalone must retain the same tuning. Also check each override independently and the unset case so restoration does not replace configured defaults with a hardcoded preset. This checks option propagation, not whether a strict device run passes its assertions.

Additional context

The standalone branch is a source-supported bypass, and the probe confirms it forwards the options. Its full device execution was not tested. The default classes independently resolve to final verification and flash Explorer; user configuration can supply other defaults, so those factory values are not asserted for every daemon installation.

Triage assessment

  • Impact level: P2
  • Assessment status: supported
  • Impact basis: The default CLI route silently drops two explicit per-run behavior settings, so requests can run with different verification and Explorer settings. The bounded probe proves propagation failure; it does not claim a false-positive assertion or device result.
  • Workaround status: unverified
  • Workaround basis: Adding --standalone forwards both options in the executed boundary probe, but a complete device run through that bypass was not exercised.

Activity

  1. added a commit that references this issue on Oct 28, 2026
    94e0f70
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions