Status: approved implementation contract.
Scope: Desktop local Off-Peak creation and automatic turns. This document is the canonical telemetry contract for V1 and overrides older Off-Peak proposal text in
docs/monitoring/automation-message-telemetry.md.
V1 adds only:
off_peak_task_create_result, for every submitted
Off-Peak creation attempt;message_completion and agent_step
events.V1 does not add exposure/form funnel events, extra lifecycle events, a new
aggregator, a persistent outbox, restart replay, or accurate step-level token
accounting. Background Off-Peak turns do not emit send_btn.
The implementation uses the existing business telemetry route. Desktop reports
to POST /api/v1/event/report on the active ZCode endpoint. Web and mobile keep
reportTelemetryEvent as a no-op. The new contract is never sent directly to
ARMS.
| Field | Value |
|---|---|
element_name |
off_peak_task_create_result |
event_region |
app.session for a homepage template; app.automations for an Automations template or direct create |
event_type |
result |
event_text |
empty string |
event_value |
omitted |
event_extra_detail |
string-valued fields only |
The source, template ID, selected model, and provider identifier are frozen at submit time before any asynchronous ticket or persistence work starts. Each submit attempt emits exactly one final result event after the structured business result is available.
Common fields:
| Field | Contract |
|---|---|
result |
success or failure |
template_id |
stable Client Scenes item ID; item-* is forwarded unchanged, with no compatibility mapping to legacy unprefixed local IDs; empty string for direct create |
model_name |
model selected by the submitted creation form |
model_provider |
stable Off-Peak model provider ID |
provider_name |
non-sensitive stable provider value; URL-derived values are hostname only |
Success-only fields:
| Field | Contract |
|---|---|
off_peak_task_id |
stable Off-Peak task correlation ID |
ticket_initial_state |
key is always present |
queue_position |
key is always present; empty string when absent |
Failure-only fields:
| Field | Contract |
|---|---|
failure_stage |
stable stage below |
error_category |
stable category below |
error_code |
key is always present; empty string when no stable code exists |
Stable failure mapping:
failure_stage |
error_category |
Meaning |
|---|---|---|
client_validation |
client_validation |
submitted data failed local validation |
ticket_request |
eligibility_3101 |
server rejected Off-Peak eligibility |
ticket_request |
quota_3103 |
server rejected the daily ticket quota |
ticket_request |
network |
RPC or network request failed |
ticket_request |
invalid_response |
response envelope or ticket body was invalid |
local_persist |
local_persist |
local task/scheduling state could not be persisted |
| current stage | unknown |
uncategorized failure |
RPC transport, network, and response parsing remain in
failure_stage=ticket_request; error_category distinguishes them. Stable
server business codes survive the service/RPC boundary. UI toast selection uses
the category/code pair and never parses raw error text.
submit snapshot
source/template/model/provider
|
v
OffPeakTaskService.createTask
validate -> ticket request -> local persist
|
v
{ ok: true, ... } | { ok: false, stage/category/code, ... }
|
+------> UI result/toast/navigation/task execution
|
`------> fire-and-forget business telemetry
POST active ZCode /api/v1/event/report
bounded in-memory retry + bounded app-quit drain
final failure is swallowed by the UI helper
Telemetry starts only after the business result exists and is not awaited by UI
result handling. A reporting failure must not change the create result, toast,
navigation, scheduler wake-up, or task execution. The common Desktop transport
reuses one logical event_id and request body for at most two attempts and joins
the normal app-quit barrier for at most two seconds. The canonical transport
contract is docs/monitoring/event-report-delivery-reliability.md.
The existing message_completion and agent_step detail maps gain:
message_source = off_peak_task
off_peak_task_id = <stable offPeakTaskId>
off_peak_run_type = init | resume
automation_id and off_peak_task_id are mutually exclusive in TypeScript
types and runtime schemas. Off-Peak attribution is transported through Desktop
Host sendPrompt, service/V4/CLI command boundaries, turn.started, and the
renderer telemetry supervisor.
Off-Peak scheduler dispatch
offPeakTaskId + offPeakRunType + new trace/message identity
|
v
Desktop Host sendPrompt (desktop-continuous)
|
v
service -> V4 sendText -> CLI runtime
|
v
turn.started { offPeakTaskId, offPeakRunType, sourceCommandId }
|
v
conversation telemetry supervisor
no send_btn
message_completion + agent_step
actual model facts from model.request.started
Attribution belongs to the triggering turn, not the session:
chat and has no
off_peak_task_id;off_peak_task_id;off_peak_run_type=init means the dispatch started without a bound
conversation and created a talk. This includes a replacement talk created
after a pre-binding dispatch failure;off_peak_run_type=resume means the dispatch reused an existing conversation
through resumeTask, including 3102 and app-restart continuation;off_peak_task_id -> talk_id one-to-many;message_id/sourceCommandId. The
off_peak_task_id is never reused as a message ID;off_peak_task_id nor
off_peak_run_type.Example:
offPeakTaskId OP-42
|
+-- talk A / message run-1 -> attributed, init
+-- talk A / message manual-1 -> chat, not attributed
+-- talk A / message resume-1 -> attributed, resume
`-- talk B / message retry-1 -> attributed, init if no talk was bound
The supervisor takes model/provider facts from model.request.started, not the
creation form. message_completion retains exact message-level token totals.
agent_step retains its existing placeholder token semantics.
Allowed values are stable IDs, enums, counts, timestamps, model identifiers, and an explicitly extracted hostname. Never report:
Telemetry helpers construct allowlisted payloads instead of serializing domain objects or thrown errors.
desktop-continuous is the only V1 delivery surface.web-remote-replayable remains unchanged and does not report this
event./remote shared-host attachment architecture is unchanged.workspaceIdentity continues to identify isolated workspace state while
workspacePath remains the filesystem/command path; neither is reported.Focused tests cover:
event_value, and privacy allowlisting;No dedicated WDIO telemetry spec is added. Existing Off-Peak E2E planning reuses OP01, OP02, OP05, and OP06, with deterministic protocol/service/supervisor tests covering telemetry-specific permutations.