Skip to content

Surface open timing breakdown in --debug JSON output #1015

Closed

Description

@thymikee

Problem

completeOpenCommand computes a full per-phase timing breakdown (relaunchCloseDurationMs, runnerPrewarmScheduled/Waited/DurationMs, openDispatchDurationMs, launchUrlDurationMs, postOpenSettleDurationMs, totalDurationMs) and records it in the session action log — but the public JSON projection strips timing, so the only way to see it is the per-request --debug ndjson. During the #1010 investigation an entire perf session concluded with "add open timing instrumentation" as its recommendation — for instrumentation that already existed but was invisible.

Proposal

Include timing in the open command's --json output when --debug is active (keeping default output lean for agent-token efficiency). Alternatively document the ndjson location in help debugging. Maintainer call on which surface.

Activity

  1. added
    enhancement
    backlog
    on Jul 2, 2026
  2. thymikee commented on Jul 2, 2026

    @thymikee
    MemberAuthor

    Recommendation: keep open success JSON unchanged and surface this through the existing debug diagnostics path rather than adding a debug-only timing field to AppOpenResult. Today the timing breakdown exists in the handler/session action log, but the typed client + serializeOpenResult intentionally omit it, so putting it into open --json is a deliberate public contract addition.\n\nConcrete shape I’d recommend: under --debug, emit one bounded open_timing diagnostic event to the request log at requestLogPath with the existing breakdown (relaunch/runtime-hints/runner-prewarm/open-dispatch/launch-url/post-open-settle/total), and document in help debugging that open --debug --json exposes requestLogPath for this evidence. That keeps default output lean and avoids a debug-only success JSON variant.\n\nIf maintainers prefer a JSON field instead, I can wire it through the typed client/serializer path, but that seems like the broader surface change.

  3. thymikee commented on Jul 2, 2026

    @thymikee
    MemberAuthor

    Agreed — the debug-diagnostic shape is strictly better than a debug-only variant of the success JSON: no public contract change, no typed-client/serializer wiring, and the evidence lands next to the per-phase timers that already live in the request log.

    Implementation note: it's ~5 lines. completeOpenCommand already assembles the full OpenTiming and computes totalDurationMs right before buildOpenResult; a single emitDiagnostic({ level: 'info', phase: 'open_timing', durationMs: timing.totalDurationMs, data: timing }) there flows into requestLogPath under --debug through the existing diagnostics pipeline — no new plumbing. Plus one line in help debugging pointing at open --debug --json → requestLogPath.

    Happy to include this in a small follow-up PR (it composes with the prewarm-scheduling consolidation that just landed on the #1011 branch, which made the timing fields write-only again).

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

    backlogenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions