Skip to content

fix(logging): carry the work's duration on AI log lines - #1544

Merged
MBombeck merged 2 commits into
mainfrom
fix/ai-line-duration
Nov 25, 2026
Merged

MBombeck merged 2 commits into
mainfrom
fix/ai-line-duration

Conversation

@MBombeck

Copy link
Copy Markdown
Owner

ai.chain.served, ai.chain.failed and ai.job.failed carried duration_ms=0 whatever the work took, a ten-minute document read included. Each is a signal line built and finished in one step, so only the writing of the line was timed.

  • emitSignal / emitOutcome take an optional durationMs. The chain wrapper times each provider call; trackAiJob times the job and hands it to its failure line. A signal that cannot know a duration leaves the field out instead of claiming zero.
  • The AI providers guide explains the two codes: the chain line's code is the OS error code behind the failure kind (empty for our own response timeout), the job line's code the job's closed code such as provider_timeout.

Tests: signal line duration, chain call timing under fake timers, job failure line timing (fails before the change).

Refs #1404

ai.chain.served, ai.chain.failed and ai.job.failed read duration_ms=0
whatever the work took, a ten-minute document read included: each is a
signal line built and finished in one step, so the only thing timed was
the writing of the line.

emitSignal and emitOutcome take an optional durationMs. The chain wrapper
times each provider call from request to answer or failure, and
trackAiJob times the job and hands it to the failure line. A signal that
cannot know a duration now leaves the field out instead of claiming zero.

The AI providers guide explains the two codes: the chain line's code is
the operating system's error code behind the failure kind, empty for
HealthLog's own response timeout, while the job line carries the job's
closed code such as provider_timeout.

Refs #1404
@MBombeck
MBombeck merged commit d0427c2 into main Nov 25, 2026
40 checks passed
@MBombeck
MBombeck deleted the fix/ai-line-duration branch December 1, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant