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

@LasmarKhalifa LasmarKhalifa force-pushed the 06-05/tool-use-format-taskcreate branch from a032e94 to ed1d90e Compare June 17, 2026 20:46
@LasmarKhalifa LasmarKhalifa force-pushed the 06-05/tool-use-format-taskoutput branch 2 times, most recently from e296b2b to 78a46fb Compare June 18, 2026 19:05
@LasmarKhalifa LasmarKhalifa force-pushed the 06-05/tool-use-format-taskcreate branch from ed1d90e to 58bf9f3 Compare June 18, 2026 19:05
@LasmarKhalifa LasmarKhalifa force-pushed the 06-05/tool-use-format-taskoutput branch from 78a46fb to 27a949f Compare June 18, 2026 19:24
@LasmarKhalifa LasmarKhalifa force-pushed the 06-05/tool-use-format-taskcreate branch 2 times, most recently from 15fb9f1 to caabfa0 Compare June 18, 2026 19:51
@LasmarKhalifa LasmarKhalifa force-pushed the 06-05/tool-use-format-taskoutput branch from 27a949f to 52d2033 Compare June 18, 2026 19:51
@LasmarKhalifa LasmarKhalifa force-pushed the 06-05/tool-use-format-taskcreate branch from caabfa0 to ac1a55e Compare June 18, 2026 20:14
@LasmarKhalifa LasmarKhalifa force-pushed the 06-05/tool-use-format-taskoutput branch from 52d2033 to 0f69410 Compare June 18, 2026 20:14
@LasmarKhalifa LasmarKhalifa force-pushed the 06-05/tool-use-format-taskcreate branch from ac1a55e to c123341 Compare June 18, 2026 21:12
@LasmarKhalifa LasmarKhalifa force-pushed the 06-05/tool-use-format-taskoutput branch from 0f69410 to 26e1c31 Compare June 18, 2026 21:12
@LasmarKhalifa LasmarKhalifa force-pushed the 06-05/tool-use-format-taskcreate branch from c123341 to 1ec1592 Compare June 18, 2026 21:46
@LasmarKhalifa LasmarKhalifa force-pushed the 06-05/tool-use-format-taskoutput branch from 26e1c31 to 3598bcf Compare June 18, 2026 21:46
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