Skip to content

feat: handover card, session divider and mode label (E8.3) - #693

Merged
neuromechanist merged 5 commits into
developfrom
feature/issue-677-handover-card-and-cost-report
Nov 11, 2026
Merged

neuromechanist merged 5 commits into
developfrom
feature/issue-677-handover-card-and-cost-report

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Summary

The widget now draws the quick-to-analysis handover that the server already streams (E8.3, board A6).

  • A card for the steps: "Summarizing our conversation…" (live), "Summarized our conversation (N messages, W words)" with a closed native <details> "What the analysis model is told" that holds the summary as text, a line saying the summary could not be written when it is degraded, and "Handing it to the analysis model with your question".
  • A role="separator" divider, "Analysis session · Claude Sonnet 5.5", with the label taken from the widget's model list (an unknown id is shown as given).
  • The mode: done.mode puts a Quick or Analysis pill (aria-label "Mode: ...") in the header, a "Quick answers" tag on quick replies, and the footnote above the input. All three are absent for a community whose stream sends no mode, and a first-message flip (no handover events) shows the label and no card.
  • The handover and the mode are stored on the reply and normalized and bounded in normalizePersistedMessage (summary at most 2000 characters, counts whole numbers, model must be a valid id), so a reload and a chat opened from History bring the card, divider and label back; a new chat clears them.
  • The summary is model output: it is only ever set with textContent, so a summary containing <img onerror> stays inert (tested).
  • New // --- Handover (E8.3) --- block after the Fresh chat on return block, with its CSS after the history CSS; one hook call per message in renderMessages plus one sync call after the loop. The run card, plan and notebook code are untouched.
  • New CI step "Run the handover card tests on a real DOM", directly after the handover stream step.

The diff for E8.3 and E8.4 together was about 2000 lines, over the 1500 lines the brief allows, so the backend half is split out as its own PR (#694, branch feature/issue-678-cost-per-conversation): the tier and conversation_id columns, the per-conversation query and osa metrics cost-report. The two are independent; this PR needs nothing from that one (done.mode is already merged).

Closes #677
Refs #678

Tests and commands

  • bun frontend/test-widget-handover-card.js: 90 passed, 0 failed (new; happy-dom, real widget, SSE through fetch)
  • bun frontend/test-widget-handover-events.js: 14 passed, 0 failed (updated: the "events change nothing" assertions are replaced; session adoption, done.session_id and the single reply are kept)
  • bun frontend/test-widget-history-store.js, test-widget-history-panel.js, test-widget-run-card.js, test-widget-tools.js, test-widget-context-switch.js: pass
  • every frontend/test-*.js exits 0
  • node --check frontend/osa-chat-widget.js: ok
  • uv run pytest tests/test_frontend tests/test_metrics tests/test_api/test_model_routing.py tests/test_api/test_streaming_metrics.py tests/test_agents/test_model_routing.py tests/test_cli -q: 663 passed, 2 skipped
  • uv run ruff check . && uv run ruff format --check .: clean

Not run: a manual look at the card in a browser against develop-demo (no Chrome session here); the layout follows board A6 and reuses the widget's notice colors, so it follows light and dark mode.

@neuromechanist neuromechanist added P2 Priority 2: Important, fix when possible feature New feature or enhancement widget Related to frontend widget labels Nov 11, 2026
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Preview Deployment

Name Link
Preview URL https://feature-issue-677-handover-c-demo.osc.earth
Branch feature/issue-677-handover-card-and-cost-report
Commit e48570f

This preview will be updated automatically when you push new commits.

…ule; card is a group; started speaks summarized too (tested)
@neuromechanist

Copy link
Copy Markdown
Member Author

Review round 1 outcomes (fixes in one commit on this branch):

  • Reduced-motion override for the handover ring (important): fixed. The override is now .osa-handover .osa-handover-marker.osa-handover-live (three classes), so it outranks the ring's later two-class rule; the comment says why. Added a source-level assertion in test-widget-handover-card.js that the override selector has at least three classes, since happy-dom cannot compute the cascade.
  • Untested paths (suggestion): fixed, one part rejected. Added a reload case from a tampered {stage: 'summarizing'} record (stopped step text, dash marker, no live ring, no divider), and assertions on the announcer text after summarizing and after summarized + started. Rejected: replacing the synthetic toggle dispatch with a real browser toggle; happy-dom is the only DOM this suite has, and the handler only reads details.open, so the synthetic event exercises the same code.
  • Announcements and landmark (suggestion): fixed. started now speaks "Summarized our conversation. Handing it to the analysis model with your question" when it follows summarized, so the first is not dropped from the single polite region (no timers). The card is now a div role="group" with the same aria-label, not a section region; tests updated.
  • Backend half and cost-report snapshot (suggestion): no change, as the finding says. The backend items are in feat: record tier and conversation per turn; osa metrics cost-report (E8.4) #694; the documented dev-database metrics cost-report run needs a machine that can reach hallu and will be posted on Usage metrics: record the model per turn and report cost per conversation #678 (kept open) before feat: record tier and conversation per turn; osa metrics cost-report (E8.4) #694 merges.

Tested: bun frontend/test-widget-handover-card.js (100 passed), handover-events, activity-status, history-panel and run-card suites (all pass), pytest tests/test_frontend (144 passed).

…ls on the two-class regression (tested, mutation-checked)
@neuromechanist

Copy link
Copy Markdown
Member Author

Review round 2 outcome.

  • Fixed (89b33d1): frontend/test-widget-handover-card.js reduced-motion assertion now strips CSS comments before matching and captures only the selector line, so (E8.3) in the comment no longer counts as a class. The failure message prints the captured selector. Tested: the handover-card suite passes (100/0), and reverting the override in osa-chat-widget.js to the two-class selector makes the assertion fail (99 passed, 1 failed), then restored. All other frontend/test-widget-*.js suites pass.

@neuromechanist

Copy link
Copy Markdown
Member Author

PM verdict: not merged. The frontend criteria look covered (handover card, mode label, restore, updated events test; review rounds 1 and 2 have outcomes). Unmet against this PR's brief: the backend criteria (tier and conversation_id columns, migration test, model-routing tests, conversation-cost query tests, cost-report CLI) live in #694, which is still open and not in this diff; the cost-report output from a copy of the dev database has not been posted on #678 with the follow-up note; and gh pr checks currently shows only the deploy check pending, with Lint, Test (3.12) and Frontend Tests not reported. Re-evaluate once those are resolved or the brief is scoped to the frontend half.

# Conflicts:
#	CHANGELOG.md
#	frontend/osa-chat-widget.js
@neuromechanist
neuromechanist merged commit 2bbd11b into develop Nov 11, 2026
8 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-677-handover-card-and-cost-report branch November 11, 2026 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or enhancement P2 Priority 2: Important, fix when possible widget Related to frontend widget

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant