nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[Enhancement] Tool output line cap and /expand follow-ups (#1298 #945)

Open coralsundy opened this issue 2 months ago • 3 comments

Description

The changes in #1298 by @addyCooks was created before my #945, without him knowing bashoutput can be shown with agent calling execute_bash. The /expand definitely changed a bit on how I would implement.

Also upon testing, I have found out some inconvinience I am facing, several vars being used to similar purposes, and in general ctrl+o should be renamed as its name is duplicate with what we have on /expand now. So I decided to open this issue for improvement.

  1. No opt-out for the cap. A preference (like #945's showAgentBashOutput) or a toggle to show tool cards uncapped would help read a whole write_file / string_replace / diff_edit at a glance. Today the only route to full output is /expand <n> per result, which is slow when reviewing edits. Enhancement, not a defect: the capped default should stay.

  2. /expand <n> is a silent no-op for search_file_contents. Its formatter hand-rolls a 20-line slice and never reads ToolOutputContext, so expanding reprints the same capped card while reporting success. (The cap came from #1311, not #1298.)

  3. Agent bash cards never show their /expand n. The id is recorded and /expand n works, but the card is queued with no context provider, so BashProgress has no expandId and prints no hint. You must run bare /expand and guess the row.

  4. Bare /expand truncates silently: it keeps 50 results but lists the last 20 with no indication.

  5. /clear calls clearExpandableToolResults, which empties the array but not nextExpandId, so ids keep climbing for the life of the process.

  6. Three cap notes, two directions, three wordings: CappedLines (first 20, +N more lines - /expand n), BashProgress (last 20, +N earlier lines, no hint), search_file_contents (first 20, no hint). Tail direction is right for bash, since errors are at the end.

  7. The toggle is named for states that no longer match. "Expand Tool Results by default" and Ctrl+O's expand tool results hint describe the OFF state as full output, but OFF is now a 20-line card. Before #1298 both names were accurate (ON = one-line summary, OFF = full output); the cap made "expand" untrue while "compact" stayed correct. Rename to a summary-vs-card vocabulary: setting Summarize tool results: ON/OFF, hint ctrl-o show tool cards / ctrl-o summarize tool results, tips and docs "Toggle tool result summaries (Ctrl+O)".

  8. showAgentBashOutput gives bash a second escape from the compact summary, separate from the hardcoded ALWAYS_EXPANDED_TOOLS set (write_tasks, ask_user). Bash was never in that set - a spec asserts it - and before #945 its completed card folded into the tally like any other tool; We should still hide it within compact=ON. The implementation in #945 changed the behavior a bit too much.

Use Case

See above

Proposed Solution

See above

Alternatives Considered

See above

Additional Context

  • [x] I have searched existing issues to ensure this is not a duplicate
  • [x] This feature aligns with the project's goals (local-first AI assistance)

Implementation Notes (optional)

If you have thoughts on how this could be implemented, share them here

coralsundy avatar Sep 15 '26 15:09 coralsundy

Hi @akramcodez please assign me this as I will have a PR out soon.

I was not aware of @addyCooks 's PR beforehand, and the design should be much cleaner.

Thanks.

coralsundy avatar Sep 15 '26 15:09 coralsundy

Thanks for the thorough write-up, @coralsundy! Happy for you to take this. I hadn't realised agent bash output could be shown via #945 when I built #1298, so unifying the cap notes and the bash path makes sense.

Points 1–4 touch code from #1298, so feel free to tag me on the PR Agreed on the summary-vs-card naming too: "expand" stopped being accurate once the cap landed.

addyCooks avatar Sep 15 '26 19:09 addyCooks

sure @coralsundy 👍

akramcodez avatar Sep 16 '26 08:09 akramcodez