mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 00:08:25 +00:00
stop-reporting-builder-custom-code-errors
36
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e7381b5384 |
feat(mcp): always turn on OAuth sign-in and add the MCP tools changelog (#6930)
* chore: add changelog entry for the MCP shared tools The tools PRs left it for when the milestone was done. * feat(mcp): always turn on OAuth sign-in BASEROW_MCP_OAUTH_ENABLED is removed before it ships, so OAuth sign-in is on everywhere. The settings page opens the endpoint tab when the OAuth connections fail to load. |
||
|
|
16dbb0690f |
feat(agent): configure who can chat, approve and continue triggered runs (#6826)
* feat(agent): configure who can chat, approve and continue triggered runs Approving held tool calls and continuing a conversation a trigger started become their own operations. With RBAC, an agent's Permissions section sets who may chat, approve and continue: a lowest role, specific people or teams, or nobody. Without RBAC every member chats and approves, and nobody continues. The owner of a private conversation can ask others to approve its held calls, and leave it to them. * feat(agent): let everyone in a private conversation leave it and name who stopped a reply Anyone asked to approve can now remove a private conversation from their own list; only its owner deletes it for everyone. Once the owner has left, the last person to leave deletes it for good, as only an owner's trash may list a private conversation. A reply someone else stopped says who stopped it. * fix(agent): close the gaps a security review of participation found Keep a triggered conversation's opening message untrusted when a person continues it, audit changes to who can chat, approve and continue, and require being able to chat to ask others to approve. People asked to approve follow runs only while they may read the conversations, the approver picker scans at most a thousand members, and the permission object lists only the agents the person may see. A reply whose sender was deleted can still be resumed by someone asked to approve it. * docs(agent): add the participation test plan with its results Cover every participation setting, asking others to approve, leaving a private conversation and stopping replies, with the outcome of the e2e run and the findings of the security review. * fix(agent): address the review of participation permissions - Name only people's messages to the model: a trigger's opening message no longer reads as written by a deleted user. - Check the approver candidates in one pass, so the number of queries doesn't grow with the workspace. - Show the read-only note only to who can't write in a conversation. - Take a person who leaves the workspace out of the conversations they were asked into and the rules naming them, and delete the conversations nobody is left in. - Record a rule change and its audit entry in one transaction. - Refuse a custom approve rule nobody named in it could use. * docs(agent): update the participation test plan after the review |
||
|
|
c152a16f92 |
feat: let Kuma create, change and remove data source filters from the filter form, the chat and MCP (#6544)
* feat: let Kuma create, change and remove data source filters from the filter form, the chat and MCP * fix: allow earlier data sources in Kuma builder filters * refactor: share targeted Kuma action endpoint * refactor: derive service filter validation from filter types * fix: reuse shared boolean values in service filters * refactor: expose filter deprecation on backend types * refactor: delegate formula examples to application types * fix: allow Kuma to edit summary widget filters * test: include summary widgets in filter tool contract * fix: allow dashboard service filter groups * test: allow dashboard filter groups in assistant prompts * feat: enable inline Kuma for summary widget filters * test: initialize roles for transactional synced table copies * fix: reject table changes during Kuma filter generation * fix: reject current node formulas in service filters * perf: batch filterable data source discovery --------- Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com> |
||
|
|
49eb0c4881 |
fix(mcp): let MCP clients undo and redo their changes (#6753)
* fix(mcp): let MCP clients undo and redo their changes MCP tool calls ran without a client session, so their actions were stored with no session and no undo could reach them. * fix(mcp): undo a whole tool call past the action group limit Sets the undo session for every tool in one place and restores it after the call. Reports lock conflicts instead of an internal error. * fix(mcp): stop undo and redo at a part of a call that failed Carrying on past a failed part left one tool call half undone. * chore(mcp): say why the undo session import stays local Qodo asked for a reason; a module-level import fails before Django is set up. * fix(mcp): keep other calls of an endpoint out while undo or redo runs Undo and redo take a call back in parts, and a call of the same endpoint that landed between two parts made them stop with the call half undone. * fix(mcp): release the endpoint lock on any database error An InterfaceError on unlock escaped and could leave the lock held, and the regression test now waits on the lock instead of a fixed timeout. * fix(mcp): give up on a taken endpoint lock and stop undo in a split call A blocked advisory lock wait froze the shared sync thread of the worker, so calls now try for a few seconds and ask the client to try again. A second undo after a failed part went on into the older parts of the same call. * docs(mcp): say how far the undo API reaches into MCP changes * fix(mcp): wait for the endpoint lock off the MCP thread and redo a partly undone call at once The retry sleep held the worker's shared MCP thread, so other calls waited too. Undo stayed refused after redo could no longer restore the call, and one redo only reset the failed part. * docs(mcp): describe the endpoint lock errors and partly undone calls * fix(mcp): take, use and release the endpoint lock in one step and redo only the failed batch A cancelled tool call could leave the endpoint lock taken until the worker restarted. Redo of a partly undone call could mark really undone parts as redone without redoing them. * fix(mcp): set the undo session on the thread that runs the tool call A cancelled call keeps running on the MCP thread after the async side stops waiting, so its later actions lost the session and group. * test(mcp): cancel the call after its first field instead of after a fixed wait A slow runner could cancel before the body started and fail the test. * fix(mcp): drop the endpoint changes lock A session advisory lock can leak under PgBouncer transaction pooling and then block the endpoint's later calls. Without it, a write during undo only splits the undo, and the next undos finish it. |
||
|
|
d822dd067a |
feat(agent): row comment tools, with a search shared by MCP and Kuma (#6760)
* feat(row comments): search comments across a database Add RowCommentHandler.search_comments and the shared search_row_comments tool. They return the comments on the rows of a database, newest first, each with its table and row, narrowed by table, mentioned users, authors and creation time. A user is given as an ID, part of a name, or 0 for the user the tools act as. Every search is index-driven. A mention search is one query that starts from the mentions of the given users. Any other search reads the newest comments of each table from two new indexes, (table, -created_on) and (table, user, -created_on), added with RetryableAddIndexConcurrently. Comments on trashed rows are dropped after a page is read, so the result carries has_more instead of a total. list_row_comments now also returns the user_id and the mentions of each comment. * feat(mcp): expose search_row_comments Register the comment search as a read-only MCP tool in the database_read group, next to list_row_comments, and document it. * feat(agent): let a tool type be deactivated for a workspace An Agent tool type can now tell that a workspace can't use it, through is_deactivated and raise_if_deactivated, like service and node types do. A deactivated tool stays in the Agent's available tools, marked deactivated, so the client can show it as locked. It is left out of the allowed tools, so a reply never offers it, and the configuration refuses to allow it. * feat(agent): show a deactivated tool as locked in the tool permissions A tool the workspace can't use keeps its row in the Agent's tool permissions. A lock button replaces its Allow checkbox and opens the modal the tool's presentation type returns from getDeactivatedClickModal. The presets and the counts only consider the tools the workspace can use. * feat(agent): add the row comment tools An Agent can now list the comments of a row, search the comments of a database and post comments. Premium registers the three tools and their presentation. A workspace without premium sees them locked, and the lock opens the paid features modal on row comments. The core tests that pin the Agent tool names and their presentation now cover the core tools only; premium pins its own. * feat(agent): tell the model who a private conversation is with The tools of an Agent act as its identity, so the model had no way to turn "me" into a user. The instructions of a private conversation now name the person and their user ID. A conversation started by a trigger names nobody. The name is collapsed to one short line because it is user-controlled text. * feat(assistant): let Kuma search row comments Wrap the shared search_row_comments tool for Kuma, active in every mode like the other database read tools, and add an eval case that asks for the comments mentioning the user. * fix(agent): require workspace RBAC for row comment tools in Agents and Kuma * fix(row comments): accept an empty table list and odd digits in a search An empty table_ids returned no comments while the empty lists of users meant no filter. It now searches every table like an omitted one. A reference such as "²" passed isdigit() and failed in int(); isdecimal() reads it as a name. * refactor(row comments): check the searched tables in one permission call check_multiple_permissions raises the first denial itself, so the search no longer evaluates a denied table a second time to get its error. * fix(agent): refuse a deactivated tool by default A tool type that only said it is deactivated was listed as locked but could still be allowed and called. The base check now raises when the type is deactivated, as the service and automation node types do. A type can still raise its own error, like the one for a missing licence. * fix(agent): tell an Agent only about the locked tools it was allowed Every reply in a workspace without the licence carried a note about the three row comment tools, also for an Agent that never had them or has no workspace access. The note now names the tools in the Agent's allow list that the workspace can't use, and is left out when there are none. The tool type gives the reason and the handler writes the sentence. Kuma has no allow list, so its tool group keeps the sentence naming all three. * fix(agent): honor saved tool grants and row comment search permissions * fix(assistant): end a scenario's enterprise licence with its eval case A scenario's instance-wide licence stayed for every later case of the run, and the cached licence list hid it from its own case. The case's fixtures now add it, refresh the cache and remove it when the case ends. A licence that was already there is kept. * fix(row comments): cap the page of the comment tools A search without a mention filter reads the comments up to its page in every table, and a huge page overflowed the offset. Both comment tools stop at page 100, also in Kuma. * fix(row comments): read a user reference the same way in the search and its step The step of a search showed "0" when the model sent the acting user as text. The search and the step now share one parser. The description also says a name matches everyone whose name contains it. * fix(agent): make a tool's lock a button only when it explains itself A locked tool without a modal got a button that did nothing, and every locked tool kept a disabled Ask first checkbox that screen readers announced. |
||
|
|
debe4729a6 |
Allow excluding workspaces from instance AI providers (#6634)
* feat: add workspace exclusions for instance AI providers * fix: keep workspace exclusion picker open for multiple selections * test: account for exclusions in workspace query budget * fix: handle large AI provider workspace exclusions * fix: keep workspace selection controls stable * fix: preserve workspace option count estimates * fix: share estimated pagination and bound migration locks * fix: renumber the AI provider exclusions migration * fix: keep Kuma unavailable in excluded workspaces * fix: search workspace options by id * refactor: share unavailable instance provider ids * refactor: pick excluded workspaces with the paginated dropdown * fix: let excluded workspaces return to the instance AI setting * fix: align the exclusions migration and keep workspace IDs visible |
||
|
|
5169076065 |
feat: introduce User-backed workspace identities (#6556)
* feat: introduce User-backed workspace identities Replaces workspace core.Agent subjects with identities stored as Django Users, so permissions, execution and attribution use the same record. - User.objects and WorkspaceUser.objects are human-only; permission and identity code opts in through objects_and_identities. is_human and is_identity classify a user at runtime. - Login, tokens, seats, notification recipients, personal views and last-admin checks stay human-only. Roles, teams and field grants work for identities unchanged. - Agent applications run as an identity, never as a person. Every shared tool rechecks the identity's authority on each call, and MCP refuses a tool that skips that boundary. - Migrations add the profile metadata and index, remove the Agent model and delete or clear legacy Agent data: trash entries, role assignments, team memberships, integration authorizations and run-as bindings. - Rename the management API, UI, events and feature flag to identity. Squashed and rebased onto develop; the previous history is kept on backup/6556-before-develop-rebase. * refactor: remove generic subject options endpoint * refactor: simplify identity selection and Agent run-as options * feat: distinguish identity notification senders * fix: restrict identity bindings to identity managers * docs: record users and identities verification * fix: restore snapshots as the person restoring A restore checked the snapshot creator's permission and used the creator to decide whether an Agent keeps its identity binding. It now checks the person restoring, passed to the import as `restored_by`. `copied_by` stays unset on restore, so credential checks keyed on it behave as on develop. Restoring a snapshot whose creator was deleted works again. The copy rule for identity bindings covers Agent run-as only; a copied Local Baserow integration keeps its authorized subject. * fix: leave settings pages the user may not open A settings route without a permitted tab rendered an empty page, as the Identities page did with its feature flag off. It now opens the first page the user may see. * fix: renumber the legacy Agent cleanup migrations Develop added agent 0016 and integrations 0043, so the migrations that clear legacy Agent run-as bindings and integration authorizations move to agent 0017 and integrations 0044. * test(agent): run the trigger self-event test as an identity The test added on develop created a `core.Agent`, which this branch removes. It now uses an identity user as the Agent's run-as subject. * perf: load user types once per batched permission check * refactor: state the stored subjects in each subject type * fix: give every user a profile * fix: keep identity attribution on rows copied in their workspace * refactor: give people and identities their own subject type UserSubjectType stays the type both are registered and stored under. It forwards what differs to HumanSubjectType and IdentitySubjectType, so get_specific_type is the only place in subject code that inspects the user type. The registry returns the specific type on request and get_by_model keeps returning the stored type, which never reads the profile. An identity's membership is checked in one query instead of two. * fix: keep the roles of identities when a database is duplicated The role import read subjects through the model's default manager, which only returns people, so duplicating or restoring a database failed when an identity held a role on it. It now resolves the subject through the subject registry. A subject that no longer exists is skipped instead of failing the whole duplicate or restore. * refactor: look up a subject type from its content type in one place * fix: reload a cached token whose profile is incomplete A token cached by the previous release has a profile without the user type, which reads as not a person, so its requests were refused until the entry expired. The token cache now treats it as a miss, with the check the user cache already used. * refactor: check the user type once where the check was repeated The MCP endpoint loader, the personal view permission manager and the identity trash type each asked the same question several times. The rule that an identity is never selected by email moves from the team handler to the identity subject type. * refactor: leave trashed workspaces out of the identity membership manager WorkspaceUser.objects_and_identities was named after objects but also returned memberships of trashed workspaces, so callers filtered them by hand. It now follows the existing pair: it leaves trashed workspaces out, and objects_and_identities_and_trash includes them, as objects_and_trash does for people. * test: state the behaviour of every user type The table fails when a user type is added and says what has to be decided first. An unknown type is checked to be denied. * refactor: refuse to say whether a stored user subject is interactive The answer differs between a person and an identity, so reading it from the stored type would be wrong for one of them. It now raises and points to the specific type. * refactor: lock the person in membership writes instead of checking the type Leaving a workspace, removing a member and adding a user lock the user through the people manager, which refuses an identity or an unknown type in the same query. Nothing adds an identity through add_user_to_workspace, so its branch for identities goes. The last admin check compares the membership with the people who are admin, which needs no type check. * test: leave no rows behind in the legacy authorization migration test The test left an integration that pointed at a user that didn't exist and a workspace, in the database the migration tests share. Tests that ran after it then failed on the foreign key or on the workspace id. It now uses a real user and empties the two tables. * docs: describe the subject types and compare the Subject table alternative ADR 013 is shorter and states that people and identities each have a specific subject type under the stored auth.User type. It compares shared User storage with a Subject table that users and identities would both point to. * chore: run the legacy run-as cleanup after the agent actions migration Develop added agent migration 0017, so the cleanup becomes 0018 and depends on it. * test: leave no rows behind in the legacy agent migration tests Like the legacy authorization test, these left a workspace in the database the migration tests share, which a later test that creates workspaces with fixed ids collides with. * fix: write and read the workspace role of an identity in one place The role assignment API wrote the role of an identity through the membership update of people, which told every member of the workspace about it and stored Builder as MEMBER, while the identities API stored BUILDER and returned the stored value. Both now write through the identity handler, which stores the role like the role of a person, and the role is read with the resolver the workspace members use. * fix: take no row lock in the membership writes of a person Leaving a workspace locked the user before the membership while removing or updating a member locks the membership first, so the two could deadlock. The user type never changes and these operations refuse an identity, so the lock protected nothing: they now only check that the user is a person. Leaving no longer locks the admin memberships and removing a member no longer checks for the last admin, as before identities. * fix: find an identity by its name only in the subject options The search also matched the email and username, which for an identity hold an internal key, so searching a part of that key returned every identity. * chore: run the identity migrations after the new ones on develop Develop added core 0138, integrations 0044 and enterprise 0073, so the identity migrations become core 0139 and 0140, integrations 0045 and enterprise 0074 and depend on them. * fix: keep the identity of a copied integration only for identity managers A duplicated application or a restored snapshot kept the identity its Local Baserow integration acts as, without checking the person who made the copy. Restoring a snapshot could so bring back a binding an admin had removed. The copy now keeps the identity only when that person may bind identities, as the Agent application already did, and is otherwise authorized as that person. * docs: follow the renumbered migrations and the copy rule in the test plan The test plan named the identity migrations and their tests by their old numbers and still said a copied integration keeps its subject. * test(agent): run the row trigger tests as an identity The row trigger tests added on develop created a `core.Agent`, which this branch removes. They now use an identity user as the Agent's run-as subject, and the e2e fixture creates it through the identities endpoint. |
||
|
|
12389f071c |
docs(mcp): align MCP docs with baserow-mcp 1.0.0 (#6754)
* docs(mcp): align MCP docs with baserow-mcp 1.0.0 Point tool changes at Edit tools under My settings > MCP server, list the six skills, add delete_element_items to the test plan, correct the BASEROW_OSS_ONLY builder notes and update the steps for adding a tool. * docs(mcp): say clients keep their tool list until they ask again * docs(mcp): fix test plan steps that fail as written Testers ticked the wrong tool, kept a stale tool list and had a wrong minimum version, so correct scenarios looked like bugs. |
||
|
|
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
|
||
|
|
4654019e22 |
feat(mcp): add search, row comment, view config and audit log tools (#6593)
* 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. * 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. * 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 * 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. * 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. * 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): 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. |
||
|
|
d5d93a12cb |
feat(mcp): add the dashboard tools (#6526)
* feat(mcp): add the dashboard tool groups * feat(dashboard): share the dashboard list and create tools * feat(dashboard): share the widget read tools * feat(dashboard): share the widget write tools * feat(mcp): offer the dashboard tools * docs(mcp): list the dashboard tools * fix(dashboard): keep chart series styles when a widget changes Only the changed data source values are sent, and a series given at the same position keeps its id, so per-series chart types and colours survive. create_dashboards is capped at 20 names. * fix(dashboard): address review of the dashboard tools Chart aggregations, licence errors, series styles, clearing values, hidden items and write permissions behaved differently from the UI and the automation tools. * feat(assistant): let Kuma build dashboards Kuma gets a dashboard mode with the shared widget tools, so it can add, change, read and delete widgets and opens the dashboard after adding them. * test(assistant): give the chart eval a premium licence Charts need premium; without it Kuma asked about the plan instead of adding the chart. * fix(assistant): name the tools that list dashboard and widget ids Without them the argument fixer told Kuma to call list_dashboards, which it doesn't have. * fix(assistant): answer dashboard questions from the widgets Kuma sometimes added a widget or view filter to count something a chart already showed. * fix(dashboard): address final review of the dashboard tools A refused write kept earlier items, other users' personal views passed the check, and broken widgets, wrong chart types and missing ids gave unhelpful errors. * fix(dashboard): address review of the dashboard tools The services validate the data source, Kuma creates dashboards without an event the frontend can't handle, and the chart evals check the figures. * refactor(dashboard): let widget types register their tool definitions Charts and pie charts are premium, so their tool models, series handling and series_config now live in premium instead of the open-source tools. * fix(mcp): keep core.tools importable before Django is set up asgi.py imports baserow.core.mcp before django.setup(), and core.mcp now imports core.tools for its error mapping. * fix(assistant): refresh db connections in the dashboard tools develop now runs every Kuma toolset through AssistantFunctionToolset, which checks the thread's database connection before each sync tool call. * fix(dashboard): check the whole widget on partial updates The service only checks an aggregation sent with its field, so a partial update could save a widget that can't compute. Also restyle a chart whose series differ from its type, and tighten the eval check for the Won count. * test(dashboard): drop tests that only check constants and pydantic They assert configured limits and pydantic behaviour that other tests already cover. |
||
|
|
440a949339 |
fix(assistant): stop Kuma runs failing on dropped DB connections and tool errors (#6517)
* fix(assistant): stop Kuma runs failing on dropped DB connections and tool errors Kuma runs failed on dropped DB connections, link fields to non-text primaries and taken page paths, which made up most production failures. * fix(assistant): address review on Kuma run failures Health checks for DATABASE_URL configs, readable link examples without DISTINCT, a reused /login page, and error telemetry without provider bodies. * fix(assistant): address second review on Kuma run failures Login form set up on any reused /login page, lighter link examples, no refusal text in telemetry, guarded nested toolsets and title cleanup that keeps title characters. |
||
|
|
583ebf9f83 |
feat(mcp): offer Kuma's automation tools (#6469)
* feat(automation): share the workflow and node read tools MCP clients can find automations and read workflow graphs; workflows and nodes in another workspace are not found. * feat(mcp): label the automation tool groups * feat(automation): check automation formulas without a model Adds the workflow and node definitions to core so MCP can use them, with a formula check that needs no model. * fix(assistant): repair automation formulas after the nodes are written The model ran inside the write transaction (#6297), and Kuma's own write path didn't scope nodes and tables to the workspace. * feat(mcp): offer Kuma's automation tools * docs(mcp): list the automation tools * fix(automation): report values the node tools can't set These values were dropped or misapplied without telling the caller, who then assumed they were set. * fix(automation): keep node formulas runnable and updates non-destructive A ref in a previous_node path broke the workflow at run time and on import, and a typo in an update wiped a working value. * fix(automation): store the email body type as a choice The quoted value made emails go out as text/'html' and left the editor without a valid choice. * fix(assistant): let repaired formulas name nodes by their ref The generator sees each node's ref, but the repair write refused a formula that used it. * fix(assistant): stop repairing automation formulas when cancelled A cancel during the model call still wrote that node's formulas. * fix(assistant): keep a cancel and each field's repair apart in formula repair A generator error after a cancel was logged as a failed repair, and a missing field kept every repaired row value in formula_errors. * fix(automation): report a row_id or values a new row node can't take add_nodes dropped them silently where update_nodes reports them, so a create_row with a row_id looked like it acted on that row. * fix(automation): refuse a formula path the node doesn't output A condition like get('previous_node.<trigger>.Priority') parsed, so it was stored and its branch never matched. Kuma used to rewrite every condition, which hid this. * fix(automation): report what the node tools drop or misplace Values a node type takes no part of, a branch on a node that isn't a router, a repeated field and unchanged nodes were all reported as done. Text naming previous_node was read as a node path, and the builder lost its loose formula detection. * test(assistant): add evals for changing existing workflows The automation evals only created workflows, so add_nodes, update_nodes and delete_nodes were never exercised against a model. * fix(automation): list branches by label and keep a branch sent without a condition In the evals the model passed a branch uid as previous_node_ref, and listed unchanged branches in update_nodes without a condition, which was refused. * fix(automation): leave formula text in string literals alone Paths and $formula: inside quoted text were checked and rewritten as code. Field names are accepted in row paths since the row services read them too. A whole value written as one call with a space before ( is a formula again. * fix(automation): reload the graph after a node change rolls back The request's cached graph kept the rolled-back change and the next node saved it. A node given twice in update_nodes had its first formula repaired over the second. An email's body_type was reported as not set although it was. * fix(assistant): list nodes Kuma repaired in updated_nodes A node only the repair changed came back missing, so Kuma retried the update. The evals also check the email is still connected to the trigger. |
||
|
|
be799d43d2 |
feat(mcp): share Kuma's table, field and view tools with MCP (#6442)
* feat(database): share field tools and store raw formulas without a model MCP and Kuma need one definition of the field tools, and the MCP path has no model. Kuma repairs invalid formulas after the shared call, outside the transaction. * fix(assistant): run formula repair after the table transaction commits Tables and fields are now created by shared core code in one transaction, and Kuma repairs invalid formulas only after it commits. Closes #6297 for database. * fix(database): save each field in its own savepoint A database error on one field aborted the whole transaction, losing the other fields in the call. * feat(mcp): offer Kuma's table, field and view tools MCP clients get the field and view write tools Kuma uses, built from the same functions, and the disabled core table and field tools they replace are gone. * fix(database): reject bad select filter values and check every view first A string select value made an empty filter and an int one an internal error. A missing view left the filters of earlier views saved, so a retry duplicated them. * refactor(database): share list_tables between MCP and Kuma MCP gains Kuma's name filters and keeps its list output; Kuma's not-found hint now only names and counts databases the user can see. * refactor(database): share get_table_schema between MCP and Kuma MCP now gets Kuma's field details (option IDs, lookup through and target, array formula type) and keeps its old keys; Kuma reshapes the same result. * feat(mcp): share list_applications between MCP and Kuma Kuma's list_builders pages instead of silently stopping at 20. list_databases stays as an alias because existing connections allow it. * fix(assistant): keep generated formulas out of Kuma's table schema The shared schema sends MCP the formula of lookup, count and rollup fields, as before; Kuma only showed it for formula fields. * test(mcp): pin that stored tool lists can't hold removed or re-enabled tools Every write path has checked names against enabled tools since allowed_tools was added, so no data migration is needed. * docs(mcp): list the shared database tools in the test plan * fix(database): log unexpected field tool errors and hide their message The per-item loops sent raw exception text to MCP clients and never logged it. * fix(database): report an empty formula in formula_errors It used to fail later with "retry later" advice that Kuma's fixer never saw. * fix(database): create the filters of all views in one transaction An error on a later view left the earlier filters saved, and a retry duplicated them. * fix(database): store form settings and skip view filters Baserow refuses A form view filter or a field option error failed the call unreadably, form submit settings were dropped, and date, boolean and select filter values were stored as something other than what the response echoed. * fix(database): lock updated fields and drop models cached in a rolled back item update_fields merged select options from an unlocked read, and a failed item or a denied table could leave the request's cached table model ahead of the database. * fix(database): look up through the link field a lookup names through_field was taken for a table id, so the lookup failed or linked a new field to the wrong table, and a link field created for a lookup went unreported. * fix(database): report a refused primary field name with the table's name A reserved, blank or too long primary_field_name failed create_tables with "Internal error.". * fix(mcp): list only databases with list_applications The tool sits in the database read group, so it must not list builders, automations or dashboards until their groups exist. * fix(assistant): leave empty formulas to the user and note every unrepaired one The fixer invented a formula for a field that had none, and a permission denial while repairing dropped the notes for the formulas still invalid. * fix(database): validate a form view's redirect URL like the REST API The public form navigates to it after submit, so a javascript: URL ran in Baserow's origin. Also stops catching filter errors this path can't raise. * fix(database): match a lookup's through_field name ignoring case and spaces Select labels are matched that way, so link field names now are too. * refactor(database): move user_error_message next to the shared tools The table tools imported it from the MCP services, which is a layer above them. * fix(database): echo no value for a relative date filter that ignores it The response showed a value Baserow never stored for modes like today; it now reports null with a note. * fix(database): match reused table field names ignoring case and spaces "email" against an existing "Email" was reported missing, and next_steps led to a near duplicate field. Also tests a blank primary field name over MCP. * fix(mcp): let list_tables and get_table_schema ignore unknown arguments They are legacy default tools and ignored extra keys before, so existing clients that send them got errors. * fix(database): lock field updates in table and field id order Two calls locking the same fields in opposite order could deadlock when waiting for locks instead of failing with a conflict. * fix(assistant): drop models cached in a failed formula repair The repair savepoints could leave the request's table model ahead of the database, like the shared loops did before. * fix(database): lock all updated fields up front and apply them in order Sorting the updates broke a rename followed by a formula using the new name; the fields are now locked in id order first, and a lock conflict reads like REST's. * fix(database): make gte and lte view filters include equal values The aliases mapped to strict comparisons, so a row equal to the value was left out. * fix(database): skip link_row view filters without a row id A missing or non-numeric value was stored and matched every row. * fix(database): skip number view filters without a number A missing value was stored as "None", which hides every row. * fix(database): use UTC in date view filters when the profile has no timezone The filter stored "None" as its timezone and matched no rows. * fix(database): limit view names in create_views to 255 characters A longer name reached the database column and failed as an internal error. * fix(database): reject select options that share a value on create Tools pick options by value, so the second of two such options could never be matched. update_fields already rejected them. * fix(database): match a reused lookup's link field name like creation does Creation ignores case and outer spaces after an exact match, so the reused table check reported a lookup through "projects" as wrong when its link is "Projects". * fix(database): only skip a requested field named exactly like the primary field Field names are unique only when they match exactly, so a requested " Name " next to the primary "Name" was dropped without a word. * fix(database): reject a table name several tables in the database share Table creation reused the last such table while a link picked the first, so the link could point at another table than the response reported. * fix(database): create lookups after every requested table has its fields Fields were added table by table, so a lookup of a field in a later table of the same create_tables call failed. * fix(database): skip a requested field named like the primary in another case Clients vary the case of the primary field name, so an exact match created a second "name" next to "Name". Spaces still count, as on develop. * fix(database): resolve linked table names among the tables the user can see A hidden table of the same name made a link ambiguous, and the error revealed it. * fix(database): store an empty value for empty and not empty number filters * docs(mcp): list_applications lists databases only * test(assistant): add formula and lookup evals for Kuma's database tools * test(assistant): expect an empty value for empty number filters * feat(database): look up through the table's only link field when none is named Kuma often leaves the link out of a lookup and retries after the validation error. * fix(assistant): keep a later formula update and stop repairing formulas when cancelled * fix(database): take the filter timezone from the tool context, not the user profile An actor such as an Agent has no profile. * docs(database): explain a lookup to a formula of a later table * fix(assistant): repair the formula of the update that failed Formula errors from update_fields carry the index of their update, so the repair no longer matches on formula text. A later update that sets the formula to None leaves it unchanged and no longer skips the repair. |
||
|
|
8c56297939 |
docs(mcp): describe OAuth sign-in and endpoint keys in the MCP docs (#6394)
* docs(mcp): describe /mcp with OAuth and endpoint keys in the MCP server doc The doc still described the SSE key URL as the only way in. * docs(mcp): cover OAuth and settings tabs in the MCP test plan and dev doc The test plan only covered the SSE key URL. * docs(mcp): add setup for other MCP clients and the baserow-mcp plugin The test plan only showed Claude Code. * docs(mcp): fix review findings in the MCP test plan and docs Use a <server url> placeholder, link the baserow-mcp README for other clients and correct UI steps. * docs(mcp): unset BASEROW_PUBLIC_URL in the tunnel step It overrides PUBLIC_BACKEND_URL, so the tunnel URL was ignored. * docs(mcp): mention the OpenAI apps challenge route for self-hosted proxies #6395 added it to the Caddyfile only. |
||
|
|
91fabcb3ab |
fix(assistant): let Kuma change menu items by uid instead of recreating them (#6295)
* fix(assistant): keep the menu items Kuma resends instead of recreating them Kuma rebuilt every menu item as a new link with a new uid, so updating a menu deleted the click actions and settings of the items it meant to keep. Items matched by name now keep their uid, type, settings and children. * fix(assistant): keep Kuma's menu items by uid instead of by name list_elements now shows each menu item's uid, with sub-links nested under their parent, and update_element takes the uid back for every item Kuma keeps. A kept item keeps its type, settings, click actions and sub-links; a new name renames it and a new page moves a link, clearing the old page's parameters. children edits the sub-links. Requests the menu can't apply are refused before anything is saved: a page on a button, an unknown or repeated uid, or a new item named like an item being removed, which means Kuma forgot its uid. * test(assistant): set a non-default variant in the menu round-trip test * test(assistant): add evals for Kuma's header menu edits Five kuma-builder cases start from a header menu with a link, a dropdown, a separator and a button with a click action, the kinds of items production menus had when Kuma rebuilt them as page links. Each checks that the items Kuma doesn't change keep their uid, type and click action: adding a link, renaming the button, removing a sub-link, making the button open a page, and adding pages one at a time. The checks are tested against the untouched menu, the right edit and a rebuild into page links. * fix(assistant): delete menu items only when Kuma lists them update_element takes remove_menu_items, the uids of the menu items to delete. Every current item must come back in menu_items with its uid or be listed there, so an item Kuma forgets is refused with its name and uid instead of being deleted. remove_menu_items alone deletes those items and keeps the rest. The rule also covers a forgotten uid, so it replaces the check on new items named like removed ones. * fix(assistant): ask Kuma for the whole menu when it changes one item "Nothing is deleted unless listed" read to Kuma as permission to send only the item it changed, which the tool then refused for leaving the others out. The description now asks for every current item plus the new ones, and points deletions to remove_menu_items. * refactor(assistant): share uid helpers and let after_update add result keys Prepares menu items to follow the table column pattern: canonical_uid and NO_CHANGES move to types/changes.py, the menu listing helpers move to types/menu_items.py, and an element type's after_update hook can now add keys to update_element's result. * refactor(assistant): merge menu item changes like table column changes merge_menu_items turns add, update, reorder and remove lists into the full item list core saves. Items it doesn't name are resent as saved, removing a dropdown removes its sub-links, and anything it can't apply is refused before saving, including pages of another application. name_key and unique_in_order are now shared with the table column merge. * fix(assistant): let Kuma change menu items with add, update, reorder and remove lists update_element on a menu, header or footer now takes add_menu_items, update_menu_items, reorder_menu_items and remove_menu_items by uid, like table columns, instead of the whole menu. Items Kuma doesn't name stay as saved, the result lists the menu's items after the write and the removed items, and a refused change saves nothing. A header or footer changes the menu nested inside it and refuses when it holds several. * test(assistant): add evals for reordering menu items and removing a dropdown Two kuma-builder cases on the header menu scenario check that moving Help keeps every item, its click action and the Products sub-links, and that removing the Products dropdown removes its sub-links and nothing else. * fix(assistant): warn that undo keeps removed menu items deleted and list custom link urls Undo restores no menu item change, so the tool now says so next to remove_menu_items, as it does for table columns. list_elements shows a custom link's url, so it no longer looks like a link to nothing. A header's or footer's menu is locked before its items are read. |
||
|
|
eeb8d3900b |
fix(assistant): let Kuma change table columns by uid instead of replacing them (#6296)
* fix(assistant): keep the table columns Kuma resends instead of recreating them Replacing a table's columns gave every column a new uid, which deleted the click actions of button columns, and adding or removing columns reset the styles of the kept ones. Columns matched by name and type now keep their uid and styles. * test(assistant): add eval cases for editing table columns * fix(assistant): don't run a call the argument fixer repaired by dropping values A repair that left out a value the model sent used to run the tool anyway, so an edit could be ignored while the call reported success. The model now gets the error report plus the dropped paths and values instead. Moving a value, renaming a key and converting its type still run because the value survives. The harness lifecycle test now repairs a renamed key instead of replacing an unparseable value. * feat(assistant): show table columns in Kuma's list_elements * fix(assistant): let Kuma change table columns by uid instead of replacing them * feat(assistant): let Kuma bind table columns to database fields * fix(assistant): send unrepairable arguments back with the model's own errors Check a repair for dropped values before validating it, and answer a repair that still fails with the errors of the arguments the model sent. Arguments whose only errors are unknown keys holding values go back without a repair, the fixer may drop only empty unsupported keys, and arguments too deeply nested to compare go back instead of raising. * fix(assistant): show list field values in table columns and refuse type changes Derive the path a column reads from the shape of the field's values, as the table editor does, so lookups and array formulas show their values instead of raw JSON, and refuse fields that hold files. Accept the type list_elements shows in a column update but refuse a different one, and tell Kuma never to remove a column to rebuild it. Also: a value spelled differently from the stored formula keeps it as stored, tables that list a property refuse field bindings, refusals name every offending column, list_elements shows a table's data_source_id, and an unknown data source ref is refused with a next step. * test(assistant): check every kept table column and the reading of the link case builder/edits-table-columns now compares Email and Edit with the seed apart from Email's position. builder/keeps-link-column-settings requires that Kuma read the columns with list_elements and allows two refused attempts, since the columns' state decides the case. The edit-action lookup is shared. * test(assistant): don't depend on the recursion limit in the nested JSON guard test * refactor(assistant): move table column handling into element type hooks * fix(assistant): recover tool calls the model printed as text * refactor(assistant): move the remaining per-type update steps into element type hooks * fix(assistant): don't complete a printed tool call cut off after a stray quote * test(assistant): make the unknown-tool case reach the tool check |
||
|
|
dc62052c97 |
[4/4] test: harden assistant evals and tool contracts (#6007)
* test: bring Kuma eval baseline and dataset updates from #6006 * test: harden assistant evals and tool contracts Add production-replay datasets, resilient eval execution and comparison UI, a committed baseline, and broad tool contract and chain coverage on top of the runtime behavior changes. * test: align tool contracts with #6006 list_tables and permission output * fix: restore the eval runner results tab and pin it structurally The Results tab shipped unable to execute: the closing brace of usageCell was dropped, renderResults read an undeclared totals, the cost cell still called the old four-argument usageCell, and a second pane clear wiped the dataset errors appended just above it. Two tests covered the tab by asserting substrings of the page, so all four passed against dead script. Check the page structurally instead, with a small tokenizer, because the backend CI image has no JavaScript engine and a node-based test would silently skip there. Replace the sampled tool-visibility assertions with the full routed-tool map, so adding a tool has to state its reach rather than inherit one. * test: score eval checks against the call that actually ran An incomplete cross-mode call is answered with a re-call redirect, so the first create_workflows call can hold a pre-switch guess rather than the arguments that executed. Score the executed call instead, recognising the redirect through the router's own helper in both its retry and tool-result forms. * test: score the update_row target from the database, not the first draft The check read row_id out of the recorded create_workflows arguments, which are the model's raw output. When those arguments fail validation the toolset's argument-repair agent fixes them and the tool runs with the repaired payload, so a workflow that correctly names its row still scored as missing one. Measured over ten repetitions this produced one false failure; the trace shows execute_tool succeeding and a fix_agent span right behind it. Read the persisted service instead, like the neighbouring trigger and action checks already do. * test: check saved values in the prod-replay evals Replay checks now verify the form collects the order fields, the page was inspected, the requested tables have rows, ISO week numbers and signed amounts are correct for seeded rows, no broken formula is left behind, and all 30 employee rows carry typed values. * fix: compare eval results only across the same case population A baseline captured on an older dataset version ran a different set of cases, so its means are not comparable. The Results tab now requires the experiment and baseline to share a dataset version and says when they do not. * test: expect Kuma to ask when an implied app table is missing #6006 decided that a request to show records refers to workspace data, so Kuma asks where the projects come from instead of inventing a table. The eval had been flipped to expect building; restore the ask expectation while the explicit example-app case still builds. * test: accept date subtraction as a correct date-difference answer Subtracting two date fields returns a duration (verified: 5 days for 2026-01-01 to 2026-01-06), so an answer that subtracts the dates is correct even when it does not name date_diff. Retrieval rarely surfaces the reference-guide passage for date_diff, which made this case fail three times in four on an accurate answer. * test: expect Kuma to offer a sample-data table when app records are missing When no table holds the records an app should show, Kuma should create nothing and ask, offering a table with sample data among the next steps. * test: accept a plain-text question when Kuma must ask ask_user only records a question for the final answer, so a run that asks in its reply and builds nothing behaves the same for the user. The ask checks still require that nothing was created. * test: match docs keywords through Markdown emphasis Answers bold feature names, so '**File** field' missed 'file field'. Keyword matching now ignores emphasis markers, and the OCR case accepts 'AI prompt', the field type's name in the product. * chore: recapture the Kuma eval baseline on the final stack Three repetitions of all 122 cases on 3ca6497591 with Groq GPT-OSS 120B (harness v5): 355/366 passed. Docs 192/192, core 9/9, database 61/63, builder 55/60, automation 20/21, prod-replay 18/21. * chore: drop an import the develop rebase left unused * test: expect docs search in every mode * test: require complete tracker and employee replay data * fix: compare Kuma eval results using recorded cases and checks * fix: correct Kuma eval scoring and preserve baseline runs * test: reuse the seeded user in Kuma builder contracts * test: isolate async docs-search database fixtures Create users and workspaces in synchronous pytest fixtures so their writes stay inside the rollback transaction. Async setup previously used a separate autocommit connection and leaked users, causing later data-sync tests to fail on duplicate usernames. Remove the global async-safety bypass, enforce Django's guard locally, and keep the real database hybrid test synchronous around its async tool call. Verified the seeded two-test reproduction fails before and passes after with no leaked users. All 71 focused tests and 1,742 broader tests pass; one existing test is skipped. Scoped pre-commit checks pass. * docs: update Builder eval count after rebase * fix: grade saved assistant results and preserve eval errors |
||
|
|
157f586602 |
feat(database): add a floating add row button to the grid view (#6193)
* feat(database): add non-optimistic createNewRowConfirmed grid store action * feat(database): add floating add row button to the grid view * test(e2e): cover the grid floating add row button * chore: add changelog entry for the grid floating add row button * test(database): update page snapshots for the grid floating add row button * test: tighten floating add row button assertions * fix(database): keep the grid floating add row button above the footer |
||
|
|
7d94a86406 |
chore(deps): upgrade pydantic-ai to 2.50.0 (#6173)
* chore(deps): upgrade pydantic-ai to 2.50.0 - Bump pydantic-ai-slim 2.28.0 -> 2.50.0 and openinference-instrumentation-pydantic-ai 0.1.20 -> 0.1.27; the lock also moves anthropic to 1.8.0, openai to 3.19.2, google-genai to 2.25.0. - Unwrap SourcedInstruction entries in the eval prompt override. - Show the error message, not the model response dump, for UnexpectedModelBehavior errors. - Disable the pydantic-ai first-run Logfire banner. - Stop in-flight tools when an eval case times out. * fix: address AI dependency upgrade feedback |
||
|
|
64c9fff85e |
feat [6/8]: prepare AI provider management for rollout (#6070)
* feat: retire AI provider flag and add rollout audit * test: remove obsolete AI provider flag setup and docs * chore: clean up AI provider configuration and tests * feat: deprecate legacy AI provider environment configuration * docs: explain AI provider migration sizing and timing * docs: mark AI provider migration audit for removal * docs: explain AI provider migration audit usage * fix: log AI provider env deprecations after logging setup log_ai_provider_env_deprecations() ran at the tail of _setup_health_checks(), which ready() calls before setup_logging(). The notice went out through loguru's default sink and missed BASEROW_BACKEND_LOG_LEVEL, the Baserow format, and the OpenTelemetry log exporter, so operators shipping logs to a collector never saw it. Also drop two references the flag removal invalidated: the getEffectiveAIAgentModels JSDoc still described filtering as conditional on the removed provider flag, and the AI field architecture doc still pointed provider authors at the deleted legacy workspace-setting hook. That doc now names BuiltInGenerativeAIModelType, which is what grants an integration override model inheritance. * fix: reuse environment AI settings in generation workers * feat: import legacy AI provider settings on upgrade Removing the ai-providers flag makes database-backed providers the default, which would leave every existing installation on an empty AI providers page with a management command as the only way to populate it. A data migration imports the environment and each workspace's stored settings instead, so a standard upgrade needs no commands. Both scopes are imported in one migration. Legacy workspace settings replaced the instance ones entirely, while database providers inherit, so each imported workspace is also switched off the instance provider of the same type. Without that a workspace would silently gain models billed to the instance account. Settings that cannot fit their columns are skipped and logged rather than raising DataError and rolling back the whole upgrade. The migration reverses as a no-op because the previous version does not read these tables, so deleting rows would only discard edits made during a rollback window. migrate_ai_provider_settings stays as the recovery path and now shares its planning logic with the migration, so both agree on which legacy settings are complete. It deliberately does not switch workspaces off inherited providers, and warns instead. * chore: remove the temporary AI provider audit command audit_ai_provider_settings existed to inventory legacy configuration before a manual import. The upgrade now imports automatically, so the command has no remaining step to support. Removal was already tracked in #5749. * docs: reduce AI provider docs to lasting behaviour The upgrade procedure, rehearsal plan and sizing query described a one-time transition and do not help anyone after the release; they live in the pull request instead. What remains explains how providers work: the two scopes, how they combine, the inheritance switch, what the deprecated environment variables still do, and how integration overrides and published applications behave. Also corrects claims that no longer hold: published applications keep materialised credentials only when they were published before the upgrade, the import is no longer optional, and a workspace-owned provider suppresses the environment fallback too. * docs: shorten the AI provider changelog entries Bullet points render as single list items under the entry. The released entries average around twenty characters; these ran to four hundred, so the detail belongs in the AI providers guide rather than the changelog. * docs: clarify where imported AI credentials are stored The previous wording implied Baserow's own exports carry provider credentials. They do not: AIIntegrationType lists ai_settings as a sensitive field and ImportExportConfig excludes those by default, and AIProviderConfig is not part of any export path. * docs: explain the AI provider upgrade and where to configure providers State that the upgrade imports the BASEROW_* provider variables once and no longer reads them, list the exceptions, and give the exact navigation for instance admins (Admin tools -> AI providers) and workspace admins (workspace Settings -> AI providers). Map each deprecated variable to the field that replaces it. * fix: renumber the legacy AI provider import after 0121_agent Develop's core 0121_agent and this branch's import migration both depended on 0120, leaving two leaf nodes, so migrate refused to run and the startup check and E2E shards failed. The import is now 0122 and depends on 0121_agent. * feat: remove the legacy workspace generative AI settings endpoint GET/PATCH /api/workspaces/{id}/settings/generative-ai/ had no caller left, yet a PATCH was still honoured for any provider type without a workspace provider and never shown in the AI providers UI. Remove it with the handler parameter, receivers and frontend handler that only it could trigger. * fix: stop instance AI provider changes from fanning out per workspace An instance-level change queued one Celery task per 25 workspaces behind a global blocking lock, sent a payload to every connected user, and made the premium receiver serialize every AI field on the instance. Instance changes now notify staff only; other users see them after a reload. The render lock is per scope, and the in-use guards no longer read one row per workspace. * fix: keep inherited Kuma when a workspace switches off the instance provider The upgrade switches imported workspaces off the same-type instance provider, which made an inherited instance Kuma model invalid there, so Kuma fell back to the deprecated env model or turned off. Inheriting the instance Kuma selection now ignores workspace switch-offs; explicit workspace selections stay strict and are the only ones that block a switch-off. * fix: skip malformed Ollama URLs during AI provider migration * fix: preserve skipped legacy AI provider connections * test: cover independent legacy AI workspace connections * fix: skip malformed legacy AI provider settings * fix: move legacy AI import after current core migrations The linear rebase omitted the migration renumbering from the previous merge commit, while develop advanced through core 0124. Rename the existing AI import to 0125, depend on 0124, and update its historical migration test so core has a single leaf. |
||
|
|
479e616ee9 |
feat: add columns layout to grouped grid views (#6022)
* feat: add columns layout to grouped grid views * test: strengthen Columns layout coverage * fix: remove doubled vertical border on group column spans The group-by divider already draws a full-height line at each level boundary, so the span's own border-right rendered a second adjacent line in the body but not in the header. * chore: renumber group_by_layout migration after rebase Develop added 0221 and 0222 in the meantime, so the branch migration forked the graph into two leaf nodes. * refactor: rename banner group layout to section |
||
|
|
581917f842 |
feat [5/8]: use database-backed providers for AI Agent services (#5976)
* feat: register ai_agent AI provider model feature type * feat: expose integration-only AI provider settings lookup * feat: validate AI agent models against the ai_agent provider feature * feat: resolve AI agent dispatch settings from database-backed providers * feat: list database-backed AI providers in the AI agent node form * chore: add changelog entry for ai agent database-backed providers * fix: close dispatch feature-gate bypass for partial AI integration settings An integration-level ai_settings blob that omits credentials (e.g. only a models list) skipped the ai_agent feature membership check at dispatch, letting a restricted model run on the admin's DB credentials. Only a complete blob (its own connection) now bypasses the check; a partial one is validated the same way prepare_values already does. Also share one ScopedAIProviderState across the publish materialization loop instead of reloading it per model, and fully annotate AIAgentAIProviderModelFeatureType.get_workspace_availability. * fix: harden AI agent provider resolution * fix: preserve AI agent model inheritance during provider migration * fix: harden AI agent provider validation and document contracts * refactor: declare built-in AI provider types on the type itself The AI Agent model resolver duplicated the backend AI_PROVIDER_TYPES keys in a frontend Set, so a provider added there without updating the Set would silently lose model inheritance. Provider types now report it through isBuiltInProviderType(), inherited from BuiltInGenerativeAIModelType, with a test asserting every registered provider declares it. |
||
|
|
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 |
||
|
|
ab45c2346a |
feat [4/8]: per-feature AI model settings (#5796)
* feat: per-feature and workspace-level AI model settings Baserow could only point every AI feature at one instance-wide model. An administrator can now register provider models, declare which AI features each model may serve, and pick the default model per feature; a workspace admin can inherit that choice, override it, or disable the feature locally. The assistant resolves its model once per logical request and threads that snapshot through its nested agents and tools, so a single run can no longer re-read settings repeatedly or pick a model other than the one it validated. The scoped provider state is memoized for the duration of a request, keeping workspace serialization from loading it once per workspace. Also: - add Google and Groq provider types, and keep these database-only providers out of the legacy workspace settings they cannot round-trip through; - prune orphaned feature selections so an unloaded feature type's RESTRICT FK no longer blocks provider and model deletion; - record whether a configured model answers text and tool-calling probes, and invalidate that result when its credentials or identifier change; - broadcast provider and availability changes over the existing realtime channel so open clients update without reloading; - read the assistant model from the shared configmap, so frontend pods no longer miss it on Helm installs. Manual test instructions live in docs/testing/kuma-model-settings-test-plan.md. * fix: address AI provider settings review feedback |
||
|
|
1fa388b83f |
chore(deps): upgrade pydantic-ai to V2 (2.28.0) (#5896)
* chore(deps): upgrade pydantic-ai to V2 (2.28.0)
Upgrades pydantic-ai-slim from 1.102.0 to 2.28.0. No user-visible behaviour
change: where V2 moved a default, the V1 behaviour is pinned rather than
silently adopted.
Production changes are five files:
assistant/assistant.py async for -> async with ... as events:
(run_stream_events is a context manager)
assistant/retrying_model.py public RunContext; state/metadata/
close_stream proxy delegation; Vertex AI
via GoogleCloudProvider
core/generative_ai/registries.py output_retries=3 -> retries={"output": 3}
assistant/model_profiles.py normalise google-gla/google-vertex prefixes
assistant/tools/database/agents.py pin end_strategy="early"
The rest of the diff is test hardening, and it is the point of the change.
The assistant suite mocked pydantic-ai's streaming path instead of running it,
which hid four real breaks — one of them user-facing:
- Agent(output_retries=3) raises TypeError on V2, breaking the premium
generate_ai_formula endpoint. Invisible because the test patches prompt()
wholesale and the shared fixture refuses structured output.
- run_stream_events became a context manager; the bare async generator mock
kept working regardless.
- end_strategy flipped early -> graceful, letting a previously-skipped tool
call execute and hard-fail formula generation.
- GoogleProvider(vertexai=True) was removed entirely.
The doubles now wrap real pydantic-ai types, one test drives the genuine
streaming path, one proves cancellation unwinds through the context manager,
and test_pydantic_ai_contract.py pins the API surface (public and private) so
the next upgrade fails at import rather than mid-run in production.
Verified: assistant + core/generative_ai 343 passed, 66 skipped; full backend
suite 11962 passed, 360 skipped, 1 failed. That failure
(test_view_empty_count_aggregation_for_interesting_table, BaserowFormulaButtonType
missing empty_query) is pre-existing and unrelated — the identical failure occurs
at base commit
|
||
|
|
667cfdd850 |
feat: support grouped row ordering (#5787)
* feat: support grouped row ordering * fix: use existing endpoints without modifications * fix: make grouped row moves reliable and optimistic * address feedback |
||
|
|
ad08d4be1d |
feat: Group-by aggregations (#5602)
* feat: show per-group aggregations in grouped grid views
Each group header shows the column's configured Summarize value computed
over that group's rows, column-aligned at every depth, visible whether
the group is collapsed or expanded. Reuses the footer aggregation config
and display components, and an interactive per-group picker that sets the
shared column aggregation. Gated behind the group_by_aggregations frontend
flag; backend returns values via the existing group-by-data response.
Not included (follow-up): realtime/live updates, performance and caching,
and consolidating the group-by-data and aggregations endpoints into one
request for grouped views.
* refactor: de-duplicate Decimal NaN handling in grid aggregations
Extract the repeated Decimal("NaN") -> "NaN" JSON-safety hack into a single
json_safe_aggregation_value helper, reused by the group-by per-group and totals
aggregations and the authed/public footer aggregation endpoints.
* fix: address copilot feedback on group-by aggregations
- Only show the "+ Summarize" picker for unconfigured columns; a configured
column with no per-group value (e.g. distribution) now renders nothing
instead of looking unconfigured.
- Document the aggregations_only and include_totals query params and the
optional top-level aggregations field in the group-by-data OpenAPI schema.
- Mark row_count, sibling_index and row_offset optional (omitted in the lean
aggregations_only mode).
* fix: de-flake replay-events last-seen-expired test
The test assumed RealtimeEvent id 1 never exists, but the id sequence isn't
reset between transactional tests, so the recorded event got id 1 when the
test ran first on an xdist worker and replay succeeded. Capture the real id,
delete it to simulate retention, and replay from it.
* feat: live, consolidated group aggregation updates
Group-header aggregation values and the footer total now update live and in
place on any change (cell edit, row create/delete, realtime), with no spinner.
In grouped mode they come from a single group-by-data request (aggregations_only
+ include_totals); the standalone /aggregations/ endpoint is no longer called
while grouped. Sort changes need no refresh (order-independent). Gated behind the
group_by_aggregations flag; flag-off behaviour is unchanged.
Deferred: per-group targeting (refreshes the loaded window), the optimistic +
realtime double request, and the 7.3.2 picker e2e.
* fix: dedupe and harden per-group aggregation refresh
Selecting an aggregation in a grouped view fired the group-by-data request
two or three times and could leave the footer total hidden behind a stuck
spinner until the page was refreshed.
- Clear the footer loading flag from refreshGroupByAggregations so the total
shows on first select.
- Make refreshGroupByAggregations the single owner and supersede in-flight
requests so a stale response can't overwrite newer values.
- Skip the duplicate fetch from updateFieldOptionsOfField and the footer
watcher while a picker already owns the refresh.
- Right-align and shrink the banner aggregation value, and let the label slide
behind the previous field instead of hiding it.
* chore: remove the group_by_aggregations feature flag
The per-group aggregations feature is finished, so enable it unconditionally
and drop the flag gating from the grid footer, group banners, and the
aggregation refresh action.
* test: drop obsolete group-by aggregation feature-flag specs
The group_by_aggregations flag is gone, so the two specs that asserted the
flag-disabled behaviour no longer apply.
* fix: stop the row context menu's Select row from clearing its own selection
The global click handler that clears a multi-select when clicking outside the
grid also fired for the row context menu's "Select row" click, wiping the
selection it had just made (most visible in group-by). Skip the clear when the
click lands inside a context menu; cell clicks, which should still clear, are
unaffected.
* fix: flaky test
* fix: show the spinner for updates as well
* fix: address copilot aggregation comment
* fix: avoid optimistic group aggregation values
* fix: address feedback
* fix: hide vert divider before primary field
* fix: only re-fetch when raw_aggregation_type changes
|
||
|
|
0aa7147db3 |
Collapsible group-by grid view (#5470)
* feat: add collapsible group-by grid view * fix: address copilot feedback, plus some other cleanup/fixes * fix: harden grid e2e navigation * Add e2e tests; improve performance; clean up code * feat: show resolved values for reference fields in group-by headers - Resolve collaborator, link-row and select group values to renderable display objects in the group-by data API, batched once per field per page (O(1) lookups, no per-group queries). - Order many-to-many groups identically to the rows via correlated-subquery ordering, since the relation column is shadowed by the aggregated array annotation in group-by queries. - Render the display values as chips in the group-by banner via dedicated multiple-select / multiple-collaborators components; shrink the collaborator badge, reduce the field-name size and keep the label on one line. * fix: group many-to-many fields by their set of values Grouping a grid by a collaborator, multiple-select or link-row field produced empty groups with orphaned rows and duplicate headers for the same set of values. The group key (an id array) was order-sensitive: the backend's aggregated array order was unstable row-to-row and the cell appends new values, so an optimistically-created group's key diverged from the server's and rows were rejected by rowBelongsToGroupBySection. - pathKey and the group-row Vue keys now sort m2m id arrays numerically, so a group is identified by its set of ids, not their order. - The backend aggregates the group value ordered by related id and sorts the group's unique value, making grouping deterministic and set-based. - Optimistically-emptied groups (row_count 0) are no longer rendered (the node is kept for reconciliation), and the leading group gap is fixed so the first visible group has no spurious gap. - A newly created collaborator group resolves its badge name from the workspace store instead of requiring the name on the value. * fix: keep cell multi-select when dragging in a group-by view A multi-select drag ends with a click whose target is the rows container (the common ancestor of the dragged cells). cancelMultiSelect- IfActive cancels the selection unless that container is recognised as part of the rows area, but its whitelist only knew the flat-grid classes (grid-view__rows / grid-view__row). The collapsible group-by feature renders rows in grid-view__group-by-rows containers, so the post-drag click was treated as "outside the rows" and the selection was cleared on mouseup. Add the group-by row containers to the whitelist. * test: expect emptied group-by banners to disappear The optimistic empty-group hiding (a group disappears once its last row moves out) made the e2e contract that kept the emptied source group visible at row_count 0 obsolete. Update the 2.2.7/2.4.4 assertions to expect the emptied group's banner to be gone (new expectNoGroupByBanner helper), and correct the tree-maintenance comments: the node is still kept for reconciliation, but the layout no longer renders its banner. * perf: load the collapsible group-by grid in one bounded request Grouping a wide table by many fields took several seconds and a request waterfall to render the first screen. The group tree was fetched one HTTP request per depth, a budget that ran out before reaching any leaf forced a per-parent fallback, and the rows endpoint resolved group-by metadata unconditionally. Backend - Walk the descendant tree with one batched windowed query per group-by level (get_group_by_data_for_parents) instead of one query per parent, so a single include_descendants request returns the whole visible subtree in O(depth) queries. - Scale the descent window to the viewport: row_budget = ceil(limit / depth). A deep group-by stacks each leaf row under its ancestor banners, so far fewer leaf rows fill the first screen; the window now returns a viewport-sized slice (~264 -> ~68 groups on a 12-level grid) and the rest lazy-loads on scroll. - Gate the rows endpoint's group-by metadata behind include=group_by_metadata so it is not computed when unused. - Resolve reference/link-row display values in one id__in query per field across all pages instead of once per page. Frontend - Initial load issues one group-by-data prefetch and one viewport rows request; expand mode no longer takes the per-depth path. - Cap the banner indent (<=50px) and shrink the per-level arrow spacing as the group-by count grows, keeping the count aligned and the field name ellipsised; render multi-level loading skeletons for the not-yet-loaded levels. - Guard walkPage against a cyclic page-resolution stack overflow and keep activeGroupBys filtered to fields that still exist. Plus e2e env isolation (configurable ports, cookie prefix) and docs. * fix: address review feedback Addresses the review comments on the collapsible group-by grid PR. - Gate the group-by add-row "+" on the same condition as the flat grid (not read-only, not a one-way data sync, has create-row permission), so it no longer renders buttons that error on click for data-sync tables. - Show the "(Empty)" label for empty array-valued groups (multiple select, link row, collaborators), matching the text-field behaviour. - Stop the flat-grid row placeholder from rendering in group-by mode (v-else-if instead of v-else). - Render formula group-by headers via the result field type's group-by component instead of RowCardFieldFormula, removing the dev-only "Missing required prop: row" Vue warning. - Keep the cell selected at the first/last field for both Tab and arrow keys (restore the pre-refactor behaviour); navigating past the edge no longer drops the selection in either flat or group-by mode. - Re-enable and de-flake the "sorted add outside buffer" e2e test: assert on the re-resolved last row instead of a snapshotted renderedRowCount() index, which raced with the create-confirmation re-render in CI. * fix: keep rows inserted below in a grouped grid view in their group Insert-below and add-row in a grouped view now derive the new row's group path from the neighbouring row, so it inherits all writable group-by values and lands in the same group; `before` is set only when the next row shares that group. * feat: soft-cap adding group-bys at 5 in the view UI Once a view reaches 5 group-bys the add button is disabled with a tooltip; views that already have more keep working and only offer to remove them. * limit group-bys; fix css * refactor: polish code and comments * fix: address Bram's feedback * feat: add vertical gap between sibling sub-groups and indent banner labels with their chevron * fix: address remaining feedback * fix: row-coloring and fixed-height for add-row * fix: address Bram's feedback v2 * fix regression in last commit * fix: address grid group review comments |
||
|
|
d8ff2e5b1f |
refactor: add a test plan and extract grid view helpers in preparation for collapsible group-by (#5430)
* refactor: extract grid view common test helpers
* refactor: extract row-lifecycle helpers and migrate grid store
Add computeRowInsertPosition to utils/row.js (expresses insert
position by row identity rather than flat array index).
Add handleRowCreated, handleRowDeleted, handleRowUpdated to
rowLifecycle.js. Each takes a store-supplied mutations adapter so
the decision logic (filter matching, sort position) is shared
between the flat-array grid store and the upcoming collapsible
group-by store.
Migrate createdNewRow, updatedExistingRow, deletedExistingRow in
grid.js to delegate through the new helpers via inline adapter
closures that translate position descriptors to the existing
flat-buffer Vuex mutations. Observable behaviour is unchanged;
search gating is preserved in each Vuex action.
Also includes grid view e2e test additions (section 1.5 task queue,
section 7.7 row identifier type, section 10.1 hover actions) and
grid test plan updates from the refactor/grid-view-common-e2e work.
* chore: fix CI
* chore: cleanup
* refactor: remove dead grid e2e search helpers and dedupe row-lifecycle guards
- Drop the unused openSearch/typeInSearch/clearSearch/toggleHideNotMatchingRows
methods from GridPage; the richer, used variants live in
grid_view_options.spec.ts. This also removes the placeholder/getByText
selectors flagged in review (the remaining 'Delete row' selector stays scoped
to the visible context menu).
- Centralize the repeated 'applyMatchFlags ?? noop' / 'rowsForMatchCheck ??
emptyRows' guards into a single normalizeMutations() helper. No behavior change.
* refactor: remove dead updateMatchFilters/updateMatchSortings grid actions
Both grid store actions lost all production callers in the row-lifecycle
migration (match flags are now computed via onRowChange/reapplyMatchFlags and
direct computeRowMatchFlags calls). Repoint the remaining viewFilters test at
the live onRowChange path instead of the orphaned updateMatchFilters action.
* docs: note field-constraint create/edit coverage in grid view test plan
Add 1.6.x and 2.6.x TODO entries describing add/edit behavior under unique and
unique-with-empty field constraints (backend validation error surfaced +
optimistic rollback; empty values exempt from uniqueness).
* test: await route registration in failNextRequest
failNextRequest fired page.route() without awaiting it, so the intercept
could register after the caller already triggered the request. Make it async
and await registration before returning (mirroring pauseNextRequestWithSignal);
it now returns { done } and the 3 callers await it.
* test: scope grid_interaction serial mode per-describe
Replace the single file-level serial config with a per-describe one (matching
the other two grid specs) so a failure in one block no longer skips the rest and
independent blocks can run in parallel.
* docs: document createRowLifecycleContext and clarify escape wording
- Add a docstring to createRowLifecycleContext.
- Reword the Deferred/Escape note in the grid view test plan.
* fix(e2e): return created rows from createRows helper
setupGrid expected createRows to return the created rows to collect their
ids, but the helper returned void and discarded the batch-create response,
so created.map() threw 'Cannot read properties of undefined' and every
grid_interaction spec failed deterministically. Return response.data.items.
* revert publicView changes
|
||
|
|
00c450872b |
chore: respect BASEROW_BACKEND_LOG_LEVEL setting in tests and management tasks (#5160)
* chore: respect BASEROW_BACKEND_LOG_LEVEL setting in tests and management commands
* fix: use dynamic Loguru {process} placeholder instead of baked os.getpid()
With setup_logging() now called from CoreConfig.ready(), the PID was
frozen to the parent process. Celery prefork children inherited the
wrong PID in their log output. Loguru's {process} resolves per record.
* fix: address feedback
|
||
|
|
cf15a4a02f |
refactor (MCP): refactor MCP tools; share AI Assistant capabilities (#4980)
* feat(mcp): refactor tools to service layer and add database/table/field CRUD Replace internal API request pattern with a dedicated service module for MCP operations. Simplify tool architecture from dynamic per-table tools to static tools with explicit table_id parameters. Add new tools for managing databases, tables, fields, and batch row operations. * fix(mcp): address Copilot review feedback - Let exceptions propagate from MCPTool.call() so call_tool() logs them - Fix N+1 queries in get_table_schema using enhance_field_queryset hook - Fetch fields for all tables in a single specific_iterator pass - Clamp list_rows pagination to safe bounds (ROW_PAGE_SIZE_LIMIT) - Fix update_fields docstring to reflect type-change support - Fix module path in utils.py comment - Update "Adding a new tool" docs to match current MCPTool pattern * fix: comment risky tools; waiting for a proper permission check * feat(mcp): add enabled flag to MCPTool and disable risky tools Add `enabled` attribute to MCPTool base class so tools can be registered but hidden from MCP clients. Disable database/table/field CRUD tools until users can control tool availability through the UI. Also add docs/testing/mcp-test-plan.md with manual testing instructions. * fix(mcp): replace list[dict] with typed Pydantic models for field/row specs Validate required keys (name+type for field create, id for field update, id for row update) at the schema level instead of relying on KeyError from dict.pop() in the service layer. Uses extra="allow" so type-specific options and field values pass through. * fix: wrap update_rows in a transaction * address feedback |
||
|
|
40c9f48081 |
feat (assistant) 3/3: add themes to templates and a set_theme tool (#4970)
* feat(assistant): add theme catalog, apply_theme, and theme templates Add 20 new theme templates and theme infrastructure: - THEME_CATALOG with 22 themes, ThemeName type, _load_theme_data(), apply_theme() - BuilderItemCreate.theme field with auto-apply on creation - set_theme() tool for changing themes on existing applications - Unit tests and eval tests for theme functionality * refactor(assistant): migrate theme evals to EvalChecklist pattern Replace removed assert_no_tool_errors with EvalChecklist + count_tool_errors in test_agent_creates_app_with_theme and test_agent_changes_theme. Remove stale test_navigate_to_workspace test. * refactor(assistant): move theme code from core/types to builder/themes Theme catalog, apply_theme, and related helpers are a builder concern, not core. Move them to tools/builder/themes.py so core never imports from builder. Also make apply_theme return bool so set_theme can report errors instead of silently claiming success, and fix "Thank youb" typo across all 23 theme templates. * refactor (AI field): remove langchain and use pydantic-ai (#5017) * refactor(ai): replace langchain with pydantic-ai for LLM calls and structured output Replace langchain dependency with pydantic-ai as the LLM abstraction layer. Each GenerativeAIModelType now implements get_ai_model() returning a pydantic-ai Model instance, and the base class provides prompt() and prompt_structured() using Agent.run_sync(). - Remove langchain, langchain-openai, and direct openai/anthropic/mistralai deps (pydantic-ai-slim extras install them) - Add prompt_structured() with PromptedOutput for Pydantic model output (e.g. BaserowFormulaModel) - Add output_choices parameter to prompt() for constrained choice selection with fuzzy matching, compatible with all models including those without tool support - Remove custom output_parsers.py (StrictEnumOutputParser, JsonOutputParser replacements) - Update AI field job flow to use prompt(output_choices=...) for choice output and prompt_with_files fallback for file-based prompts * refactor(ai): replace deprecated Assistants API with pydantic-ai multi-modal content Replace OpenAI's deprecated Assistants API (file_search, threads, polling) with pydantic-ai's native BinaryContent support. Files are now read from storage and passed directly in the prompt as multi-modal content — no upload/delete lifecycle needed. - Add content parameter to prompt() for multi-modal file attachments - Remove GenerativeAIWithFilesModelType abstract class and its upload/ delete/prompt_with_files methods - Remove get_client() from BaseOpenAIGenerativeAIModelType (no longer needed without file operations) - Replace AIFileManager.upload_files_from_file_field() with get_file_contents() returning BinaryContent objects - Simplify job_types.py: file+choice paths merge into single prompt() call with content and output_choices parameters - Remove format_prompt/parse_output hooks (no longer needed) - Remove FileId type alias and AIFileError exception - Works with any provider that supports documents (OpenAI, Anthropic, Mistral, Google) instead of only OpenAI * refactor(ai): unify prompt API into single method with output_type parameter Merge prompt_structured() into prompt() via the output_type parameter: - None (default): plain text response - list[str]: choice selection with fuzzy matching - Pydantic BaseModel/TypedDict: structured output via PromptedOutput Remove prompt_structured(), output_choices parameter, and dead code (format_prompt, parse_output hooks, AIFileError, FileId type). * refactor(ai): clean file handling API with model type owning processing logic Redesign file handling so the model type owns all file processing decisions (embed vs upload, size limits, count limits) while the manager only reads metadata from storage and provides a lazy reader callback. - Add supports_files flag and prepare_files() to GenerativeAIModelType base - OpenAI implementation: embeds images inline (BinaryContent, 50MB/500 limit), uploads documents (UploadedFile via Responses API) - Use OpenAIResponsesModel instead of OpenAIChatModel for OpenAI provider (supports all file types via input_file/input_image) - AIFileManager.prepare_file_content() collects metadata, passes lazy read_file callback — no data read until model type requests it - Remove is_file_compatible/get_max_file_size from public API (moved into prepare_files) - Add type hints throughout * fix(assistant): fix generate_formula tests and grid view row_height - Add output_type param to TestGenerativeAIModelTypePromptError.prompt() - Return BaserowFormulaModel in test mocks instead of raw JSON string - Use correct ORM field name row_height_size in grid view from_django_orm * docs: add AI field test plan * refactor(ai): improve docstrings, fix prompt signature and empty prompt handling * refactor(ai): merge ERROR_OUTPUT_PARSER into ERROR_GENERATIVE_AI_PROMPT The distinction between output parsing errors and prompt errors didn't provide actionable info to the user. Both now surface as a single ERROR_GENERATIVE_AI_PROMPT error code. * refactor(ai): move value generation into AIFieldHandler with AIFile abstraction Introduce AIFile dataclass that wraps serialized UserFile dicts with lazy read_content(). Move the core generation logic from AIValueGenerator._generate_value_for into AIFieldHandler.generate_value_with_ai so the handler owns the full flow: prompt resolution, file preparation, AI call, file cleanup, and choice resolution. - prepare_files() now takes list[AIFile] and returns only processed files - cleanup_files() mirrors prepare_files() for provider file cleanup - delete_file() takes AIFile instead of raw file_id string - AIFieldEmptyPromptError raised when prompt resolves to empty - Delete AIFileManager (absorbed into handler + model type) * docs: add AI field architecture overview * fix(ai): handle missing files and partial upload cleanup in prepare_files - OpenAI prepare_files() now catches per-file errors (missing files, upload failures) and skips them instead of failing the whole generation - Handler cleanup uses ai_files instead of prepared so files uploaded before a mid-prepare failure are still cleaned up * fix(ai): normalize LLM responses before choice matching Strip quotes, markdown bold, backticks, and trailing punctuation from model responses before fuzzy matching. Use case-insensitive comparison so responses like "POSITIVE" correctly match "Positive". * address feedback * Address feedback |
||
|
|
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
|