Skip to content

Widget: fix release 0.8.16 review findings - #567

Merged
neuromechanist merged 11 commits into
developfrom
fix/release-0.8.16-widget
Sep 30, 2026
Merged

neuromechanist merged 11 commits into
developfrom
fix/release-0.8.16-widget

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Fixes the widget and Chrome-harness findings from the five-reviewer review of release PR #562. Each was reproduced or confirmed before it was changed. One commit per finding; the model and key rules mirror _select_model, _bedrock_choice and _route_request in src/api/routers/community.py as they are on current develop.

Changes

  • 1. Inline code before emphasis. renderInlineMarkdown lifts code spans out first, so the sentence Use *.set or `*.fdt` files is text plus one code span (it rendered <em>.set or `</em>.fdt` files). Code inside bold, italic and link text renders too. 13 new cases in frontend/test-markdown.js (globs, bullet, heading, table cell, bold beside code, a forged placeholder).
  • 2. Duplicate @keyframes osa-pulse. The status line's pulse is now osa-activity-pulse; the header status dot keeps its own. test-widget-activity-status.js checks each keyframes name is defined once and every animation started has keyframes.
  • 3. API key field kept while focused. Emptying it with a non-Custom model no longer hides it under the cursor; it is put away on blur. A press on Save defers that until the click has landed (the dialog is centred, so hiding a field moves the button). Tests in test-widget-settings.js.
  • 4. Saved and typed models held to the server's rules. One check (modelKeyProblem) now covers the Custom field and the menu, and is applied to saved settings: the platform-only rule at load, the offered-list rules once the community's own list arrives (a pinned widget can be older than its backend, so a model missing from its fallback list proves nothing at load). The widget holds every alias in MODEL_ALIASES (was one), so claude-haiku-4.5 and claude-sonnet-4.5 come back as the offered model and save with an Anthropic key. A drift test keeps the two tables equal.
  • 5. Default selected when the saved model is the community default. Matched on the model an id stands for, for both sides. Saving from the old blank menu stored model: "".
  • 6. Capsule focus survives a resize across 600px. The circle that had focus gets it back after arrangeCapsule reorders them.
  • 7. Comment corrected, code unchanged. Nothing on pagehide saves; showing the rest releases the wait that holds a reply whose done has arrived, so done saves it at once. A test pins that a still-streaming reply is not saved by pagehide.
  • 8. Finished reply kept whole when the reveal's redraw fails. The done handler applies and saves the canonical text, citations and request id first and raises the page's failure after them, and the error path adds no "Stream interrupted" note once done has arrived.
  • 10. Chrome harness flakiness. launch() kills a Chrome that reports no DevTools endpoint and starts another in a fresh profile, waiting 90 s; every Chrome check goes through it. Timed bounds in paced-reveal-check, activity-status-check and launcher-geometry-check are stretched by how late the page's own sampler ran in the window they time (capped), the wait's digits are held to the clock and to each other instead of fixed seconds, and frame counts follow the run's frame rate with one in-between frame as the floor against a snap.

Not changed

  • 9. STREAM_TIMEOUT_MS. Confirmed dead: the elapsed time is measured a moment after lastChunkTime is reset, and the wait is inside reader.read(). Against the real widget a 61 s gap between chunks completes normally and a stream that never resumes is still pending. Not fixed here: the server sends no keepalive on the chat stream, so enforcing 60 s would cut a reply with a legitimately quiet stretch (reasoning before the first word, a slow tool) that today finishes inside the 120 s request bound. Filed as Widget: STREAM_TIMEOUT_MS never fires, so a stalled stream is bounded only by the 120 s request timeout #564 with both options.
  • 7, behaviour. Saving a partial reply on pagehide would store unlabelled partial text as if complete; the comment was wrong, so the comment changed.
  • 4, Default. Default is not refused with an Anthropic key when the community default is service-only (HED, EEGLAB, BIDS, NWB default to Luna): _route_request swaps a Bedrock default it cannot run for Claude, and refuses only a model the request names. A test pins both halves.
  • 4, claude-haiku.4.5. The finding's spelling is not a server alias (the alias is claude-haiku-4.5); the server answers it 400 and so does the widget.

Also found

  • Quartile check in paced-reveal-check used strict <, which two quartiles landing on one sampled frame defeat; now in order, with the first and third apart.
  • loadUserSettings let a non-string saved model through unchecked; it is now treated as invalid.

Testing

Bun 1.4.2 (the version CI pins; local 1.3.10 fails test-widget-popout.js and the bundle check on develop itself), Chrome 154 on macOS.

  • bun frontend/test-*.js, test-widget-*.js, workers/osa-worker/test-*.js, notebook/test-open.js, notebook/test-bridge.js, scripts/build-runtime-bundle.js --check, node --check on the widget and worker: all pass
  • Real Chrome: paced-reveal-check, activity-status-check, launcher-geometry-check, color-scheme-check --serve, first-paint-check --serve, popout-check --serve, chrome.js: all pass
  • uv run pytest tests/test_frontend -q -p no:cacheprovider --color=no: 112 passed (includes the launch-retry test and the alias drift test)
  • uv run ruff check . and ruff format --check src tests: clean
  • New cases fail on the old code (checked for 1, 3, 4, 5, 6, 8)
  • Harness: a stream 2.3 s slower than designed fails the old fixed-digit check and passes the new one; a widget that restarts the wait at each label still fails it
  • Not run: a JS linter (the repo has no Biome config and CI runs none); the rest of the Python suite beyond tests/test_frontend

Refs #564

…d `*.fdt` render

An italic match starting before a code span swallowed it, so
"Use *.set or `*.fdt` files" rendered as <em>.set or `</em>.fdt`.
renderInlineMarkdown now lifts code spans out first and puts them back as
<code> (or raw backticks inside an address), so code inside bold, italic
and link text renders too. Tested: frontend/test-markdown.js (13 new cases).
A second @Keyframes osa-pulse replaced the header status dot's (opacity 1 to
0.4) with the status line's (0.25 to 1). The status line now uses
osa-activity-pulse. frontend/test-widget-activity-status.js checks that the
stylesheet defines each keyframes name once and that every animation started
has keyframes. Tested: that suite passes.
Emptying the key with a non-Custom model hid the field under the cursor,
dropping keyboard focus to the page. The field now stays while focused and is
put away on blur; a press on a dialog button defers that until the click has
landed, since the dialog is centred and hiding a field moves Save.
Tested: frontend/test-widget-settings.js (6 new checks; 2 fail on the old code).
Settings checked a service-only model against an Anthropic key only for a menu
pick: a custom openai.gpt-oss-120b saved and then 403'd on every send, and a
custom openai/gpt-5 with an Anthropic key 400'd. One rule (modelKeyProblem,
from _select_model, _bedrock_choice and _route_request) now covers the custom
field and the menu, and is applied to saved settings: the platform-only rule at
load, the offered-list rules once the community's own list arrives (a pinned
widget may be older than its backend), each resetting the model with a notice.
Default names no model, so it is not held to the rule: the server swaps a
Bedrock default it cannot run on the caller's key for a Claude model.
The widget now holds every alias in MODEL_ALIASES, so claude-haiku-4.5 and
claude-sonnet-4.5 come back as the offered model, not Custom; a drift test
keeps the two tables equal.
Tested: frontend/test-widget-settings.js (new cases fail on the old code) and
tests/test_frontend.
The default is left out of the menu's options (it is the Default entry), so a
saved model equal to it, such as claude-sonnet-5 mapped to claude-sonnet-5-5
on NEMAR or a model picked before a community made it the default, left the
menu blank, and saving from there stored an empty model. The match is made on
the model an id stands for, for the default as well as the saved value.
Tested: frontend/test-widget-settings.js (10 checks fail on the old code).
arrangeCapsule re-appends the circles when the window crosses 600px, and moving
a node takes keyboard focus from it. Whichever circle had focus gets it back.
Tested: frontend/test-widget-launcher-geometry.js (4 checks fail on the old code).
A redraw error raised by reveal.check() inside the done handler skipped
applyDoneEvent, so the canonical text, citations and request id were lost and
a completed answer was labeled 'Stream interrupted'. The handler now applies
and saves the reply first and raises the page's failure after it, and the
error path adds no interruption note once done has been received.
Tested: frontend/test-widget-paced-streaming.js (5 checks fail on the old code).
The comment on the pagehide handler said the rest of a reply is 'saved' when the
page is left, but nothing there saves: showing the rest releases the wait that
holds a reply whose done has arrived, so its done handler saves it at once, and
a reply still streaming is saved only by its own done. Comment corrected, no
behaviour change; a test pins that a still-streaming reply is not saved by
pagehide. Tested: frontend/test-widget-paced-streaming.js.
A release PR run failed with 'Chrome did not report a DevTools endpoint' after
30 seconds. launch() now kills that Chrome and starts another, in its own
profile, waiting 90 seconds for its endpoint; only a second silence fails the
run. Every Chrome check goes through launch(), so all are covered.
Tested: tests/test_frontend/test_chrome_launch.py runs the real launch() against
a stand-in executable that is silent on its first start; the real Chrome checks
still pass.
…ed clock

The paced-reveal, activity-status and launcher-geometry checks held a shared
runner to numbers measured on a quiet laptop. Each timed bound is now stretched
by how late the page's own sampler ran in the window it times (capped), so the
same bound holds when nothing stalled; the wait's digits are held to the clock
and to each other instead of to fixed seconds; frame counts follow the run's
frame rate, keeping one in-between frame as the floor against a snap.
Tested in real Chrome: all three pass; a stream 2.3 s slower fails the old
fixed-digit check and passes the new one; a widget that restarts the wait at
each label still fails it.
@neuromechanist neuromechanist added bug Something isn't working widget Related to frontend widget labels Sep 30, 2026
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Preview Deployment

Name Link
Preview URL https://fix-release-0.8.16-widget-demo.osc.earth
Branch fix/release-0.8.16-widget
Commit fbb6d45

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

chrome.js imported serve.js at the top, and serve.js needs the pyodide
package, which only the Frontend job installs. The new launch tests in
tests/test_frontend import chrome.js, so they failed in the Python test
job (Cannot find module 'pyodide/package.json') while passing locally
where node_modules existed. serve.js is now imported inside main(), the
only place startServer is used.

Tested: tests/test_frontend passes (112) with no node_modules present;
the 5 launch tests failed the same way before the change.
@neuromechanist
neuromechanist merged commit 4d01b51 into develop Sep 30, 2026
8 checks passed
@neuromechanist
neuromechanist deleted the fix/release-0.8.16-widget branch September 30, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working widget Related to frontend widget

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant