Bug description
After a step runs for 241 seconds, the token tracking shows 0 in / 0 out and cost $0.0000.
[claudeflow] ✗ failed in 241348ms
[claudeflow] Tokens: 0 in / 0 out
[claudeflow] Cost: $0.0000
Expected behavior
Even if the step fails, token usage should be captured from Claude's response, since Claude clearly did work (it ran for 4 minutes reading files with tools).
Root cause hypothesis
When Claude returns an empty result (see #1), the JSON response parsing likely fails entirely, losing the usage field along with the result. The token/cost tracking should be resilient to partial failures — capture usage even when the result text is empty or schema validation fails.
Suggested fix
Parse usage from Claude's response independently of the result field. Even on failure, report actual tokens consumed.
Bug description
After a step runs for 241 seconds, the token tracking shows
0 in / 0 outand cost$0.0000.Expected behavior
Even if the step fails, token usage should be captured from Claude's response, since Claude clearly did work (it ran for 4 minutes reading files with tools).
Root cause hypothesis
When Claude returns an empty result (see #1), the JSON response parsing likely fails entirely, losing the
usagefield along with the result. The token/cost tracking should be resilient to partial failures — capture usage even when the result text is empty or schema validation fails.Suggested fix
Parse
usagefrom Claude's response independently of theresultfield. Even on failure, report actual tokens consumed.