Skip to content

feat: no-truncate param for debug#1207

Merged
afjcjsbx merged 4 commits intosipeed:mainfrom
afjcjsbx:feat/debug-mode-no-truncate
Mar 10, 2026
Merged

feat: no-truncate param for debug#1207
afjcjsbx merged 4 commits intosipeed:mainfrom
afjcjsbx:feat/debug-mode-no-truncate

Conversation

@afjcjsbx
Copy link
Copy Markdown
Collaborator

@afjcjsbx afjcjsbx commented Mar 7, 2026

📝 Description

This PR introduces a new --no-truncate CLI flag to the gateway command to improve the debugging experience.

Currently, large messages, prompts, and JSON payloads are shortened in the logs via utils.Truncate() to prevent console clutter. However, this makes it difficult to inspect full LLM responses or complex tool arguments during development.

This feature:

  • Adds a global toggle (disableTruncation via atomic.Bool) in pkg/utils/string.go.
  • Exposes a --no-truncate flag in the Cobra gateway command.

🗣️ Type of Change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 📖 Documentation update
  • ⚡ Code refactoring (no functional changes, no api changes)

🤖 AI Code Generation

  • 🤖 Fully AI-generated (100% AI, 0% Human)
  • 🛠️ Mostly AI-generated (AI draft, Human verified/modified)
  • 👨‍💻 Mostly Human-written (Human lead, AI assisted or none)

🔗 Related Issue

(Leave blank if there is no linked issue)

📚 Technical Context (Skip for Docs)

  • Reference URL: N/A
  • Reasoning: Advanced debugging of AI agents often requires full visibility into the LLM's context window, prompt construction, and tool execution arguments. Instead of hardcoding log changes or removing truncations globally, this optional flag allows developers to inspect the raw, unclipped strings safely on demand, while keeping default production logs clean.

🧪 Test Environment

  • Hardware: Mac M1
  • OS: macOS
  • Model/Provider: All
  • Channels: CLI

📸 Evidence (Optional)

Click to view Logs/Screenshots

Command usage validation:

$ picoclaw gateway --no-truncate
Error: the --no-truncate flag requires the --debug (-d) flag to be set

@sipeed-bot sipeed-bot Bot added type: enhancement New feature or request domain: agent go Pull requests that update go code labels Mar 7, 2026
@afjcjsbx afjcjsbx changed the title feat: no-truncate param feat: no-truncate param for debug Mar 7, 2026
@afjcjsbx afjcjsbx requested review from lxowalle and mengzhuo March 9, 2026 12:13
Copy link
Copy Markdown
Collaborator

@huaaudio huaaudio left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! LGTM, solid targeted fix. One thing to suggest is that before we merge, try to make it documented in the CLI help and (optionally) the README.

Comment thread pkg/utils/string.go Outdated
// Handles multi-byte Unicode characters properly.
// If the string is truncated, "..." is appended to indicate truncation.
func Truncate(s string, maxLen int) string {
// If the no-truncate flag is active, it returns the integer string
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Return the full string?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

srry typo, fixed

@afjcjsbx
Copy link
Copy Markdown
Collaborator Author

afjcjsbx commented Mar 9, 2026

hi @huaaudio, thanks for the review, you are right! it was an oversight, added doc and shorthand flag

@afjcjsbx afjcjsbx merged commit 9cd2d21 into sipeed:main Mar 10, 2026
4 checks passed
fishtrees pushed a commit to fishtrees/picoclaw that referenced this pull request Mar 12, 2026
dj-oyu pushed a commit to dj-oyu/picoclaw that referenced this pull request Mar 14, 2026
dj-oyu pushed a commit to dj-oyu/picoclaw that referenced this pull request Mar 16, 2026
andressg79 pushed a commit to andressg79/picoclaw that referenced this pull request Mar 30, 2026
ra1phdd pushed a commit to ra1phdd/picoclaw-pkg that referenced this pull request Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: agent go Pull requests that update go code type: enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants