Skip to content

fix: live reasoning, tool progress, in-flight session recovery (closes #367) - #383

Merged
nesquena-hermes merged 6 commits into
masterfrom
pr-367-review
Apr 13, 2026
Merged

fix: live reasoning, tool progress, in-flight session recovery (closes #367)#383
nesquena-hermes merged 6 commits into
masterfrom
pr-367-review

Conversation

@nesquena-hermes

Copy link
Copy Markdown
Collaborator

Summary

Merges PR #367 by @Jordan-SkyLF. Rebased cleanly onto current master (v0.50.20). One addition made before merging: loadInflightState() stub added to static/ui.js (the function was called with a typeof guard in sessions.js but was undefined — the else path already handles reload recovery correctly, this stub resolves the guard cleanly and documents the extension point).

What this delivers

Live reasoning cards — the generic thinking spinner now upgrades to a live reasoning card with lightbulb icon and scrollable reasoning text as the backend streams reasoning. Verified visually in browser.

tool_complete SSE eventson_tool() callback now accepts both the old 3-arg (name, preview, args) signature and the new 4-arg (event_type, name, preview, args) form. tool.completed events transition live tool cards cleanly from running to done.

In-flight session state across switchesattachLiveStream refactored to a named function; partial assistant text mirrored into INFLIGHT on every token; data-live-assistant DOM anchor preserved across renderMessages() rebuilds.

Reload recoveryactive_stream_id, pending_user_message, pending_attachments, pending_started_at persisted on the session object before streaming, cleared on completion or exception. loadSession() detects a live stream and calls attachLiveStream(..., {reconnecting:true}) to reattach.

Session-scoped message queue — global MSG_QUEUE replaced with SESSION_QUEUES keyed by session ID. Queued follow-ups stay attached to their originating session.

newSession() idle reset — resets S.busy=false, S.activeStreamId=null, updates cancel button and queue badge for the new session.

Todos survive session reloadloadTodos() reads from S.session.messages (raw, includes tool messages) rather than the filtered S.messages.

Review history

  • First review: approved (missed the 5 failing tests)
  • Second review: flagged 5 failing tests (unimplemented features). Author chose Option B — implemented all missing features in commit 8ad112e.
  • Third review: confirmed all 5 tests pass, noted loadInflightState undefined. Added stub before this merge.
  • 960/960 tests passing.

Browser QA

  • Live reasoning card renders with lightbulb icon and text ✅
  • SESSION_QUEUES, queueSessionMessage, shiftQueuedSessionMessage all functional ✅
  • All feature functions present: loadInflightState, attachLiveStream, updateThinking, _thinkingMarkup, getPendingSessionMessage
  • Session API returns active_stream_id, pending_user_message, pending_attachments
  • Zero JS errors throughout ✅

Jordan-SkyLF and others added 6 commits April 13, 2026 23:11
(cherry picked from commit 401e3b643d25e8dad8c06883b478b3c3073f07a5)
(cherry picked from commit 7ee093ba19978af23b79148df2f2347e2f1e5bde)
- static/ui.js: add loadInflightState() function (currently returns null —
  the typeof guard in sessions.js means reload recovery works via the
  else-path attachLiveStream call; this stub satisfies the guard cleanly
  and documents the extension point for future localStorage-backed state)
- CHANGELOG.md: v0.50.21 entry; 960 tests (up from 949)
@nesquena-hermes
nesquena-hermes merged commit 9542639 into master Apr 13, 2026
3 checks passed
@nesquena-hermes
nesquena-hermes deleted the pr-367-review branch April 13, 2026 23:28
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.

3 participants