mirror of
https://github.com/baserow/baserow.git
synced 2026-12-05 08:48:35 +00:00
stop-reporting-builder-custom-code-errors
5
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
90fcd746ac |
refactor(builder): move the builder tools from enterprise to contrib/builder (#6660)
* refactor(builder): move the builder tools from enterprise to contrib/builder Only login needs enterprise code, so setup_user_source and its helpers stay there and the other builder tools work without a paid edition. * test(builder): keep the guards on the builder tools left in enterprise The enterprise tests block model calls and assistant imports again, and the backend tests pass without enterprise. * fix(builder): say an auth_form needs an instance that has it On an instance without enterprise, the refusal no longer claims the whole batch was undone. * test(builder): run the missing element check without enterprise |
||
|
|
ad7c61db45 |
fix(mcp): follow-up fixes for the application builder tools (#6650)
* perf(automation): leave replaced published copies to the hourly cleanup
clear_old_history already removes them and keeps the newest copy, so the extra task isn't needed. Its delete now batches the service deletes.
* fix(mcp): keep dashboard creation on connections that allowed create_dashboards
The tool is now create_dashboard and unregistered names are ignored, so stored grants lost it.
* docs(mcp): list pause_workflow and move_elements as destructive
* fix(mcp): log the integration create_automation adds
It was created without its action type, so the audit log missed it.
* test(assistant): expect the integration action when redoing a new automation
* fix(mcp): check the workflow copy that publish_workflow makes live
A service-only node edit during the publication still went live unchecked. The checks now run on the copy in the same transaction, and come from the node types.
* test(assistant): tighten Kuma eval checks and add unquoted ask case
Search check judges only the sentence naming Sales and Invoices; two cases
also check nothing else changed; core cases share one database scenario.
* docs: run the shared tool tests in the assistant test plan
* chore: add changelog entries for the MCP builder tools and redo fix
* fix(mcp): check {{ }} templates in linear time
* fix(mcp): report the client's value in formula_errors
Kuma's repair step reads the description instead. The invalid-formula
warning uses loguru and no longer names the assistant.
* fix(builder): refuse a user property the user data provider doesn't have
* fix(assistant): route Kuma's mapping, move and style tools through the shared tools
Kuma now refuses mappings the page can't read and makes its moves in one
transaction, like MCP.
* fix(mcp): title list_applications 'List databases'
It lists only databases. The old list_databases becomes 'List all databases'
so the two stay apart at consent.
* feat(mcp): name the builder action tools element actions
list_element_actions, create_element_actions and update_element_action, so
they read apart from automation actions before grants store them. MCP drops
add_action_field_mapping; Kuma keeps it and its own tool names.
* fix(assistant): name the right update tool for an application of another type
* fix(mcp): keep create_database out of the shared create_tables description
The Agent Builder offers create_tables but not create_database; Kuma's own
description still names it.
* fix(builder): validate page paths in the handler and create pages with visibility in one action
* fix(builder): refuse row action mappings on read-only fields
* fix(builder): bound page, user source, menu item and column names in tool input
* fix(builder): keep an explicit column formula over a field of the same name
* perf(builder): reuse the loaded page when listing elements
* perf(builder): reload page graphs only after a failed move
* feat(builder): allow get_row data sources without a row id in the tools
* refactor(builder): update builders through the shared update_application helper
* perf(builder): list a page's data sources with the service in one call
* fix(builder): record tool-created integrations and login pages in the audit log
* docs(mcp): say setup_user_source can create a users table or a password field
* feat(mcp): move builder item deletes into a builder_delete group
* feat(builder): list links and actions a page parameter change breaks, and let update_element fix a link
* test(mcp): expect delete_element_items in the annotation list
* chore: update English backend translation catalogs
* feat(assistant): use the element action tool names in Kuma too
Kuma lists every mode's tools by name and switches mode on a call, so create_actions next to the automation node tools could route an automation request into the builder.
* chore: drop the MCP builder tools feature changelog entry
The MCP feature entry is added once the milestone is done.
* fix(automation): keep the draft dirty when a publication rolls back
Refuse an empty draft before copying it, and warn about a delete row node with no row ID.
* fix(mcp): keep the integration create_automation adds out of undo
Undo could trash it under the nodes that use it; the builder tools already do this.
* fix(builder): list table link columns a page change breaks and fix the link hint
* fix(assistant): keep Kuma's style and move tools to the page they name
* fix(mcp): shorten the setup_user_source title so consent shows it whole
* fix(mcp): keep tool changes made while the create_dashboard rename runs
One UPDATE rewrites each allow list from the row it locks, so a revoked tool
isn't restored from a stale read.
* fix(automation): keep the draft's dirty flag when a workflow is published
The flag tracks the test clone, which publishing doesn't replace, so a draft
edit made during a publication was lost and the next test run reused a stale clone.
* fix(builder): write page parameter formulas by name after a concurrent edit
The formula step runs in its own transaction, so an editor can reorder or
retarget the parameters in between. Match each formula by name, and refuse
when the link or action now opens another page.
* fix(builder): list menu items whose page parameters no longer fit
A menu item made in the editor can give page parameters, so a page that drops
them still breaks it. Compare its parameters always, and point to the editor.
* fix(assistant): judge the search-finds-table eval on claims, not wording
Negation is scoped to the clause naming the table, lists under a Sales heading
count, and an answer that also says Invoices is missing fails.
|
||
|
|
be71e3bce6 |
feat(mcp): add application builder tools and one create and update tool per application type (#6606)
* refactor(mcp): share the tool error messages
The row comment, row colour and audit log tools need licence errors to reach the client, and the item error helper outside automation.
* fix(assistant): show shared tool errors to Kuma
A licence or input error from a shared tool ended the chat run instead of reaching the model.
* feat(mcp): search the workspace
Lets MCP clients and Kuma find a table or row by name without walking every database.
* feat(mcp): read and post row comments
Lets MCP clients and Kuma read what people said about a row and add to it, in plain text.
* feat(mcp): change view sorts, field visibility and row colours
Lets MCP clients and Kuma configure views, and delete views and filters. list_views now returns the ids those tools take.
* feat(mcp): read the workspace audit log
Lets MCP clients and Kuma answer who did what in a workspace. It stays off until a user turns it on, even though it only reads.
* refactor(assistant): move the builder tool types out of the assistant
The builder tools need these types and helpers without pydantic_ai
or the assistant, so MCP can share them with Kuma.
* feat(assistant): make Kuma's builder writes undoable
Kuma's page, data source, workflow action and user source writes now appear in undo and the action log.
* fix(assistant): set up a new login page after undoing the old one
Undo trashes the login page but the builder still points at it, so setup skipped creating one.
* fix(mcp): run the field visibility change in a transaction
Over MCP and Kuma it failed on select_for_update, as they call tools outside a transaction.
* feat(mcp): add the application builder tool groups
Builder tools need their own groups and picker labels so users can switch them on separately.
* feat(mcp): offer the application builder read tools
Clients other than Kuma can inspect builders, pages, data sources, elements and actions.
* test(mcp): keep the no model calls check to the shared builder tests
Under a rootdir that excludes the enterprise tests, pytest applied the autouse patch of Agent to every test.
* test(mcp): prove the no model calls check runs and restore Kuma's not found hints
The folder check now resolves paths, and Kuma's list tools explain a missing builder or page again.
* feat(mcp): offer creating and updating builders and pages
Clients with builder_edit can set up an application builder and its pages. Kuma's
page tools now run the same create and update code, and keep their own results.
* feat(mcp): offer creating and updating builder data sources
The formula step that needs no model moves to the shared code, so MCP stores given
formulas and reports the rest. Kuma runs it, then repairs what is left with its model.
* fix(mcp): check builder formulas against values of the right type
Example values of the wrong type refused valid formulas, and over MCP no model can
fix that. Failures after a batch committed are now reported with their item.
* fix(mcp): check builder formulas without evaluating them
Example values can't stand in for every field type, so they refused valid formulas.
The check now looks at the formula's functions and paths against what the page has.
* fix(mcp): check nested builder formulas in linear time
Each nested get was visited twice, so a short formula could stall a request thread.
* feat(mcp): offer the application builder element tools
MCP clients can build page content without a model. Kuma runs the same create and
update code and repairs what it leaves.
* fix(mcp): store the values the element create tools are given
A default value or link URL was dropped with nothing reported; a negative size gave an internal error.
Column-name-wins is now opt-in, and update_element is marked destructive.
* fix(mcp): only take row colours a row can show
A row takes its colour from a CSS class per palette name, so a hex value reported success and coloured nothing.
* fix(mcp): undo a row colour that fails halfway
The tool adds to a view's colours, so a client retrying after an error would end up with a second colour.
* fix(mcp): show how a view's filters combine
A view matching any filter, or one with filter groups, read as one matching all of them.
* fix(mcp): mark set_view_sorts as overwriting
It replaces a view's sorts and an empty list removes them, so clients should confirm it.
* fix(mcp): read comments with a mention without a label
The API accepts such a mention, and one of them made every comment of the row unreadable.
* fix(mcp): refuse a blank workspace search
The API trims the query too, and a space would match most names.
* docs(mcp): say why reordered sorts are recreated
* test(mcp): expect how filters combine in the listed views
* feat(mcp): offer the application builder action, setup and theme tools
MCP clients can now wire up workflow actions, build a page in one call, add logins and set a theme.
Kuma's tools call the same functions and keep their results, repairing formulas after each phase.
* fix(mcp): handle bad input to the audit log tools
A reversed range and a blank query read as nothing having happened, and an unknown browser timezone ended Kuma's run.
* fix(mcp): read comments with no content
The API accepts such a comment, and one of them made every comment on the page unreadable.
* fix(mcp): show when a view's filters are switched off
Those filters hide no rows, so listing them as active misled the client.
* docs(mcp): correct what the view tools say they do
Row colours work on every view with rows, and Kuma was told to skip list_views when it needs the filters and colours.
* fix(mcp): leave IP addresses out of the audit log tools
Who did what doesn't need them, and Kuma sends tool results to the LLM provider.
* feat(mcp): add update_action and fix the builder action review findings
A refused notification or open_page value had no way to be corrected over MCP.
A shared page action could name a data source only one page has, which fails on click.
* fix(mcp): let clients read back action values and check open_page parameters
update_action could silently drop page parameters it couldn't show, and store ones the target page lacks.
Reads now give the values in the form update_action takes.
* fix(mcp): keep function-call values as formulas when update_action gets them back
A value list_actions shows like upper('abc') was written back as fixed text.
A custom-URL action no longer fails the page parameter check.
* feat(mcp): offer one create and one update tool per application type
A client asking for one application type should only get that type, and an
edit group should not reach the other types.
* fix(mcp): connect new automations to the workspace data
Row actions fail at run time without a Local Baserow integration, and Kuma's
old hook used to add it.
* fix: redo restores an automation after undoing its creation
An automation is trashed under its own type, so restoring it as an application failed and rolled back the whole undo group.
Undoing a delete and redoing a duplicate or template install had the same problem.
* feat(mcp): offer publishing a workflow
MCP clients could build a workflow but not make it run.
The list reported the draft copy, so a published workflow looked like a draft.
* fix(mcp): refuse publishing a workflow that can't do anything
An MCP client has no UI to stop it, and the workflow came back as live.
Clients also skipped confirmation for a tool that starts real effects.
* feat(mcp): offer pausing a workflow
A client could start a workflow over MCP but had no way to stop it.
* perf: delete older published workflow copies in the background
The delete took over 90% of a republish, in the transaction and on the thread
shared by MCP calls and websocket DB work.
* fix: keep the newest published copy of a paused workflow
The cleanup only kept live copies, so a paused or disabled workflow lost its copy and reported the wrong state.
pause_workflow no longer needs a local cache scope: the update reads the published copy uncached.
* perf: delete superseded copies on the export queue
Deferring the service deletes takes a 200 node copy from 22s to 1.2s.
A 60s countdown keeps the delete away from a row event still reading the just-disabled copy.
* fix(mcp): tighten application tool names, lookups and checks
Blank names, hidden applications and the unclear-request eval check slipped past the new application tools.
* test(mcp): cover builder tool schemas and the read only preset
Keeps Kuma-only parameters off MCP and shows the preset can't write.
* test: add a Kuma eval for a bare request to create an application
A request like this should make an application builder, not a database.
* docs: list the builder and application MCP tools and their test steps
Adds groups, defaults and destructive flags, the new tools, and the manual create-an-application test.
* test: drop tests another test covers and tighten the weak ones
Each dropped test had a covering test that asserts the same behaviour.
The routing test no longer hides a redirect behind a second call.
* test: add Kuma evals for dashboards, several applications, renames and action edits
Nothing called create_dashboard, update_* or update_action in the last eval run.
* fix: let Kuma create an application that has a purpose without asking for a name
Evals asked only for the name, and create_builder had lost the rule against inventing app records.
The setup_user_source description now says it reuses an existing source.
* docs: say MCP writes can't be undone where the action layer is described
The line said operations are undoable, which the builder section contradicts.
* fix: say an application, app or website means an application builder
Kuma and MCP clients could pick a database or dashboard tool for a plain request for an app.
* fix(mcp): refuse a builder formula that reads a row field by its name
A published page only loads fields its formulas name as field_<id>, so such a value
was stored with no report and rendered empty there. Kuma's repair now rewrites it.
* fix(mcp): point a button's click message to its notification action
A model asked to change the message a button shows rewrote the button's text and saw
only success. Descriptions say where that message lives, and the result names it.
* fix: ask first on a bare app request even though an app means a builder
"Application means builder" and "for my team" read as enough to create Team App.
The wording now says it only picks the tool, and who an app is for isn't a purpose.
* fix: show update_action's required thought in an example
On notification title edits the model left thought out and Groq rejected the call,
so the edit took two or three tries.
* fix(mcp): check what new and changed table columns read
A by-name column was stored and came back empty on the published page, with no signal to the client.
* fix(mcp): read a form element's default value from the row around it
At run time a record selector's default value reads the enclosing repeat, not its own rows.
* fix(mcp): refuse a user source table whose fields can't be used
A text field named Password made adding the password field an internal error, and a refused setup left an integration behind.
* fix(mcp): keep the given order of children in a container
Core puts each new child first, so one call's children came out reversed on both clients.
* fix(mcp): accept a file field's thumbnails in a formula
They are valid at run time, but the file field's schema leaves them out.
* fix(mcp): check a new row action's field values like an update does
A value like nosuchfn('x') was stored unchecked and failed only when the page ran.
* chore: remove the table button action hook that never created anything
It always returned no actions, so its result handling and the empty TYPE_CHECKING block were dead too.
* fix(mcp): mark update_action as destructive
Moving an action to another table clears its field values, so clients should ask first.
* docs: correct the builder tool descriptions and docs for MCP
They promised undo MCP doesn't have, named an unset setting, and left out the button note.
* fix(mcp): store plain field values on a new row action as fixed text
Only text that is or parses as a formula goes through the check; Alice no longer comes back empty.
* fix(mcp): list a page's elements in page order
A move showed in the page but not in the list. A move before a child of another place is refused.
* fix: point formula fields to the tool description
The field text claimed a $formula: prefix that MCP does not repair.
* fix(mcp): describe a field value so it is true on create and update
update_action refuses plain text with the same schema create_actions uses.
* fix(mcp): treat an empty place_in_container as unset when moving before a child
The move schema treats an empty place as unset, but this check refused it.
* fix(mcp): refuse an open_page action missing its page parameters
A new action without them stored a button that couldn't open its row and reported success; update_action already refused this.
* fix(mcp): create a child before the element given in its container
before_element_id was ignored once a parent was given, so the element went last.
* fix(mcp): move into a column's first place when none is given
The field says none means the default slot and create does this, but the move failed.
* fix(mcp): refuse moving an empty container into itself
The check for an element already last caught this case, so the move reported success.
* fix(mcp): make a valid example email for a role with spaces
A role name with a space or symbol made the example row fail, and with it the whole setup.
* fix(mcp): refuse a row_id on a data source that is neither a number nor a formula
Plain text was stored as a literal row id with no report, and on update it replaced a working value.
* fix(mcp): read a whole function call as a formula on a new action too
create_actions stored upper('abc') as text while update_action read it as a formula.
* fix(mcp): show a client the shared page's data sources and its ID
A header can only read a shared page data source, and a client couldn't list one or find where to create it.
* fix(mcp): let create_display_elements give a link's page parameters
Over MCP only setup_page could give them, so a link to a page with a path parameter was left broken.
* fix(mcp): refuse a link's new page when its parameters don't fit
update_element kept the old page's parameters, leaving a link that breaks when clicked.
* fix(mcp): say what a client can do when a link's new page doesn't fit
The refusal said to replace the link, but no tool deletes a builder element.
* fix(mcp): give a login page that's already set a working form
setup_user_source reported success on a set login page with no usable form, or one only logged-in visitors can see, and nobody could log in.
* fix(mcp): keep a sentence with a parenthesis as plain text
Order now (today only) was stored empty over MCP, against the docs saying plain text is fixed text.
Builder values now use the automation pattern, which keeps a whole spaced call like get ('x') as a formula.
* fix(mcp): refuse a new link whose parameters don't fit its page
The frontend hides such a link at run time. open_page and link updates already refuse it.
* fix(mcp): keep a fixed value that parses as a sum as plain text
A field value of 3/4 was stored as a formula showing 0.75, and a link parameter of 10/2 as 5.
Field values and link parameters now follow the title rule: calls and plain numbers or booleans only.
* fix(mcp): check every changed column when two share a name
Keyed by name, a bad formula on the first of two columns named Edit was stored unchecked.
* fix(mcp): list a column's children in the order the page shows them
Places were walked in insertion order, so a child added to the second column first was listed first.
* fix(mcp): refuse page parameters with a repeated name
The frontend compares the name lists exactly and hides the link or button if a name is there twice.
* fix(mcp): share the lookup that hides an application the user can't see
The same wrapper was copied in the four application types' tools.
* fix(mcp): remove a dead refresh action helper and a repeated form element block
The refresh helper's value was always overwritten, and four form elements built their label and default value the same way.
* fix(mcp): refuse form data on items of the shared page
At run time a shared element reads the form data of the page being shown, so a
header form's value is empty and its element or action counts as in error.
* fix(mcp): store an auth form's login button label as text
The frontend can't parse 'Sign in' as a formula, so visitors saw the default label
instead. Export and duplicate keep the value either way.
* fix(mcp): store page parameters in the order of the page they open
The frontend compares the names with _.isEqual, so a complete list in another order
hides the link or button from visitors.
* fix(mcp): make a link go to the page or URL an update gives it
Without a navigation type the stored one stayed, so visitors still went to the old
target.
* fix(mcp): refuse a menu item that links to a page with path parameters
Menu items have no parameter field, and one missing its parameters puts the whole
menu in error, which hides it from visitors.
* fix(mcp): refuse a row id on a data source that has none
A list_rows source dropped it and reported success. A get_row source does have a
search query, so that stays.
* fix(mcp): refuse a move before an element outside the given parent
It moved to the end and reported success. No Kuma prompt, eval or test depends on it:
on the base a parent made before_id ignored either way.
* fix(mcp): refuse a new field mapping on a trashed field
The mapping would be stored against a field no visitor's row can get. A mapping the
action already has on a trashed field can still be changed.
* fix(mcp): say when the login page's form uses another user source
The result reported success while people in the new table couldn't log in. A page at
/login found with no login page set now keeps its one form too, instead of a second.
* fix(mcp): mark the builder tools that overwrite stored values destructive
update_nodes, update_fields and update_widgets do. Clients only ask first when the hint
is set.
* fix(mcp): refuse element values the REST API refuses
level=99, format='html' and column_amount=500 reached the database with no error, and
rows=-1 gave "Internal error.". The limits are the serializers' and models'.
* chore(mcp): format the review fixes
* fix(mcp): keep what a restricted view hides out of the view tools
A member below builder could read a restricted view's filters, hidden sorts and colours from list_views, and a field's name from an error before permissions were checked.
* fix(mcp): replace a view's sorts one call at a time
Two calls could each read the old sorts and add to them, leaving a list neither asked for.
* fix(mcp): read a mention whose label isn't a string
The API accepts such a label, and one comment holding it stopped the row's comments from being listed.
* fix(mcp): limit the row comments of a call to 100
Each comment runs about nine queries in its own transaction, and a commenter could ask for any number.
* fix(mcp): show Kuma that set_field_visibility needs a field
Both clients now reject an empty list from the schema, so the checks after it can't run.
* docs(mcp): correct the audit log tools' licence and fields
An advanced licence also has the audit log, and entries no longer hold an IP address.
* test(mcp): run the missing formula case on a data source with a row id
A list_rows source now refuses a row id before any formula is generated.
* test(mcp): expect the builder tools that overwrite values to be destructive
* refactor(mcp): rename set_row_colours to add_row_colours
It adds to the colours a view has, while set_view_sorts replaces the sorts.
* fix(mcp): add a login form for the new user source beside another's
People in the new table can log in once the call succeeds, whichever way the login page
was found. This replaces the note and restores the two forms Kuma's test expects.
* fix(mcp): leave a refused field value out of a new row action
The empty placeholder was a live mapping, so each click wrote an empty string
over that field of a real row until someone fixed the formula.
* fix(mcp): refuse a header's pages that can't work
share_type 'only' with no pages hides a header on every page, and page_ids with
no share_type were ignored. An update has no page_ids, so it can only refuse.
* fix(mcp): refuse changing an action on a trashed page
The lookup only checked the application, so an action on a page in the trash
could still be changed.
* fix(mcp): keep a zero column gap and page size on a new element
0 is allowed, as on REST, but was replaced by the default of 20.
* fix(mcp): treat a whole function call on an element as a formula
A formula like upper('abc') read from list_elements and sent back was stored as
text, so the page showed the formula itself. Actions already follow this rule.
Also replaces the placeholder expression repeated on each element value.
* fix(mcp): share the parameter model and the stored formula reader
Two identical parameter models and three readers of a stored formula's text.
* chore(mcp): format the round's review fixes
* fix(mcp): refuse a page size of zero on tables and repeats
A page size of 0 fetches no rows and shows an empty element; the editor's
minimum is 1.
* fix(mcp): warn on publish about a row_id stored as an empty literal
update_nodes stores row_id='' as '', which the check for a missing row_id
didn't count as empty.
* fix(mcp): keep a field value's formula when its field id has spaces
The formula was stored under the stripped id and looked up under the raw one, so
' 12' lost its value with no report.
* fix: leave test clones out of the superseded copies task
A test run can pick up an older clone just before this task deletes it, so writing
its history entry fails. clear_old_history removes unused clones.
* fix(mcp): refuse style values the element columns can't hold
An overlong color or a radius or size past the column's limit gave "Internal
error.", and a negative radius, which the editor refuses, was stored.
* fix(mcp): treat a whole function call in search_query as a formula
upper('abc') from list_data_sources was stored as text when sent back, as elements
were. The create docstring also said plain text was left empty, which it isn't.
* fix(mcp): mark the application update tools destructive
update_table only renames and is marked destructive, as is update_page; these
overwrite a stored name too. update_builder also changes the login page.
* chore(mcp): format the round's review fixes
* fix(mcp): stop set_view_sorts deadlocking with a new sort
A new sort checks its view when it commits, which the view lock blocked while
the sort rows it needed were held. Sort writers now share a weaker view lock.
* fix(mcp): title add_row_colours Add row colours
* refactor(mcp): merge search_audit_log into list_audit_log
The two differed only by a text query and a 90 day cap. Timestamps now need an
offset, as nothing tells MCP the user's timezone.
* feat(mcp): let a date filter carry its timezone
MCP has no timezone for the user, so relative date modes would follow UTC. An
offset can't express those, so the caller names the IANA timezone.
* test(assistant): expect the login page to stay after undo
Develop creates the login page without an action, so undo no longer trashes it.
* fix(mcp): say a licence is missing when a tool needs one
The REST message reads like a permission problem, which sends users to the wrong fix.
* test(mcp): cover the licence message of the tool errors
* fix(mcp): mark tools that reach outside the workspace as open world (#6609)
ChatGPT's scan refused to publish create_views because it reported
openWorldHint false while public views, emails and redirects reach outside.
* fix(builder): refuse a reused user source without password login
A login form for it could never sign anyone in, yet the setup reported success.
* fix(automation): check a workflow under the lock that publishes it
A node deleted between the checks and the publication went live unchecked.
* fix(builder): cap how many items one builder tool call takes
A caller could ask for any number of elements or nested items in one call.
* test(assistant): fail evals that only look like they passed
A wrong dashboard name, a denied table search and a form mapping both fields to one input passed.
* fix(mcp): mark pausing a workflow and moving elements as destructive
Neither only adds: a pause drops events and a move changes existing placement.
* refactor(builder): read tables without the database MCP module
The shared builder layer shouldn't depend on one client's adapter.
* test(assistant): add an eval that changes a row action's mapping
update_action had no eval for the branch that writes rows.
* test(mcp): expect moving elements to be destructive
|
||
|
|
0bb39e36c6 |
[1/4] feat: AI assistant eval platform on self-hosted Phoenix (#5958)
* feat: add Phoenix LLM tracing service to the dev stack (ai profile) * chore(deps): add openinference pydantic-ai instrumentation (dev) * feat: export assistant traces to Phoenix when BASEROW_ASSISTANT_PHOENIX_URL is set * fix: harden Phoenix tracing setup after review * feat: Phoenix postgres storage, ai-evals profile and auth support * docs: ADR 007 and assistant tracing/evals guides * feat: assistant eval platform core (types, registries, scenarios) * feat: eval harness with shared assistant factory * feat: phoenix dataset sync for assistant evals * feat: assistant eval experiments via phoenix client + CLI * feat: migrate core, database and docs evals to the platform Ports the 42 kuma-core/kuma-database/kuma-docs pytest evals into declarative EvalCase/EvalScenario registrations, plus structure-level tests asserting dataset counts, ids, and scenario wiring. * feat: migrate builder and automation evals to the platform Ports the 12 builder + 2 proactive + 2 user-source cases into evals/datasets/builder.py (kuma-builder, 16 cases) and the 7 automation cases into evals/datasets/automation.py (kuma-automation), following the Task 5 pattern established in core.py/database.py. Extends eval_platform/test_datasets.py with counts, id lists, a mode-per-case assertion, and pre_state snapshot checks for the two cases that need one. * fix: link traces and final counts for single-case eval runs * fix: root spans for single-case eval runs use the assistant tracer provider * feat: assistant eval runner service with run page Adds the assistant_eval_runner management command (migrate -> instrumentation -> dataset sync -> single worker thread -> wsgiref server) and its runner.py module: a stdlib WSGI app serving a plain server-rendered page (GET /, POST /run, GET /healthz) backed by a bounded in-memory run history and one background worker draining a queue.Queue via run.run_experiment_for. Wires the assistant-eval-runner compose service (ai-evals profile, own baserow_evals DB), renames phoenix-db-init to ai-evals-db-init and extends it to also create baserow_evals, and adds BASEROW_EVAL_RUNNER_PORT to both env example files and the dev docs. * fix: eval runner integration fixes assistant-eval-runner needs its own SECRET_KEY/DATABASE_*/REDIS_* env vars: dev-overlay compose services don't inherit docker-compose.yml's x-backend-variables anchor (that's file-scoped YAML), so the container was starting without a Django SECRET_KEY and without a Redis password, crashing on auth. Also links to finished experiments pointed at the container-internal BASEROW_ASSISTANT_PHOENIX_URL (http://phoenix:6006), unreachable from the developer's browser. Adds BASEROW_ASSISTANT_PHOENIX_PUBLIC_URL (defaulting to http://localhost:${BASEROW_PHOENIX_PORT:-6060}) and has runner.py build the Phoenix link from it, deep-linking straight to the finished run's experiment compare view when its dataset_id/experiment_id are known, falling back to the datasets list otherwise. * refactor: retire the pytest eval harness All 65 eval cases now live in baserow_enterprise.assistant.evals.datasets; delete the legacy pytest-based suite and its `eval` markers. * docs: rewrite assistant evals guide for the Phoenix platform * feat: docs judge, prompt sync, git stamping and UI-contributed eval examples - answer_quality LLM-as-judge evaluator for kuma-docs (BASEROW_EVAL_JUDGE_MODEL) - Kuma prompts versioned into Phoenix on sync; experiments stamped with prompt hashes, git branch/commit and judge model - sync preserves UI-added dataset examples with prompt-match adoption; eval-export emits paste-ready docs.py snippets - final-review fixes: skip-safe scoring, runner CSRF/bind hardening, doc corrections * feat: eval runner UI round — tabs, fan-out, reference answers, 64-case docs dataset - Runner page: dataset tabs with selection badges, per-dataset and global all/none, cross-dataset fan-out (one experiment per dataset), 5s auto-refresh of runs, persistent run history across restarts, per-dataset Phoenix links, in-page Help tab rendering the repo docs via /docs.json. - Reference answers for kuma-docs: EvalCase.reference_answer, judge grades against it, sync preserves UI-curated ones, eval-export round-trips them. - kuma-docs grown to 64 cases: reference answers for all, PostHog-mined frequent questions, and cannot-do guardrail cases. - Gemini (google:gemini-3.6-flash) in the eval model list. * feat: runnable UI examples, prompt overrides, eval baseline and results view - UI-added Phoenix examples now execute: docs questions get the standard docs checks + judge; tool cases declare scenario/expected_tools/ answer_contains in metadata (empty-workspace default scenario). They are tickable per dataset on the runner page and run in whole-dataset experiments too. - Prompt overrides: run any experiment with a prompt's latest Phoenix version instead of the code constant (runner checkbox panel with soft per-tab ordering, or --override-prompt). Agent singletons keep their dynamic instructions; effective hashes + override list stamped on the experiment. - Committed baseline snapshot (evals/baseline.json, 111 cases) with just b eval-baseline capture/import; the runner imports it on startup so every Phoenix instance gets a baseline experiment per dataset, idempotent by content hash and run count. - Results tab: all datasets in one view for a named experiment, with baseline deltas and a case-weighted overall row, via Phoenix experiment annotation summaries. - New evaluation guide (docs/testing/ai-assistant-eval-analysis.md) served in the Help tab; layout uses horizontal space better (single tab row, fluid case columns). * feat: time and cost in eval results, frozen into the baseline snapshot - Results tab gains time (sum of run latencies) and cost/token columns per dataset and summed overall, with lower-is-better baseline deltas. - eval-baseline capture freezes each dataset's time/cost/token totals into baseline.json; import stamps them as metadata so imported baselines (which carry no traces to price) still show time and cost. - Importing a new baseline supersedes the previously imported one instead of accumulating duplicates. - Changelog entry for the eval platform. * fix: OpenInference attributes on subset-run task root spans Bare wrapper spans rendered as kind 'unknown' with Unset status and empty input/output in Phoenix. The Task root span now carries the CHAIN kind, the case prompt as input, the run result as JSON output, and an explicit OK status. * polish; minor fixes * fix: address eval platform review feedback Apply production model settings and retries, isolate automation checks, and fix runner configuration, links, and result status. Defer GPT-5.6 compatibility and baseline comparisons to #6034. * fix: preserve model profiles in rebased eval harness Use an explicit model profile for evals and share concrete models with tools. Manage model clients through the existing lifecycle helper and preserve regression coverage from the retired harness. * fix: harden eval persistence and Phoenix access |
||
|
|
b65c7e77cb |
chore refactor (AI Assistant): context offloading; better telemetry data; add google and anthropic models compatibility (#4951)
* chore(deps): replace udspy with pydantic-ai and opentelemetry-sdk
Replace the udspy dependency with pydantic-ai-slim (with openai, groq,
anthropic, bedrock providers) and opentelemetry-sdk for structured
telemetry collection.
* fix(sentry): exclude pydantic_ai from auto-enabling integrations
sentry-sdk's pydantic_ai integration patches ToolManager._call_tool
which was removed in pydantic-ai >= 1.x (now execute_tool_call),
causing import-time errors.
* feat(settings): add dev log file mirroring and allow embeddings URL in tests
- Add BASEROW_LOG_FILE support in dev settings to mirror logs (including
loguru output) to a file, useful for AI-assisted debugging.
- Allow BASEROW_EMBEDDINGS_API_URL to be overridden via env in test
settings for search_user_docs eval tests.
* feat(assistant): add message_history field to AssistantChat
Add a BinaryField to store serialized pydantic-ai message history
(JSON bytes) for multi-turn conversation context, replacing the
previous udspy-based conversation state.
* refactor(assistant): port to pydantic-ai agent framework
Replace udspy with pydantic-ai as the agent framework for the AI
assistant. Key changes:
- Add Agent definitions with typed deps (AssistantDeps) and dynamic
toolsets for runtime tool loading
- Add deps module with AssistantDeps, ToolHelpers, and EventBus for
streaming events to the UI
- Add history module for serializing/deserializing pydantic-ai message
history to the database
- Add model_profiles for provider-specific configuration (Anthropic,
OpenAI, Groq, Bedrock)
- Add toolset module with ToolGroup base class replacing the udspy
tool registry pattern
- Add shared/ with formula_utils and sub-agent helpers
- Add tool_types.py per tool module for pydantic-ai ToolDefinition
- Port all tool modules (core, database, navigation, automation,
search_user_docs) from udspy decorators to pydantic-ai Tool instances
- Port assistant orchestrator, handler, and prompts
- Remove signatures.py (replaced by pydantic-ai output types)
* refactor(assistant): update telemetry for pydantic-ai
Rework telemetry collection to use pydantic-ai's message history
format and OpenTelemetry SDK for structured span/event recording,
replacing the previous udspy-based telemetry hooks.
* test(assistant): update unit tests for pydantic-ai port
Rewrite assistant unit tests to use pydantic-ai's testing utilities
(TestModel, FunctionModel) instead of udspy mocks. Add new test files
for core tools, navigation tools, and search docs tools. Remove
obsolete skip file.
* test(assistant): add LLM eval test suite
Add end-to-end eval tests that run the real agent against a live LLM
to verify tool selection, schema compatibility, and output quality.
Includes evals for: navigation, core builders, database tables/rows,
sample rows, automation workflows, search_user_docs, and cross-cutting
structured output validation.
Tests are marked with @pytest.mark.eval and skipped by default.
Configure via EVAL_LLM_MODEL or EVAL_LLM_MODELS env vars.
* docs: add eval guide and update AI assistant installation docs
- Add docs/development/ai-assistant-evals.md with instructions for
running the eval suite, configuring models, and writing new evals.
- Update docs/installation/ai-assistant.md to reflect pydantic-ai
provider configuration replacing the previous udspy setup.
* fix(assistant): fix test patch paths, optional filter args, and eval marker
- Fix mock patch paths from `assistant.agent` to `assistant.agents`
- Make ListTablesFilterArg fields optional to prevent LLM validation errors
- Surface field_errors in create_fields tool result
- Simplify EvalToolTracker to use message history inspection
- Register `eval` pytest marker and skip evals by default
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: move testing docs to docs/testing/ and add PR test plan
Move ai-assistant-evals.md from docs/development/ to docs/testing/,
add ai-assistant-test-plan.md with manual and automated test steps
for the pydantic-ai port PR.
* refactor(assistant): extract row models to types/rows.py, rename utils to helpers
- Move FieldDefinition, row model builders, and get_link_row_hints to
new types/rows.py module with dict-of-callables dispatch replacing
match/case
- Simplify update model: fields are optional (omit = don't change),
removing the __NO_CHANGE__ sentinel
- Move get_table_rows_tools into tools.py as _build_row_tools since it
builds pydantic-ai Tool objects
- Rename utils.py to helpers.py for clarity, remove dead list_tables
- Add docstrings with :param/:returns to all public functions, add
proper type annotations throughout
* refactor(assistant): flatten field/view/filter types into single models
- Replace per-type config classes in fields.py with a single flat
FieldItemCreate model using optional type-specific fields and a
model_validator for type aliases
- Simplify view_filters.py and views.py type hierarchies similarly
- Update table.py types and corresponding tests
* fix(assistant): improve telemetry span processor and minor tweaks
- Replace SpanExporter with SpanProcessor for real-time span handling
- Remap child tool spans past 'running tools' grouping span
- Parse JSON string arguments in tool call parts
- Add data_brief parameter to sample rows prompt
- Disable reasoning_effort for groq models temporarily
- Rename _fix_formula to _fix_formula_field in helpers
* refactor(assistant): use ISO strings for dates and add dateutil fallback
Replace Date/Datetime Pydantic model objects with compact ISO 8601
strings. Add lenient parsing via dateutil.parser fallback when
fromisoformat fails.
* feat(assistant): add DO/EXPLAIN agent modes with switch_mode tool
Introduce AgentMode enum (DO/EXPLAIN) and ModeAwareToolset that filters
available tools based on mode. DO mode (default) exposes all action
tools except search_user_docs. EXPLAIN mode exposes only read-only
tools (list_*, navigate) plus search_user_docs for answering Baserow
feature questions. The switch_mode tool allows bidirectional switching.
* refactor(assistant): flatten automation node types and add $formula: convention
Replace 13+ per-type action node classes (RouterNodeCreate, SendEmailActionCreate,
etc.) with a single flat ActionNodeCreate model using @model_validator for per-type
validation and dict-dispatched functions for ORM conversion and formula generation.
Add $formula: prefix convention — values prefixed with '$formula:' are sent to the
LLM formula generator, plain values become literal formulas. Also detect raw formula
expressions (get(), concat(), etc.) written inline.
Add trigger validation: periodic triggers now require periodic_interval (with
automatic folding of flat fields), row triggers require rows_triggers_settings.
* build: bump pydantic-ai-slim to 0.1.66 and anthropic to 0.84.0
* feat(assistant): add RetryingModel for transient provider error recovery
Wraps pydantic-ai model instances to automatically retry on transient
errors (rate limits, timeouts, server errors) with exponential backoff.
Handles both streaming and non-streaming calls.
* feat(assistant): add AgentMode system with ModeAwareToolset and switch_mode
Introduce domain modes (DATABASE, APPLICATION, AUTOMATION, EXPLAIN) that
control which tools are visible to the agent. ModeAwareToolset filters
the combined toolset per-mode, registries generate per-mode manifests,
and switch_mode lets the agent transition between domains. Each mode
gets a cross-mode summary so the agent knows what other modes offer.
* refactor(assistant): integrate RetryingModel, event-based streaming, and JSON retry
Replace direct model usage with RetryingModel for resilience. Rewrite
streaming to use run_stream_events for proper text/reasoning/tool event
handling. Add JSON-tool-call-as-text detection with automatic retry.
Auto-detect starting mode from UI context. Update model_profiles with
max_tokens settings.
* refactor(assistant): improve shared formula utils and add formula language reference
Add RAW_FORMULA_RE for detecting raw formula expressions, needs_formula()
for $formula: prefix and raw formula detection, literal_or_placeholder()
for ORM value creation, and a shared formula language prompt. Improve
formula generator to track remaining unresolved fields across retries.
* refactor(assistant): improve database tools with routing rules and type fixes
Add per-module routing rules via get_routing_rules(). Extract ToolInputError
to helpers. Fix field type validators, improve row model handling, and
refine view filter types. Update agents and prompts for better tool
guidance.
* refactor(assistant): improve automation tools with routing rules and formula handling
Add per-module routing rules for automation. Improve node type handling
with better formula context support. Refine automation agents and prompts.
* fix(assistant): improve telemetry span processor with real-time remapping
Enhance SpanProcessor with JSON arg parsing, real-time span remapping,
and improved trace output handling. Update tests to cover new behavior.
* test(assistant): update tests for mode system, retry logic, and type refactors
Add tests for switch_mode, mode-aware manifests, JSON retry logic.
Add test_assistant_automation_node_tools and test_assistant_database_field_tools.
Update existing database/automation/core tests for refactored types and
new tool signatures. Update eval_utils for new deps structure.
* fix: lint
* chore(frontend): ignore .claude dir in vite watcher and fix Nitro EMFILE
- Add .claude/ to vite server watch ignore list alongside node_modules
and .git to avoid unnecessary file watching in worktrees.
- Configure Nitro devStorage to use fs-lite driver to prevent chokidar
from watching the entire repo root, which causes EMFILE on macOS in
large monorepos.
* fix(tests): fix test settings and seat usage test isolation with xdist
- Ensure pytest always finds backend/pytest.ini by passing -c pytest.ini
explicitly, fixing DJANGO_SETTINGS_MODULE=dev when running from root
- Preserve existing TEST dict keys when setting MIGRATE in test settings
- Add transaction=True to seat usage tests to prevent data leaking from
TransactionTestCase tests running on the same xdist worker
* fix(assistant): fix field types, formula regex, validator guard, and consolidate evals
Fix multiple_select returning None instead of [], link_row description
typo, formula regex missing greater_than_or_equal/less_than_or_equal
variants, and guard against overwriting original validators on repeated
prepare_tools calls. Consolidate sample rows and navigation evals into
the database tables eval file and remove the meta tool-call history test.
* fix(assistant): improve tool return types, filter aliases, and eval infrastructure
- Return consistent dict types from all tools instead of plain strings
- Add operator aliases for view filters so LLMs can use natural names
- Fix boolean filter operator (is → equal)
- Remove reasoning format from UTILITY model profiles (pollutes structured output)
- Add ModelRetry for workflow creation and formula agent errors
- Add EvalChecklist for soft assertions with pass/fail scoring
- Add EVAL_RETRIES support for flake detection in eval tests
- Suppress loguru DEBUG noise during evals
* refactor(assistant): extract table creation helpers and remove unused model profile
- Extract _create_empty_tables and _create_table_fields from create_tables
- Filter out duplicate primary field in field creation to avoid model mistakes
- Remove unused gpt-oss-20b model profile
- Always attempt sample rows regardless of field errors
* fix(assistant): strip <think> tags and unify streaming as reasoning chunks
Models like MiniMax-M2.5 emit <think>...</think> tags inline. Handle
ThinkingPart/ThinkingPartDelta events from pydantic-ai and extract
inline thinking from text parts as a fallback. Stream all content as
AiReasoningChunk during the agent run; the final answer is emitted
as AiMessageChunk by _emit_answer.
* fix(assistant): simplify streaming and add collapsible reasoning UI
Replace _accumulate_text/_extract_thinking with a single _get_content_delta
helper that forwards text/thinking deltas. Accumulate reasoning_so_far and
strip <think> tags before sending to frontend (which replaces content on
each chunk). Add collapsible reasoning bubble (max 250px with fade mask
and chevron toggle).
* fix(assistant): bridge legacy UDSPY_LM_* env vars to pydantic-ai config
* docs(assistant): improve ai-assistant.md and add AWS_REGION_NAME backward compat
- Add both Bedrock auth methods (boto3 creds + bearer token)
- Add section 6 with pydantic-ai model overview link and provider list
- Restructure migration table: unchanged / bridged / new variables
- Fix AWS_BEARER_TOKEN_BEDROCK incorrectly listed as removed
- Bridge AWS_REGION_NAME to AWS_DEFAULT_REGION in settings for backward compat
* minor doc/evals fixes
* fix(assistant): strip unclosed <think> tags during streaming
Models behind Groq emit <think> tags as text content rather than using
the native thinking protocol. During streaming, the closing </think>
tag may not have arrived yet, causing raw thinking content to leak to
the frontend. Also strip think tags from tool thought fields and reset
reasoning on tool results.
* docs(assistant): use provider:model format and refresh eval docs
- Update all docs to use pydantic-ai provider:model format (colon separator)
- Fix mixed-up provider descriptions in configuration.md
- Refresh eval docs: replace assert_no_tool_errors with EvalChecklist pattern
- Add embeddings URL for local vs Docker in ai-assistant-evals.md
- Skip KB sync post_migrate signal during tests
- Fix temperature type in model_profiles.py
- Refactor justfile PYTHONPATH for test recipe
* fix(assistant): clean up navigation and improve tool types
- Remove unused WorkspaceNavigationRequestType
- Narrow exception catch in navigate tool to ObjectDoesNotExist
- Guard id field in CreateRowModel.from_django_orm
- Use id__in for batch filtering in ListTablesFilterArg
* Revert "chore(frontend): ignore .claude dir in vite watcher and fix Nitro EMFILE"
This reverts commit
|