Repository navigation
Description
Summary
A completed recorded task can have steps in the session database while its compiled PASS-folder steps.json is []. artemis trace view consequently renders an empty step table. This report concerns step metadata only; it makes no claim about missing videos or other artifact types.
Steps to reproduce
From the main source checkout with its Python dependencies installed, run the following focused offline fixture with PYTHONPATH=.. It uses the real DataEngine step writer, SDK finalizer, and CLI trace viewer. It replaces IPC publication/connection and device-lock annotation with no-ops, supplies synthetic task/context objects instead of launching a task, waits for step writes to finish before finalization, and cleans up its temporary directory. No model, phone, host daemon, or screenshots are needed.
import asyncio
import json
import os
import tempfile
from datetime import datetime
from pathlib import Path
from types import SimpleNamespace
from unittest.mock import patch
root = Path(tempfile.mkdtemp(prefix='artemis-trace-probe-'))
os.environ['ARTEMIS_APP_DIR'] = str(root / 'app-state')
os.environ['ARTEMIS_TRACES_DIR'] = str(root / 'fixture' / 'traces')
os.environ['ARTEMIS_CONFIG_PATH'] = str(root / 'no-config.json')
import artemis.data_engine.engine as engine_module
from artemis.data_engine.engine import DataEngine
from third_party.mobile_use.sdk.agent import AgentBase
from third_party.mobile_use.utils.media import create_steps_json_from_trace_folder
from artemis.interfaces.cli.commands.trace import view_trace
class OfflineEngine(DataEngine):
def _connect_ipc_locked(self):
return None
def _publish(self, *args, **kwargs):
return None
traces = root / 'fixture' / 'traces'
output = root / 'fixture' / 'output'
output.mkdir(parents=True, exist_ok=True)
name = 'synthetic-task'
(traces / name).mkdir(parents=True, exist_ok=True)
context = SimpleNamespace(execution_setup=SimpleNamespace(traces_path=traces, trace_name=name), device=None, run_outcome=None)
context.data_engine = OfflineEngine(context)
with patch('artemis.runtime.DeviceExecutionLock.annotate_active_owner'):
context.data_engine.start_session('Synthetic trace compilation fixture', session_id='synthetic-session')
for action in ['click', 'click', 'report_task_status']:
context.data_engine.record_step(action_taken={'action': action})
for thread in list(context.data_engine._pending_threads):
thread.join()
# Disable log-to-DB capture before the finalizer; step storage is already complete.
engine_module._CURRENT_DATA_ENGINE = None
assert len(context.data_engine.storage.get_steps('synthetic-session')) == 3
task = SimpleNamespace(status='completed', created_at=datetime.now(), request=SimpleNamespace(record_trace=True, trace_path=output), get_name=lambda: name)
asyncio.run(AgentBase._finalize_tracing(SimpleNamespace(_tmp_traces_dir=traces), task, context))
compiled = next(output.glob('synthetic-task_PASS_*'))
result = {
'db_steps': len(context.data_engine.storage.get_steps('synthetic-session')),
'session_status': context.data_engine.storage.get_session('synthetic-session').status,
'compiled_steps': json.loads((compiled / 'steps.json').read_text()),
}
print('PROBE_RESULT', json.dumps(result, sort_keys=True))
print('TRACE_VIEW_BEGIN')
view_trace(compiled.name, output)
print('TRACE_VIEW_END')
control = root / 'fixture' / 'legacy-control'
control.mkdir(parents=True, exist_ok=True)
(control / '123.json').write_text('{"action":"click"}')
create_steps_json_from_trace_folder(control)
print('LEGACY_CONTROL', json.dumps(json.loads((control / 'steps.json').read_text())))
import shutil
shutil.rmtree(root)The fixture is a reproduction of the DB-to-compiled-artifact boundary, rather than a new end-to-end task run. Separately, supplied evidence from a completed Flash task on the same source baseline showed three session-API step records and an empty compiled PASS steps.json. That live task was not rerun for this report.
Expected behavior
For a recorded task whose session steps are already persisted, trace finalization and artemis trace view should preserve and display those steps. The CLI describes view as a step-by-step summary of a recorded trace session; a successfully compiled trace should not silently represent three persisted steps as an empty sequence.
Actual behavior
The focused fixture exited successfully and produced the following discriminating output:
Found 0 steps to compile
PROBE_RESULT {"compiled_steps": [], "db_steps": 3, "session_status": "completed"}
Between TRACE_VIEW_BEGIN and TRACE_VIEW_END, the CLI displayed only the step/action/reasoning column headers and no rows. The legacy-file control produced one compiled entry:
Found 1 steps to compile
LEGACY_CONTROL [{"timestamp": 123, "data": "{\"action\":\"click\"}"}]
Evidence
- Expected source:
artemis/interfaces/cli/commands/trace.py:72-104documents and implements the recorded trace's step-by-step summary;TaskRequestBase.record_traceinthird_party/mobile_use/sdk/types/task.pyenables recording, andartemis/sdk/agent.py:282-340prepares the task trace and starts its DataEngine session. - Failure source: The executed fixture above calls
DataEngine.record_step()andAgentBase._finalize_tracing()and compares persisted steps with the generated JSON and CLI output.artemis/data_engine/engine.py:852-952writesStepRecordobjects to SQLite;third_party/mobile_use/sdk/agent.py:885-928calls the folder compiler;third_party/mobile_use/utils/media.py:192-206reads only numeric-basename JSON files and writes the collected list tosteps.json. - Evidence provenance: observed
- Local verification: reproduced
- Reproduction completeness: complete
The focused synthetic fixture and its legacy-file control were executed; the additional live Flash-task observation is supplied evidence. Reproduction is complete for the offline persistence/finalization/view path; a new end-to-end phone/model task was not executed.
The existing media unit test exercises a timestamp-named JSON file, which the control confirms still compiles. The failing fixture instead uses the current DB-backed step writer. This source evidence identifies the disconnected boundary without prescribing how to reconcile the storage and artifact formats.
Runtime or environment
Fresh google/artemis default-branch checkout at 351ca8422f7b5b54e80a9c1ce03a222e02415b6b (main), project metadata version 1.0, CPython 3.12.15, macOS. No published GitHub releases or tags were available when checked. The installed dependency environment was reused read-only only after confirming the fresh checkout's uv.lock matched; module import identity pointed at the fresh checkout. The supplied live observation used this same source baseline.
Restoration check
With the same three already-persisted synthetic steps, finalization must retain a nonempty, faithful step history and the recorded-trace viewer must show those steps. Verify the session still has all three rows and the legacy-file control still preserves its step, so a passing result cannot come from dropping DB rows, suppressing recording, or discarding existing trace inputs. Choose the implementation and test design freely.
Triage assessment
- Impact level: P2
- Assessment status: supported
- Impact basis: Recorded tasks can finish correctly while their compiled step artifact and CLI step summary omit the persisted action history, reducing trace inspection and debugging reliability. One supplied completed Flash task and the focused offline fixture support this scope; other profiles and population frequency were not measured.
- Workaround status: available
- Workaround basis: The session database retains the step rows; the supplied live observation obtained all three steps through the session API, and the focused fixture read all three through StorageManager. Preserve the database and inspect that retained history instead of relying on the compiled JSON.
Activity
aron-intframe commentedon Oct 25, 2026
Reproduced your fixture verbatim on Linux at the same baseline (
351ca8422f7b5b54e80a9c1ce03a222e02415b6b), CPython 3.12.3, and got the discriminating lines unchanged:Cause in one line: nothing in the tree writes the inputs the folder compiler reads.
create_steps_json_from_trace_foldercollects only digit-named.jsonfiles (third_party/mobile_use/utils/media.py:196) andcreate_gif_from_trace_folderonly*.jpeg(media.py:171), while step metadata now goes to SQLite viaDataEngine.record_step(artemis/data_engine/engine.py:853) and screenshots into a content-addressed store at<traces>/images/<sha256>.jpg(engine.py:832-834). The only.jpegfilename references left in the tree are the two consumers, with no producer:and no module builds a digit-named
.jsonpath anywhere, so_finalize_tracing(third_party/mobile_use/sdk/agent.py:920-921) compiles a folder that nothing populates.Found 0 images to compilein your own run is the same defect on the GIF path.Three things I ran that the report does not cover.
1. Restoring the legacy writer alone would not fix
artemis trace view. The compiler emits{"timestamp": int, "data": "<raw json string>"}, but the viewer readsstep,actionandmotivation/thought(artemis/interfaces/cli/commands/trace.py:99-101). I compiled a legacy123.jsonwhose contents already carry exactly those keys, then viewed it:One row, every cell a dash. The compiler and the viewer never agreed on a schema, so your legacy control is green at the file level only. Any fix that re-populates per-step files has to change the shape too.
2.
artemis trace listpresents the broken trace as having steps. It tests existence, not content (trace.py:59-60), and the compiler always writes the file, so a zero-step trace is indistinguishable from a good one in the inventory view:emptythere holdssteps.jsoncontaining[], which is exactly what a finished task now produces.3. A restoration check that passes. Emitting the viewer's own schema from
StepRecordrows (step_number,action_taken["action"],summary) renders all three steps:That points at the finalizer rather than
media.pyas the place to source from: readstorage.get_steps(session_id)while the session id is still in hand and write that, and resolve images for the GIF throughDataEngine.get_image_path()or drop the GIF stage.One note on test design.
tests/unit/utils/test_media.pypasses today (1 passed in 0.02s) and will keep passing under any fix, because it hand-writes the123.jsoninput that no production path produces. It pins the compiler's file format, not the property that persisted steps survive finalization. A regression test that would have caught this has to start atrecord_stepand assert on the compiledsteps.jsonor on theview_tracerows.A writer that finds nothing, logs the zero and reports success is a failure shape we keep hitting ourselves; the catalog entry and the self-test we use against it are in our repo (ours): https://github.com/aron-intframe/agent-guards