Fixed a critical issue where the agent was truncating command output to 500 characters, causing incomplete display of list commands and other verbose output.
When users ran commands like list resumes, the output was being cut off mid-display:
========================================================================================================================
📋 RESUME LIST (9 total)
========================================================================================================================
# Resume Name Master Updated Description
-------------------------------------------------------------------------------------------------------------------
💡 What would you like to do next?
1. Review the output
2. Run related commands
3. Check the results
The actual resume data was missing because the ResultAnalyzer was truncating all output to 500 characters.
File: src/agent/result_analyzer.py
Lines: 181, 190, 193, 199
Issue: Hardcoded 500-character limit on all command output
# Old code - truncates everything to 500 chars
clean_output = output.strip()[:500]Implemented context-aware truncation that:
- Detects list/display commands
- Uses 10,000 character limit for list commands
- Keeps 500 character limit for other commands
- Passes command context to the formatter
File: src/agent/result_analyzer.py
- Updated
_format_message()method signature to acceptcommandparameter - Added list command detection logic
- Implemented dynamic
max_output_lengthbased on command type - Updated
analyze()method to pass command to formatter
File: tests/test_result_analyzer.py
- Updated existing test to pass command parameter
- Added
test_list_command_full_output()- verifies list commands show full output - Added
test_non_list_command_truncation()- verifies other commands still truncate
The following commands now show full output (up to 10,000 characters):
list_resumes.pylist_job_listings.pylist_experiences.py- Commands with
--listflag - Commands with
--showflag - Commands with
--format simpleflag - Commands with
--format jsonflag
Resume entries shown: 0 (truncated)
Output length: ~500 characters
Resume entries shown: 9 (all resumes)
Output length: ~1,945 characters
All resume data visible and properly formatted
python -m pytest tests/test_result_analyzer.py -v
# Result: ✅ 18 passed# Through agent API
curl -X POST http://localhost:5000/api/agent/chat \
-H "Content-Type: application/json" \
-d '{"message": "run: python src/utils/list_resumes.py"}'
# Result: ✅ All 9 resumes displayed with full formatting- ✅ Resume list now displays all resumes
- ✅ Job listings display completely
- ✅ Experience lists show all entries
- ✅ Any verbose output is now visible
- ✅ Non-list commands still truncate at 500 chars (prevents token bloat)
- ✅ Error messages still truncated appropriately
- ✅ All existing tests pass
To adjust truncation limits, modify src/agent/result_analyzer.py:
# Line ~180 in _format_message()
max_output_length = 10000 if is_list_command else 500Change these values to:
- Increase list command limit: Change
10000to desired value - Increase other command limit: Change
500to desired value
- Resolves: Agent Output Truncation Issue (
.github/ISSUE_TEMPLATE/agent_output_truncation.md) - Implements: Option 4 from proposed solutions (Command-Specific Handling)
- Configurable Limits: Add environment variables for truncation limits
- Pagination: Implement "show more" functionality for very large outputs
- Smart Truncation: Preserve complete lines when truncating
- Output Caching: Cache full output for later retrieval
src/agent/result_analyzer.py- Core fixtests/test_result_analyzer.py- Added testssrc/utils/list_resumes.py- Windows emoji encoding fix (related)
- All unit tests pass (18/18)
- Manual testing confirms full output display
- List commands show complete data
- Non-list commands still truncate appropriately
- Error handling unchanged
- Backward compatible with existing code