AIToday
AI Coding AssistantsZenn AI/MLPublished: Oct 12, 2026, 10:00 JST

spec-lane adapter's 30s timeout cut off 36.454s cost measurements

spec-lane adapter's 30s timeout cut off 36.454s cost measurements

3 Key Points

  1. What happened

    Running agent-cost directly on the same Claude Code session finished in 36.454 seconds, but the pre-fix AgentCostTelemetryAdapter stopped it at 30.019 seconds with a default 30_000ms timeout and only a "Command failed" message.

  2. Why it matters

    A completed measurement that takes longer than the caller's timeout gets killed before it finishes, so a slow-but-working job can look like a failure rather than a result. The diagnostic message gave no signal that the timeout was the cause rather than agent-cost itself or the input data.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, in your inbox every morning.

Context & Analysis

The investigation began when a session's cost record simply was not there. Running agent-cost directly on that same Claude Code session succeeded and took 36.454 seconds, while the pre-fix AgentCostTelemetryAdapter failed at 30.019 seconds. The adapter's default timeout was 30_000ms, so it killed a process that needed roughly six more seconds. The error message said only "Command failed", giving no indication that a timeout had occurred or that agent-cost itself might be at fault.

The fix in spec-lane v0.10.1 raises the default to 180_000ms and exposes the setting through a CLI option, with a new message that reports the timeout and SIGTERM. A re-run with a different session completed in 38.01 seconds and produced a CalibrationObservation and a cost_ledger entry, with emit-metrics reporting coverage.status=complete. The author notes this proves the measurement finished and was stored, but not that the estimated cost, the pricing catalog, or the task attribution are correct.

A separate concern is that usage-import can return exit 0 while recording measurement-incomplete and matched: false without writing to the ledger. The author's takeaway is that "measurement failed" and "cost was zero" are different states, and that collapsing them into one value makes it impossible to tell later whether a cost was truly zero or never measured.

FAQ
What was the actual cause of the missing cost record?
The adapter had a default timeout of 30_000ms, but measurement needed about 36 seconds. It stopped the process before it could finish and saved no data.
What happens to the data when measurement times out?
No record is written at all, not a zero-cost record. CalibrationObservation and cost_ledger were both empty, and emit-metrics reported coverage.status=no_data.
How is this fixed?
spec-lane v0.10.1 raises the default timeout to 180_000ms and lets users set a custom value with --agent-cost-timeout-ms, from 1ms up to 3_600_000ms.

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleJim Cramer: AMD's AI inference push opens growth