Skip to content

[agent_stop] Prevent potential negative duration calculation due to clock skew #338277

Closed

Description

Overview

In the agent_stop command handler, the duration of an active turn is calculated as:
Timestamp::now().as_millisecond() - started_at.as_millisecond()

If minor clock skew occurs between the agent host and client, this subtraction can potentially result in an invalid negative duration value.

Proposed Solution

Add a defensive check during duration calculation to ensure that if started_at appears to be in the future relative to Timestamp::now(), the duration defaults safely to 0.

Activity

  1. added
    agent-host
    on Sep 27, 2026
  2. added
    unreleased
    on Oct 5, 2026
  3. added this to the 1.142.0 milestone on Oct 5, 2026
  4. added
    insiders-released
    and removed
    unreleased
    on Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-hostinsiders-released

Type

No type

Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions