Skip to content

feat: one copy path, image references and bold links in replies, activity status check (E3.3, E3.4, E3.5) - #697

Merged
neuromechanist merged 9 commits into
developfrom
feature/issue-665-reply-polish
Nov 11, 2026
Merged

neuromechanist merged 9 commits into
developfrom
feature/issue-665-reply-polish

Conversation

@neuromechanist

Copy link
Copy Markdown
Member

Summary

Part of #648 (E3.3 to E3.5). The widget is one classic script, so every change is in frontend/osa-chat-widget.js and the copy path is a self-contained // BEGIN copy-text / // END copy-text block.

  • E3.3, one copy path (Widget: one copy implementation with fallback and Copied feedback #665).
    copyToClipboard is deleted.
    copyCodeFromButton (Clipboard API, then execCommand, then select-and-prompt) now serves reply code blocks, the whole-reply copy, the run card, the gate and the error-reference copy.
    Buttons with no .osa-code-block ancestor get a visible "Copied" beside a check icon (the run card keeps "Copy code" to "Copied"), and the widget's existing status announcer says it, so no per-message live region is added to the conversation.
    A refused whole-reply copy shows the markdown source in a block under the reply and selects it, and a line names the keys.
  • E3.4, reply markdown (Widget: reply markdown fixes for image references and links in bold #666).
    Bold and italic render their content through the same inline renderer (code-span placeholders stay valid, isSafeUrl still checks every href; a javascript: link in bold renders as text).
    ![alt](url) renders as the escaped alt text in a span, never an img, never the address, with "(see the figure above)" only when the reply's message has a run figure.
  • E3.5, activity status (Widget: say what the assistant is doing while it writes and runs code #494).
    No tool_composing event: tool_call (Say what a pending reply is doing: searching, writing code, analyzing results #542) already does it (audit below).
    The status line is styled after board A3 (accent dot, 12.5 px text, 8 px gap, as .osa-run-card-retry), propose_plan reads "Proposing plan..." instead of "Working...", and Stop on a run is now covered by tests.
  • Docs (docs/community-widget.md) and CHANGELOG.md updated.

#597 and #598 stay open with a comment each (#597: PR #601 fixed the reply-content half; #598: needs the Python scanner without the bundle and a language on the fence).

Closes #665
Closes #666
Closes #494

Commands run

  • uv sync --all-extras --dev && bun install
  • bun frontend/test-markdown.js (59 passed) and bun frontend/test-citation-markers.js (10 passed)
  • bun frontend/test-widget-copy.js (63 passed, new, wired into the frontend-tests job), test-widget-run-card.js, test-widget-host-styles.js, test-widget-activity-status.js (322 checks passed)
  • every frontend/test-*.js suite: all pass
  • uv run pytest tests/test_frontend tests/test_api/test_tool_call_streaming.py -q (184 passed)
  • bun frontend/browser-harness/activity-status-check.mjs and run-card-check.mjs in real Chrome: all checks passed
  • uv run ruff check . and uv run ruff format --check .: clean

Notes for review

  • The diff is about 760 lines, under the 1500 that would have split it, so there is one PR.
  • The reply's whole-message copy and the error-reference copy are new callers of copyCodeFromButton; the error banner's copy button now shows "Copied" text as well as the check.
  • The Widget: say what the assistant is doing while it writes and runs code #494 audit is in the first comment below.

…inks in replies (E3.3, E3.4)

copyToClipboard is gone: reply code blocks, the whole-reply copy, the run card and
the error reference all copy through copyCodeFromButton (Clipboard API, copy
command, select-and-prompt), each with a visible Copied and a polite announcement.
Bold and italic render their content through the inline renderer, so a link inside
bold renders (isSafeUrl still checks every href); an image reference renders as its
alt text with a pointer to the figure above when the message has a run figure,
never an img.

Tested: test-markdown.js (new cases), new test-widget-copy.js in the frontend-tests
job, test-widget-run-card.js.
…sts (E3.5)

The pending-reply line takes the accent dot and 12.5 px text of the run card's
retry line; propose_plan reads Proposing plan... instead of Working.... No
tool_composing event: tool_call (#542) already announces each call. Tested: new
cases for Stop on a run, the line's style and the label in
test-widget-activity-status.js.
@neuromechanist

Copy link
Copy Markdown
Member Author

#494 audited against what #542 shipped

Line numbers are on this branch (frontend/osa-chat-widget.js unless stated).

Item in #494 Where it is Test Status
"Writing code..." from the moment the model starts composing an execute_code call until its tool_request arrives server: _tool_call_sse_events, src/api/routers/community.py:3825, called from both streaming loops (:4367, :5012); widget: tool_call handler :14750 (classifyToolActivity :13254, phase writing); cleared by tool_request at :14863 tests/test_api/test_tool_call_streaming.py:340 (test_a_code_call_is_announced_before_its_tool_request); frontend/test-widget-activity-status.js:1205 done
a readable label while a server tool runs, from tool_start (nemar_get_events) tool_start handler :14760; the label is read from the tool name alone, so nemar_get_events reads "Looking up events..." (the issue's "the dataset's events" would need the arguments, which are never read because they can be long or private) test-widget-activity-status.js:383 block, :448 done, wording differs by design
"Running Python in your browser..." run card's running state, :11218 frontend/test-widget-run-card.js ("running: the status, a bar...") done
"Reading the result..." while the next run starts on /chat/resume shipped as "Analyzing results..." (ACTIVITY_ANALYZING :13246), set after a run's answer (:10458), after a plan decision (:11444) and after a server tool's tool_end (:14780) test-widget-activity-status.js:1205, :1268 done; kept the shipped wording so a server-tool wait and a browser-run wait read the same, recorded as a deviation
clears when text streams content handler, clearActivity() :14732 (whitespace alone does not clear) test-widget-activity-status.js:491, :1500 done
clears when the reply ends done :14817, tool_request :14863, stream end :14936, and the finally of the send :15293 test-widget-activity-status.js:1065 (every way a stream can end, mid-reply or not), :1109 done
never outlives an error error event :14890, catch :14958, and the finally :15293 test-widget-activity-status.js:1065 (error event, reader error, no done), :1268 (server refuses a result) done
never outlives Stop Stop cancels the run (browserTools.cancel()), the cancelled result goes back and the reply continues, so the line says "Analyzing results..." until the model answers, then every ending above clears it; Stop plan sets currentReply.stopped, and the finally at :15293 clears gap: untested. Added test-widget-activity-status.js:1299 (Stop on a run, then the reply finishes, and then it errors: the panel goes, the resume carries cancelled, nothing is left) tested here
unknown tool name classifyToolActivity returns "Working..." for any name it cannot read, including a missing or non-string one and Object.prototype names test-widget-activity-status.js:383 block (label(undefined), hostile names) done
a tool the repository ships reads something propose_plan (a client tool the model writes for many seconds) read "Working..." gap. Added propose: ['work', 'Proposing'] (:13216), so it reads "Proposing plan..."; the registry-wide check is tests/test_frontend/test_widget_activity_labels.py fixed and tested here
a polite aria-live line the status announcer :13024, written by announceStatus :13371; the visible label is aria-hidden test-widget-activity-status.js:963 done
status styled after board A3 .osa-activity-status was 12 px with a 6 px gap and a grey dot gap. Now 12.5 px, 8 px gap and an accent dot, as .osa-run-card-retry is drawn (.osa-run-card-retry rule near :4200) fixed; style test at test-widget-activity-status.js:1578
Server half: a pytest driving the real streaming function with a chunked tool call: one tool_composing before tool_request tool_call is that event, once per call, from both loops; an old widget logs an unknown event, a new widget on an old server labels from tool_start test_tool_call_streaming.py:250 (Anthropic chunks), :265 (Bedrock), :281 (parallel calls), :340 (before tool_request), :443 and :454 (after a resume); frontend/test-widget-activity-status.js:752 (old server) done; no tool_composing event added, since a second event would make old and new widgets disagree
happy-dom tests for each label, clearing, and an unknown tool name frontend/test-widget-activity-status.js (322 checks) and the real-Chrome frontend/browser-harness/activity-status-check.mjs; both run in the frontend-tests job done
Docs and changelog docs/community-widget.md ("What a pending reply says it is doing") and CHANGELOG.md done here

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Preview Deployment

Name Link
Preview URL https://feature-issue-665-reply-poli-demo.osc.earth
Branch feature/issue-665-reply-polish
Commit 14c929f

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

…xt, never as an address or stray markup (#666); tested with bun frontend/test-markdown.js
…beside the selected block, one timer per button, no false 'is selected', labelled fallback blocks; tested with bun frontend/test-widget-copy.js and tests/test_frontend
…nk; restore renderInlineMarkdown doc comment above the function (tested: test-markdown.js, frontend pytest)
@neuromechanist

Copy link
Copy Markdown
Member Author

Review round 2 outcomes (commit a2b4aa9):

  • Two-level parenthesised image address leaks a ! and a link (frontend/osa-chat-widget.js): fixed. In the link branch of renderRun, a link match preceded by ! is treated as an unparsed image: the ! is dropped, the alt text renders as the plain image-reference span, and the whole address is skipped by balancing its parentheses, so ![a](https://x/y_((1)).png) tail renders as the alt text plus tail. Added cases to frontend/test-markdown.js.
  • renderInlineMarkdown doc comment displaced below the regex constants: fixed. The block now sits above the function signature next to the options.figureAbove note; the regex constants keep their own comment.

Tested: bun frontend/test-markdown.js (68 passed), test-citation-markers.js, test-widget-capsule.js (133 passed), uv run pytest tests/test_frontend (166 passed).

@neuromechanist

Copy link
Copy Markdown
Member Author

PM verdict: all acceptance criteria are met and every review finding has an outcome. After a conflict in CHANGELOG.md (kept both entries) I merged develop into the branch (0cb424c); Lint, Test (3.11), Test (3.12), Frontend Tests and the preview deploy all pass, and the PR is CLEAN. The squash merge itself was not run by this agent (blocked by the permission layer), so the PR is ready to merge and #665, #666 and #494 still need closing after it lands; #597 and #598 stay open.

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.

1 participant