Skip to content

fix(conversation): consistent formatting for execute_go_code in conversation print#159

Merged
spachava753 merged 1 commit intomainfrom
issue-158-consistent-code-mode-formatting
Jan 24, 2026
Merged

fix(conversation): consistent formatting for execute_go_code in conversation print#159
spachava753 merged 1 commit intomainfrom
issue-158-consistent-code-mode-formatting

Conversation

@spachava753
Copy link
Copy Markdown
Owner

Summary

Fixes #158 - Consistent output formatting for execute_go_code in conversation commands.

Changes

  • New: internal/agent/codemode_format.go - Shared formatting functions for execute_go_code tool calls and results
  • Updated: response_printer.go - Uses shared formatting functions
  • Updated: tool_result_printer.go - Uses shared formatting functions
  • Updated: conversation.go - Formats execute_go_code consistently with live sessions

Details

The conversation print command (cpe convo print) now renders execute_go_code tool calls as Go code blocks and results as shell code blocks, matching the formatting used during live sessions.

Key implementation details:

  • Shared ParseExecuteGoCodeToolCall() and FormatExecuteGoCodeToolCallMarkdown() functions eliminate duplication
  • isCodeModeResult() properly matches tool call IDs to results, handling cases with multiple tool calls
  • Comprehensive test coverage for all new functions

Testing

  • All existing tests pass
  • Added tests for new formatting functions
  • Added tests for isCodeModeResult() edge cases (multiple tool calls, ID matching)
  • Added integration test for conversation formatting with execute_go_code

…rsation print

The conversation print command now formats execute_go_code tool calls and results the same way as the response printer during live sessions. Previously, these were rendered as raw JSON, making conversation history harder to read.

Extracts shared formatting functions into codemode_format.go to eliminate duplication between the response printer, tool result printer, and conversation formatter. The isCodeModeResult function properly matches tool call IDs to tool results, ensuring correct formatting when multiple tool calls exist in a single message.

Closes #158
@spachava753 spachava753 merged commit bf8f59d into main Jan 24, 2026
@spachava753 spachava753 deleted the issue-158-consistent-code-mode-formatting branch April 10, 2026 00:23
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.

[Enhancement]: Consistent output formatting for execute code mode in conversation commands

1 participant