Record Class AgentRun

java.lang.Object
java.lang.Record
com.tnsai.quality.security.harness.AgentRun
Record Components:
agentId - stable id of the agent backend ("claude-opus-4-7")
agentVersion - agent backend version / model identifier; bumping this invalidates cached runs
startedAt - when the agent was invoked
finishedAt - when the run completed (or failed)
findingCount - number of findings produced
inputHash - hash of the input the agent saw (file content + prompt template); same hash + same agentVersion = cached run, skip
error - present when the run failed; absent on success

public record AgentRun(String agentId, String agentVersion, Instant startedAt, Instant finishedAt, int findingCount, String inputHash, Optional<String> error) extends Record
History entry for one ReviewAgentSpi invocation against a single FileRecord (TNS-291).

Used by the PipelineStateStore to make agent runs idempotent — a re-run sees the previous run's agentVersion + inputHash and skips when nothing has changed.

Since:
0.10.0 (TNS-291)
  • Constructor Details

    • AgentRun

      public AgentRun(String agentId, String agentVersion, Instant startedAt, Instant finishedAt, int findingCount, String inputHash, Optional<String> error)
      Creates an instance of a AgentRun record class.
      Parameters:
      agentId - the value for the agentId record component
      agentVersion - the value for the agentVersion record component
      startedAt - the value for the startedAt record component
      finishedAt - the value for the finishedAt record component
      findingCount - the value for the findingCount record component
      inputHash - the value for the inputHash record component
      error - the value for the error record component
  • Method Details

    • durationMs

      public long durationMs()
      Wall-clock duration of the run in milliseconds.
    • succeeded

      public boolean succeeded()
      true when the run completed without recording an error.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • agentId

      public String agentId()
      Returns the value of the agentId record component.
      Returns:
      the value of the agentId record component
    • agentVersion

      public String agentVersion()
      Returns the value of the agentVersion record component.
      Returns:
      the value of the agentVersion record component
    • startedAt

      public Instant startedAt()
      Returns the value of the startedAt record component.
      Returns:
      the value of the startedAt record component
    • finishedAt

      public Instant finishedAt()
      Returns the value of the finishedAt record component.
      Returns:
      the value of the finishedAt record component
    • findingCount

      public int findingCount()
      Returns the value of the findingCount record component.
      Returns:
      the value of the findingCount record component
    • inputHash

      public String inputHash()
      Returns the value of the inputHash record component.
      Returns:
      the value of the inputHash record component
    • error

      public Optional<String> error()
      Returns the value of the error record component.
      Returns:
      the value of the error record component