Repository navigation
AI Assistant: restore Save to Macros in reloaded conversations, show saved macros, propose macros without running them - #448
Merged
Conversation
Macros proposed by the AI Assistant could get lost or stay out of reach:
- A conversation reopened from History... showed a 200-character summary
of each tool message, without parsing its JSON payload: the "Save to
Macros" link of create_and_run_macro results was not restored, and
failed tool calls were displayed as successful. Live turns and reloaded
conversations now share _append_tool_result, which uses the actual
status and restores the link.
- Saving a macro added it to the Macro panel, which is tabbed with the AI
Assistant and stayed hidden. The confirmation line now has a "Show in
Macro panel" link (no automatic switch, which would hide the
conversation).
- create_and_run_macro accepted autorun=False (validate and offer the
macro without running it), but neither the schema nor the system prompt
said so: a "write a macro" request could be answered with plain code
that cannot be saved. The parameter is now documented, the prompt routes
such requests to autorun=False, and the confirmation dialog states that
the macro will not be executed ("Approve" instead of "Run").
- As a fallback, a "Save to Macros" link is offered under each Python code
block of the replies (markdown_to_html gets an optional code_block_footer
callback), named after the user request, unless AI macros are disabled.
Closes #447
Assisted-by: Claude Opus 5.5
…ons) Describe macros proposed without being run, the "Save to Macros" links under code blocks and in reloaded conversations, and the "Show in Macro panel" link; add the corresponding 1.4.0 bug-fix notes, with their French translations. Refs #447 Assisted-by: Claude Opus 5.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Macros proposed by the AI Assistant could get lost or stay out of reach. Found while checking the DataLab-Web issue DataLab-Platform/web#76 against DataLab desktop (Web fix: DataLab-Platform/web#77).
Closes #447
Changes
_append_tool_result). The JSON payload of each tool message is parsed, so a reloaded conversation shows the actual ✓/✗ outcome of each call and restores the Save to Macros link ofcreate_and_run_macroresults.autorunparameter ofcreate_and_run_macrois now documented in the tool schema, and the system prompt routes "write a macro" requests toautorun=falseinstead of plain code in the reply. The confirmation dialog states that such a macro will not be executed (Approve instead of Run), and the tool result tells the model so.code_block_footercallback ofmarkdown_to_html), named after the user request, unless AI macros are disabled.ai_assistant.rst), 1.4.0 release notes, French translations (UI, user guide, release notes).Tests
test_chatpanel_macros.py(GUI):autorun=Falseruns nothing; reloaded conversation restores the links and the failed status; saving from tool results and code blocks; Show in Macro panel brings the panel to the front; no code-block link when AI macros are disabled; confirmation dialog wording. The reload and live-turn tests fail on the previouschatpanel.py.test_markdown.py: Python block detection and footer callback.test_tool_registry.py/test_controller.py: documentedautorun, prompt rule only when the macro tool is exposed.pytest datalab/tests/aiassistant datalab/tests/features/macro datalab/tests/features/common/welcome_unit_test.py: 102 passed. Ruff and Pylint (10/10) clean on the changed files.Not covered: the actual choice of a real LLM (the prompt makes plain-code answers less likely; the code-block link covers the remaining cases).