Studio: keep grouped Python scripts visible and save them natively - #7528
Conversation
Main's unslothai#7455 extracted the tool script block into a shared ToolCodeCell and re-introduced a plain blob-anchor download there, so this branch's change to tool-ui-python.tsx no longer applies. Take main's refactor and re-apply the native-save fix where the download now lives: - tool-code-cell.tsx routes Download through the shared downloadFile boundary, so browsers keep the normal download and Tauri gets the native save chooser. Cancellation stays silent, a real failure toasts. - The terminal card downloads command.sh through that same cell, so add a shell arm to the Tauri save_filter and cover both names in the generic fallback. - tool-group.tsx keeps the python ungrouping exception (merged cleanly).
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 30e41d5d22
ℹ️ 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".
| if (toolCount <= 1 || containsUngroupedTool) { | ||
| return <>{children}</>; |
There was a problem hiding this comment.
Keep completed Python content visible after ungrouping
When a persisted completed turn is reopened, this return only removes the outer aggregate group; each Python child still mounts ToolFallbackRoot defaultOpen={isRunning} with isRunning === false, and ToolCodeCell remains inside ToolFallbackContent (tool-ui-python.tsx, lines 91–104). Consequently, the scripts and Download controls in the reported history-hydration scenario are still hidden behind individually collapsed Python cards, so the change does not provide the promised persistent visibility unless those cards are opened or the code cell is moved outside their collapsible content.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and confirmed against a running Studio: with only the ungrouping change, reopening a persisted turn with two adjacent Python calls left two tool-fallback-root cards in data-state="closed" and zero Download controls in the DOM.
Fixed in d4169a4 by rendering ToolCodeCell outside ToolFallbackContent for Python, restoring the #7240 behaviour that #7455 folded back inside when it unified the code cell. Same scenario now shows both scripts and both Download controls with no clicks, and Download still saves byte-exact script.py. Status, output and images still collapse; the terminal card keeps its command inside the collapsible.
Ungrouping the aggregate tool group was not enough on its own. Each Python
card still mounts with defaultOpen={isRunning}, so on a reopened turn the
script and its Copy/Download controls stayed hidden behind the card's own
chevron and the reported issue persisted.
Render ToolCodeCell outside ToolFallbackContent for Python, restoring the
behaviour from unslothai#7240 that unslothai#7455 folded back inside when it unified the code
cell. Status, output and images still collapse. Terminal keeps its command
inside the collapsible: a one-line command is not the artifact a user reopens
a thread to retrieve, a script is.
Verified against a running Studio: reopening a persisted turn with two
adjacent Python calls now shows both scripts and both Download controls with
no clicks, and Download still saves byte-exact script.py.
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! 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". |
#7240 keeps executed Python scripts visible outside the tool card's collapsed output and adds a
script.pydownload. Two paths still bypassed that behavior:ToolGroup. Reopening the thread from history mounts that outer group closed, hiding every Python script and download control again..pyfiles.Reproduction
2 tool callsgroup.The executed scripts and both download controls are hidden until the group is expanded.
In the desktop app, clicking Download also follows the browser-anchor path instead of invoking
save_native_file.Fix
render_htmlexception, so the executed source cannot be hidden by the aggregate collapse. Ranges without Python remain grouped, and non-Python siblings in a mixed range retain their own collapsed cards.downloadFileboundary. Browsers retain the normal download, while Tauri uses the native save chooser.script.py.Python status, output, and images remain collapsible. Copy and Download continue to use the full executed source even when the displayed code is truncated.
Verification
script.pywith byte-exact executed source.script.pyfilename, silent cancellation, and an error toast on native rejection.npm run typechecknpm run buildcargo fmt --checkgit diff --check