Repository navigation
Studio: paste links, tables, lists and formatting into the composer as Markdown - #16298
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…ells onto the grid
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 56824ad458
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| .filter((line) => { | ||
| const keep = fenced || line.trim() !== ""; |
There was a problem hiding this comment.
Preserve paragraph separators after nested lists
When a list item contains a nested list followed by another paragraph, removing every blank line outside fenced code changes which item owns the following text. For example, <li><p>Parent</p><ul><li>Child</li></ul><p>After</p></li> converts to - Parent\n - Child\n After; Markdown treats After as a lazy continuation of the child's paragraph rather than a paragraph belonging to the parent. Preserve the separator after nested lists so pasted instructions retain their original hierarchy.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this one: every word is still pasted, only the bullet a trailing paragraph after a nested list renders under differs, and that layout is rare in copied content. Keeping lists tight matters more for the common case.
`studio/backend/tests/test_rag_vec_ann.py::test_search_recalls_the_exact_neighbours` failed in `(Python 3.13, g-r)` on #16298, which only touches the frontend: ``` tests/test_rag_vec_ann.py:57: in test_search_recalls_the_exact_neighbours E assert (590 / (20 * 30)) >= 0.99 ``` ### Why The data and the queries are seeded, but the index was built with `threads = 2`. A parallel HNSW build inserts nodes in whatever order the two threads interleave, and the graph, and so the recall, depends on that order. That is scheduling, not anything the test means to measure. Measured on this file's data and queries, torch 2.10 CPU, usearch 2.26.6: | build | recall over 60 builds | |---|---| | `threads = 2` | 0.9950 to 1.0000, four distinct values | | `threads = 1` | 1.0000 every time | The hosted 4-vCPU runner interleaves differently and produced 0.983. ### Change `_built` takes a `threads` argument, defaulting to the 2 it used before. Only the recall test passes `threads = 1`, so the other five tests that use `_built` still exercise the parallel `add` path. ### Verification - The file passes 7 tests, three runs in a row. - Sabotage: with `new_index` switched from `metric = "cos"` to `"l2sq"`, the recall test fails with `28 / 600`, so the single-thread build still catches a real retrieval regression. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
|
The |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex security review |
# Conflicts: # studio/frontend/src/features/chat/index.ts
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
… offsets from the UI scale (#16524) ## Summary Two UI font scale guards are red on main, so every Studio PR fails three jobs at once: `Repo tests (CPU, studio)`, `Frontend build + bundle sanity` and `Frontend unit tests (Windows)`. In the last 30 PRs that is 18, 9 and 9 PRs respectively. Both reproduce on current main (`99d1bc6686`). **1. `tests/studio/test_ui_font_scale_contract.py::test_no_raw_pixel_text_utilities`** ``` Raw px text utilities ignore the UI font size preference; use the text-ui-* / leading-ui-* tokens in index.css instead: ['features/settings/components/composer-settings.tsx: text-[10px]'] ``` #16298 (`63a3896459`) added the composer's Beta badge with `text-[10px]`. Every other Beta badge of this shape uses `h-4 px-1.5 text-ui-10`, and `utils.ts` registers `text-ui-*` with tailwind-merge as a font size. `--text-ui-10` is `calc(0.625rem * var(--ui-font-scale, 1))`, which is exactly 10px at the default size. The guard is right. **2. `studio/frontend/tests/ui-font-size-scales-spacing.test.ts`: "no hand-set length above a hairline skips the scale"** ``` 'features/settings/settings-dialog.tsx: left-[13.5px]', 'features/settings/settings-dialog.tsx: pl-[39.5px]', 'features/settings/settings-dialog.tsx: right-[12.5px]' ``` #16455 (`adfd9e0cc9`) added the settings search field. Its height is already `h-[calc(36px*var(--ui-space-scale,1))]`, and its search and clear icons are `size-4`, which scales too. Only the three offsets that place the icons and the text inside the field were fixed pixels, so at a larger interface scale the icons and the text start would drift relative to a field that grew. The guard is right here too. ## Change - `composer-settings.tsx`: `text-[10px]` becomes `text-ui-10`. - `settings-dialog.tsx`: the three offsets become `calc(...px*var(--ui-space-scale,1))`, the same form as the field's height on the same line. At the default font size and interface scale, every changed value computes to the same length as before, so nothing moves for anyone on the defaults. At other scales, the badge text and the search field's contents now follow the scale like their neighbours. No behaviour, layout structure or copy changes. ## Testing - `studio/frontend/tests/ui-font-size-scales-spacing.test.ts`: main gives 1 failed of 27 (the case above); this branch passes 27 of 27. - `tests/studio/test_ui_font_scale_contract.py`: main gives 1 failed of 12; this branch passes 12 of 12. - No screenshots: at the default scale, the computed lengths are identical by construction (`calc(13.5px * 1)` is `13.5px`, and `0.625rem` at a 16px root is `10px`).
…slothai#16471) The Settings search field introduced three fixed pixel offsets in unslothai#16455 while its height and icons already follow the interface spacing scale. Those offsets break the existing spacing guard and leave the search icon, text inset and clear button out of proportion at non-default interface sizes. Scale the three offsets with the same interface spacing variable. Their exact original values remain at the default scale. The existing regression test is unchanged. The same validation pass found a second font-scaling regression in unslothai#16298: its rich-paste Beta badge used `text-[10px]`. Preserve the new feature and use the existing `text-ui-10` typography token, which follows the font preference. That shared token computes to 9.375 px at the default preference and 15 px at the enlarged setting; the former fixed value was 10 px at both. The existing font-contract test is unchanged. [Tailwind's typography documentation](https://tailwindcss.com/docs/font-size) describes how the theme token supplies the generated utility. Validation: - Matching-head strict staging passes 12 Python font-contract checks and 42 Node spacing/control checks on [Linux](https://github.com/Imagineer99/unsloth/actions/runs/41582365621), [Apple Silicon macOS](https://github.com/Imagineer99/unsloth/actions/runs/41582365722) and [Windows](https://github.com/Imagineer99/unsloth/actions/runs/41582365773), with zero failures or skips. Logs and staged ancestry were checked. The initial generic advisory jobs are not counted as correctness gates. - The badge regression reproduces on merge base `242f14b1d`: 11 font-contract checks pass and one fails. All 12 pass after the one-line correction. Two isolated real Studio installs show the enlarged badge at 10 px before and 15 px after, retaining the feature label and switch. A separate [strict live-Studio staging probe](https://github.com/Imagineer99/unsloth/actions/runs/41582365955) confirms 9.375 / 15 px and visible controls on the published head; this is separate from the synthetic test-kit smoke. - Production-built stylesheet probes pass in Chromium, Firefox, WebKit and Edge on both badge arms at default and enlarged settings. The current dependent auth frontend passes 14,747 tests, zero failures and one existing skip after a normal local dependency installation. A first run using symlinked dependencies was rejected by Vite's filesystem boundary and is excluded from passing evidence. - The baseline spacing guard fails on exactly these three offsets. The focused spacing, icon and Settings visibility selection passes 31 tests with the fix. - The refreshed combined application tree, including unslothai#16468 and unslothai#16470, passes 14,747 frontend tests, no failures and one existing skip. Its frontend Git tree equals the tested auth head. The production build and all 62 actual Tauri command tests pass. - Real Studio rendering at default scale preserves icon/text/clear offsets of 13.5 / 39.5 / 12.5 px. At 1.4 scale the branch computes 18.9 / 55.3 / 17.5 px; base incorrectly retains the default offsets. - Chromium, Firefox, WebKit and Edge all compute the intended geometry at default and 1.5 scale using the production-built stylesheet and representative search markup. - Linux, Apple Silicon macOS and Windows staging checks complete. The selected UI suites also run successfully on both arms on a GPU-equipped cloud worker. No training or inference kernel is changed or benchmarked. An initial local auth journey hit an intermittent blank frontend boot before the auth request. The same-head confirmation and a fresh paired auth run both pass all nine steps. Its cause remains unproven, and the redirect assertion and timeout are unchanged. The fresh paired Studio/Desktop run with the corrected harness passes its strict gate: 49 steps, all ten native Desktop steps successful on both sides, and no failed or VOID steps. The older failed run is retained as a driver failure, not relabelled as a pass. The latest organization CPU security job was cancelled, without a test failure. Its exact four-file suite passes 105 tests locally. The same strict, unmasked job also passes [105 tests on an owned Linux CPU runner](https://github.com/Imagineer99/unsloth/actions/runs/41596344327), with zero failures or skips. The staged job equals the source job, contains this PR head and uses identical test-file blobs. Earlier official CI included cancelled checks, which are not counted as passes. Matching owned staging checks are complete for the current head; organization CI is still running, and no all-green organization CI claim is made. Comparison at 1.4 spacing scale:  Rich-paste badge at the enlarged font preference, from merge base `242f14b1d` and head `e3a4e3a06`; the feature and switch are preserved: 
…ai#16470) Desktop can stop a healthy Studio backend after earlier health probes time out. Its final, wider probe may verify that the backend is alive, but the watchdog previously accepted that answer only when inference was active. A live idle answer still fell through to backend shutdown and a server-crashed event. This branch includes the reviewed unslothai#16471 spacing fix as a shared frontend CI dependency. The Settings component is byte-identical to that PR. Merge unslothai#16471 first to keep the remaining diffs focused; the dependency is already present here for validation. Respect a positively verified live confirmation, reset the failure count, and set the inference latch from that answer. Protection for a busy backend whose probe times out remains in place. Ownership verification, generation checks, shutdown checks and failure budgets are unchanged. Validation: - Matching-head native [Rust decision checks](https://github.com/LeoBorcherding/unsloth/actions/runs/41583955027) compile the production function on Linux x86_64, Apple Silicon macOS and Windows MSVC against refreshed merge base `242f14b1d`. Each base reproduces two false-stop decisions; each head matches all eight expected states. Artifact source hashes match both actual revisions. Separate scoped checks pass 12 Python and 42 Node tests on [Linux](https://github.com/LeoBorcherding/unsloth/actions/runs/41583941228), [Apple Silicon macOS](https://github.com/LeoBorcherding/unsloth/actions/runs/41583941300) and [Windows](https://github.com/LeoBorcherding/unsloth/actions/runs/41583941248), with zero failures or skips. This does not replace the unperformed full asynchronous native-app fault injection. - The current head also carries unslothai#16471's rich-paste badge correction for the font-contract CI regression introduced by unslothai#16298. Both Settings components are byte-identical to the parent. Local font checks pass 12 Python and 42 Node tests; the native decision reproduction also passes against the refreshed merge base. Refreshed platform checks include the font contract and native Rust compilation. - An identical harness extracted from the production Rust helpers and tests reports four passes / two failures on base, then six passes / no failures on this branch. Live idle confirmation is retained; a later idle stall still uses the ordinary failure budget. - A fresh production frontend build followed by the actual Tauri commands test suite passes all 62 tests. The final run uses real built frontend assets. - The eight predicate combinations preserve six decisions and widen two to retain a verified live response; no prior keep decision becomes a stop decision. - The local auth/settings/crawl switchboard reports `NO_REGRESSION`, with baseline startup flakes and nonfunctional DOM/visual differences recorded. Paired staging reports also say `NO_REGRESSION` on Linux, Apple Silicon macOS and Windows. The initial native Settings failures were traced to a hidden-control selector in the test. With the corrected harness from unslothai/scripts#790, both native arms now pass all ten steps, including a displayed Settings dialog and IPC, with exact `rc=0` receipts. The new paired run reports `NO_REGRESSION` across 49 steps with no failed or VOID steps. - The refreshed combined application tree with unslothai#16468 and unslothai#16471 passes 14,747 frontend tests, no failures and one existing skip; its frontend Git tree equals the tested auth head. The production build and all 62 actual Tauri command tests pass. Merge unslothai#16471 first to keep the dependent diffs focused. The watchdog fix preserves download concurrency, timeout budgets, notebook code and model loading. The shared unslothai#16471 dependency supplies the separately reviewed interface-spacing correction. This demonstrates a watchdog false-stop, not the cause of every download-time exit in the Discord report. A full asynchronous watchdog fault injection into the native app has not been run. Current organization CI remains queued or running. Matching owned staging checks are complete for the current head; no all-green organization CI claim is made. The normal signed-in chat remains unchanged in the browser comparison; this picture does not simulate a watchdog failure.  The shared spacing dependency below is the exact unslothai#16471 change; this comparison validates that dependency.  The inherited rich-paste badge correction is also byte-identical to unslothai#16471. At the enlarged font setting it scales from the previous fixed 10 px to 15 px, with the feature and switch retained: 
…othai#16468) Opening the same Studio session in two windows can log both windows out when their access tokens expire together. Refresh tokens are single-use, but refresh coordination was limited to each window: the losing 401 could clear shared credentials before the successful refresh saved its rotated pair. This branch includes the reviewed unslothai#16471 spacing fix as a shared frontend CI dependency. The Settings component is byte-identical to that PR. Merge unslothai#16471 first to keep the remaining diffs focused; the dependency is already present here for validation. Serialize refresh across same-origin windows using Web Locks, then reuse a peer's rotated token only within the same session. Lock acquisition is bounded without cancelling a submitted refresh request. Existing sessions retain their session marker, and logout and account-switch boundaries remain enforced. Browsers without Web Locks retain the existing behavior. Validation: - Matching-head scoped staging passes 21 Python auth/font checks and 75 Node checks on each of [Linux](https://github.com/LeoBorcherding/unsloth/actions/runs/41583927636), [Apple Silicon macOS](https://github.com/LeoBorcherding/unsloth/actions/runs/41583927585) and [Windows](https://github.com/LeoBorcherding/unsloth/actions/runs/41583927734), with zero failures or skips. Raw logs and exact source-head ancestry were checked. The real frontend/backend reproductions below provide the actual Studio UI evidence. - The current head also carries unslothai#16471's rich-paste badge correction for the font-contract CI regression introduced by unslothai#16298. Both Settings components are byte-identical to the parent. Local validation passes 21 Python checks, 75 Node checks and the full frontend suite: 14,747 passing, zero failing and one existing skip. Refreshed cross-platform checks include the Python font contract. The first expanded frontend run used symlinked dependencies outside Vite's root and is excluded; the passing run uses a normal local dependency installation. - Full Studio pages and the real backend refresh endpoint reproduce the race in Chromium. Seeded invalid access plus a real refresh token and a controlled two-second successful-response delivery delay produce base responses 401 / 200, both windows at `/login`, and credentials cleared. This branch produces one 200, both windows at `/chat`, and credentials retained. The delay forces ordering; it is not a claim about natural frequency or backend task survival. - Two real pages running the production auth modules against a single-use refresh endpoint reproduce the failure in Chromium, Firefox, WebKit and Edge. Base sends two refresh requests and loses credentials; this branch sends one, both pages return `ok`, and the rotated credentials remain stored. - Identical differential tests against refreshed merge base `242f14b1d`: base 27 pass / 6 fail; branch 33 pass / 0 fail / 0 skip. Five are behavioral fixes; one calls a new session helper and is counted as a new API check, rather than a repaired baseline defect. Base production sources and test-file hashes were verified. The broader original focused auth selection passes 72 tests. - The local switchboard reports `NO_REGRESSION` for auth, settings and route crawling: 38 same steps and one zero-pixel Hub DOM variation. The signed-in chat route, composer and stored session also survive a real reload on both sides. - Linux, macOS and Windows staging checks complete. Paired Studio journeys pass the functional gate on Linux and macOS Intel. The original Apple Silicon paired arms were cancelled before acquiring runners; macOS smoke checks ran separately. The final paired native run with the hardened test client passes all ten Desktop steps on both sides, with exact `rc=0` receipts and a passing strict evidence gate. One dropped body-text response is recovered on the base arm; navigation, clicks and assertions are not replayed. Earlier native transport failures remain recorded, and the client hardening is isolated in unslothai/scripts#790. One baseline route screenshot is missing after a dropped GET response; that visual comparison is not claimed. - The refreshed combined application tree with unslothai#16470 and unslothai#16471 passes its production build and all 62 actual Tauri command tests. Its frontend Git tree equals this branch's tested tree. - The CPU auth fixture now exports the two session helpers that its production module imports. Its nine redirect checks pass without relaxing their assertions. The merged parity normalizer from unslothai#16464 is included. Current organization CI remains queued or running; the completed owned staging results above provide scoped evidence. This fixes a demonstrated refresh race; the report of backend jobs actually being cancelled has not been reproduced. Plain HTTP LAN origins without Web Locks retain the existing race limitation. Core inference, notebooks, backend token rules and model prompts are unchanged. Two real Studio windows after the controlled refresh race:  The shared spacing dependency below is the exact unslothai#16471 change; this comparison validates that dependency.  The inherited rich-paste badge correction is also byte-identical to unslothai#16471. At the enlarged font setting it scales from the previous fixed 10 px to 15 px, with the feature and switch retained: 
…nslothai#16476) The mmap startup-progress test depends on a child process generating enough real page faults inside a 1.5-second stall window before health becomes ready at 2.5 seconds. It failed in the Python 3.13 CPU job even though the same test passed locally on both base and the auth branch. The exact remote scheduling or page-cache cause is unproven; a wall-clock resource dependency makes this an unreliable test of the progress policy. The reviewed unslothai#16471 spacing dependency is already merged. The remaining changes are confined to tests. Drive the production startup sampler and health wait with a controlled clock and process counters. CPU time, resident memory and read-byte counters stay flat. Advancing faults keep the wait alive beyond its original deadline; fixed faults reach the original stall timeout. A separate parser check covers the platform counter fields and Linux stat parsing, including a process name containing a closing parenthesis. The health-test fix changes no production startup code, stall budget or polling interval. The test does not sleep, skip the failing case or relax its negative assertion. Fake process IDs are outside the valid host PID range and all process access is controlled. The final validation pass also corrects the installer progress fixture to model successful uv bootstrap. Forcing bootstrap failure could instead hit the valid torch-freeze guard before reaching the progress assertion on newer torch installations. All 16 progress checks now pass without changing installer behavior or weakening assertions. Current-main integration with this health change passes 896 checks, with two existing platform skips. That integration also verifies the upstream CI fixture fixes from unslothai#16530 through unslothai#16533. The rewrite also removes the now-unused `os` import. The existing import-safety check correctly rejected the preceding head; the same command passes after this one-line cleanup. All 101 local health/font checks pass. Refreshed Linux, macOS and Windows staging explicitly includes that required import-safety gate. The raw logs confirm that the gate runs and passes on all three platforms. The health-wait behavior and original test came from unslothai#11055, with later timing adjustments in unslothai#11284 and unslothai#12065. The complete health-wait test file passes 89 tests. This hardens the test contract without claiming a production mmap failure was reproduced or that every earlier CI timeout has the same cause. Disabling production fault accounting makes the new positive case fail while the stalled case still passes. Three panel reviews and three independent focused reviews found no actionable defect. Platform counter formats are simulated on Linux; removing the worker means this case no longer covers actual native mmap page-ins. Other real-process startup tests remain. The paired Studio switchboard completes auth, Settings and route crawling with functional `NO_REGRESSION`: 38 matching steps and one Hub visual difference. All 39 functional captures succeed on both arms. The Hub benchmark-popover comparison retains a visual/mask difference on confirmation, so exact visual parity for that capture is not claimed. The health-test change itself has no production UI effect. The included unslothai#16471 dependency changes Settings spacing and uses its existing before/after evidence below. Current-head staging passes 117 Python checks (89 health, 12 font-contract and 16 installer progress checks), 42 Node spacing/control checks and the required import-safety gate on each of [Linux](https://github.com/Imagineer99/unsloth/actions/runs/41645022400), [Apple Silicon macOS](https://github.com/Imagineer99/unsloth/actions/runs/41645022445) and [Windows](https://github.com/Imagineer99/unsloth/actions/runs/41645022404), with zero failures or skips. Raw logs and exact source-head ancestry were checked. The current-head switchboard reports functional `NO_REGRESSION` across auth, all 19 Settings steps, model picker and route crawling. The retained Hub/data-recipes comparisons include DOM/mask differences with zero changed pixels; exact visual parity is not claimed for those captures. The current head also carries unslothai#16471's rich-paste badge correction for the font-contract CI regression introduced by unslothai#16298. Both Settings components are byte-identical to the parent. Local validation passes 101 Python checks and 42 Node checks. Refreshed platform checks include the font contract as well as the unchanged health-policy checks. The shared spacing dependency below is the exact unslothai#16471 change; this comparison validates that dependency.  The inherited rich-paste badge correction is also byte-identical to unslothai#16471. At the enlarged font setting it scales from the previous fixed 10 px to 15 px, with the feature and switch retained: 
Summary
Pasting from a web page or a document into the chat composer now keeps its structure as Markdown. It is on by default, with a Beta toggle in Settings > Chat > Composer (Rich text paste) to turn it off; the description notes a full rich text composer is coming soon.
Kept: links, tables (including spreadsheet copies from Excel or Google Sheets), bullet and numbered lists (nested too), headings, quotes, code blocks with their indentation and language, and bold, italic and strikethrough, including the inline-style emphasis Google Docs and Word use.
Left alone (the browser pastes plain text as before):
vscode-editor-data)Other details:
execCommand("insertText"), so one Cmd+Z undoes it; there is asetTextfallback.http,httpsandmailtolinks survive; anything else pastes as its text. Images, scripts and styles are dropped, and the HTML is parsed into an inertDOMParserdocument that is only read for text.features/chat/utils/rich-paste.ts.Verification
npm run typecheck,npm run i18n:check:strict,npm test,npm run buildtests/rich-paste.test.ts(9 cases): links, unsafe and relative links, tables with pipes and ragged rows, nested lists, headings, quotes, code blocks, Google Docs styling, the fallbacks, VS Code copies.Not testable here