Skip to content

add taskoutput tool use formatter#945

Open
LasmarKhalifa wants to merge 1 commit into
06-05/tool-use-format-taskcreatefrom
06-05/tool-use-format-taskoutput
Open

add taskoutput tool use formatter#945
LasmarKhalifa wants to merge 1 commit into
06-05/tool-use-format-taskcreatefrom
06-05/tool-use-format-taskoutput

Conversation

@LasmarKhalifa

@LasmarKhalifa LasmarKhalifa commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

closes #932

Improves the formatting of the taskoutput tool use message.

Current output:
image.png

New output:
image.png

Copy link
Copy Markdown
Contributor Author

@LasmarKhalifa LasmarKhalifa force-pushed the 06-05/tool-use-format-taskcreate branch from 9ef9ff2 to a032e94 Compare June 8, 2026 16:28
@LasmarKhalifa LasmarKhalifa force-pushed the 06-05/tool-use-format-taskoutput branch from c383b7f to b5f9b74 Compare June 8, 2026 16:28
@LasmarKhalifa LasmarKhalifa linked an issue Jun 8, 2026 that may be closed by this pull request
@LasmarKhalifa LasmarKhalifa marked this pull request as ready for review June 8, 2026 20:55
Comment on lines +354 to +357
timeout_str = if timeout_ms
secs = timeout_ms / 1000.0
secs == secs.to_i ? "#{secs.to_i}s timeout" : "#{secs}s timeout"
end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is a bit counterintuitive to read. It deserves a short comment like "# don't display decimal values if seconds is a whole number", but even that is clunky.

You can make this clearer and also more elegant with ActiveSupport::NumberHelper

Suggested change
timeout_str = if timeout_ms
secs = timeout_ms / 1000.0
secs == secs.to_i ? "#{secs.to_i}s timeout" : "#{secs}s timeout"
end
timeout_str = if timeout_ms
seconds = number_to_rounded(timeout_ms, delimiter: ",", precision: 3, strip_insignificant_zeros: true)
"${seconds}s timeout"
end

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.

format_taskoutput

2 participants