Repository navigation
fix(prompt storage): rework prompt storage into a master-detail layout - #8692
Conversation
Cards rendered the full prompt body with no truncation, so a few dozen saved prompts became a long scroll of uneven cards. Editing happened inline in a four-row textarea, so long prompts were edited through a peephole while the list shifted underneath. Replace the flat list with a master-detail layout: a compact rail of name plus one-line preview on the left, and a detail pane on the right that owns its height. Unsaved edits are held per entry so switching rows no longer discards them, with a dirty marker in the rail and Save/Revert in the footer. List items now auto-size to their content and reorder by dragging the grips, animated with FLIP. The drag listener lives on window rather than using setPointerCapture: reordering makes React move the row's DOM node, and detaching implicitly releases pointer capture, which ended the drag after one row. Hit-testing uses offsetTop/offsetHeight since a client rect reports the pre-animation position while FLIP is in flight. Add a Preview toggle on both tabs backed by the existing MarkdownPreview, and allow bookmarking prompt lists into the + menu next to bookmarked prompts. Rows there carry a Prompt / List pill, since selecting a prompt fills the composer while selecting a list queues and sends every prompt in it. Presentation only: no schema migration, no API change, no change to the export formats or import parser, and onUse/onRunList signatures are unchanged.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8476efd7fa
ℹ️ 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".
Select a newly created prompt or list only after the refresh resolves. The keep-a-row-selected effect runs against whatever list is in state, so selecting the new id while the old list was still in state made the effect bounce the selection to the first existing entry, and the new entry was never shown. Let the body shrink and stack on small viewports. The fixed 420px floor plus the header could exceed the dialog's 94dvh on a short window and clip the detail pane's actions behind overflow-hidden, and a fixed 248px rail left the detail pane unusably narrow below ~600px. The floor is now capped against the viewport, the rail narrows at sm and stacks below it, and the action rows wrap. Report when a list cannot be queued. startQueue refuses synchronously when queueing is unavailable and does not run the onAborted callback, so running a list from the project new-chat composer silently did nothing from both the Run button and the bookmarked-list menu items.
|
All three were real. Fixed in da19879. Wait for refresh before selecting the new entry. Confirmed, including that it Narrow and short viewport layout. Confirmed, and self-inflicted: the previous Bookmarked lists when queueing is unavailable. Confirmed, and slightly wider typecheck and build clean; tests unchanged from baseline. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 099055ba73
ℹ️ 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".
A list taller than the detail pane could only be reordered within the visible region: the pointer handler hit-tested coordinates but never scrolled the overflow-y-auto ancestor, and pointerdown suppresses the browser's own drag gesture, so there was nothing to pull the list along. Holding a grip near the top or bottom edge now scrolls the pane and re-runs the hit-test each frame, so a drag can reach any row. The step ramps with depth into the edge band and is capped per frame. The step calculation lives in its own module with unit tests covering the dead zone, both directions, the ramp, the cap, and panes too short to hold two edge bands.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e2beec10bd
ℹ️ 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".
Awaiting the refresh was not enough on its own. With a search active that the new entry does not match, the refreshed rail still excludes it, so the keep-a-row-selected effect bounced the selection to the first row that did match and the form closed on someone else's prompt. Clear the search alongside the selection so the new entry is eligible for the filtered rail. Applies to both create forms.
|
Confirmed and fixed in 9b7ece1. Reproduced it against the same filter + selection effect: with a search active that the new entry does not match, awaiting the refresh still left the effect bouncing the selection to the first matching row. Both create forms now clear the search alongside the selection so the new entry is eligible for the filtered rail. @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9b7ece18dd
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b2644e3c2
ℹ️ 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".
…ased off-window The auto-sizing textarea only remeasured when its value changed, so any width change that rewrapped the text left the old height in place. With overflowY set to hidden that clipped the newly wrapped lines until the next keystroke. It now remeasures on window resize, and on a ResizeObserver width change for the cases where the column moves without the window doing so. The grip deliberately does not capture the pointer, so releasing the mouse outside the window delivered neither pointerup nor pointercancel and the drag stayed live, still autoscrolling and reordering. A move reporting no buttons held is now treated as the release that was missed, and window blur ends the drag for a release that happens entirely off the page.
|
Both confirmed and fixed in cd10586. Remeasure on width change. The effect only depended on Release outside the window. Confirmed: without pointer capture, neither pointerup nor pointercancel arrives, and the drag stayed live with the autoscroll loop still running. A move reporting @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cd105866da
ℹ️ 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".
…rips Export passed the saved entry while the pane could be showing unsaved edits, so the downloaded file silently disagreed with what was on screen. It now exports the draft when there is one, normalised the way saving would normalise it, for both prompts and lists. A right- or middle-press on a reorder grip started a drag, and the zero-buttons recovery could not end it because buttons reads 2 or 4, so opening a context menu over a grip could reorder the list. Reordering now starts only on a primary press; touch and pen contacts report button 0 so they still drag, and isPrimary keeps a second finger from starting a competing drag.
|
Both confirmed and fixed in a101125. Export the visible draft. Export passed the saved entry while the pane could be showing unsaved edits, so the file silently disagreed with the screen. It now exports the draft when there is one, normalised the way saving would normalise it (the same untitled fallback, trimmed text, and blank list items dropped), for prompts and lists. Went with exporting the draft rather than disabling the button, so there is no dead control while editing. Non-primary presses on grips. Confirmed, including that the zero-buttons recovery could not clean it up since buttons reads 2 or 4. Reordering now starts only on a primary press. Verified right-click, middle-click, and a non-primary second contact all refuse to start a drag and leave the order untouched, while a primary press still drags and reorders. typecheck and build clean; tests unchanged from baseline. @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a101125719
ℹ️ 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".
PromptStorageDialog keeps a row selected during render: when the selected id is not in the filtered rail it falls back to the first row. handleDelete cleared the selection and then left the refresh unawaited, so that pass ran against a promptEntries that still held the deleted row, and returning from the callback released the mutation lock while the refetch was still out. Measured against a harness with a 1200ms refetch, 350ms after confirming a delete: the rail still lists 8 rows, and Delete and Use on the pane report disabled=false. Deleting the first row leaves the pane rendering that row, since the fallback picks it straight back out of the stale list. Deleting any other row moves the selection to row 1 rather than to the deleted row's neighbour. Awaiting the refresh inside the lock means the fallback runs against a list the row has already left and the controls stay held until then. Same harness, same instant: Save and Delete both report disabled=true, and the selection settles on one row, once. Both detail panes had it; both are fixed.
The body carried min-h-[max(0px,min(420px,calc(94dvh - 13rem)))], where 13rem stands for the header, tabs and search above it. DialogContent is overflow-hidden, so whatever the dialog's own children add up to past its height is painted nowhere, and the floor only holds while that chrome really is 13rem tall. It is not on a narrow dialog. At 320x320 in Chromium the title wraps to two lines and the description to six beside Import and Export, so the chrome is about 284px while the floor still claims 92.8px for the body. DialogContent then measures clientHeight 320 against scrollHeight 377: the body's scroll port is 93px tall with only 36px of it on screen, so a row scrolled to the bottom of that port lands in 57px the dialog never paints. main has no floor and does not clip, so the mismatch arrived with the master-detail layout. min-h-0 removes the guess and makes the port honest. The floor never did any work anywhere else: at 390x844 it asks for 420px of a 628px body, at 740x360 for 130px of 152px, and at 568x320 for 93px of 134px. The grid rows already carry the 132px and 272px each pane needs and the body scrolls to them. Measured in Chromium at 320x320, 568x320, 640x360, 667x375, 740x360, 390x844, 600x800, 1024x700 and 1280x860: clipping is 0px everywhere, and scrolling Use, Save, Preview and Run into view leaves each one inside every clipping ancestor on both tabs. That last part already held before this commit; what changes is that the body no longer claims height the dialog cannot show.
Review and fixes, pushed as
|
| transforms written (px) | |
|---|---|
7b8c53c0 |
-188, -90, -5, -4, 20, 22, 152, 157 |
| after | -188, -90, 152 |
The four extra values are rows that did not move, shifted by the height difference the toggle
introduced (149 -> 144, 170 -> 180, 106 -> 83, 85 -> 83). On screen that is the whole list
jumping.
applyOrder now reads the offsets when the reorder is requested, which is FLIP's "first" by
definition and is right for the keyboard path too. flipShifts in reorder.ts holds the arithmetic.
The effect also stops forcing a layout read on every keystroke.
3. Creating a prompt or list had no lock and no error path
NewPromptForm and NewPromptListForm awaited savePromptEntry / savePromptList bare. The id is
minted inside the handler, so the by-id mutation lock cannot cover it, and parseJsonOrThrow throws
on any non-2xx with nowhere for the rejection to go.
Three clicks on Save with the server returning 500:
| PUTs sent | distinct ids | Save disabled mid-flight | toast | console | |
|---|---|---|---|---|---|
7b8c53c0 |
3 | 3 | no | none | 3x uncaught Error: Disk is read only |
| after | 1 | 1 | yes | Could not create prompt / Disk is read only |
clean |
On a working server those three ids are three duplicate rows. useCreateGuard decides from a ref,
for the reason mutatingRef already gives.
4. A save cleared its draft before the refreshed entry arrived
The panes render draft?.text ?? entry.text, and entry stays the pre-save copy until
listPromptEntries returns. handleSave cleared the draft first and left the refresh unawaited, so
for the length of that request the editor showed the text as it was before Save, then snapped back.
Renaming showed the old name the same way. Awaiting the refresh and clearing after it also widens
the window in which samePromptDraft protects an edit made during the request, which is what
snapshotting the submitted values was for.
5. A delete cleared its selection before the row was gone
The dialog keeps a row selected during render by falling back to the first filtered row. handleDelete
cleared the selection and left the refresh unawaited, so that fallback ran against a promptEntries
that still held the deleted row, and returning from the callback released the mutation lock while the
refetch was still out.
Measured 350ms into a 1200ms refetch, after confirming a delete:
| rail rows | pane shows | Delete | Save | |
|---|---|---|---|---|
7b8c53c0 |
8 | the deleted row, when it was first | enabled | enabled once dirty is cleared, disabled otherwise |
| after | 8 | the row being deleted, controls held | disabled | disabled |
Deleting any row other than the first moved the selection to row 1 rather than to the deleted row's
neighbour. Awaiting the refresh inside the lock means the fallback runs against a list the row has
already left.
6. The body claimed a height the dialog could not show
The body carried min-h-[max(0px,min(420px,calc(94dvh - 13rem)))], where 13rem stands for the
header, tabs and search above it. DialogContent is overflow-hidden, so whatever the dialog's own
children add up to past its height is painted nowhere.
At 320x320 the title wraps to two lines and the description to six beside Import and Export, so that
chrome is about 284px while the floor still claims 92.8px:
DialogContent client / scroll |
clipped | body box / visible | |
|---|---|---|---|
main |
320 / 320 | 0px | 36 / 36 |
7b8c53c0 |
320 / 377 | 57px | 93 / 36 |
| after | 320 / 320 | 0px | 36 / 36 |
A row scrolled to the bottom of that 93px port lands in 57px the dialog never paints. main has no
floor and does not clip, so the mismatch arrived with this layout. The floor never did any work
elsewhere either: at 390x844 it asks for 420px of a 628px body, at 740x360 for 130px of 152px, at
568x320 for 93px of 134px. min-h-0 removes the guess; the grid rows already carry the 132px and
272px each pane needs.
Verification
npm run typecheck, npm test (5674 pass, 0 fail), npm run build, npm run bundle:check: all
clean on the pushed head. npx eslint on the four files reports 10 errors, all of them present
unchanged on main (unused imports at lines 74-80, two catch {}, three set-state-in-effect), and
zero in sortable-prompt-items.tsx, reorder.ts and the two test files.
Every new test was mutation-checked. Reverting ownsDrag, the FLIP baseline capture, the create
guard, either settle-after-refresh ordering, or the body floor each fails at least one.
Scrolling Use, Save, Preview and Run into view and testing each rect against every clipping ancestor:
all reachable on both tabs at 1280x860, 1024x700, 600x800, 390x844, 740x360, 667x375, 640x360,
568x320 and 320x320, in Chromium and WebKit. That already held at 7b8c53c0; what changed is item 6.
Deliberately not changed
- Drag autoscroll. Codex asked for it and
e2beec10had it, but @danielhanchen asked for the
autoscroll module to be split out, and the split did that. Leaving it out. - The PR description. "Run still fires the saved items, not the draft" no longer matches
PromptListDetail, which passesrunnableItemsoff the draft since18ef8252. Worth updating. - The pre-existing lint errors above, which belong to
main.
Gaps
- Firefox did not run: the Playwright Firefox build crashes at startup on this macOS 27 box with
RenderCompositorSWGL failed mapping default framebuffer. Untested there. - Branded Chrome and Edge are not installed on this machine, and native Safari automation is off, so
those three are untested too. WebKit is coverage, not proof of Safari. - The scenes drive the four
prompt-storagemodules mounted in isolation against a stubbed API, not
a running Studio, so nothing here exercises the real backend or the Tauri window. - No touch or hybrid-pointer hardware, so the multi-pointer guards are covered by the pure tests
only.
Convergence rounds, 7fb249cf through cca42e81
Four more Codex rounds after the review above. Eight more defects fixed, two rejected. Codex's last
verdict on cca42e813b: "Didn't find any major issues."
Three of the eight were mine, introduced by fixes in an earlier round. They are marked below.
Round 1, 90c83b15
The create guard died with the form that held it. useCreateGuard sat inside NewPromptForm,
which is mounted only while showNewPrompt is true, so selecting a rail row during a create dropped
the guard and reopening New handed back a fresh one reading false. (mine, from the create-guard fix)
Save, click a rail row, click New prompt, Save again, 1500ms PUT: before, the second Save is enabled
and 52364ff66bd6 and 791ac64a2899 both reach the backend, storing one prompt twice. After,
disabled, one id. Same mount-boundary mistake the row locks are hoisted above the keyed panes to
avoid; both guards now live in PromptStorageDialog, one per kind.
Round 2, 7f2582ea
A slow create wiped a draft that had moved on. The New form stays editable while its request is
out and Cancel is live during one, so onClose() on success reset a draft that no longer matched
what was sent. (mine)
| before | after | |
|---|---|---|
| type on while it saves | "", the tail saved nowhere |
"first half, and the part typed while it saved" |
| Cancel mid-create, start another draft | "" |
"a completely different draft" |
Both paths hand the submitted snapshot up now and the parent resets only on a match, reusing
samePromptDraft / sameListDraft.
Rejected: propagate refresh failures before closing. Accurate, but refreshEntries' catch {}
is main's at 4147f80c, unchanged here and shared by every caller. The PUT succeeded, so the row is
on the server, and the open effect refetches on reopen; main shows the same stale list on the same
failed GET. Reasoning in the thread.
Round 3, 8aa9d09f
Opening the Lists tab froze on a large list. Selecting the tab auto-selects its first row and the
pane mounted one controlled textarea, grip and ResizeObserver per item. Timed tab click to pane
settled, Chromium, first list N items:
| N | this PR | main |
|---|---|---|
| 50 | 146 ms | 79 ms |
| 100 | 246 ms | 82 ms |
| 500 | 2465 ms | 82 ms |
| 2000 | 35586 ms | 70 ms |
main is flat because the collapsed card rendered items.slice(0, 3) and only mounted the editor on
Edit. The backend takes 10000 items in one list, which an import can produce. Past
EDITOR_ROW_LIMIT (100) the pane shows the first five and an "Edit all N prompts" button: 101 items
now settle in 76ms and 115 nodes, 10000 in 80ms. Save, Run and Export still read the full items, so
renaming a deferred 2000-item list sends all 2000 back.
A hidden tab's selection was corrected against the other tab's search. searchQuery is shared.
Select "Docs sweep" on Prompt Lists, switch to Saved Prompts, search "rewrite", switch back: the pane
opens on "Release checklist". Gating on activeTab was half of it; the per-tab reset was an effect,
so the first render of the new tab still held the old query and the correction ran in it. Clearing in
the tab handler means no render sees the mismatch, and it drops one of the file's
react-hooks/set-state-in-effect errors.
A finished create dragged the view back. Save, then click the fourth rail row: completion pulls
the pane off "Explain this regex". Save, switch tabs, type "docs" in the search there: completion
empties it. Each form now reports whether it is still the one on screen.
Round 4, cca42e81
The mounted flag never survived StrictMode. Set at the ref and only ever cleared in an effect
cleanup, so StrictMode's setup, cleanup, setup replay left it false for the form's whole life and
every successful create reported an unmounted form. (mine, from the round-3 guard)
Create a prompt and let it finish: before, the form stays open with an emptied draft and no row
selected. After, the form closes and "A brand new prompt" is selected. This is the one to check
first if anything here looks wrong, since it broke the ordinary create path in dev builds.
Add prompt unmounted the editor at the limit. A 100-item list plus one row made editorMounted
false and swapped the editor for the summary mid-edit: 100 textareas to 0. Now latched at mount, 100
to 101. (mine, from the deferral)
Preview stayed on a deferred list's toolbar and only relabelled itself to Edit, since the summary
renders neither editor nor preview. Not rendered while deferred now. (mine, from the deferral)
Mutation locks shared one key space across two tables with independent ids, so an imported prompt
and list sharing an id blocked each other's Save and Delete. lockKey prefixes the kind.
Rejected: drag autoscroll, for the third time. @danielhanchen asked for that module to be split
out and 60dc3bc3 did it, so putting it back is the one change on this PR a maintainer has
explicitly asked against. It belongs in the follow-up. The drag itself still hit-tests correctly
while the pane is scrolled; only the scrolling during the gesture is absent.
Verification at cca42e81
npm run typecheck, npm test (5683 pass, 0 fail), npm run build, npm run bundle:check all
clean. npx eslint on the four files reports 9 errors, all present unchanged on main, down one
from the review above because the tab reset left the effect. Every new test mutation-checked.
Seven browser scenes re-run on the final tree with no regressions: create, deferred-editor latch,
navigation guard, pending-edit draft, create remount, tab selection, delete mid-flight. Detail
actions still reachable at all nine viewports in Chromium and WebKit.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7fb249cfeb
ℹ️ 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".
useCreateGuard lived inside NewPromptForm and NewPromptListForm, which are mounted only while showNewPrompt or showNewList is true. Selecting a rail row turns that off, so a create still in flight loses the guard that was blocking a second one, and reopening New mounts a fresh guard reading false over a draft the parent still holds. Against a harness with a 1500ms PUT: Save, click a rail row, click New prompt, Save again. Before, the second Save is enabled and two ids reach the backend, so one prompt is stored twice. After, it is disabled and one id goes out. This is the same mount-boundary mistake the row mutation locks are held above the keyed detail panes to avoid. Both guards now live in PromptStorageDialog and reach the forms as props, one per kind so a prompt create and a list create stay independent.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 90c83b15c5
ℹ️ 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".
| } | ||
| // Await the refresh first, or the keep-a-row-selected effect runs | ||
| // against a list without the new id and bounces the selection off it. | ||
| await onRefresh(); |
There was a problem hiding this comment.
Propagate refresh failures before closing
When the PUT succeeds but the following list GET fails, refreshEntries catches the error and resolves normally, so this path still selects the new ID, closes the form, and resets its draft even though promptEntries does not contain the created row. The selection-correction logic then selects an older row, leaving the successful creation invisible until a later refresh; make refresh failure observable or update local state from the PUT result before closing. The list-creation path has the same failure mode.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Accurate description, but not something to change here.
The swallow is main's, not this PR's. refreshEntries is try { setPromptEntries(await listPromptEntries()); } catch {} at 4147f80c too, unchanged by this diff, and every caller shares it. Making the failure observable means changing that shared helper, which widens a PR @danielhanchen asked to narrow to the layout.
Nothing is lost when it happens. The PUT succeeded, so the row is on the server; the list is stale until the next fetch, and the open effect refetches on every reopen, so closing and reopening the dialog shows it. On main the same failed GET produces the same stale list and the same silence. What this PR adds is the selection landing on an older row rather than nothing, which is a worse-looking symptom of the same stale list, not a new loss.
It is also an infrastructure error path, a GET failing immediately after a PUT succeeds, rather than something reachable on well-formed input.
If the swallowed catch is worth addressing, it is its own change across all of refreshEntries / refreshLists' callers rather than a special case on the create path.
The New form's fields stay editable while its request is out, and Cancel is live during one too, so the draft the parent holds can differ from what was sent by the time the create lands. Both forms called the parent's onClose on success, which resets that draft outright. Against a harness with a 1500ms PUT: type "first half", Save, then finish the sentence while the request runs. Before, reopening New shows an empty form and the tail is gone, saved nowhere. Cancel mid-create, reopen New, and type a different draft: that one is wiped too when the first request lands. Both create paths now hand the submitted snapshot up, and the parent resets only when the draft still equals it, reusing the samePromptDraft and sameListDraft comparison the edit panes already settle on. onClose stays what Cancel means, an outright discard.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f2582eaf3
ℹ️ 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".
Selecting the Prompt Lists tab auto-selects its first row, and the detail pane
mounts SortablePromptItems for every item straight away: one controlled
textarea, one grip and one ResizeObserver each. That cost grows faster than the
item count.
Measured in Chromium against a harness whose first list is N items, timing the
tab click until the detail pane settles:
N this PR main
50 146 ms 79 ms
100 246 ms 82 ms
500 2465 ms 82 ms
2000 35586 ms 70 ms
main is flat because the collapsed card rendered `items.slice(0, 3)` and only
mounted the editor when the user clicked Edit. The backend takes 10000 items in
one list (studio/backend/routes/prompts.py), which an import can produce, so this
is reachable by opening a tab.
Past EDITOR_ROW_LIMIT the pane shows the first five items and an "Edit all N
prompts" button instead, and mounts the editor when that is clicked. At the limit
it still mounts: 100 items 246ms, 101 items 76ms and 115 nodes, 10000 items 80ms.
Deferring the editor changes nothing about what is stored. Save, Run and Export
all read `items`, not the mounted rows: renaming a deferred 2000-item list and
saving sends all 2000 back, first and last intact.
selectCreatedPrompt cleared the search, selected the created row and hid the New form unconditionally. A create can take long enough for none of that to be where the user is any more: selecting a rail row, switching tabs or reopening New all happen while the request is out. Against a harness with a 1500ms PUT. Save, then click the fourth rail row: before, completion pulls the pane off "Explain this regex". Save, switch to Prompt Lists, type "docs" in the search there: before, completion empties that box. Both hold after. Each form now carries a mounted ref and reports it, so the parent moves the view only while the form that started the create is still the one on screen. Reopening New mounts a different form, which reports false for the old request, so a second draft is left alone too. The draft reset stays outside the guard: a draft that still matches what was sent is now a saved row wherever the user went, and keeping it would leave the + button marked unsaved for it.
searchQuery is shared by both tabs, and the keep-a-row-selected pass ran over both collections every render. Filtering one therefore also filtered the hidden one and dropped the row it had. Select "Docs sweep" on Prompt Lists, switch to Saved Prompts, search "rewrite", switch back: before, the pane opens on "Release checklist". The query matches no list, so the hidden tab's selection is cleared while the user is nowhere near it. Gating the correction on activeTab is half of it. The per-tab reset was an effect keyed to activeTab, so the first render of the new tab still held the old query and the correction ran in it before the reset landed. Clearing in the tab handler means no render sees the mismatch, and it drops one of the file's react-hooks/set-state-in-effect errors.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8aa9d09f90
ℹ️ 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".
| pointerYRef.current = e.clientY; | ||
| evaluate(); |
There was a problem hiding this comment.
Auto-scroll the list editor while dragging
When a prompt list is taller than the scrollable detail pane, this handler only updates the pointer position and hit-tests the currently visible layout; it never scrolls the pane when the pointer reaches an edge. Because the grip also uses touch-none and prevents the pointer-down default, touch and pen users cannot move an item to an offscreen position in one drag, while mouse users must separately wheel and jiggle the pointer or reorder repeatedly. Add edge-triggered auto-scrolling and reevaluate the insertion point as the pane scrolls.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Accurate, and deliberately out of scope for this PR.
@danielhanchen asked for exactly this to be split out: "this branch also lands list bookmarking in the plus menu, the new kind pill and the drag autoscroll module. Could you split those out so the layout change lands on its own?" The split in 60dc3bc did that, and e2beec10 had the autoscroll before it. Putting it back is the one change on this PR that a maintainer has explicitly asked not to have.
It belongs in the follow-up with the rest of the split, and this is the third round it has come up, so noting it here rather than in a fourth.
The drag itself does still work while the pane is scrolled: hit-testing is pointerY - container.getBoundingClientRect().top against offsetTop, and the container moves with the scroller, so the coordinates stay right. What is missing is only the scrolling during the gesture.
The flag that tells the parent whether the form that started a create is still on screen was initialised at the ref and only ever cleared, in an effect cleanup. StrictMode replays an effect as setup, cleanup, setup on mount, and main.tsx wraps the app in it, so that first cleanup left the flag false for the rest of the form's life and every successful create reported an unmounted form. The visible result in a dev build: create a prompt, and it saves and refreshes, but the New form stays open with an emptied draft and the new row is never selected. Measured against the harness, before: form still open, draft "", no row selected. After: form closed, "A brand new prompt" selected. Setting it in setup restores it on the replayed mount. The guard it feeds still works: with a 1500ms PUT, selecting another row or typing a search on the other tab while the create is out still leaves both alone.
editorMounted was recomputed every render from the live item count, so a list sitting exactly at EDITOR_ROW_LIMIT lost its editor the moment Add prompt took it one over: the whole editing view was replaced by the deferred summary. The draft kept the new item, but the caret and the view did not. Measured on a 100-item list, clicking Add prompt: before, the pane goes from 100 textareas to 0. After, 100 to 101. The decision is now state initialised from the count at mount. The pane is keyed by row id, so selecting another list still re-decides it, which is the part that should depend on size.
The deferred branch renders the five-row summary and ignores `preview`, but the toggle stayed on the toolbar. Clicking it on a list above EDITOR_ROW_LIMIT left the same raw, line-clamped rows on screen and relabelled itself to Edit, so the control claimed a preview that was never rendered. Measured on a 500-item list: before, the toolbar carries a Preview button alongside "Edit all 500 prompts". After, it does not. A list under the limit is unchanged, toggle and all.
Prompts and prompt lists are separate tables with independent id spaces, and the backend takes arbitrary ids up to 128 characters, so an import can give one of each the same id. Both panes fed the raw id into one mutatingIds set, so saving prompt x marked list x pending and disabled its Save and Delete until that unrelated request settled. lockKey prefixes the kind, which is enough on its own: reaching a list key needs a list, since a prompt id of "list:abc" keys "prompt:list:abc".
|
@codex review |
|
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". |
CI at
|
| Check | On this PR | On main 7457e94d |
On main 5775785a |
|---|---|---|---|
| Frontend build + bundle sanity | fail | fail | fail |
| (Python 3.13) | fail | fail | fail |
| Repo tests (CPU) | fail | fail | fail |
| Core (HF=latest + TRL=latest) | fail | fail | fail |
| Chat UI, API, Update and GGUF inference | fail | runner fault, below |
Frontend build + bundle sanity. [ansi-smoke] pageerror: ReferenceError: Cannot access 'CHAT_GPU_MEMORY_MODE_KEY' before initialization. I reproduced this locally on the merge base
4147f80c with no PR code in the tree, loading smoke-ansi.html on a plain Vite dev server: the
identical error, on main and on this branch alike. It is a temporal dead zone inside the import
cycle around features/chat/index.ts, stores/chat-runtime-store.ts and features/model-picker;
walking the graph from smoke-ansi-main.tsx finds 43 cycles through chat-runtime-store.ts, so it
is not a one-import fix. Main's frontend CI has been red on this job since 54367e59 at 03:54 today
(fd31302d at 03:38 was the last green).
(Python 3.13). Five backend failures, all source-inspection of openai_chat_completions:
test_api_profile_usage_routes, test_checkpoint_compaction (x3), test_nudge_tool_calls_wiring.
This PR's own six commits touch no Python at all; the Python files in the diff arrive with the merge
of main.
Repo tests (CPU). test_chat_title_generation, test_model_picker_contracts,
test_usage_examples_model_source_contract, all reading sources this PR does not modify.
Core (HF=latest + TRL=latest). The transformers-drift failure @LeoBorcherding already identified
on the previous head.
Chat UI, API, Update and GGUF inference. llama-server failed to launch on macOS 15.7.7 (dyld load / symbol error), from .github/scripts/assert-llama-loads.sh. A runner toolchain fault with
nothing to do with a frontend change; it did not clear on a rerun.
Worth flagging on its own: main is currently red on four separate job families, so every frontend
PR is blocked behind the same breakages.
mahiatlinux
left a comment
There was a problem hiding this comment.
All reviewed and fixed, LGTM. https://github.com/unslothai/unsloth/pull/8692/checks
#8692) * Studio: rework prompt storage into a master-detail layout Cards rendered the full prompt body with no truncation, so a few dozen saved prompts became a long scroll of uneven cards. Editing happened inline in a four-row textarea, so long prompts were edited through a peephole while the list shifted underneath. Replace the flat list with a master-detail layout: a compact rail of name plus one-line preview on the left, and a detail pane on the right that owns its height. Unsaved edits are held per entry so switching rows no longer discards them, with a dirty marker in the rail and Save/Revert in the footer. List items now auto-size to their content and reorder by dragging the grips, animated with FLIP. The drag listener lives on window rather than using setPointerCapture: reordering makes React move the row's DOM node, and detaching implicitly releases pointer capture, which ended the drag after one row. Hit-testing uses offsetTop/offsetHeight since a client rect reports the pre-animation position while FLIP is in flight. Add a Preview toggle on both tabs backed by the existing MarkdownPreview, and allow bookmarking prompt lists into the + menu next to bookmarked prompts. Rows there carry a Prompt / List pill, since selecting a prompt fills the composer while selecting a list queues and sends every prompt in it. Presentation only: no schema migration, no API change, no change to the export formats or import parser, and onUse/onRunList signatures are unchanged. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: address review feedback on prompt storage Select a newly created prompt or list only after the refresh resolves. The keep-a-row-selected effect runs against whatever list is in state, so selecting the new id while the old list was still in state made the effect bounce the selection to the first existing entry, and the new entry was never shown. Let the body shrink and stack on small viewports. The fixed 420px floor plus the header could exceed the dialog's 94dvh on a short window and clip the detail pane's actions behind overflow-hidden, and a fixed 248px rail left the detail pane unusably narrow below ~600px. The floor is now capped against the viewport, the rail narrows at sm and stacks below it, and the action rows wrap. Report when a list cannot be queued. startQueue refuses synchronously when queueing is unavailable and does not run the onAborted callback, so running a list from the project new-chat composer silently did nothing from both the Run button and the bookmarked-list menu items. * Studio: auto-scroll the prompt list while dragging A list taller than the detail pane could only be reordered within the visible region: the pointer handler hit-tested coordinates but never scrolled the overflow-y-auto ancestor, and pointerdown suppresses the browser's own drag gesture, so there was nothing to pull the list along. Holding a grip near the top or bottom edge now scrolls the pane and re-runs the hit-test each frame, so a drag can reach any row. The step ramps with depth into the edge band and is capped per frame. The step calculation lives in its own module with unit tests covering the dead zone, both directions, the ramp, the cap, and panes too short to hold two edge bands. * Studio: clear the search when selecting a newly created prompt or list Awaiting the refresh was not enough on its own. With a search active that the new entry does not match, the refreshed rail still excludes it, so the keep-a-row-selected effect bounced the selection to the first row that did match and the form closed on someone else's prompt. Clear the search alongside the selection so the new entry is eligible for the filtered rail. Applies to both create forms. * Studio: remeasure auto-grown textareas on resize, and end a drag released off-window The auto-sizing textarea only remeasured when its value changed, so any width change that rewrapped the text left the old height in place. With overflowY set to hidden that clipped the newly wrapped lines until the next keystroke. It now remeasures on window resize, and on a ResizeObserver width change for the cases where the column moves without the window doing so. The grip deliberately does not capture the pointer, so releasing the mouse outside the window delivered neither pointerup nor pointercancel and the drag stayed live, still autoscrolling and reordering. A move reporting no buttons held is now treated as the release that was missed, and window blur ends the drag for a release that happens entirely off the page. * Studio: export the visible draft, and ignore non-primary presses on grips Export passed the saved entry while the pane could be showing unsaved edits, so the downloaded file silently disagreed with what was on screen. It now exports the draft when there is one, normalised the way saving would normalise it, for both prompts and lists. A right- or middle-press on a reorder grip started a drag, and the zero-buttons recovery could not end it because buttons reads 2 or 4, so opening a context menu over a grip could reorder the list. Reordering now starts only on a primary press; touch and pen contacts report button 0 so they still drag, and isPrimary keeps a second finger from starting a competing drag. * Studio: run the visible list draft, scope drags to one pointer, keep new-entry drafts Run queued entry.items while the editor could be showing something else. Worst case, deleting every draft item left the button enabled off the stored length and silently ran the whole old list. Run now fires the visible non-blank items and disables on those. The window-level drag listeners saw every pointer on the device, so a second finger's movement reordered using its own clientY and its release ended the first finger's drag. The initiating pointerId is now recorded and the other pointers are ignored. The new-entry forms held their name and text locally, so selecting any row in the rail unmounted the form and discarded a half-written prompt or list without warning. That state now lives in the parent alongside the edit drafts, and the New button carries a dot while a draft is waiting. Starting a bookmarked list bypassed the busy gate that ordinary sends respect, overwriting the queue refs and firing another send on top of a run already in flight. It now refuses while a run or an existing queue is active and says so. * Studio: block list runs while dictating, bind drags to one pointer, shrink the body floor Ordinary sends gate on isDictating and this path did not, so selecting a bookmarked list mid-dictation set the composer text and scheduled a send that a landing transcription could overwrite first, queueing the dictated words instead of the saved prompt. isPrimary is scoped per pointer type, so on a hybrid device a primary mouse or pen press passed the guard while a touch drag was already running and took the drag over, stranding the pointer that started it. Pointer-down is now rejected outright while a drag is bound. The body floor took a flat share of the viewport, so on a phone in landscape it still added up past the dialog's 94dvh once the ~13rem of non-shrinking header and tab/search chrome was counted, and the detail actions were clipped. The floor now subtracts that chrome, and clamps at zero when the viewport is shorter than it. * Studio: let the stacked rail shrink, scope the abort reopen, narrow the delete race The stacked grid kept a hard 96px minimum on the rail row, which with the gap and padding exceeded the whole body floor on a short viewport: the detail pane collapsed to zero height and its actions overflowed into DialogContent's clipping region, undoing the floor fix. The rail row is now shrinkable and the gap and bottom padding tighten below sm. The queue abort callback reopened the storage dialog, which was right for a run started inside it but threw a modal over the destination chat when the run came from the "+" submenu. The launch source is now passed through so only a dialog-started run reopens it. Deleting awaited the request and then cleared the selection outright, so selecting another row while the delete was in flight was undone. The deleted id now goes up and the parent clears only if it still matches. * Studio: give the shrunken panes an overflow path, confirm deleting a dirty entry Shrinking the grid tracks did not shrink what was inside them. On a short viewport the rail's new button and count footer, and the detail pane's name field, metadata and action row, still overflowed their tracks and spilled into DialogContent's clipping region, so the actions stayed unusable at exactly the size the previous change targeted. Each pane now keeps the minimum its own fixed chrome needs and the body scrolls when those minimums do not fit. Delete sits beside the draft controls in this layout, where the old one was hidden while editing, so a single click destroyed the stored entry and the only copy of the unsaved draft together. Deleting a dirty prompt or list now asks first and names what is being lost. * Studio: harden the bookmarked-list run guards and the draft maps The busy guard read React state that only refreshes on the 200ms handle poll, so a list started in the window right after a send queued over the live generation. It now asks the handles directly, the way that poll does. A staged image or audio attachment was left in place, and send() picks those up, so the first prompt in the list went out with the attachment and the rest without it. Running a list while something is staged is now refused rather than clearing it, since the attachment belongs to the user. The draft maps were plain objects keyed by entry id. Ids come from storage and may be any string, so an entry called "constructor" or "toString" resolved to an inherited prototype member: the row read as permanently dirty and the inherited function's own `name` could land in the editor as the entry name and be saved from there. They are Maps now. * Studio: refuse bookmarked list runs while the image editor is open The composer is deliberately raised above the generated-image overlay, so the "+" menu stays clickable while an image edit is pending. Submitting normally rewrites the prompt into an edit instruction, sets the pending image reference and closes the overlay; startQueue appends the saved text untouched, so the first list prompt was either applied to the selected image or consumed the pending reference outright. Running a list now refuses while the overlay is open and says why. The shared composer has no overlay of its own, so this is limited to the chat thread path. * Studio: trim the prompt storage comments Several had grown to five or more lines, restating the reasoning from review rather than the fact a reader needs. Each is now at most three lines and keeps only what is not evident from the code: why there is no pointer capture, why the hit-test uses layout offsets, why the draft maps are Maps, and so on. No behaviour change. * Studio: namespace the saved-items menu keys, and make the empty drafts factories Prompts and lists live in separate tables with independent ids, and the "+" submenu renders both as siblings, so a shared id produced duplicate React keys and the wrong row could be reused or dropped on an async refresh. Keys are prefixed by kind in both composers. The empty new-entry drafts were shared module constants, so every reset handed back the same `items` array. Nothing mutates it today, but one in-place edit would corrupt it permanently; they are factories now. * Studio: address the review on prompt storage Serialize the mutations. PUT is an unconditional upsert, so a Save pressed while a DELETE was still in flight wrote the row back. Both details now refuse a second mutation while one is pending, and report a failure instead of swallowing it. Reorder by insertion slot rather than by the row under the pointer. Hit-testing the containing row oscillates across uneven heights: drop a short row onto a tall one and the tall row is still under the pointer, which sends it straight back. reorder.ts counts the passed midpoints of the other rows, which has a fixed point at every pointer height. FLIP off layout offsets. Client rects move with the scroll position, so scrolling between reorders baked the accumulated distance into every transform. Hand autoscroll outwards through the whole scroll chain. A nested scroller reports its unclipped height, so its edge could sit past the ancestor hiding it and past the viewport, where the pointer can never reach it. clipSpan intersects the pane with what clips it. Give the rail a roving tabindex and aria-current, so reaching the editor no longer means tabbing through the library. Sequence the plus-menu refreshes and drop the rows on failure, so a stale or deleted list cannot be queued from the menu. Guard the composer paths the earlier rounds missed: dictation on the chat thread's menu, and audio still being read into base64, which pendingAudio cannot see yet. Fix the lint the new component tripped: refs read during render, and setState called synchronously from an effect. * Studio: split the prompt storage PR down to the layout change Per review: land the master-detail relayout on its own. Three things that rode along with it come out, to follow separately once this is in. Bookmarked lists in the "+" menu. The pinnedListIds store, the pin control on a list, the pinned marker in the rail, and the menu entries in both composers. thread.tsx, shared-composer.tsx and plus-menu-prefs-store.ts go back to main untouched, so the guards those menu entries needed (live handles, dictation, staged attachments, the image overlay) travel with them. That also returns the storage dialog's Run button to how main queues a list. The kind pill. It exists only to tell a prompt from a list once both share the "+" submenu, so it has no reason to land before the lists do. Drag autoscroll. The module, its tests, and the scroll-chain walk in the drag loop. Reordering still works over what the pane shows; it just does not scroll to reach the rest. What stays is the layout: the rail and detail pane, per-entry drafts, the preview toggle, the auto-sizing rows and their drag/keyboard reorder, and the review fixes for that surface. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: hold prompt-storage mutation locks above the keyed detail panes The detail panes are mounted with key={entry.id}, so selecting another rail row unmounts them and the local pending lock came back false. The save is an unconditional PUT, which makes this reachable: start a Save, switch rows, switch back, Delete. If the DELETE settles first the PUT lands after it and writes the deleted row straight back. The lock now lives in the dialog, keyed by row id, and is held until the request settles. PromptListDetail had the same defect and gets the same fix. acquire and release moved to mutation-lock.ts so the transitions can be tested without a renderer, the same reason reorder.ts was split out. Five tests, mutation-checked: dropping the guard in acquire fails two of them. * Studio: decide the mutation lock from a ref, and keep edits made while saving Two review findings on the prompt-storage dialog, both real. The lock read its own outcome out of a functional updater: set started inside the setMutatingIds callback, then check it on the next line. React does not promise to run that updater during setState, so the check could see false, skip the request, and still acquire the id later during render, leaving nothing to release it and the row's Save and Delete disabled for good. That was a defect I added with the lock itself. A ref is now the authority and the decision is made synchronously; the state exists only so the buttons re-render. Separately, a save cleared the draft unconditionally on success. The editor stays usable while the request is in flight, so anything typed meanwhile is newer than what the server was sent, and clearing threw it away. Both panes now snapshot what they submit and clear only if the draft still matches, so a newer edit survives and the row stays dirty. The list editor had the same defect. samePromptDraft and sameListDraft live in mutation-lock.ts rather than the dialog because the test runner cannot import a .tsx, which is the same reason reorder.ts exists. Eight tests, all mutation-checked: neutering either comparison fails two, restoring the deferred-updater pattern fails one. * studio: end a prompt-storage drag for the pointer that started it The reorder grips deliberately skip setPointerCapture, so pointermove, pointerup and pointercancel are handled on window and see every pointer on the page. `isDragPointer` treated a null `pointerIdRef` as a match, which is the state an already-ended drag leaves behind. endDrag clears the id, but React only unsubscribes the listeners on the next commit. A window blur while the button is still held ends the drag and then matches the very next pointermove, so evaluate() reorders the list again after the drag was over. `ownsDrag` in reorder.ts now requires a live id, and it is pure so the case is testable without a renderer. * studio: capture the prompt-list FLIP baseline at the reorder The baseline was re-recorded in the layout effect keyed to [uids, items], so it only tracked commits that changed the order or the text. Row heights move without either: toggling Preview swaps every textarea for a rendered markdown block, and a resize regrows the auto-sizing textareas. The next drag then animated from offsets that described a layout no longer on screen. With rows 100px tall and a baseline left over from 40px rows, swapping the first two rows transforms the untouched third row by 120px and animates the swap over 42px instead of 102px, so the whole list visibly jumps. applyOrder now reads the offsets when the reorder is requested, which is FLIP's "first" by definition and is correct for the keyboard path too. flipShifts in reorder.ts holds the arithmetic so both cases are testable without a renderer, and the effect no longer forces a layout read on every keystroke. * studio: guard and report the prompt-storage create paths Saving from NewPromptForm or NewPromptListForm awaited savePromptEntry / savePromptList with no lock and no catch. Both defects follow from that. A second click before the first request settles mints a second newId() and stores a duplicate row, because the id is created inside the handler and the Save button is only disabled on empty content. The by-id mutation lock cannot cover this: the row has no id until the request is built. savePromptEntry throws through parseJsonOrThrow on any non-2xx, and the rejection had nowhere to go. The handler stopped before onClose, so the form stayed exactly as it was with no toast and no error, which is what a successful create with a slow refresh also looks like. The edit panes already toast; the create paths now do too. useCreateGuard decides from a ref rather than the state it schedules, for the reason mutatingRef already gives. * studio: refresh before clearing a saved prompt-storage draft The detail panes render `draft?.text ?? entry.text`, and `entry` stays the pre-save copy until listPromptEntries comes back. handleSave cleared the draft first and left the refresh unawaited, so for the length of that request the editor showed the text as it was before Save, then snapped to the saved text. Renaming showed the old name in the same way. Awaiting the refresh and clearing after it keeps the draft over the entry until the saved copy is there to replace it. It also widens the window in which samePromptDraft protects an edit made during the request, which is the point of snapshotting what was submitted. The prop is typed as returning a promise now rather than being called and dropped. * studio: refresh before clearing a deleted prompt-storage row PromptStorageDialog keeps a row selected during render: when the selected id is not in the filtered rail it falls back to the first row. handleDelete cleared the selection and then left the refresh unawaited, so that pass ran against a promptEntries that still held the deleted row, and returning from the callback released the mutation lock while the refetch was still out. Measured against a harness with a 1200ms refetch, 350ms after confirming a delete: the rail still lists 8 rows, and Delete and Use on the pane report disabled=false. Deleting the first row leaves the pane rendering that row, since the fallback picks it straight back out of the stale list. Deleting any other row moves the selection to row 1 rather than to the deleted row's neighbour. Awaiting the refresh inside the lock means the fallback runs against a list the row has already left and the controls stay held until then. Same harness, same instant: Save and Delete both report disabled=true, and the selection settles on one row, once. Both detail panes had it; both are fixed. * studio: drop the guessed height floor on the prompt-storage body The body carried min-h-[max(0px,min(420px,calc(94dvh - 13rem)))], where 13rem stands for the header, tabs and search above it. DialogContent is overflow-hidden, so whatever the dialog's own children add up to past its height is painted nowhere, and the floor only holds while that chrome really is 13rem tall. It is not on a narrow dialog. At 320x320 in Chromium the title wraps to two lines and the description to six beside Import and Export, so the chrome is about 284px while the floor still claims 92.8px for the body. DialogContent then measures clientHeight 320 against scrollHeight 377: the body's scroll port is 93px tall with only 36px of it on screen, so a row scrolled to the bottom of that port lands in 57px the dialog never paints. main has no floor and does not clip, so the mismatch arrived with the master-detail layout. min-h-0 removes the guess and makes the port honest. The floor never did any work anywhere else: at 390x844 it asks for 420px of a 628px body, at 740x360 for 130px of 152px, and at 568x320 for 93px of 134px. The grid rows already carry the 132px and 272px each pane needs and the body scrolls to them. Measured in Chromium at 320x320, 568x320, 640x360, 667x375, 740x360, 390x844, 600x800, 1024x700 and 1280x860: clipping is 0px everywhere, and scrolling Use, Save, Preview and Run into view leaves each one inside every clipping ancestor on both tabs. That last part already held before this commit; what changes is that the body no longer claims height the dialog cannot show. * studio: hold the prompt-storage create guard above the New forms useCreateGuard lived inside NewPromptForm and NewPromptListForm, which are mounted only while showNewPrompt or showNewList is true. Selecting a rail row turns that off, so a create still in flight loses the guard that was blocking a second one, and reopening New mounts a fresh guard reading false over a draft the parent still holds. Against a harness with a 1500ms PUT: Save, click a rail row, click New prompt, Save again. Before, the second Save is enabled and two ids reach the backend, so one prompt is stored twice. After, it is disabled and one id goes out. This is the same mount-boundary mistake the row mutation locks are held above the keyed detail panes to avoid. Both guards now live in PromptStorageDialog and reach the forms as props, one per kind so a prompt create and a list create stay independent. * studio: keep a new-entry draft that moved on while its create ran The New form's fields stay editable while its request is out, and Cancel is live during one too, so the draft the parent holds can differ from what was sent by the time the create lands. Both forms called the parent's onClose on success, which resets that draft outright. Against a harness with a 1500ms PUT: type "first half", Save, then finish the sentence while the request runs. Before, reopening New shows an empty form and the tail is gone, saved nowhere. Cancel mid-create, reopen New, and type a different draft: that one is wiped too when the first request lands. Both create paths now hand the submitted snapshot up, and the parent resets only when the draft still equals it, reusing the samePromptDraft and sameListDraft comparison the edit panes already settle on. onClose stays what Cancel means, an outright discard. * studio: let an oversized prompt list wait before mounting its editor Selecting the Prompt Lists tab auto-selects its first row, and the detail pane mounts SortablePromptItems for every item straight away: one controlled textarea, one grip and one ResizeObserver each. That cost grows faster than the item count. Measured in Chromium against a harness whose first list is N items, timing the tab click until the detail pane settles: N this PR main 50 146 ms 79 ms 100 246 ms 82 ms 500 2465 ms 82 ms 2000 35586 ms 70 ms main is flat because the collapsed card rendered `items.slice(0, 3)` and only mounted the editor when the user clicked Edit. The backend takes 10000 items in one list (studio/backend/routes/prompts.py), which an import can produce, so this is reachable by opening a tab. Past EDITOR_ROW_LIMIT the pane shows the first five items and an "Edit all N prompts" button instead, and mounts the editor when that is clicked. At the limit it still mounts: 100 items 246ms, 101 items 76ms and 115 nodes, 10000 items 80ms. Deferring the editor changes nothing about what is stored. Save, Run and Export all read `items`, not the mounted rows: renaming a deferred 2000-item list and saving sends all 2000 back, first and last intact. * studio: leave the view alone when a create lands after the user moved on selectCreatedPrompt cleared the search, selected the created row and hid the New form unconditionally. A create can take long enough for none of that to be where the user is any more: selecting a rail row, switching tabs or reopening New all happen while the request is out. Against a harness with a 1500ms PUT. Save, then click the fourth rail row: before, completion pulls the pane off "Explain this regex". Save, switch to Prompt Lists, type "docs" in the search there: before, completion empties that box. Both hold after. Each form now carries a mounted ref and reports it, so the parent moves the view only while the form that started the create is still the one on screen. Reopening New mounts a different form, which reports false for the old request, so a second draft is left alone too. The draft reset stays outside the guard: a draft that still matches what was sent is now a saved row wherever the user went, and keeping it would leave the + button marked unsaved for it. * studio: correct the prompt-storage selection for the visible tab only searchQuery is shared by both tabs, and the keep-a-row-selected pass ran over both collections every render. Filtering one therefore also filtered the hidden one and dropped the row it had. Select "Docs sweep" on Prompt Lists, switch to Saved Prompts, search "rewrite", switch back: before, the pane opens on "Release checklist". The query matches no list, so the hidden tab's selection is cleared while the user is nowhere near it. Gating the correction on activeTab is half of it. The per-tab reset was an effect keyed to activeTab, so the first render of the new tab still held the old query and the correction ran in it before the reset landed. Clearing in the tab handler means no render sees the mismatch, and it drops one of the file's react-hooks/set-state-in-effect errors. * studio: set the New form's mounted flag in effect setup The flag that tells the parent whether the form that started a create is still on screen was initialised at the ref and only ever cleared, in an effect cleanup. StrictMode replays an effect as setup, cleanup, setup on mount, and main.tsx wraps the app in it, so that first cleanup left the flag false for the rest of the form's life and every successful create reported an unmounted form. The visible result in a dev build: create a prompt, and it saves and refreshes, but the New form stays open with an emptied draft and the new row is never selected. Measured against the harness, before: form still open, draft "", no row selected. After: form closed, "A brand new prompt" selected. Setting it in setup restores it on the replayed mount. The guard it feeds still works: with a 1500ms PUT, selecting another row or typing a search on the other tab while the create is out still leaves both alone. * studio: latch the prompt-list editor once it is mounted editorMounted was recomputed every render from the live item count, so a list sitting exactly at EDITOR_ROW_LIMIT lost its editor the moment Add prompt took it one over: the whole editing view was replaced by the deferred summary. The draft kept the new item, but the caret and the view did not. Measured on a 100-item list, clicking Add prompt: before, the pane goes from 100 textareas to 0. After, 100 to 101. The decision is now state initialised from the count at mount. The pane is keyed by row id, so selecting another list still re-decides it, which is the part that should depend on size. * studio: hide Preview while the prompt-list editor is deferred The deferred branch renders the five-row summary and ignores `preview`, but the toggle stayed on the toolbar. Clicking it on a list above EDITOR_ROW_LIMIT left the same raw, line-clamped rows on screen and relabelled itself to Edit, so the control claimed a preview that was never rendered. Measured on a 500-item list: before, the toolbar carries a Preview button alongside "Edit all 500 prompts". After, it does not. A list under the limit is unchanged, toggle and all. * studio: namespace prompt-storage mutation locks by entry kind Prompts and prompt lists are separate tables with independent id spaces, and the backend takes arbitrary ids up to 128 characters, so an import can give one of each the same id. Both panes fed the raw id into one mutatingIds set, so saving prompt x marked list x pending and disabled its Save and Delete until that unrelated request settled. lockKey prefixes the kind, which is enough on its own: reaching a list key needs a list, since a prompt id of "list:abc" keys "prompt:list:abc". --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Maheswar Kumar <[email protected]>
…hing (#9768) * Studio: stop a small context window ending a tool-using turn with nothing A chat at a 4096 context died with "request (4237 tokens) exceeds the available context size (4096 tokens)" after edit_file had already written the file. Measured through the model's own template and tokenizer, the overflow was not the tool result: it was the assistant's own edit_file arguments, which the template only renders once a tool message answers the call. Five defects came out of that one thread: 1. Completed tool-call arguments were replayed verbatim forever, so a whole-file write kept costing its full size on every later turn. They are now compacted in the replayed conversation only, leaving the stored thread and what the tool received byte-identical. 2. The fit was discovered after execution, so an unservable turn had already spent its side effect. The check is hoisted above the call, and a turn that cannot be rescued is refused before it writes. 3. edit_file took one old_string/new_string pair, so building a file meant one call per hunk and the model spent whole turns chunking. It now takes a batched edits[] array, matched against the original text with overlap detection and applied all-or-nothing. 4. A tool call whose JSON was cut off mid-stream was healed by filling the first single-string argument with the raw fragment, so a truncated python call became a program that was literally its own broken JSON. Truncated calls are now told apart from merely malformed ones and are never healed. 5. A turn could spend the entire window reasoning and stop on finish_reason length with no answer and no tool call. Because a truncated thought is correctly not promoted as an answer, that rendered as an empty message. It now continues with thinking off, and says which lever to pull if that still produces nothing. Verified against the live llama-server that produced the original 400. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: stop a starved tool result turning into a read loop Asked to show a 2401-byte file inline at a 4096 window, a turn spent eighteen tool calls getting nowhere. The log says why: tool result: name=terminal budget_tokens=0 chars=109 Six of the last eight calls were priced at zero, so each returned only the notice saying it had been cut. The model read that as a fresh failure and tried again with a different line range every time. Three changes, cheapest first: - A result budget below a useful floor now triggers compaction and a re-price before the call runs. Room is exactly what compaction reclaims, and spending it here is what lets the call succeed rather than return a notice. - A call the window has already priced at nothing says so on the FIRST result. The pricing is known before the tool runs, so waiting for a repeat guard to rediscover it spends calls learning something already computed. - A tool that returns byte-identical results several times in a row now tells the model the answer will not change. Keyed on the RESULT and not the arguments, because the arguments differed on every one of the eighteen calls; an argument-keyed guard would have watched it happen. It never fires while results are still changing, so polling is untouched, and it tells the model rather than aborting the run. edit_file's description also now says a successful call means the file on disk holds what was sent, so there is no need to read it back. That is what started the spiral. The result-keyed guard and the never-fire-while-changing rule follow OpenClaw's tool-loop detection. hermes-agent's repetition guard was measured against this turn first and would not have fired: two repeats of a 75-char line in 9935 chars is far below its thresholds. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: finish an answer the window cut in half, and stop leaking the unparsed-arguments sentinel Two things from live threads on the previous build. 1. A turn streaming a 2401-byte file inline at a 4096 window stopped mid-token, at `ctx.arc(6, -5, 5, 0` with a <!DOCTYPE and no closing tag. The earlier fixes had already done their part: the same turn made one tool call where the build before it made eighteen. What remained is arithmetic, and the room that ran out belongs to the reply rather than the prompt, so compaction cannot help and the answer has to span two turns. The existing continuation only covered a turn that showed NOTHING. It now also resumes a truncated answer, handing the partial back with continue_final_message so the model extends it mid-token instead of restarting and apologising. Thinking stays on, because thinking was never the problem here. hermes-agent's repetition guard is ported alongside it, and this is the path it was written for: their continuation nudge once stitched a repeated fragment into a 60,698-char response. A fragment that is mostly an echo of itself is kept as-is rather than extended. It was measured against the earlier read-loop first and correctly ruled out there. 2. `__unsloth_unparsed_arguments__` was reaching both places a caller looks. The tool card showed it to the user verbatim, and the replayed assistant turn showed it to the MODEL, teaching it a key that no tool declares. Both boundaries now go through one accessor: the card shows the fragment under `raw`, and the replay sends it verbatim as the arguments string, which is what that field is in this format. test_a_turn_that_answers_is_never_continued is retargeted rather than removed. It encoded the old rule that any turn with content was left alone, which the first change deliberately reverses; what still holds, and is what it now asserts, is that an answer resumes with thinking on and extends the partial rather than being treated as a stalled thought. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: keep replayed tool-call arguments parseable The previous commit stopped `__unsloth_unparsed_arguments__` reaching the model by replaying the truncated fragment verbatim as the call's `arguments`, on the reasoning that the field is a string in this format so the fragment was the honest value. The field is a string the SERVER PARSES while rendering the chat template, which that reasoning missed. A fragment is unparseable by definition, that being why it is there at all, so every request carrying one failed outright: llama-server returned 500: Failed to parse tool call arguments as JSON: parse error at line 1, column 7201: missing closing quote That surfaced in the UI as "An internal error occurred", which is a worse outcome than the cosmetic leak it was fixing. The replay is now a short valid object naming the failure. The detail the model needs is already in the tool result, and the fragment is not worth resending: it is the content that overflowed the window. Five parametrised cases pin the invariant that was missing, that replayed arguments always parse, plus one that the replay stays small. Checked against the broken version: all seven fail there. The test that asserted verbatim replay is corrected rather than removed. Its comment stated the same wrong premise, so both now record what the assertion failed to consider. * Studio: shorten the guidance, and give it one consistent rule Reading every model-facing string in this branch side by side turned up a contradiction it had shipped: the compacted-arguments placeholder ended "read the file back if you need the content", while the edit_file description says not to read back what you just wrote and both no-progress notices say reading again will not help. Three lines discouraging a re-read and one inviting it, and the re-read is the loop that cost eighteen calls in a single turn. Every one of them now says the same thing: continue from what you have, in parts if it will not fit at once, and finish the task. Each is also shorter, since they are spent out of the same window they are describing (roughly 68 -> 32 tokens for the repeated-result notice, 68 -> 47 for the starved one, 41 -> 27 for the placeholder). The larger saving is not in those. Tool schemas go into EVERY prompt and came to about 1351 tokens, a third of a 4096-token window before any conversation at all. edit_file's description was 277 of it and is now 170, with every rule kept: batch into edits, match against the original text, no overlaps, exactly one match unless replace_all, all-or-nothing, do not read back. That is about 108 tokens returned on every turn. Also fixed: thinking_exhausted_message read "spent its whole reply of the 4096-token window on reasoning", from formatting a pre-spaced fragment. Four tests asserted the exact old phrasing. The meaning survives the rewrite in each, so the assertions moved rather than the messages. * Studio: continue a truncated answer in the final generation too A live run spent 25 tool calls and 22387 tokens, hit the tool-iteration ceiling, and then stopped on finish_reason length inside drawBird() with the game half-written and nothing to recover it. The continuation added earlier covers the generation INSIDE the tool loop. At the iteration ceiling the loop breaks, appends the budget-exhausted nudge, and runs a separate final generation after it, which had no continuation at all. A turn that spends its whole tool budget produces its answer there, so the one path most likely to be cut off was the one path with no way back. That generation is now wrapped in the same continuation, under the same rules: the partial goes back through continue_final_message to be extended rather than responded to, thinking is left as the caller set it because thinking is not what ran out, an answer that is mostly an echo of itself is left alone, and the whole thing is capped. Four tests drive the final path directly, with max_tool_iterations = 0 so the tool loop cannot take the request first. Checked against a disabled build: the two that assert the continuation fail there, and the two that assert it stays out (clean stop, echo) still pass. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: address review findings on the small-window tool turn fixes Backend: - Rebind the assistant message after run-then-compact rebuilds the conversation, so a second call in the same batch is still visible to the model when its result arrives. - Compact only the last call carrying an id. Parsers number from call_0 on every turn, so rewriting every match relabelled an earlier call with a later one's outcome. - Keep the arguments of a call that never ran. A tool reply proves an answer, not an execution, and the completed receipt claimed a write the user had declined. - Word the receipt per tool. python, terminal and MCP calls write no file, so they no longer read as already written to disk. - Build the malformed-arguments receipt from the same phrase, so a refused call is not replayed as having run. - Continue a reasoning-only length stop in the final pass, which the in-loop continuation cannot reach, and say so when it never converges. - Drop an explicit reasoning effort for a thinking-off continuation. For that style the effort wins, so the retry re-ran the failing turn. - Give continuations their own loop credits instead of charging them to the caller's tool budget. - Count the final continuation prompt before reopening the stream, and keep the partial rather than send a request that cannot be served. - Replay only the new suffix on a final continuation, and fold each attempt's usage in before the next overwrites it. - Replay the truncated answer unstripped so the continuation builds on the whitespace it was cut on. - Price the result budget against the compacted prompt when the gate ran the call because compaction will make room. - Use the conservative estimate at the admission gate so dense ASCII cannot skip the exact check. - Key the no-progress guard on the arguments too, unless the result is a notice the window itself produced. - Count repeated windows without overlap, so one long rule no longer reads as an echo. - Detect a value cut mid-literal as truncation, and a complete document with trailing junk as not. - Derive healing keys from the request's schemas as well, restoring auto-healing for single-string MCP tools. - Offer a lever the refused tool actually has. Frontend: - Tell the Max Tokens wall from the context wall using the prompt count, so a cap the prompt left no room for is not blamed. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: keep a continuation inside the caller's budget and stop guessing disk state - Respect an explicit max_tokens when continuing a truncated answer. A caller cap and the context wall both report finish_reason length, so a 100-token request was continued twice into roughly 300. The retry now gets the remainder of the caller's budget, and an attempt that ended on length is charged its whole allowance when the server reported no usage. max_tokens unset, or equal to the window, is still the context wall the continuation exists for. - Build the continuation as a candidate and commit it only once another stream is certain to run. The replay and the usage fold happened first, so a refused continuation reported roughly double the tokens it cost: the same usage went into the accumulator and then into the metadata event. - Pair a tool reply with its own call site. Ids restart at call_0 every turn, so a conversation-wide set of answered ids let an earlier success vouch for a later declined call, which was then replayed as already written. - Earn the file wording from the reply rather than the tool name. An edit_file that ran and returned an error is not a write, and a python or terminal call may well have created files, so both directions of the guess are wrong. Anything the reply does not settle gets a receipt that claims nothing about the disk. - Require evidence a result was actually cut before saying so. The budget is what the window allowed, not what the tool returned, and a short complete result was being reported as nothing usable. - Cap the edits array. Each entry rescans a file that may be 16 MiB, so an unbounded batch turns one call into gigabytes of scanning. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: re-baseline the refactor guard and drop an unused import The guard pins the tool-call parsing stack by AST, runtime surface and a digest of every guarded function's output. This PR adds six symbols to tool_call_parser, so the inventories needed the snapshot the module's own docstring prescribes. Two of the new notices take a result alongside the tool name, which had no argument fixture, so the driver reported them as undrivable rather than pinning them. Audited rather than taken on trust: no existing digest changed, nothing was removed from any inventory, and the only additions are the three new guarded functions. The apparent deletions are entries re-ordered and re-added with identical digests. Also removes an import of re that this branch added to tool_loop_controller and never used. Ruff does not reach it; the lint job's import-hoist check does, and only for files a change touches. * Studio: carry the continuation guards into the tool loop and compact on aggregate size The previous round guarded the final generation pass. A request with tools enabled takes the in-loop path instead, which had neither guard: - Count the in-loop continuation prompt before retrying, and keep the partial when the retry would not be served. With a single user turn there is no older history to evict, so the retry was window-sized. - Spend the caller's output budget across the whole reply rather than per attempt. The in-loop payload rebuilds max_tokens from the caller's value every iteration, so a request capped at 100 tokens ran two more 100-token generations. Also: - Compact arguments on their aggregate size, not per string. A batched refactor of fifty 800-character edits is tens of thousands of characters with no single string over the floor, so nothing was reclaimed and the call stayed in the prompt for good. The final check that the receipt is smaller than what it replaces still applies. - Word an elided old_string neutrally. Only new_string is on disk after a replacement; the completed phrase sent the model after content the edit had just removed. - Reset in_thinking once a truncated reasoning block is closed. The thinking-off retry closed it a second time on its first content token, and the route showed the stray tag as answer text. - Apply a lone replace_all without enumerating its matches. There is nothing to overlap with, so str.replace does it in linear space where spans cost a tuple per match. Entries inside a batch still need spans for overlap detection and are bounded instead. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: guard the reasoning retry too, and stop blaming a file for every tool call The previous round guarded the in-loop partial-answer continuation. The reasoning-only continuation beside it mutated the conversation directly and checked neither thing: - Count its candidate prompt before committing, and keep the thought when the retry would not be served. - Spend the caller's cap across the whole reply here as well, and stop when it is gone. Also: - Compact the arguments of a call the user denied. The denial is itself the tool message that makes the template render the call it refused, so declining an oversized write cost the prompt the very arguments it declined to afford, and the bulk pass skips denials by design. - Size a result against a prompt carrying the current call's stand-in reply. Templates that render a tool call only once a reply follows it were pricing the result without the arguments it sits beside. - Keep the destination path out of the elision. It is the one field that says which file was changed, and the lower aggregate floor had started spending it. - Repeat the path inside a receipt only when it is short. Every elided leaf embeds it, so a long path cost more than the content removed and the size check rejected the whole compaction. - Blame a file only when a file is involved. An oversized python, terminal or MCP call was answered with advice to ask for a smaller file, which names the wrong cause and cannot be acted on. - Treat a cap reached together with the context wall as context-bound. At equality raising Max Tokens creates no room, so the advice to do so is the one thing that cannot help. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: rebind to the current turn, neutralize the replay, and name the right wall Three of these are defects in the fixes from the previous rounds: - Scan backward when rebinding the assistant message after a compaction. Generated ids restart at call_0 every turn, so a forward scan bound the oldest turn carrying the id and the rest of the batch was appended to history instead of the live exchange. - Rebind after compacting a denied call too. The denial path was added last round with the same detached-handle defect the executed path had already been fixed for. - Neutralize a continuation candidate before counting and sending it. The first payload neutralizes every message; the replay put raw model output back, so a template delimiter inside printed code was read as chat structure, and the admission count described a different string from the one actually sent. And three from elsewhere: - Resolve the forced choice when a call is refused by the context gate, as a user denial already does. Left pending, the next iteration advertised the same tool as required and the model was pushed into the same call and the same refusal. - Say so when a reasoning turn was stopped by the caller's own Max Tokens rather than by the window. The two have opposite levers, only one attempt ran, and this text reaches the client as ordinary content where the frontend's cap-aware error cannot correct it. - Pass the local context length only for local requests. The resident GGUF window stays populated while an external model is selected, so an external request with a 16K cap was measured against an unrelated 4096-token window. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: price both counts alike, bound the repetition scan, name the right lever Six review items, four of them defects in earlier commits on this branch. Argument compaction chose aggregate mode from the largest leaf, so one 1100-char edit beside fifty 800-char ones stayed in per-leaf mode and compacted only the first, replaying about 40 KB. Chosen from the total now, which is the shape a batched refactor actually produces. The result-budget rescue re-counted the prompt without the empty tool stand-in the initial sizing uses. On templates that render a call only once a reply follows, that dropped the pending call's own arguments from the count and handed the room they occupy to the result. The final-pass retry runs with thinking off but was admitted under the thinking-on kwargs, pricing a prompt nobody sends. The kwargs are computed once now and used for both admission and the request. Final-pass exhaustion always blamed the context window. When a caller-set Max Tokens is what was spent, it now says so, matching the fork the in-loop give-up already made. The repetition scan kept one 60-char slice per starting offset, so a very long fragment held a large multiple of itself alive to decide one continuation. Keyed by hash with a collision check and a ceiling on distinct windows; both directions of the bound fail open. The GenerationLengthError toast hardcoded the Max Tokens advice, overriding the remedy the error had already chosen from the cap and the prompt size. It repeats the message now. Each fix has a regression test confirmed to fail without it. Affected backend modules 457 passed, frontend 5647 passed, tsc and ruff clean. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: judge a continuation on its own attempt, and make room before giving up Five review items. A tool reply was paired with the OLDEST pending announcement of its id. Textual parsers number from call_0 every turn, so an interrupted call leaves a stale site under the same id: the reply marked the abandoned call executed and left the call that actually ran replaying its arguments in full. The in-loop retry was admitted under the previous attempt's thinking-on kwargs even though it goes out with thinking off, which prices a request nobody sends. The final pass already computed its own; this path now does too. A continuation that did not fit ended the turn, so the next iteration's ordinary preflight never got its chance to drop an older exchange. Under truncate_oldest the candidate is now fitted once before being abandoned, to the room the continuation itself needs rather than to the caller's cap: with a small max_tokens the preflight target is larger than the window minus the reply floor, so fitting to the caller's figure would evict and still leave it unservable. Applied at all three continuation sites. has_content_tokens and _last_emitted are cumulative across attempts by design, so a continuation that produced nothing but reasoning was classified as another truncated visible answer: it replayed an empty suffix with thinking still on instead of taking the reasoning-off recovery. Each attempt is now judged on what it put on screen itself. Because content events are cumulative, the give-up no longer sends its explanation on its own once an earlier attempt has written an answer, which would have replaced the answer with a message about not having one. Reaching either give-up by exhausting the retry limit left the cap classification at its default, so a turn whose last permitted attempt finished off an explicit Max Tokens was told to raise the Context Length. Both sites re-read the remaining cap. Each fix has a regression test confirmed to fail without it, except the one guarding the answer against being overwritten, which guards behaviour the per-attempt change made reachable. Affected backend modules 590 passed, ruff clean. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: price a continuation as one, and give the safety tests their guards back Three review items. The in-loop answer continuation is sent with continue_final_message, which renders without a generation prompt and with the partial as the turn being extended, but the admission counted it as an ordinary prompt. The flag is threaded through _loop_continuation_fits now, and the eviction retry added alongside it uses the same flag. Two edit_file safety tests still called execute_tool directly with the top-level old_string and new_string shape. That shape is refused outright now, and the refusal starts with "Error:" like the failures they were asserting, so test_full_access_does_not_replace_a_device_node and test_a_failed_create_removes_the_partial_file passed without reaching the device-node guard or the simulated ENOSPC cleanup. Both now send edits, and both assert the message their own guard produces rather than any error, so neither can go green again on a malformed call. Cap attribution passed a null context length for a local safetensors or MLX request on the legacy stream path, where neither GGUF field is set. A null window reads as infinite, so every context-length stop was reported as a Max Tokens stop and the user was told to raise a value already at the model's maximum. params.maxSeqLength is added last and coerced from zero, the same order the RAG context_length beside it already uses. Each fix has a regression test confirmed to fail without it. Affected backend modules 591 passed, frontend 5648 passed, tsc and ruff clean. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: fix the AttributeError that 500s every planned GGUF load (#9821) * Studio: fix the AttributeError that 500s every planned GGUF load _planned_tensor_spill read the host-RAM headroom as host_ram_headroom_bytes = self._HOST_RAM_HEADROOM_MIB * 1024 * 1024 copying the shape of _PIPELINE_PER_DEVICE_OVERHEAD_MIB on the line directly above it. That one is a class attribute (llama_cpp.py:9597). The headroom is module-level (llama_cpp.py:4721), so it is not reachable through self, and every load that got as far as the planning call raised 'LlamaCppBackend' object has no attribute '_HOST_RAM_HEADROOM_MIB' and came back to the client as a 500. Since #9779 the planner is default-on, so this is on the path of every GGUF load, not an opt-in one. Observed loading unsloth/Qwen3.8-Flash-Next-GGUF UD-IQ1_S on a Colab T4 high-RAM VM: llama-server never spawned and the load returned 500. The seam suite stayed green through all of it because the _Stub double declared _HOST_RAM_HEADROOM_MIB = 2048 itself, so the lookup found it on the double and never on the class under test. Dropping that line from the double is most of the fix here: with it gone and the source left unpatched, 66 of the 127 seam tests fail. A named test also asserts the double declares no attribute the real class lacks, and that the seam source no longer reaches for this one through self. * Tighten the comments on the host RAM headroom fix * Tighten the comments this PR added (#9825) Post-convergence comment pass over the 3,346 comment lines this branch adds across 27 files. 810 lines out, 609 back: every block keeps the fact that made it worth writing and drops the paragraph restating it. What stays, deliberately. The measured figures (2296 MiB reserved against 1008 MiB allocated; 1039 -> 2105 MiB at 4k), the upstream citations (fit.cpp:463, llama_init_from_model(model_tgt), server-context.cpp gating on a non-empty mmproj.path, common_prompt_checkpoint on the host heap), and the "what this looked like when it was wrong" clause on each. Those are the parts a reader cannot reconstruct from the code. What does not change. The estimate-memory path operation's docstring is untouched: FastAPI renders it as the route's OpenAPI description, so editing it is an API change rather than a comment change. The class docstrings in test_memory_estimate.py are untouched too -- each carries a distinct account of the defect its tests exist for, and at that density the next cut removes a fact. AST-gated throughout: comment_tools.py check 17/17 with --strip-docstrings, and prepush_gate.py --comment-only against the pre-pass head. Backend 909 passed, frontend 5331 passed, typecheck clean. * Fix the studio PEP 604 union ratchet and name what breaches it (#9826) * Fix the studio PEP 604 union ratchet and name what breaches it main is red on Core and Python 3.13: AssertionError: 37 studio files now evaluate PEP 604 unions on the floor, up from 35. #7880 added studio/backend/tests/test_kv_cache_estimate_compat.py and test_kv_cache_estimate_route.py, which annotate with Path | None, str | None and int | None but carry no `from __future__ import annotations`. requires-python is still 3.9, where those evaluate to a TypeError at import. The ratchet is right and the new files are the thing to fix. The debt it tracks is FastAPI routers and pydantic models, where the future import has real failure modes around class dependencies; these two are plain test modules with no such constraint, so they take the import and the count returns to 35. Raising the ratchet instead would bank the debt for no reason. Also make the next breach diagnosable. The check stored a bare count, so the failure said only that 37 exceeded 35 and then printed all 37 truncated at 2000 characters. Finding the two additions meant re-running the scan against an older checkout and diffing by hand. It now stores the SET and reports the difference: 37 studio files now evaluate PEP 604 unions on the floor, up from 35. Add `from __future__ import annotations` to these, do not raise the ratchet: studio/backend/tests/test_kv_cache_estimate_compat.py studio/backend/tests/test_kv_cache_estimate_route.py The count still governs the assertion, so one file fixed and another added cannot pass on set membership alone, and a file that stops offending is named too so the list can shrink. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Studio: keep the memory row readable on a narrow panel (#9824) * Studio: keep the memory row readable on a narrow panel The model config panel is w-[min(468px,calc(100vw-1rem))], so once the window is under about 460px it shrinks with the viewport. The Estimated Memory Usage header is the only row carrying a title and two figures at once, and the figures do not shrink, so the title absorbed the entire shortfall: measured on the current build it went from 150px at 460px wide to 91px at 400, 51px at 360 and 11px at 320, where it rendered as "E...". Let that header wrap. The figures drop to a line of their own only at the widths where they would not have fitted beside the title anyway, and ml-auto keeps them under the right edge they already had, since justify-between has nothing to push against on a line holding one item. At 460px and above the layout is unchanged. The breakdown captions had a smaller version of the same problem: "f16 . 262,144 tokens . 4 slots" broke at whatever space fitted, which left the word "slots" alone on a line under "... tokens . 4". Gluing each item together with U+00A0 leaves one break opportunity per bullet, and gluing the bullet to the item that follows it puts the break before the bullet rather than orphaning it at the end of the previous line. Measured in the real 183px caption column, the final line goes from a 22px fragment to the whole 38px item. * Leave an unseparated breakdown note breakable Only the KV caption is a list. The Weights and Draft cache notes are ordinary prose ("256 of 257 layers on GPU", "2.14 GB on GPU"), and passing those through glueNoteItems replaced every space with U+00A0, leaving them zero break opportunities. On a narrow panel, or at an enlarged browser font, that made them a single unbreakable run that overflows the caption column instead of wrapping inside it, which is worse than the orphaned word the function exists to prevent. Return a note with no separator untouched. There are no items to keep apart, so gluing bought nothing and cost every break the note had. --------- Co-authored-by: danielhanchen <[email protected]> * route thinking controls to ollama * Studio: expose Thinking for Ollama and forward reasoning_effort Ollama connections had no reasoning capability, so Studio hid Thinking and never sent reasoning_effort. A reasoning model then kept its default thinking with no way to turn it off (#9649). Flag the connection as a reasoning model to show Thinking, then map off/on onto Ollama's OpenAI-compat reasoning_effort field. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: pin Ollama thinking per model and keep research Thinking off Ollama connections can serve mixed catalogs, so the reasoning-model toggle now stores which model ids support thinking. Unmarked models no longer advertise Thinking or send reasoning_effort. Deep Research serializes reasoningEffort "none" when Thinking is off so Ollama does not fall back to the model's default. * preserve ollama max reasoning effort * fail closed on malformed reasoning pins * prune stale ollama reasoning pins * name ollama reasoning model controls * isolate ollama reasoning request tests * align reasoning regression test style * keep ollama gpt-oss reasoning enabled * gate research reasoning on model support * match ollama reasoning pins case insensitively * reset reasoning state on provider changes * remove ollama reasoning ui --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Maheswar Kumar <[email protected]> * Read the memory row's captions past their line-breaking glue (#9831) The breakdown captions now join their items with U+00A0 so a narrow panel breaks between "262,144 tokens" and "4 slots" rather than inside either. The scene asserts on the caption with a plain `"6,144 tokens" in text`, which stopped matching: the figure was correct on screen and in the response, but the space between it and "tokens" is no longer a space. Normalise the glue back to ordinary spaces in the two inner_text readers, so every assertion reads the caption the way it looks rather than the way it is encoded. Verified against the exact strings CI reported. Co-authored-by: danielhanchen <[email protected]> * Studio: persist model disclaimer across instances (#9835) * Studio: persist model disclaimer across instances * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: invalidate queued preference reads --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Studio: consolidate the two memory-estimate stacks (#9830) * Studio: freeze both memory-estimate route contracts before consolidating /api/inference/estimate-memory and /api/models/kv-cache-estimate already share the _gguf_memory_breakdown planner, so their arithmetic cannot drift, but their response contracts are still separate and are about to be consolidated onto one implementation. The hazard is not shape drift, which a typechecker catches. weights_bytes exists on both routes, is an int on both, and means different things: every resident file on the inference route (weights plus projector plus drafter), the quant file alone on the models route, where the planner aggregate travels separately as gpu_bytes / total_bytes / gpu_floor_bytes. Unifying the key changes the number under whichever caller loses, with no JSON change for a client to notice. These tests pin both envelopes and that collision, so the consolidation cannot silently resolve it. The models route has no response_model at all, so nothing else enforces its shape. Verified by mutation rather than by passing: adding a key, removing a key, repointing weights_bytes at the planner aggregate and disabling the delegation each fail the suite. The first draft did not catch the aggregate swap, because the planner delegation is gated on _cached_estimate_config resolving the repo to this disk and is skipped for a synthetic repo id, leaving every planner field present and null. A freeze written over that fixture asserts nothing. Pinning the config so the planner returns real figures is what makes these bite. * Studio: give both memory-estimate routes one canonical contract The two routes already share the _gguf_memory_breakdown planner, so their arithmetic agrees. Their vocabulary did not, and the sharp edge is weights_bytes: it exists on both, is an int on both, and means every resident file on /inference/estimate-memory but the quant file alone on /models/kv-cache-estimate. Nothing in the type system separates those, so a caller reading the wrong one is simply wrong, quietly. Adds models.inference.MemoryEstimate as the shared contract. It deliberately has no weights_bytes at all: the name is replaced by quant_file_bytes and resident_files_bytes, which each say which they are, and it is absent rather than redefined so no new reader can pick it up and guess. core/inference/memory_contract.py holds the projections back onto each route's existing wire shape. Both legacy mappings now sit side by side in one file, which is the only place either is written down, instead of being implied by two handlers that never referenced each other. /kv-cache-estimate is rewired onto the projection and its JSON is unchanged, which the contract-freeze suite from the previous commit verifies rather than assumes. Two subtleties it caught while this was being written: - gpu_bytes must keep 0 distinct from None. Zero is a real answer, an inherited LLAMA_ARG_DEVICE=none launch that touches no card; None means the planner never ran. The first draft applied `or None` uniformly and reintroduced a bug this route had already fixed. MemoryEstimate.gpu_bytes is Optional for that reason. - the quant figure is not clamped against the resident total, though a quant file cannot really exceed the files containing it. The two come from different resolvers, and clamping truncated a 4.1 GB quant to a 373 byte synthetic header rather than catching anything. kv_bytes is passed into the projection rather than read off the estimate: this route prices the target cache itself and the planner's figure is not interchangeable with it. * Studio: route the Load Model estimate through the shared contract too /inference/estimate-memory now builds the same canonical MemoryEstimate that /models/kv-cache-estimate builds, and projects back to EstimateMemoryResponse. Both routes go through one vocabulary; neither wire shape changes. weights_bytes keeps its aggregate meaning here through project_estimate_memory_response, which is the counterpart of the quant-file mapping the sibling route uses. The two sit next to each other in core/inference/memory_contract.py so the difference is impossible to read past. quant_file_bytes is 0 on this route rather than a stand-in. This handler is given a resolved config and prices what the launch would hold, so nothing in it measured the single file the user picked; the legacy response does not carry the field, and inventing a value would be a wrong number for the sake of a non-null. * Studio: one presentation core for both memory surfaces The Load Model panel and the Hub memory bar were fed byte-identical figures by one backend planner and still disagreed about how to present them, in every category that decides what a user reads: unit labels, rounding, fit thresholds, the fraction of a card a load may claim, and the verdict vocabulary itself. Each difference was defensible alone. Together they meant one model could read as fitting on one screen and not on the other. src/lib/memory/ now holds the shared core: - format.ts. There were two exported functions called formatMemoryGb, one per surface, both (number) => string, one taking bytes and one taking gibibytes, printing different labels. Importing the wrong one was off by 1024^3 and typechecked cleanly. They are replaced by formatGiB and formatBytesGiB, whose names carry the unit, plus formatKvRate. - thresholds.ts. The fit ratio and the pressure ramp measure different things and keep different values, but they now differ in one file rather than per surface. - verdict.ts. A superset vocabulary, not a winner: the panel's tight band and the bar's why-it-exceeds cause both survive, so neither surface loses a distinction it used to make. memory-fit.ts and model-memory.ts stay as each surface's entry point and become thin re-exporters, so no call site moves. memory-fit.ts keeps relative imports with explicit extensions rather than the @/ alias: three tests load it directly under node --experimental-strip-types without a bundler resolver, and an alias there breaks all three. Its docstring said "no imports" and meant no ALIAS imports; that is now written down. Two user-visible labels change, both mislabels rather than preferences: - the panel printed GiB values labelled GB across seven figures, the defect #9570 fixed elsewhere. vram-total-gib-suffix.test.ts could not see it, since its regex only matches interpolations naming a *TotalGb and neither module was in its list. That guard now reads the shared module, covers all three formatters including the panel's, and separately asserts neither surface has redefined one locally. - formatKvRate divided by 1024 and labelled the result KB/MB. Existing assertions were updated to the new expectations rather than relaxed, and two fixtures were retuned rather than left passing: at the wider budget the speculative-reserve case no longer tipped over, so it would have gone green while measuring nothing. * Studio: decide unified memory from the hardware, not from the platform The Load Model panel asked usePlatformStore(s => s.appleSilicon) whether the GPU and the rest of the system share one memory pool, and passed that answer to resolveMemoryCapacityGb. On a ROCm APU the answer was false, so the panel charged one pool as discrete VRAM PLUS host RAM: the same bytes counted twice, and a ceiling high enough to report a fit for a load that cannot open. The correct signal already existed. use-gpu-info.ts derives unifiedMemory from the backend's per-device unified_memory flag, which the ROCm probe sets, and the Hub memory bar already abstains on exactly that flag. Only the panel was reading the platform instead of the hardware. The two uses are now separate rather than renamed wholesale, because they are genuinely different questions: - isAppleUnifiedMemory still drives the WORDING. "Unified" is what Apple calls its pool; an AMD APU's is a "Shared" one, and the panel already prints both. - hasUnifiedMemory drives the CAPACITY, and falls back to the Apple check while the device probe is in flight, so it is never a weaker answer than before. A discrete card is unaffected: its devices do not report unified_memory, so nothing about an ordinary NVIDIA host moves. Covered by tests on resolveMemoryCapacityGb for the APU pool and for a discrete card, plus a source assertion that the panel hands the capacity call the general signal. That last one is not decoration: the behavioural tests pin what the resolver does with each flag, not which flag it is given, and they both pass on the unfixed panel. Verified by reverting the fix and watching only the source assertion fail. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: harden the memory contract and pin it across the platform matrix Adversarial pass over this PR's own changes. Three real defects, two of them mine, plus a simulation matrix that would have caught all three. Fixed, introduced by this PR: - routes/models.py assigned gpu_bytes, compute_bytes, total_bytes and n_ctx onto a MemoryEstimate AFTER building it. Pydantic does not validate assignment by default, so a post-construction write puts whatever it is handed straight onto the wire. Measured rather than assumed: on pydantic 2.13 m.gpu_bytes = "not an int" succeeds, and a declared int field accepts None the same way. Those four are now parameters of build_memory_estimate, so the model is built once and validated once. gpu_bytes needs a sentinel rather than a None default because it has three states: a number, a real None meaning the planner never ran, and "use the breakdown's". Fixed, pre-existing but in scope because it made the two surfaces disagree: - computeModelMemory turned a non-finite weightsBytes into "model-exceeds": a full destructive bar reading "Larger than VRAM" beside a weights figure of "0 GiB", because the formatter clamps what the verdict did not. JSON.parse turns 1e999 into Infinity, so a malformed response reaches it without trying. classifyMemoryFit on the panel already answered "unknown" for the same input, which is the divergence this PR exists to remove. Null and undefined are untouched: those mean "has not arrived", an ordinary state. New simulation coverage: - memory-cross-surface-matrix.test.ts: [linux, wsl, win32, darwin] x nine device inventories (NVIDIA single and dual, ROCm discrete, ROCm APU, AMD Vulkan iGPU, Intel iGPU, Apple unified, mixed dGPU+iGPU, CPU only) x four footprints, minus the physically impossible cells, checked against six properties: no false fit, no bar/panel contradiction, one label per byte count, no pool counted twice, CPU-only draws nothing, and no NaN or Infinity reaching a label. 128 cells. The Infinity defect above is what P-hostile found. - test_memory_contract_platforms.py: the same four platform keys x six placements, pinning that both wire shapes are byte-identical everywhere and that weights_bytes keeps its own meaning per route in every cell. - Old-backend degradation: a backend that never sends unified_memory leaves hasUnifiedMemory exactly equal to the appleSilicon check it replaced, in both directions. Verified in a clean uv venv holding only pytest, pydantic, fastapi, structlog, huggingface_hub, psutil, pyjwt, passlib, bcrypt and cryptography: 710 passed. The only two failures there need the real transformers package and pass with it. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: scope unified memory to the pin, and share one budget with the fit badge Two P2 review items, both reproduced before agreeing. 1. The unified-memory flag was host-wide. inferenceGpu.unifiedMemory is devices.some(...) over the whole inventory, so an APU beside a discrete card made it true, and a pin naming ONLY the discrete card then told resolveMemoryCapacityGb the two are one pool. Measured on a 16 GiB pin with an APU present and 128 GiB of RAM: totalCapacityGb collapsed from 143.52 to 15.52 GiB, so the panel warned "more than this machine holds" for a load that fits comfortably. That is a regression this branch introduced; on main the flag was the Apple check and read false there. hasUnifiedMemory now narrows to the pinned devices before asking, falling back to the whole inventory when nothing is pinned. The Apple check stays host-wide and unconditional: there every device really is the one pool, and it also covers the window before the per-device probe lands. SystemGpuDevice carries unifiedMemory per device for this, alongside sharedMemory, which is per device for the same reason. 2. The Hub fit badge and the memory bar render on the same row and judged against different budgets: gguf-fit.ts held 0.90 while the bar used the loader's own 0.97. gguf-fit now re-exports the shared constant. Worth being exact about what that buys, because the review item claims it removes the contradiction and it does not. Measured over 15-24 GiB on a 24 GiB card, badge-vs-bar disagreements go from 11/19 sizes to 8/19. The residual 8 are the ESTIMATOR difference: gguf-fit scores size * 1.15 + 1 GB while the bar uses the planner's real figures, so no constant can reconcile them. Rewiring the badge onto the planner is a separate change with its own blast radius, since it also drives a filter. Frontend: 5677 passed, typecheck and build clean. * Do not treat a mixed GPU selection as unified memory Scoping the unified-memory flag to the pinned devices fixed the discrete-only pin, but the quantifier was still `.some()`, so a set holding one APU and one discrete card read as a single pool. That is every unpinned load on such a host, and any pin naming both. Measured on a 48 GiB APU beside a 16 GiB discrete card with 128 GiB of system RAM: unpinned, .some() gpu 62.08 total 62.08 singlePool true unpinned, .every() gpu 62.08 total 128.00 singlePool true pin both, .some() gpu 62.08 total 62.08 singlePool true pin both, .every() gpu 62.08 total 143.52 singlePool false One device with its own memory means there is real VRAM beside system RAM, so the two are not one pool and the RAM must not be discarded. `[].every()` is true, so a host with no probed devices would read as a unified-memory machine; guarded explicitly rather than relying on the caller never passing an empty set. use-gpu-info.ts deliberately keeps `.some()`. It answers a different question, whether the host has any unified-memory device at all, and is noted as such so the two are not "fixed" into agreement later. * Correct the memory-estimate scene's unit mirror to GiB The Playwright scene builds its expected strings with a Python mirror of the panel's formatter, and that mirror printed "GB" because the panel did. Both divided by 1024**3 and both called the result a decimal gigabyte, so the test agreed with the app about the wrong label and the agreement was what made it invisible. Staging CI caught it on this branch: row header text: 'GPU 4.75 GiB Total 5.50 GiB' FAIL: the row does not show the returned total '5.50 GB' Every figure is byte for byte what it was. Only the unit moved, which is the change this branch makes to the panel, so the mirror moves with it. * Separate the unified pool's size from the fact that it is one pool `unified_memory` on the wire is ROCm-only: hardware.py sets it from `_rocm_known_unified` and nothing produces it for Apple. So the panel's general signal is Apple-or-ROCm, and it was feeding a resolver branch whose comment reads "Apple reports the one pool as the GPU budget already". True for Apple, where memory_total_gb is the machine's unified memory. False for a BIOS-carved window onto system RAM. Measured on a 96 GiB machine carving a 48 GiB window, budget 0.97: gpu total singlePool Windows unified=F 46.56 96.00 true Windows unified=T 46.56 46.56 true Linux unified=F 46.56 142.56 false Linux unified=T 46.56 46.56 true Both are wrong on Linux and in opposite directions. Before this branch the ceiling double counted the window that already sits inside the RAM; after it, the ceiling discarded 49.44 GiB the load can really use, and the panel warned that a 60 GiB load exceeds a machine holding 96. The backend has said which figure is real all along, in llama_cpp.py::_available_system_memory_mib: "On a unified-memory APU this, not the ROCm-reported VRAM, is the real ceiling: the weights load into shared system RAM." `unifiedMemory` still classifies the pool. A new `unifiedPoolReportedAsGpuMemory` says whether the GPU figure is that pool's size. The ROCm case falls into the existing `Math.max(gpuCapacityGb, systemRamTotalGb)` branch the Vulkan iGPU already used for this exact reason rather than into new arithmetic. The flag defaults to true, so callers written before the ROCm case keep their answer untouched. Apple is deliberately not routed through the RAM branch: max(93.12, 96) would return the raw 96 and drop the VRAM Budget. Both are pinned as tests, and both new tests were confirmed to fail against the unfixed resolver. Score the Hub fit badge against the saved VRAM Budget Sharing one default constant fixed the loading and old-backend case. It did not reach the case where the user has actually saved a fraction: the badge kept applying 0.97 while the memory bar on the SAME ROW consumed the live value from use-model-memory.ts. On a 24 GiB card with a saved 0.90 the loader admits at 21.6 GiB while the badge scored against 23.28 GiB: size required badge [email protected] 18.0 21.70 fits OVER 18.5 22.27 fits OVER 19.0 22.85 fits OVER `GgufFitInput` takes an optional `budgetFraction`, and the Hub card reads the live value through a new `useVramBudgetFraction`. It is threaded into all three fit-scoring calls on the row, not only the badge: the sort and the menu use the same classifier and would otherwise rank rows against a line the badge no longer applies. Absent means "use the shared default", not "the whole card": scoring an unloaded fraction against 1.0 admits loads the loader refuses, which is the same error in the other direction. Zero, negative, above-one and non-finite values fall back too, since this arrives from a settings route; 1.0 is honoured, being a legitimate saved value. The hook is the fifth caller of subscribeVramBudgetSettings plus loadVramBudgetSettings and the first not to roll the pattern by hand. It subscribes before loading, so a save committed while the GET is in flight is not lost. Frontend suite 5685 pass, 0 fail; typecheck and build clean. * Do not count a Linux APU's window as VRAM beside system RAM Third face of one reporting split, exposed by the previous two fixes. hardware.py sets shared_memory only on Windows, so the same APU arrives as shared_memory true there and unified_memory true / shared_memory false on Linux. Making a mixed set non-unified correctly routed the ceiling to `dedicatedCapacityGb + systemRamTotalGb`, and `dedicated` was computed from sharedMemory alone. A 48 GiB APU beside a 16 GiB discrete card on a 128 GiB host at 0.97: before total = 190.08 GiB after total = 143.52 GiB (16 * 0.97 + 128) 46.56 GiB of capacity that does not exist, in the direction that admits a load. The two flags are folded where they are read rather than the capacity path learning about a second one: they answer the same question, and the split is a platform reporting detail, not a distinction the arithmetic should carry. SystemGpuDevice already grew unifiedMemory earlier in this branch and satisfies MemoryCapacityDevice structurally, so the panel carries it through with no call-site change. A test asserts Windows and Linux now price the same APU identically, which is the property that matters: if those diverge again, one platform charges differently for the same silicon. Credit the VRAM budget, not the raw card, once layers spill vram_budget_settings.py describes the reserve as "a slice of every card that the model and KV cache may not use", so the GPU's contribution to a partly offloaded load is the budget. Adding the raw card to the RAM allowance invented capacity the loader will not give. At the legal minimum 0.80 on a 24 GiB card with 16 GiB of RAM: budget 19.20 combined raw 32.00 combined@budget 27.20 size required before after 23 27.45 partial oom 24 28.60 partial oom 25 29.75 partial oom 26 30.90 partial oom Four quant sizes the badge and the fit sort recommended for a card that cannot load them. `marginal` deliberately keeps the raw card. `fits` returns for everything at or under the budget, so scoring this band against the budget too would make it unreachable; it names the gap between the budget and the card, which is a warning rather than a claim of admission. A test pins that it stays reachable. Frontend suite 5689 pass, 0 fail; typecheck and build clean. Both fixes were confirmed to fail their new tests when reverted. * Carry the saved budget and the unified pool to every surface Three consequences of the previous two rounds, each on a surface the earlier fix did not reach. Local On Device card ranked against the default budget. The live fraction went to the Hub download card's three fit-scoring calls and not to sortLocalGgufVariants, so that card rendered a memory bar using the saved fraction directly above a quant menu ranked against 0.97. Free capacity answered a whole-load question with a carved window. resolveMemoryFit sends the WHOLE load to freeGpuCapacityGb as soon as the pool is single, and marking a ROCm APU single-pool is what this branch did, so a 60 GiB load on a 96 GiB machine with 60+ GiB free was warned as not fitting a 48 GiB window. A non-Apple unified pool now takes the host view, the same discriminator the capacity side uses, so the two cannot answer differently. FreeVramDevice also folds unifiedMemory the way MemoryCapacityDevice does; measured, that changes nothing for an APU beside a discrete card (52.08 either way, since a fully shared device already contributes its free once) and matters when a SECOND view of the same pool appears, an APU beside a Vulkan iGPU: 77.12 -> 38.56. One GET per mounted card. loadVramBudgetSettings has no read-through cache by design and clears its shared promise once each request settles, so it coalesces only overlapping callers; a catalog mounting cards through scrolling and filtering issued a settings GET per card, and a 404 per card on an older backend. The FRACTION is now cached module-wide and kept live by the change event every reader already subscribes to, while the loader keeps its always-refetch behaviour for the callers that need reloadRequired. usableSystemRamGb was computed inline in JSX and is now hoisted, because the free-capacity memo needs the same figure and two copies of the same headroom subtraction is how they drift. Frontend suite 5694 pass, 0 fail; typecheck and build clean. Each fix was confirmed to fail its own test when reverted; one first-draft test asserted a double count that does not occur and was replaced with the case that does. --------- Co-authored-by: danielhanchen <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * fix(prompt storage): rework prompt storage into a master-detail layout (#8692) * Studio: rework prompt storage into a master-detail layout Cards rendered the full prompt body with no truncation, so a few dozen saved prompts became a long scroll of uneven cards. Editing happened inline in a four-row textarea, so long prompts were edited through a peephole while the list shifted underneath. Replace the flat list with a master-detail layout: a compact rail of name plus one-line preview on the left, and a detail pane on the right that owns its height. Unsaved edits are held per entry so switching rows no longer discards them, with a dirty marker in the rail and Save/Revert in the footer. List items now auto-size to their content and reorder by dragging the grips, animated with FLIP. The drag listener lives on window rather than using setPointerCapture: reordering makes React move the row's DOM node, and detaching implicitly releases pointer capture, which ended the drag after one row. Hit-testing uses offsetTop/offsetHeight since a client rect reports the pre-animation position while FLIP is in flight. Add a Preview toggle on both tabs backed by the existing MarkdownPreview, and allow bookmarking prompt lists into the + menu next to bookmarked prompts. Rows there carry a Prompt / List pill, since selecting a prompt fills the composer while selecting a list queues and sends every prompt in it. Presentation only: no schema migration, no API change, no change to the export formats or import parser, and onUse/onRunList signatures are unchanged. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: address review feedback on prompt storage Select a newly created prompt or list only after the refresh resolves. The keep-a-row-selected effect runs against whatever list is in state, so selecting the new id while the old list was still in state made the effect bounce the selection to the first existing entry, and the new entry was never shown. Let the body shrink and stack on small viewports. The fixed 420px floor plus the header could exceed the dialog's 94dvh on a short window and clip the detail pane's actions behind overflow-hidden, and a fixed 248px rail left the detail pane unusably narrow below ~600px. The floor is now capped against the viewport, the rail narrows at sm and stacks below it, and the action rows wrap. Report when a list cannot be queued. startQueue refuses synchronously when queueing is unavailable and does not run the onAborted callback, so running a list from the project new-chat composer silently did nothing from both the Run button and the bookmarked-list menu items. * Studio: auto-scroll the prompt list while dragging A list taller than the detail pane could only be reordered within the visible region: the pointer handler hit-tested coordinates but never scrolled the overflow-y-auto ancestor, and pointerdown suppresses the browser's own drag gesture, so there was nothing to pull the list along. Holding a grip near the top or bottom edge now scrolls the pane and re-runs the hit-test each frame, so a drag can reach any row. The step ramps with depth into the edge band and is capped per frame. The step calculation lives in its own module with unit tests covering the dead zone, both directions, the ramp, the cap, and panes too short to hold two edge bands. * Studio: clear the search when selecting a newly created prompt or list Awaiting the refresh was not enough on its own. With a search active that the new entry does not match, the refreshed rail still excludes it, so the keep-a-row-selected effect bounced the selection to the first row that did match and the form closed on someone else's prompt. Clear the search alongside the selection so the new entry is eligible for the filtered rail. Applies to both create forms. * Studio: remeasure auto-grown textareas on resize, and end a drag released off-window The auto-sizing textarea only remeasured when its value changed, so any width change that rewrapped the text left the old height in place. With overflowY set to hidden that clipped the newly wrapped lines until the next keystroke. It now remeasures on window resize, and on a ResizeObserver width change for the cases where the column moves without the window doing so. The grip deliberately does not capture the pointer, so releasing the mouse outside the window delivered neither pointerup nor pointercancel and the drag stayed live, still autoscrolling and reordering. A move reporting no buttons held is now treated as the release that was missed, and window blur ends the drag for a release that happens entirely off the page. * Studio: export the visible draft, and ignore non-primary presses on grips Export passed the saved entry while the pane could be showing unsaved edits, so the downloaded file silently disagreed with what was on screen. It now exports the draft when there is one, normalised the way saving would normalise it, for both prompts and lists. A right- or middle-press on a reorder grip started a drag, and the zero-buttons recovery could not end it because buttons reads 2 or 4, so opening a context menu over a grip could reorder the list. Reordering now starts only on a primary press; touch and pen contacts report button 0 so they still drag, and isPrimary keeps a second finger from starting a competing drag. * Studio: run the visible list draft, scope drags to one pointer, keep new-entry drafts Run queued entry.items while the editor could be showing something else. Worst case, deleting every draft item left the button enabled off the stored length and silently ran the whole old list. Run now fires the visible non-blank items and disables on those. The window-level drag listeners saw every pointer on the device, so a second finger's movement reordered using its own clientY and its release ended the firs…
unslothai#8692 landed as a squash, so resolve toward main and keep only this PR's delta (bookmarked lists, kind pill, drag autoscroll). Drops the unrelated backend reformatting of llama_cpp.py, routes/inference.py and two backend tests, as asked in review.
…kind pill and drag autoscroll (unslothai#9788) * Studio: rework prompt storage into a master-detail layout Cards rendered the full prompt body with no truncation, so a few dozen saved prompts became a long scroll of uneven cards. Editing happened inline in a four-row textarea, so long prompts were edited through a peephole while the list shifted underneath. Replace the flat list with a master-detail layout: a compact rail of name plus one-line preview on the left, and a detail pane on the right that owns its height. Unsaved edits are held per entry so switching rows no longer discards them, with a dirty marker in the rail and Save/Revert in the footer. List items now auto-size to their content and reorder by dragging the grips, animated with FLIP. The drag listener lives on window rather than using setPointerCapture: reordering makes React move the row's DOM node, and detaching implicitly releases pointer capture, which ended the drag after one row. Hit-testing uses offsetTop/offsetHeight since a client rect reports the pre-animation position while FLIP is in flight. Add a Preview toggle on both tabs backed by the existing MarkdownPreview, and allow bookmarking prompt lists into the + menu next to bookmarked prompts. Rows there carry a Prompt / List pill, since selecting a prompt fills the composer while selecting a list queues and sends every prompt in it. Presentation only: no schema migration, no API change, no change to the export formats or import parser, and onUse/onRunList signatures are unchanged. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: address review feedback on prompt storage Select a newly created prompt or list only after the refresh resolves. The keep-a-row-selected effect runs against whatever list is in state, so selecting the new id while the old list was still in state made the effect bounce the selection to the first existing entry, and the new entry was never shown. Let the body shrink and stack on small viewports. The fixed 420px floor plus the header could exceed the dialog's 94dvh on a short window and clip the detail pane's actions behind overflow-hidden, and a fixed 248px rail left the detail pane unusably narrow below ~600px. The floor is now capped against the viewport, the rail narrows at sm and stacks below it, and the action rows wrap. Report when a list cannot be queued. startQueue refuses synchronously when queueing is unavailable and does not run the onAborted callback, so running a list from the project new-chat composer silently did nothing from both the Run button and the bookmarked-list menu items. * Studio: auto-scroll the prompt list while dragging A list taller than the detail pane could only be reordered within the visible region: the pointer handler hit-tested coordinates but never scrolled the overflow-y-auto ancestor, and pointerdown suppresses the browser's own drag gesture, so there was nothing to pull the list along. Holding a grip near the top or bottom edge now scrolls the pane and re-runs the hit-test each frame, so a drag can reach any row. The step ramps with depth into the edge band and is capped per frame. The step calculation lives in its own module with unit tests covering the dead zone, both directions, the ramp, the cap, and panes too short to hold two edge bands. * Studio: clear the search when selecting a newly created prompt or list Awaiting the refresh was not enough on its own. With a search active that the new entry does not match, the refreshed rail still excludes it, so the keep-a-row-selected effect bounced the selection to the first row that did match and the form closed on someone else's prompt. Clear the search alongside the selection so the new entry is eligible for the filtered rail. Applies to both create forms. * Studio: remeasure auto-grown textareas on resize, and end a drag released off-window The auto-sizing textarea only remeasured when its value changed, so any width change that rewrapped the text left the old height in place. With overflowY set to hidden that clipped the newly wrapped lines until the next keystroke. It now remeasures on window resize, and on a ResizeObserver width change for the cases where the column moves without the window doing so. The grip deliberately does not capture the pointer, so releasing the mouse outside the window delivered neither pointerup nor pointercancel and the drag stayed live, still autoscrolling and reordering. A move reporting no buttons held is now treated as the release that was missed, and window blur ends the drag for a release that happens entirely off the page. * Studio: export the visible draft, and ignore non-primary presses on grips Export passed the saved entry while the pane could be showing unsaved edits, so the downloaded file silently disagreed with what was on screen. It now exports the draft when there is one, normalised the way saving would normalise it, for both prompts and lists. A right- or middle-press on a reorder grip started a drag, and the zero-buttons recovery could not end it because buttons reads 2 or 4, so opening a context menu over a grip could reorder the list. Reordering now starts only on a primary press; touch and pen contacts report button 0 so they still drag, and isPrimary keeps a second finger from starting a competing drag. * Studio: run the visible list draft, scope drags to one pointer, keep new-entry drafts Run queued entry.items while the editor could be showing something else. Worst case, deleting every draft item left the button enabled off the stored length and silently ran the whole old list. Run now fires the visible non-blank items and disables on those. The window-level drag listeners saw every pointer on the device, so a second finger's movement reordered using its own clientY and its release ended the first finger's drag. The initiating pointerId is now recorded and the other pointers are ignored. The new-entry forms held their name and text locally, so selecting any row in the rail unmounted the form and discarded a half-written prompt or list without warning. That state now lives in the parent alongside the edit drafts, and the New button carries a dot while a draft is waiting. Starting a bookmarked list bypassed the busy gate that ordinary sends respect, overwriting the queue refs and firing another send on top of a run already in flight. It now refuses while a run or an existing queue is active and says so. * Studio: block list runs while dictating, bind drags to one pointer, shrink the body floor Ordinary sends gate on isDictating and this path did not, so selecting a bookmarked list mid-dictation set the composer text and scheduled a send that a landing transcription could overwrite first, queueing the dictated words instead of the saved prompt. isPrimary is scoped per pointer type, so on a hybrid device a primary mouse or pen press passed the guard while a touch drag was already running and took the drag over, stranding the pointer that started it. Pointer-down is now rejected outright while a drag is bound. The body floor took a flat share of the viewport, so on a phone in landscape it still added up past the dialog's 94dvh once the ~13rem of non-shrinking header and tab/search chrome was counted, and the detail actions were clipped. The floor now subtracts that chrome, and clamps at zero when the viewport is shorter than it. * Studio: let the stacked rail shrink, scope the abort reopen, narrow the delete race The stacked grid kept a hard 96px minimum on the rail row, which with the gap and padding exceeded the whole body floor on a short viewport: the detail pane collapsed to zero height and its actions overflowed into DialogContent's clipping region, undoing the floor fix. The rail row is now shrinkable and the gap and bottom padding tighten below sm. The queue abort callback reopened the storage dialog, which was right for a run started inside it but threw a modal over the destination chat when the run came from the "+" submenu. The launch source is now passed through so only a dialog-started run reopens it. Deleting awaited the request and then cleared the selection outright, so selecting another row while the delete was in flight was undone. The deleted id now goes up and the parent clears only if it still matches. * Studio: give the shrunken panes an overflow path, confirm deleting a dirty entry Shrinking the grid tracks did not shrink what was inside them. On a short viewport the rail's new button and count footer, and the detail pane's name field, metadata and action row, still overflowed their tracks and spilled into DialogContent's clipping region, so the actions stayed unusable at exactly the size the previous change targeted. Each pane now keeps the minimum its own fixed chrome needs and the body scrolls when those minimums do not fit. Delete sits beside the draft controls in this layout, where the old one was hidden while editing, so a single click destroyed the stored entry and the only copy of the unsaved draft together. Deleting a dirty prompt or list now asks first and names what is being lost. * Studio: harden the bookmarked-list run guards and the draft maps The busy guard read React state that only refreshes on the 200ms handle poll, so a list started in the window right after a send queued over the live generation. It now asks the handles directly, the way that poll does. A staged image or audio attachment was left in place, and send() picks those up, so the first prompt in the list went out with the attachment and the rest without it. Running a list while something is staged is now refused rather than clearing it, since the attachment belongs to the user. The draft maps were plain objects keyed by entry id. Ids come from storage and may be any string, so an entry called "constructor" or "toString" resolved to an inherited prototype member: the row read as permanently dirty and the inherited function's own `name` could land in the editor as the entry name and be saved from there. They are Maps now. * Studio: refuse bookmarked list runs while the image editor is open The composer is deliberately raised above the generated-image overlay, so the "+" menu stays clickable while an image edit is pending. Submitting normally rewrites the prompt into an edit instruction, sets the pending image reference and closes the overlay; startQueue appends the saved text untouched, so the first list prompt was either applied to the selected image or consumed the pending reference outright. Running a list now refuses while the overlay is open and says why. The shared composer has no overlay of its own, so this is limited to the chat thread path. * Studio: trim the prompt storage comments Several had grown to five or more lines, restating the reasoning from review rather than the fact a reader needs. Each is now at most three lines and keeps only what is not evident from the code: why there is no pointer capture, why the hit-test uses layout offsets, why the draft maps are Maps, and so on. No behaviour change. * Studio: namespace the saved-items menu keys, and make the empty drafts factories Prompts and lists live in separate tables with independent ids, and the "+" submenu renders both as siblings, so a shared id produced duplicate React keys and the wrong row could be reused or dropped on an async refresh. Keys are prefixed by kind in both composers. The empty new-entry drafts were shared module constants, so every reset handed back the same `items` array. Nothing mutates it today, but one in-place edit would corrupt it permanently; they are factories now. * Studio: address the review on prompt storage Serialize the mutations. PUT is an unconditional upsert, so a Save pressed while a DELETE was still in flight wrote the row back. Both details now refuse a second mutation while one is pending, and report a failure instead of swallowing it. Reorder by insertion slot rather than by the row under the pointer. Hit-testing the containing row oscillates across uneven heights: drop a short row onto a tall one and the tall row is still under the pointer, which sends it straight back. reorder.ts counts the passed midpoints of the other rows, which has a fixed point at every pointer height. FLIP off layout offsets. Client rects move with the scroll position, so scrolling between reorders baked the accumulated distance into every transform. Hand autoscroll outwards through the whole scroll chain. A nested scroller reports its unclipped height, so its edge could sit past the ancestor hiding it and past the viewport, where the pointer can never reach it. clipSpan intersects the pane with what clips it. Give the rail a roving tabindex and aria-current, so reaching the editor no longer means tabbing through the library. Sequence the plus-menu refreshes and drop the rows on failure, so a stale or deleted list cannot be queued from the menu. Guard the composer paths the earlier rounds missed: dictation on the chat thread's menu, and audio still being read into base64, which pendingAudio cannot see yet. Fix the lint the new component tripped: refs read during render, and setState called synchronously from an effect. * Studio: split the prompt storage PR down to the layout change Per review: land the master-detail relayout on its own. Three things that rode along with it come out, to follow separately once this is in. Bookmarked lists in the "+" menu. The pinnedListIds store, the pin control on a list, the pinned marker in the rail, and the menu entries in both composers. thread.tsx, shared-composer.tsx and plus-menu-prefs-store.ts go back to main untouched, so the guards those menu entries needed (live handles, dictation, staged attachments, the image overlay) travel with them. That also returns the storage dialog's Run button to how main queues a list. The kind pill. It exists only to tell a prompt from a list once both share the "+" submenu, so it has no reason to land before the lists do. Drag autoscroll. The module, its tests, and the scroll-chain walk in the drag loop. Reordering still works over what the pane shows; it just does not scroll to reach the rest. What stays is the layout: the rail and detail pane, per-entry drafts, the preview toggle, the auto-sizing rows and their drag/keyboard reorder, and the review fixes for that surface. * Studio: restore prompt list bookmarking, the kind pill and drag autoscroll Split out of unslothai#8692 so the master-detail relayout could land on its own, as Daniel asked. This is the other half, unchanged, stacked back on top of it. Three separable features share these files, which is why they travelled together and why they had to be separated by hand: - List bookmarking in the plus menu. plus-menu-prefs-store.ts holds the pinned list and shared-composer.tsx surfaces it. - The kind pill, prompt-kind-pill.tsx, which labels an item as prompt or list in the master column. - Drag autoscroll, autoscroll.ts, so a drag near the edge of a long list scrolls instead of stalling. Covered by prompt-list-drag-autoscroll.test.ts. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: trim prompt storage extras comments * Studio: show a count bubble on bookmarked lists instead of kind pills Drop the Prompt pill from saved prompts in the + menu and replace the List · N pill with a small round count, so prompt names are no longer truncated and the menu reads cleaner. * Studio: refuse list runs while an image attachment is still converting * Studio: refuse list runs while an audio transcription is in flight * Studio: refuse single-chat list runs while an audio transcription is in flight * Studio: refuse compare list runs while a model is loading or a compare send is preparing * Studio: hold list runs for the whole attach path, classification included * Studio: don't report a pending duplicate list start as a queue failure * Studio: trim prompt list comments after review * Studio: point the compare queue setup test at runPromptList --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Daniel Han <[email protected]>





Motivation
Prompt Storage didn't scale past a handful of prompts. Cards rendered the full
prompt body with no truncation, so a few dozen entries became a long scroll of
uneven cards with nothing to sort or scan by. Editing happened inline in a
four-row textarea, so long prompts were edited through a peephole while the list
shifted underneath.
What changed
detail pane on the right. Tabs, search, and import/export unchanged.
and updated time.
get a dot in the rail, and the footer offers Save and Revert.
reorder by dragging the grips, animated with FLIP. Arrow up/down works too.
MarkdownPreview(so code highlighting, math, and mermaid come along). Listsrender per item, keeping the grips live.
fills the composer but a list immediately queues and sends N prompts, rows
carry a pill (
Prompt/List · 5) to tell them apart before clicking.What deliberately did not change
Presentation only. Lists are run queues, not folders, so they stay a separate tab
on their own table and routes.
No schema migration, no API change, no change to the export formats or import
parser,
items_jsonstill stores raw text, andonUse/onRunListsignaturesare untouched (Run still fires the saved items, not the draft).
Testing
typecheck,build, andtestall clean and unchanged from baseline.Drag reorder verified against a harness mounting the component in isolation: row
1 to row 6 in one gesture through every intermediate order, the same in reverse,
and again in preview mode.
Worth flagging for reviewers: the drag listener is on
window, not the grip.setPointerCapturedoesn't survive a reorder, because React moves the row's DOMnode and detaching implicitly releases capture, which killed the drag after one
row. Hit-testing uses
offsetTop/offsetHeightrather than client rects, sincethe FLIP transform makes a client rect report the pre-animation position.