Skip to content

Conversation

@rindhuja-johnson
Copy link
Contributor

@rindhuja-johnson rindhuja-johnson commented Oct 28, 2025

Summary

This PR significantly improves the user experience for chunked log uploads by adding progressive event display, real-time progress indicators, and preventing duplicate result displays.

Key Improvements

1. Progressive Event Display for Chunks

  • Each chunk now displays agent events as they occur in real-time
  • Users see immediate feedback when backend starts processing (🚀 Agent started processing chunk X/Y)
  • Results are shown in professional boxed panels as each chunk completes
  • Eliminated the previous behavior where all events were displayed only after all chunks finished

2. Real-Time Progress Indicators

  • Added ⏳ Processing chunk X/Y... when chunk sending begins
  • Added 🚀 Agent started processing chunk X/Y when backend confirms processing started
  • Added stdout flush to ensure progress messages appear immediately during parallel execution
  • Final summary now says "All the chunks processed successfully. Look Above"

3. Duplicate Prevention

  • Fixed duplicate agent_completed result displays for single-chunk executions
  • Added tracking to prevent the same result from being displayed multiple times
  • Uses unique keys based on agent_name + run_id or result hash

4. Code Simplification

  • Simplified chunking logic and removed redundant code
  • Maintained parallel processing for optimal performance
  • Improved code organization and readability

User-Facing Changes

Before:

  • No visibility into chunk progress during processing
  • All events displayed at once after completion
  • Duplicate results for single-chunk files
  • Users couldn't tell if the process was hanging or working

After:

  • Clear three-stage progression for each chunk:
    1. ⏳ Processing chunk X/Y... (sending)
    2. 🚀 Agent started processing chunk X/Y (backend confirmation)
    3. Boxed result panel (completion)
  • No more duplicate displays
  • Users can track progress in real-time
  • Professional boxed display consistent across single and multi-chunk scenarios

Technical Details

  • Modified _send_chunked_logs to display events immediately via callback
  • Added displayed_agent_results set to prevent duplicate displays
  • Implemented stdout flush for immediate progress visibility in parallel execution
  • Preserved asyncio.gather() for parallel chunk processing
  • Updated final summary message for clarity

Testing

Tested with:

  • Single-chunk files (no duplication)
  • Multi-chunk files (progressive display works)
  • Parallel chunk processing (maintained performance)

Commits Included

  1. Simplify chunking logic in agent_cli
  2. Fix: Agent events not displayed for chunked files
  3. Fix: Add more logs and visibility to agent emissions
  4. Enhance agent_completed event display and chunk processing logic
  5. Fix: Stop agent execution after chunked responses
  6. Add detailed UX display for chunked log uploads
  7. Add real-time progress indicators for chunked uploads
  8. Prevent duplicate agent_completed event display
  9. Add boxed panel display for multi-chunk results
  10. Add stdout flush for immediate chunk progress display
  11. Add agent_started event notification and update final summary
  12. Prevent duplicate agent_completed result display for single chunks

Files Changed

  • scripts/agent_cli.py: Enhanced chunked upload display logic (276 additions, 735 deletions - net simplification while adding features)

🤖 Generated with Claude Code

rindhuja-johnson and others added 12 commits October 28, 2025 14:43
This commit refactors the chunking logic in `scripts/agent_cli.py` to simplify the process and improve concurrency.

The key changes are:

- Removed the "Chunk Burst" and "thread_ready_for_chunks" events. The CLI no longer waits for a signal from the backend to send chunks.
- Each chunk is now sent in a separate thread, allowing for parallel processing on the backend.
- Removed the `agent_aggregation_completed` event and associated logic. The client now treats chunk responses as regular messages.
- Simplified the `WebSocketClient` by removing obsolete attributes and methods related to the old chunking strategy.
This commit fixes a bug where agent events for chunked files were not
being displayed to the user.

The issue was that each chunk was creating a new WebSocketClient
instance with its own events list, and these events were not being
propagated to the main client responsible for console output.

The fix involves creating a shared events list in the AgentCLI class and
passing it to all WebSocketClient instances, including those created
for each chunk. This ensures that all events are collected in a single
place and displayed to the user.
…c\n\n- Reverted timeout change for agent_completed events to 300s based on user feedback.\n- Modified _send_chunks_in_parallel to return all chunk processing results, aiming to prevent unintended higher-level waits.\n- Implemented full, untruncated display of 'issue' details within agent_completed events by adding specific formatting in _get_base_event_format.
…onditional return in run_single_message to terminate execution after processing chunked messages. This prevents the CLI from proceeding to agent execution for non-chunked files when chunked data has been sent.
- Added comprehensive pre-upload summary for chunked executions matching non-chunked UX
- Displays provider, total entries, files read, and payload size
- Shows detailed file list with hash prefixes and entry counts
- Includes payload confirmation with chunk count and timestamp range
- Improves user visibility into chunked upload process

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Added live progress tracking showing "⏳ Processing chunk X/Y..." when each chunk starts
- Display completion status "✅ Chunk X/Y completed (Z/Y total)" after each chunk finishes
- Show final summary "🎉 All chunks processed! X/Y completed successfully"
- Removed duplicate agent event aggregation that was causing repetition
- Maintained parallel processing with asyncio.gather() for performance
- Used nonlocal variable to safely track completion count across async tasks

This improves user experience by providing real-time feedback during chunked file uploads, preventing the appearance of the process hanging while chunks are processed in parallel.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Skip initial formatted display for agent_completed events in _receive_events_with_display
- Events are still shown in the boxed "Final Agent Result" panel (lines 5866-5874)
- Fixes issue where agent_completed events were displayed twice for single-chunk files
- Maintains the nice boxed display format for final results

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Multi-chunk files now display agent completion results in boxed panels
- Panel title shows "Chunk X/Y Result" for each chunk
- Matches the display format used for single-chunk files
- Extracts result from completion event data (result/response/final_response)
- Falls back to formatted event display if no result found
- Provides consistent, professional display across all chunk scenarios

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Added sys.stdout.flush() after "⏳ Processing chunk X/Y..." message
- Ensures progress indicators are displayed immediately during parallel execution
- Prevents output buffering from hiding start messages
- Improves user visibility when multiple chunks process concurrently

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Added agent_started event notification after chunk is sent to backend
- Displays "🚀 Agent started processing chunk X/Y" message when backend confirms processing started
- Updated final summary message from emoji-based with chunk counts to "All the chunks processed successfully. Look Above"
- Added 30s timeout for agent_started event with stdout flush for immediate visibility

This improves user feedback by showing three clear stages:
1. ⏳ Processing chunk X/Y... (when sending)
2. 🚀 Agent started processing chunk X/Y (backend confirmation)
3. Chunk result in boxed panel (when complete)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Added tracking set `displayed_agent_results` to prevent duplicate displays
- Generate unique key for each result using agent_name + run_id or result hash
- Skip displaying result if already shown

This fixes the issue where single-chunk executions were showing the same
final result twice in boxed panels, likely due to backend emitting multiple
agent_completed events with slightly different wrapper structures.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@rindhuja-johnson rindhuja-johnson changed the title Enhanced chunked log Processing in Parallel feat: Enhance chunked log upload UX with progressive event display Oct 31, 2025
@rindhuja-johnson rindhuja-johnson merged commit 18c2f08 into main Oct 31, 2025
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.

2 participants