Add dispatch duration report derived from dispatch timestamps #549

Closed
opened 2026-09-10 14:42:06 +00:00 by jared · 1 comment
Owner

no pipeline-level dispatch duration / route latency report

Problem

The user asked for this while investigating #528 (settlement timing). dispatches already has created_at, updated_at, completed_at, routed_at, stalled_at (Db.timestamp_columns, plugins/os-sdlc/lib/os_sdlc/model/db.rb). There is no gate_runs table; gate/verdict data lives in correction_rounds, violations, step_results, each with only created_at/updated_at. Per-dispatch duration and route latency are derivable without new columns.

Cases

  1. Given an implementation with N completed dispatches, when the durations report runs, then it lists dispatch id, node, agent type, created_at, completed_at, routed_at, duration_ms, and route_ms per dispatch.
  2. Given the same implementation, when the report runs, then it also prints totals: dispatch count, total duration, total route latency.
  3. Given --format md|json|csv, when passed, then output renders in that format, matching the existing violations subcommand's formats.

Approach

route_ms = routed_at - completed_at (routing happens after the dispatch completes in this pipeline). duration_ms = completed_at - created_at. Copy the violations command pattern (plugins/os-sdlc/lib/os_sdlc/pipeline/cli.rb, plugins/os-sdlc/lib/os_sdlc/pipeline/dispatch_commands.rb) and its ViolationsReport rendering. DispatchSummary (plugins/os-sdlc/lib/os_sdlc/model/implementation/dispatch_summary.rb) already computes elapsed_s per dispatch but has no route latency or totals.

Required work:

  1. Add a duration value object under plugins/os-sdlc/lib/os_sdlc/model/implementation/ (Data.define, per ADR-0167)
  2. Add a durations IMPLEMENTATION_ID --format md|json|csv Thor subcommand beside violations in dispatch_commands.rb
  3. Minitest coverage for the value object and the subcommand's three formats; no schema change

Acceptance criteria

  1. Given an implementation id with completed dispatches, when durations IMPLEMENTATION_ID runs, then it prints per-dispatch duration_ms and route_ms plus totals.
  2. Given --format json, when passed, then the output parses as valid JSON with the same fields as the md/csv forms.

Owner sketch

class OsSdlc::Model::Implementation::DispatchDuration
end

Non-goals

No gate_runs table or new columns; this ticket does not touch #528's throwaway timing probe.

Origin

  • Trigger: User request on 2026-09-10 while investigating #528
  • Root candidate: #528
  • Where: plugins/os-sdlc/lib/os_sdlc/model/db.rb, plugins/os-sdlc/lib/os_sdlc/pipeline/cli.rb, plugins/os-sdlc/lib/os_sdlc/pipeline/dispatch_commands.rb
  • Session: 8d211345-da76-4772-b616-ed676eb86ad1
# no pipeline-level dispatch duration / route latency report ## Problem The user asked for this while investigating #528 (settlement timing). `dispatches` already has `created_at`, `updated_at`, `completed_at`, `routed_at`, `stalled_at` (Db.timestamp_columns, plugins/os-sdlc/lib/os_sdlc/model/db.rb). There is no `gate_runs` table; gate/verdict data lives in `correction_rounds`, `violations`, `step_results`, each with only `created_at`/`updated_at`. Per-dispatch duration and route latency are derivable without new columns. ## Cases 1. Given an implementation with N completed dispatches, when the durations report runs, then it lists dispatch id, node, agent type, created_at, completed_at, routed_at, duration_ms, and route_ms per dispatch. 2. Given the same implementation, when the report runs, then it also prints totals: dispatch count, total duration, total route latency. 3. Given `--format md|json|csv`, when passed, then output renders in that format, matching the existing `violations` subcommand's formats. ## Approach `route_ms = routed_at - completed_at` (routing happens after the dispatch completes in this pipeline). `duration_ms = completed_at - created_at`. Copy the `violations` command pattern (plugins/os-sdlc/lib/os_sdlc/pipeline/cli.rb, plugins/os-sdlc/lib/os_sdlc/pipeline/dispatch_commands.rb) and its ViolationsReport rendering. DispatchSummary (plugins/os-sdlc/lib/os_sdlc/model/implementation/dispatch_summary.rb) already computes elapsed_s per dispatch but has no route latency or totals. Required work: 1. Add a duration value object under plugins/os-sdlc/lib/os_sdlc/model/implementation/ (Data.define, per ADR-0167) 2. Add a `durations IMPLEMENTATION_ID --format md|json|csv` Thor subcommand beside `violations` in dispatch_commands.rb 3. Minitest coverage for the value object and the subcommand's three formats; no schema change ## Acceptance criteria 1. Given an implementation id with completed dispatches, when `durations IMPLEMENTATION_ID` runs, then it prints per-dispatch duration_ms and route_ms plus totals. 2. Given `--format json`, when passed, then the output parses as valid JSON with the same fields as the md/csv forms. ## Owner sketch ```ruby class OsSdlc::Model::Implementation::DispatchDuration end ``` ## Non-goals No `gate_runs` table or new columns; this ticket does not touch #528's throwaway timing probe. ## Origin - Trigger: User request on 2026-09-10 while investigating #528 - Root candidate: #528 - Where: plugins/os-sdlc/lib/os_sdlc/model/db.rb, plugins/os-sdlc/lib/os_sdlc/pipeline/cli.rb, plugins/os-sdlc/lib/os_sdlc/pipeline/dispatch_commands.rb - Session: 8d211345-da76-4772-b616-ed676eb86ad1
Author
Owner

Resolution

Done: durations IMPLEMENTATION_ID --format md|json|csv Thor subcommand reports id, agent_type, duration_ms, route_ms per dispatch plus totals from existing timestamps; no schema change

Evidence: commit 326aa792; os-sdlc suite 1438 runs 0 failures

Follow-ups: none

## Resolution **Done:** durations IMPLEMENTATION_ID --format md|json|csv Thor subcommand reports id, agent_type, duration_ms, route_ms per dispatch plus totals from existing timestamps; no schema change **Evidence:** commit 326aa792; os-sdlc suite 1438 runs 0 failures **Follow-ups:** none
jared closed this issue 2026-09-24 20:34:27 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jared/cc-os#549
No description provided.