Files
ironclaw/tests
Henry Park 7206bf0694 feat(gateway): rich tool cards in history + thread processing indicator (#2477)
* feat(gateway): rich tool cards in history + thread processing indicator

History rendering:
- Add createActivityGroupFromHistory() to render the most recent turn's
  tool calls as the same .activity-tool-card DOM structure used during
  live SSE (expandable cards with icons, output preview, error details).
  Older turns keep the compact "N tools used" summary to limit DOM size.

Thread processing indicator:
- Track background threads with active agent work via processingThreads
  Set (fed by thinking, tool_started, stream_chunk SSE events for
  non-current threads; cleared on status "Done" and SSE reconnect).
- Render a .thread-processing spinner in the sidebar for threads that
  are actively processing.

E2E tests:
- test_message_persists_across_page_reload: message + response survive
  full page reload
- test_tool_calls_rendered_as_activity_cards_after_reload: echo tool
  renders as rich .activity-tool-card with data-status="success"
- test_tool_calls_expandable_after_reload: summary click expands cards
  container, card header click expands body
- test_background_thread_shows_processing_indicator: background thread
  gets unread badge after completion

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test(e2e): add processing indicator tests + review fixes

- test_processing_indicator_shows_on_thread_switch: verify completed
  turns show no stale "Processing..." when switching back
- test_processing_indicator_shows_for_incomplete_turn: verify the
  thinking indicator appears when switching to a mid-turn thread
  (gracefully skips if agent completes too fast to catch)
- Add activity_thinking/activity_thinking_text selectors to helpers.py

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(gateway): address PR #2477 review comments

- Clear processingThreads + refresh sidebar on SSE reconnect so stale
  spinners are removed immediately
- Clear processingThreads on "Awaiting approval" status (terminal state
  where agent is blocked on user input, not actively processing)
- Map tool call status from has_result/has_error: running (neither),
  success (has_result), fail (has_error) — shows spinner for in-progress
  tools in history instead of misleading checkmark
- Auto-expand activity group when any tool call has an error
- Add data-thread-id attribute to .thread-item for testability
- Scope processing spinner and unread badge assertions to specific
  thread ID in E2E tests
- Add explicit spinner visibility/removal assertions to background
  thread processing indicator test

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(gateway): address second round of PR #2477 review comments

- Use activity-icon-success/activity-icon-fail CSS classes for history
  tool card icons (matches live card styling with colored ✓/✗)
- Fix _wait_for_completed_turn to check turns[-1] instead of any() to
  avoid early return when earlier turns are already completed
- Rename test_processing_indicator_shows_on_thread_switch to
  test_no_stale_processing_indicator_for_completed_thread to match
  what it actually verifies (no stale indicator, not indicator presence)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 08:11:52 -07:00
..