Commit Graph
91 Commits
Author SHA1 Message Date
Peter EvansandJeremie Pardou 5a62c876e4 fix: align custom code in builder Preview with the editor on shared hostnames (#6881)
* fix: restrict editor-written code in the builder editor and on the editor hostname

* fix: simplify builder author code restrictions by hostname

* refactor: remove redundant backend custom code hostname checks

* refactor: unify builder HTML element rendering restrictions

* refactor: clarify builder web frontend hostname terminology

* fix: distinguish untrusted builder content in preview notices

* refactor: remove unused backend preview security setting

* docs: shorten builder code restriction changelog

* fix: restrict iframe cookie access across frontend ports

* refactor: share web frontend hostname matching

* fix: preserve protected HTML interactions and bound iframe height

---------

Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com>
2026-11-26 17:20:44 +00:00
Peter EvansandJeremie Pardou 95b892af41 feat: add automatic snapshot schedules (#6746)
* feat: add automatic snapshot schedules

* fix: show the count in relative date labels

* refactor: rename snapshot allowance setting to workspace

* feat: notify workspace admins when automatic snapshots fail

* feat: show the last automatic snapshot execution per application

* fix: simplify snapshot modal layout and capacity feedback

---------

Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com>
2026-11-24 14:12:03 +00:00
Peter EvansandJeremie Pardou 2b8e6ba569 feat: add per-workspace snapshot allowances and protected snapshots (#6783)
* feat: add per-workspace snapshot allowances and protected snapshots

* fix: guard snapshot replacement and separate quota management

* refactor: delegate snapshot permission descriptions to application types

* fix: highlight inherited workspace snapshot maximums

---------

Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com>
2026-11-23 11:23:05 +00:00
Davide Silvestri d21801281f feat(agent): trigger agents when rows are created, updated or deleted (#6695)
* feat(agent): trigger agents when rows are created, updated or deleted

* test(agent): find the trigger picker by the class it now has

The trigger picker renders the shared service picker since the send
email actions, so its menu is under .agent-service-picker.

* fix(agent): check a trigger's access again before its conversation starts

The task that starts a firing's conversation trusted the access check made
when the event happened. A run identity removed, trashed or without access
by the time the task ran still got a conversation with the event's rows.

* fix(agent): apply the row trigger review fixes

- A type change moves an overlap rule left at the old type's default to
  the new type's default.
- Queued replies wait while the run identity can't read what the trigger
  watches.
- An imported formula is kept as written when no path is remapped,
  through one import_formula in core.
- Row events hand their listeners services holding the event's table.
- Trigger form choices no longer read the workspace's views.
- A first row too long for a message is cut short instead of left out.
- A no-access error for a type the card no longer shows is ignored.
- The dispatcher no longer clamps the batch size.

* fix(agent): keep the merged trigger behaviour and UI for row triggers

- Skipping stays the default overlap rule: only the row trigger types say
  their events can't be skipped, so HTTP and periodic triggers start as
  they did before.
- The workspace-access note is a plain alert and the batch size field is
  spaced like the hosted forms, without style overrides.
- The type-change and queued-firing tests are develop's again, with the
  row trigger tests added after them.
- ADR 014 names the hooks row triggers add to the shared service type.

* fix(agent): show a row trigger without workspace access as misconfigured

The trigger can't run until the agent has workspace access, so its card
gets the error icon with a tooltip and the database field shows the error,
instead of an info note.
2026-11-17 23:42:51 +01:00
Davide Silvestri b587de3dba feat(agent): configure per-user active-run limits (#6458)
* feat(agent): configure per-user active-run limits

BASEROW_AGENT_MAX_ACTIVE_RUNS_PER_USER caps the Agent replies one user can
have queued or running across workspaces. Unset means no limit, so
self-hosted installs are unaffected. The run-type hook receives the user so
a plugin can set the limit per user.

* fix(agent): address review of the per-user run limit

- Negative Agent run limits mean no limit, like the trigger limits, so no
  configured value can refuse every send.
- Docs keep plan wording for the workspace hook only; the user hook sets
  one user's cap across workspaces.
- ChatRunLimitReached docstrings say "a reply limit" instead of listing
  which limits exist.
- Drop Agent tests that repeated core checks; core now checks that a
  finished run frees its slot.
2026-11-17 11:38:12 +01:00
Davide Silvestri 26ff58a3d9 feat(agent): let agents send emails through configured actions (#6720)
* feat(agent): add configurable send email actions

* fix(agent): send what an action call showed and harden actions

Review fixes for the send email action.

- Resolve an action call's formulas once and carry the values from the
  held call to its dispatch, so the approved preview is exactly what is
  sent. DispatchContext.resolved_values lets a dispatch skip resolving
  the formulas of that service again.
- Deny an approved call when its integration changed, or when it comes
  back without the values its approver read.
- Let the AgentActionType base own configuration checks, preview and
  dispatch. A type only supplies its defaults and readable values.
- Reserve the mcp<number>_ names of connected app tools, and accept any
  valid input name, run_ctx included.
- Keep whole numbers whole in Number inputs.
- Add BASEROW_AGENT_MAX_ACTIONS_PER_AGENT, unset by default, and load an
  agent's actions in a constant number of queries.
- Order and label an action's fields from its presenter in the step
  card and in configuration errors.
- Replace the plan with docs/development/agent-actions.md.

* fix(agent): show what a saved action returns and drop undone errors

- A debounced save updated a copy the action card doesn't render, so the
  configuration errors the server found never showed. Save through the
  object the list renders.
- Clear a rejected edit's error once the edit is undone.
- Word the action limit so it also reads well with a limit of one.

* test(database): update decorator tooltip snapshots for edge-aware tooltips

The tooltip directive now keeps top and bottom tooltips inside the
viewport and positions their arrow, which changes the inline style the
two decorator tooltip snapshots record.

* fix(agent): mark an action formula with a refused argument as invalid

A function's argument check raises Django's ValidationError, which the
readiness check let through. A formula like minus('abc', 1), stored by
an import, then failed the action list, the configuration and every
reply instead of showing the action as misconfigured.

* fix(agent): start an email action on the instance server only if it delivers

The starter asked the looser question the builder and automations use,
while the readiness check asks whether a message is delivered. With a
backend that only prints, a new action opened on the instance server
and was unavailable straight away.

* fix(agent): name a deleted action in the trash

* fix(agent): read a negative agent limit as no limit

A limit of -1 was kept as a limit, so nothing could be added: no action
with BASEROW_AGENT_MAX_ACTIONS_PER_AGENT, no reply with
BASEROW_AGENT_MAX_ACTIVE_RUNS_PER_WORKSPACE. Both now treat 0 or less
as no limit, like the trigger caps.

* feat(agent): ask first by default before an action runs

A new action sent as soon as it was added, so anyone chatting with the
agent could have it email any address. Built-in tools that change data
and MCP tools already start with Ask first on; every action now does
too, at the model level so the next action types inherit it.

* fix(agent): tell the approver's own session when "Always allow" applies

Approving with "Always allow" turned Ask first off on the server, but
the realtime event skipped the approver's session as if it had edited
the action itself. The Actions card kept showing Ask first on while
emails went out. No session made this edit, so every session is told.

* fix(agent): show an action call in full to whoever approves it

The approval preview kept 10 recipients and 1,000 characters while the
call sent everything. An action's step now shows every value, never
shortened. Limiting what a call may send is left to a follow-up.

* fix(agent): apply every action event a reconnect replays

Action events all write to one slot of the agent, and the watcher only
saw the last value of a tick. A reconnect replays what it missed in one
loop, so an action another user created was lost when a later event
followed it. The watcher now runs on every write.

* fix(agent): reload the configuration when the agent gains or loses an action

Actions count as tools for web search, but nothing refetched the
configuration when one was added, switched, repaired or deleted, here
or by another user. On a model that can't search while it uses tools,
the web search setting stayed stale until a reload. The Actions section
now emits the reload other sections already use, only when the agent
gains its first callable action or loses its last.

* docs(agent): leave the limits of a call to its action type

What a call may send and what its preview shows is for each action type
to limit. Send email limits neither yet.

* fix(agent): mark a stored formula that can't be checked as invalid

A formula nested too deeply raised RecursionError in the readiness check,
so listing the actions, the configuration and every reply failed. Any
failure to check a formula now marks its field as invalid, as a stored
formula can make the parser or a function's own check raise anything.

* fix(agent): keep an approval when its integration is renamed or moved

The approval key digested the whole exported integration. Its name and
its place in the list don't change where a call is sent, and the place
of every integration can change when another one is added or moved.

* fix(core): keep the custom scrollbar in WebKit browsers

Since Chromium 121 the standard scrollbar properties replace the
::-webkit-scrollbar rules, so the rich text editor lost its 10px thumb.
The standard properties now only apply where those rules don't exist.
Stylelint is told that a mixin's body ends up inside a rule.

* chore(agent): name the collapse-all button after its block
2026-11-16 14:41:41 +00:00
Davide Silvestri 9af8a8422e feat(agent): rate-limit agent triggers and let a busy trigger skip or wait (#6672)
* feat(agent): rate-limit agent triggers and let a busy trigger skip or wait

* feat(agent): choose a trigger's overlap rule and show skipped firings

* feat(agent): let a trigger run its replies in parallel

A third overlap rule, Run in parallel, starts up to
BASEROW_AGENT_TRIGGER_MAX_PARALLEL_RUNS replies at once (default 5) and
queues the rest up to the queue cap. Skip, Wait and Parallel now share one
rule (OverlapLimits): start while there is room to go and nothing is
queued ahead, queue while the queue has room, else skip. A firing held
back by the workspace's run limit queues where the rule queues. The
hand-off and the sweep start as many queued replies as fit.

* test(agent): pin the trigger lock order a hand-off and a builder's save rely on

* fix(agent): lock agent before firing its trigger

* fix(agent): tighten trigger overlap counts and limit parsing

- A reply in a trashed conversation no longer counts as going, so it
  can't block a trigger until the trash is emptied.
- A message that fails to resolve fails its reply before the overlap
  rule, so the builder sees it instead of a skip.
- The hand-off locks only the queued replies that can start.
- Rate-limit pairs must be positive integers.
- The API help text describes `parallel`.

* fix(agent): hand a trigger's queue on in its own task

- When a trigger's reply ends, a task started with the trigger's id
  starts its queued replies, instead of the ending reply's save doing
  it. With the broker down, a hand-off fails at most one reply instead
  of the whole queue, and the reply's save no longer loads the trigger.
- The hand-off and the sweep check what a firing checks: Agents on, the
  trigger type available and the agent ready. A trigger that can't fire
  keeps its queue until it can.
2026-11-13 17:38:50 +01:00
Bram 3d9e37163e feat: [3/5] Semantic search action for automations and applications (#6451)
* Semantic search action for automations and applications

* Fixed feedback
2026-11-12 11:03:12 +01:00
Tsering Paljor 72fbe9106b Add sweep that cleans up stuck Automation workflows. (#6665) 2026-11-11 09:47:39 +04:00
Davide Silvestri 4cbe4af199 feat(agent-builder): Agents reply to messages (#6466)
* feat(agent-builder): answer messages with background replies

Each message starts a core chat run that streams the configured model's reply and saves it with its turn: status, error code, model messages, usage, and the provider and model that answered. Messages record their author. One reply runs per conversation, and BASEROW_AGENT_MAX_ACTIVE_RUNS_PER_WORKSPACE caps a workspace (default 5). Copies keep turns and authors and end replies still running.

* feat(agent-builder): stream, stop and resume replies in the chat

The chat follows each reply through the core run stream, shows authors, lets the user stop a reply, resumes after a reload or in another tab, and explains replies that did not finish.

* refactor(agent): keep replies focused on chat

* refactor(agent): keep each reply's outcome on its message

A reply is an assistant message created empty with its prompt, and the run
writing it saves its text, status and error code there, replacing the turn
table. Send responses name the run they started, so a reply that ends before
the response is still followed. Retries read the run before the reply, listed
replies that still look unfinished are read again from the primary, and blank
replies are saved empty.

* feat(chat): add shared chat components

Store-free message, markdown, composer and copy button components styled
after the agent builder designs, so the Agent chat and later Kuma can share
one UI. Replies render markdown without images, which could carry
conversation data to any URL, and app links open in the router.

* feat(agent-builder): show replies with the shared chat components

Replies render in place from the conversation history under the agent's
name and avatar, with Thinking and Writing above the composer while they
run, a note when stopped and an error card when they fail. Stop stays
available while a reply runs, even when the configuration stops being
ready.

* feat(agent): hand finished replies to followers and announce reply runs

A finished run carries the saved reply as the messages list shows it, so
followers can apply it without reading the messages again. Conversations
expose the run writing a reply, and agent_conversation_updated carries that
run's id when a reply starts and null when it ends, with the conversation's
updated_on to order them, so every session can show it without requests.
A blank model answer now ends the reply as failed, and replies reuse
ChatRunStatus. Reply permission checks move to the service, sends check the
agent-builder flag, finishing a reply relies on the engine's run lock
instead of a row lock, and the workspace limit defaults to 10.

* feat(chat): share Kuma's typing and loading indicators

Kuma's bouncing dots and reasoning spinner move to core as ChatTyping and
ChatLoading, and Kuma renders them from there with the same look.
ChatComposer's status prop becomes activity and keeps focus on the input
when Send and Stop swap, ChatMessage drops its author props until
conversations can be shared, and markdown leaves mailto and other non-web
links to the browser.

* feat(agent-builder): show reply progress like Kuma and apply replies in place

A reply shows the typing dots until its first text, then a spinner beside
the streaming text. The finished run's saved reply replaces it in place, a
run's start no longer reads the messages, and a streamed chunk re-renders
only the reply being written. Realtime updates set a listed conversation's
run without reading the list again, so its dot pulses grey while it
replies, in every session, and the page drops its chat subscription when no
conversation is open.

* fix(agent): handle empty replies and legacy message retries

* fix(agent): address reply review feedback

* refactor(chat): share response UI with Kuma

* fix(assistant): separate thinking from streamed answers

* feat(chat): share message footers with Kuma

* fix(chat): keep thinking blue and streamed answers expanded
2026-11-03 17:03:13 +01:00
Bram d0571201ad feat: [2/5] Added semantic search vector indexing for text fields (#6450)
* Added semantic search vector indexing

* Introduced incompatible state

* Covered template scenarios

* Set data_schema in local baserow ingration

* Check if field is still enabled when updating

* Update docs about env var hash change

* Added enterprise query test

* Fixed index name
2026-11-03 11:41:13 +01:00
alamin-br 6b20dcc391 fix: limit password reset and verify email requests (#6441)
* fix: limit password reset and verify email requests

Anyone could flood an address with reset emails, and parallel requests got past
the verify email limit. Adds a per-recipient reset limit, a per-IP limit on both
endpoints, and makes the rate_limit decorator atomic.

* fix: keep reset and verify email limits separate

Both senders were named send_email, so they shared one rate limit bucket per user.

* fix: make the per-IP email limit opt-in and name rate limits

Behind nginx and Caddy every caller shares one IP, and behind an appending
proxy the caller picks it, so the IP limit now needs BASEROW_THROTTLE_IP_ENABLED.
2026-10-21 16:56:03 +02:00
Davide Silvestri 9eabe6b06b feat(core): add Redis-backed background chat runs (#6382)
* feat(core): add Redis-backed background chat runs

Run AI work once in Celery and follow bounded Redis Streams over HTTP. Keep
lifecycle, Stop, leases and final outcomes in Postgres without per-token writes.
Include the shared frontend follower, adapter registry, recovery API, migration,
queue/deployment wiring and adapter guide. No product uses it yet.

Part of #6346

* Remove unused chat run response header exposure

* Extract shared async streaming HTTP router

* Simplify chat run follower and group engine constants

- Check read access once when a stream opens; read run state from Postgres
  only after 5 s without output or on run.finished.
- Split follow_run into small steps around _OutputReader.
- Turn event kinds, error codes and stop reasons into StrEnums; the
  Kuma-only model_unavailable code moves to Kuma.
- Document ChatRunType hooks with param, return and raises fields.
- Add BASEROW_ASGI_HTTP_MAX_CONCURRENT_STREAMS and size the follower Redis
  pool by it.
- Give handler publish/recover calls their own event loop, so cleanup
  cannot close pools shared by HTTP followers.
- Update ADR 010 and the background chat runs docs.

* Clean up chat run interfaces and test setup

* Prune chat runs once after 7 days and skip overdue claims

- Delete each expired page with one statement. Incomplete runs get one more
  ensure_interruption_warning call first, and are deleted even if it fails,
  so run metadata never accumulates. The hook now returns None.
- Keep runs for 7 days instead of 30.
- Never claim a queued run older than NOT_STARTED_AFTER; the sweeper ends it.

* Retry brief Redis failures in chat run followers

- A connection error, or a buffer that does not exist yet, is retried with
  the same cursor, sending heartbeats meanwhile.
- run.replay_unavailable is only sent once the follower stops reading, so
  the browser can treat it as final.

* Let finished chat run output expire with the active TTL

Nothing reads a buffer once its run has finished: followers return the saved
outcome first and recovery only reads running runs. Drop finish() and the
24 h TTL, so a finished buffer expires an hour after its last append.
_publish_terminal now reuses _publish.

* Run the chat run scale tests on fakeredis

Build the buffer's real read and write pools on fakeredis connections, so
these tests always run and backend CI needs no Redis service. The Kuma e2e
tests cover a real Redis.

* Address the remaining chat run review comments

- Serialize the saved outcome after the transaction, so only a failed save
  is logged as one.
- Make the primary-pin test transactional; inside the test transaction the
  router always used the primary, so it could not fail.
- Cover the race past the per-user lock, a lost run after Stop and an old
  writer appending to a recreated buffer.
- End the admission test's request with a disconnect, so a regression fails
  instead of looping.
- Document that one worker process runs AI replies one at a time.

* Move the chat run migration after develop's core 0130

* Log only the class of an outcome serialization error

* Test that the run deadline asks a run to stop

* Keep a run's status when a resumed follower rebuilds its output

* Note that slow DNS lookups turn off a run's live output
2026-10-21 14:52:59 +02:00
Peter EvansandJeremie Pardou a36e7e3688 feat: implementing the new invite-to-scope feature. (#6361)
* Implementing the new invite-to-scope design and functionality.

* Simplifying the invitation acceptance, we don't need the redirect.

* Fix the action type description

* Addressing my own review feedback, and making sure the workspace invitation form behaves like the scoped one.

* Further tweaks after testing edge cases manually

* Lint fix

* Taking a DRYer approach to validating the subject chips.

* Lint fix

* Addressing feedback

* fix: block invitation batches containing invalid emails

Malformed addresses could be silently cleared after a partial batch send.
Keep them visible and block submission until corrected or removed.

* fix: respect workspace invitation permission in scope sharing

Scoped Admins could attempt email invites denied by workspace permissions.
Gate new-email invitations while keeping existing subjects assignable.

* feat: unify workspace and scoped access lists

Workspace and scope lists duplicated markup and lacked consistent controls.
Share rows, add workspace edit/cancel actions, and cap lists at six rows.

* fix: reconcile invitation branch with develop

Develop enables agents and adds an Enterprise migration at the same number.
Align invitation subjects and renumber the branch migration after develop.

* refactor: resolve workspace user roles in the backend

The frontend duplicated the backend mapping from basic roles to RBAC roles.
Expose role_uid in user payloads and reuse it for inherited access counts.

* fix: validate invitation emails before submission

The permissive database validator let malformed invitation addresses reach the API.
Use the existing strict validator for email suggestions, chips, and batch submission.

* fix: align invitation input focus styling

The invite input used a gray border tied to whether suggestions were open.
Use the standard blue border with focus-within so Escape preserves the focus highlight.

* feat: limit email invitation batches

Large invitation batches can exhaust the sending allowance partway through.
Default to five new emails per batch, configurable, with a message before submission.

* feat: let roles declare the invitation default

RBAC invitations should default to Viewer without Enterprise-specific logic in core.
Let role types declare the default: Member for basic workspaces and Viewer for RBAC.

* refactor: keep invitation role semantics in their owning modules

Core invitation UI should not interpret Enterprise role IDs or depend on Database roles.
Move basic roles to core and let Enterprise supply invitation subtitles through role metadata.

---------

Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com>
2026-10-21 13:33:41 +01:00
Davide Silvestri 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.
2026-09-25 17:05:10 +02:00
Bram ac6cdb5aca All workspaces homepage [4/7] Remember user last viewed (#6001)
* Track when a user last viewed a view, page, dashboard or workflow

* moved `ai_provider_states` into _get_application_serializer_context

* Fixed feedback

* Fix migration conflict

* Fixed feedback

* Skip impersonated last viewed
2026-09-25 12:37:13 +02:00
Jérémie PardouandTsering Paljor 40c18a3c9f feat: add separate domain for preview (#5682)
Co-authored-by: Tsering Paljor <tsering@baserow.io>
2026-09-09 08:53:47 +02:00
Bram 0e75a6bb6d feat: Harden workspace invites with Captcha and rate limit (#5808) 2026-07-31 21:34:13 +02:00
Tsering Paljor 429847210a feat: Add Go to node type (#5582)
* Add Go to node

* Remove goto_ prefix from destination_node_*

* Move max dispatches check into _before_node_dispatch()

* Remove translations from backend errors

* move validate_goto_destination to a static method in the node type

* Move clearing goto links to node type

* Refactor cleared_goto_links to a more generic post_move_modifications

* Remove automation concepts from integration land

* Fix flakey service test

* Remove 'node' mentions in CoreGotoServiceType

* Implement new import_references() hook to avoid overriding import_formulas()

* Fix forward-jumps

* Fix test

* Rename goto_node to just goto

* Update comment

* Clean up old references to connectors (we now use badge)

* Refactor history handler's get_destination_labels() to get the destination from node type.

* Handle max dispatch error in the dispatch_node()

* Rename output_service_id to destination_service_id

* Remove simulate check from goto node type.

* Rename post_move_modifications to move_extra_data

* Rename revert_move_in_workflow and after_move_in_workflow to revert_move and after_move respectively.

* Rename import_references to post_import

* Make _condition_is_set more consistent

* Move CoreGottoServiceForm to integrations and refactor logic/imports.

* Make node history label more generic.

* Add afterMove() hook

* Max dispatch check should happen for simulations too

* Move _before_node_dispatch() error handling into the main try/except

* Move post_import() into EasyImportExportMixin

* Add a generic getDestinations() method to node types

* Simplify setting destination_service_id

* Use existing convention to inject registry

* Set limit to 2000 for max dispatch

* Add new skipped history status

* Dedupe queries for destination labels

* Ensure destination node validation considered deleted nodes.

* Ensure destination nodes are ordered per graph

* Set max dispatches default limit to 1000

* Only allow backward jumps.

* Fix ordering bug that caused non-default router branch nodes to not appear as a destination target.

* Fix migration

* Re-add lost commit from Jeremie - rename to after_import()
2026-07-23 20:57:19 +07:00
Davide Silvestri e6f2a44e85 chore: scale OpenTelemetry sampling and preserve traffic metrics (#5726)
* feat: scale OpenTelemetry sampling and metrics

* feat: add per-user invitation metric

* fix: monitor every queue in OpenTelemetry

* docs: explain retaining every eligible trace

* feat: retain all eligible traces with -1

* fix: address feedback; trace ActionType.do and several important handlers methods
2026-07-22 11:57:11 +02:00
alamin-br 7bc6d19977 fix: guard data sync and SSO outbound requests against SSRF (#5489)
* fix: guard data sync and SSO outbound requests against SSRF

Route the GitLab data sync issue fetch and the OpenID Connect well-known
and JWKS fetches through the advocate library instead of plain requests,
so that user/admin configured URLs can't be used to reach Baserow's
internal network. The behaviour is controlled by two new settings,
BASEROW_DATA_SYNC_ALLOW_PRIVATE_ADDRESS and BASEROW_SSO_ALLOW_PRIVATE_ADDRESS,
both defaulting to blocking private addresses.

Also strictly validate the workspace import manifest version before using
it to build a schema file path, preventing path traversal from an
untrusted uploaded archive.

* fix: address review feedback on SSRF guard settings

- Move BASEROW_SSO_ALLOW_PRIVATE_ADDRESS to the enterprise settings module.
- Drop the settings comments that re-explained the env vars.
- Add breaking change changelog entries for both new defaults.
- Cover the blocked private address paths for GitLab data sync and the
  OpenID Connect well-known fetch, and the unknown manifest schema version.

* fix: guard Jira data sync and OAuth2 token/user info fetches against SSRF

The Jira issues data sync passed the user configured jira_url to the
atlassian client, which uses a plain requests session. It now gets an
advocate session gated by BASEROW_DATA_SYNC_ALLOW_PRIVATE_ADDRESS, and a
blocked address becomes a clear sync error.

The OAuth2 token and user info endpoints come from the provider's
well-known document, which the guard on the base URL doesn't constrain.
The OAuth2 session now mounts advocate's validating adapter, gated by
BASEROW_SSO_ALLOW_PRIVATE_ADDRESS.

* fix: parse SSRF guard env vars with str_to_bool

bool(os.getenv(...)) treats "false" and "0" as enabled, which would
silently disable the SSRF guard. Also reword the bug changelog entry to
cover the manifest fix instead of duplicating the breaking change
entries.

* fix: list new SSRF guard env vars in .env.example

* fix: address PR review feedback (#5489)

- default both allow-private-address settings to true for backward compat
- scope the SSO OAuth2 session guard to providers with configurable URLs
- route iCal data sync through the guarded request helper
- clarify blocked-URL errors to mention non-standard ports
- validate import manifest version against supported versions
- use whitelisted ports in private-IP tests so the IP check is exercised

* fix: treat empty SSRF env vars as unset so defaults apply
2026-07-17 13:21:34 +00:00
alamin-br 1c8ecb4dbd fix(backend): fan out periodic field updates into one task per workspace (#5666)
* feat(backend): add per-workspace timing telemetry to periodic field updates

* feat(backend): add per-workspace periodic field update task with overlap lock

* fix(backend): guard periodic field update lock release and cover missing workspace

* feat(backend): fan out periodic field updates into one task per workspace

* fix(backend): run periodic field update management command synchronously

* chore: changelog for periodic field update fan-out

* docs(backend): note periodic update eligibility is snapshotted once

* refactor(backend): simplify periodic update comments and restore setting-based dispatcher timeout

* test(backend): lock dispatch ordering, dispatch metric, and slow-workspace warning

* refactor(backend): batch periodic field updates and use singleton lock

Address review feedback on PR #5666:

- Fan out into BASEROW_PERIODIC_FIELD_UPDATE_BATCH_COUNT tasks (default 1)
  instead of one task per workspace, so the export queue isn't flooded on
  large instances.
- Replace the manual cache lock with celery-singleton on the batch task
  (unique_on batch_index) so a slow cycle can't stack on itself.
- Record the dispatch metric only for dispatched runs, not the inline
  management command.

* refactor(backend): use itertools.batched for workspace batching

* refactor(backend): inline batching and drop otel histograms

Inline the batch splitting into the dispatcher (itertools.batched) and
remove the per-workspace and dispatch OpenTelemetry histograms. Keep the
per-workspace timing and the >60s slow-workspace warning log.

* feat(backend): add fenced acquire/extend/clear_if to SingletonAutoRescheduleFlag

* feat(backend): add periodic run-lock constants and finish callback

* refactor(backend): guard periodic field updates with a fenced per-cycle run lock

Dispatch periodic field batches as a chord instead of independent .delay()
calls, so the callback reliably fires once all batches finish and releases
the per-cycle Redis lock. Batches heartbeat the lock's TTL instead of
running as celery_singleton tasks.

* docs(backend): changelog for periodic field update run lock

* docs(backend): restore flag docstrings and plainer changelog wording

* refactor(backend): token-fence periodic run-lock heartbeat; add env vars to .env.example

* refactor(backend): warn on periodic field update overlap with tuning hint

* fix(backend): isolate periodic field update failures per workspace

* refactor(backend): address review feedback on periodic field update

- parse BASEROW_PERIODIC_FIELD_UPDATE_BATCH_COUNT with "or 1" so an empty
  env string falls back to the default
- round-robin workspaces across batches so the most overdue run first in
  parallel instead of being stranded at the tail of one batch
- drop the default value from the docstring so it can't rot
- make clear_if/extend_if atomic via redis eval to avoid TOCTOU, keyed and
  encoded through the cache client to match what acquire wrote
- escalate the overlap skip to an error naming the settings to tune

* fix(backend): harden periodic field update run lock (review round 2)

- stop swallowing SoftTimeLimitExceeded: re-raise it in the per-field-type
  helper and return cleanly in the batch loop, so a soft timeout ends the
  batch and the chord releases the lock instead of running to the hard-limit
  SIGKILL and stranding the lock until its TTL
- heartbeat the run lock before every workspace, not just once per batch, so
  a long serialized batch keeps the TTL fresh and the next batch still finds
  the lock held when it dequeues
- log the batch "lock no longer held" stop at warning, not info: it drops the
  rest of the batch's work for the cycle
- acquire the run lock before the eligibility scan so an overlapping run skips
  cheaply instead of scanning and discarding the result
- fetch each field type's due fields once and early-return before refresh_now,
  dropping the duplicate exists() query per workspace
- resolve SingletonAutoRescheduleFlag's default timeout in the body so
  override_settings(AUTO_INDEX_LOCK_EXPIRY=...) is honored again
- note the management command bypasses the run lock (inline path)
- document BASEROW_PERIODIC_FIELD_UPDATE_BATCH_COUNT in configuration.md

* refactor(backend): pass run-lock TTL in the chord callback for uniformity

clear_if ignores the timeout, so this is cosmetic, but every other
SingletonAutoRescheduleFlag(RUN_LOCK_KEY, ...) construction passes
RUN_LOCK_TTL. Keeping the callback consistent avoids a reader wondering
whether the omission is meaningful.
2026-07-14 17:12:14 +02:00
Davide Silvestri ecdda10a8f feat: add configurable max length for text-based field values (#5689)
* feat: add configurable max length for text-based field values

Add BASEROW_MAX_FIELD_TEXT_LENGTH (default 500000), enforced at the serializer and in the frontend for single line text, long text, URL and AI fields. Existing longer values remain readable; only new writes over the limit are rejected.

Implements #5688

* fix: address review feedback for max text length

- Fix rich text editor modal crashing on expand: guard
  FieldRichTextModal.serializeToMarkdown() while the editor is
  unmounted during the open transition.
- Surface the max-length error inside the expanded modal (Alert
  banner) and block closing while the value is over the limit.
- Fall back to the default limit in the frontend when the runtime
  config is missing or non-numeric instead of silently disabling it.
- Improve the error message to show how many characters are over the
  limit (Max N chars (-x)).
- Avoid a settings crash when BASEROW_MAX_FIELD_TEXT_LENGTH is set to
  an empty string.
- Add frontend tests for the rich text modal and the validation.
2026-07-09 15:45:21 +02:00
Jérémie Pardou a1b92d682d task: add multiple instances support (#5541) 2026-06-22 17:43:59 +02:00
Jérémie Pardou b3aa83514b feat: add code service (#5425) 2026-06-09 15:41:31 +00:00
Jérémie Pardou 2daacc7bea chore: improve error handling in frontend (#5109) 2026-05-13 19:36:30 +00:00
Tsering Paljor 1b69168c79 feat: Introduce min retention days to keep more history entries (#5274)
* Introduce min retention days for history to keep more entries for recent workflow runs.

* Fix test
2026-05-05 08:48:37 +07:00
Tsering Paljor 54c8509723 fix: Move workflow history cleanup to periodic task (#5166)
* Move workflow history cleanup to a separate periodic task.

* Add tests

* Add change log

* Add error handling so that one workflow clean-up doesn't crash the entire periodic task.

* Keep _mark_failure_for_timed_out_history() inside before_run()

* History clean-up logic should use bulk query/deletion

* Add tests

* Update docstring

* Add more tests

* Lint fix

* move mark_failure_for_timed_out_history into periodic task

* Rename clear_old_automation_history to automation_periodic_cleanup

* Fixes post rebase

* Fix fk reference: should point to original_workflow_id
2026-04-28 16:40:34 +07:00
Jérémie PardouandTsering Paljor 33a6d46e62 fix: workflow runner race conditions (#4953)
* Ensure running workflow histories aren't deleted.

* Fix race conditions

* Fix simulation

* Fix simulation error for big dispatch delay

---------

Co-authored-by: Tsering Paljor <tsering@baserow.io>
2026-03-16 17:27:13 +01:00
Jérémie Pardou 30906040c6 feat: allow to configure CERT requirement for Redis (#4930)
* Add missing part in the redis  url
2026-03-05 17:07:39 +01:00
Tsering Paljor d48df9eca8 feat: dispatch Automation Nodes in separate Celery tasks (#4645)
* Refactor to support async node dispatch

* Store history_id and current_iterations in dispatch context

* Add simulate_until_node to AutomationWorkflowHistory

* Simplify dispatch: history is always created

* CorePeriodicServiceType should do a truthy check, since event_payload is loaded from the DB and can be {}

* Make sure current_iterations is considered for next iteration nodes.

* Initial async dispatch tests

* Simplify test

* Add trigger simulation test

* Add test for action node simulation

* Add remaining async node dispatch tests

* Add tests for dispatching async router, update, and delete nodes

* Add test for dispatch async with advanced formulas

* Remove old test_node_dispatch.py , which is replaced by the async version test_node_dispatch_async.py

* Add test for simulating complex router node

* Remove unused tests, port complex router simulation test to async module

* Fix existing tests since after_dispatch() was removed.

* Remove old workflow error history tests, they're covered in test_node_dispatch_async.py

* Refactor 'too many errors' handling.

* Refactor test; replace after_dispatch() with previous_nodes_results

* Add tests for history clean-up

* Regenerate migrations

* Ensure simulation history is excluded from get_workflow_history()

* Add test for before_run() error handling

* Add missing bool returns

* Add comment

* Add changelog

* Fix test

* Simplify allowed nodes

* Add docstring

* Make dry

* Fix error condition

* Improve comment

* Add tests for start_workflow()

* Remove unnecessary tests

* Lint fix

* Add specific iterator child dispatch test

* Optimize fetching simulate_until_node

* Use parent node to find current iteration

* Rename dispatch_node_async() to dispatch_node()

* Rename _update_previous_results to _load_previous_results

* Use Celery Canvas to dispatch nodes with support for parallel branch execution.

* WIP - fix tests

* Simplify node_dispatch() by always returning a signature.

* Refactor tests to account for Celery canvas: test_node_dispatch_async.py

* Return self.replace()

* Ensure chord callback doesn't overwrite any errors.

* Ensure an empty chain is not scheduled.

* Ensure start_workflow() uses same pattern as node dispatch task

* Fix test

* Event payload can be None

* Re-add is_test_run for ZDM

* Add db_default to new fields

* Rename get_workflow_history -> get_workflow_histories(). Refactor get_workflow_history() to return by ID.

* Clean up condition

* Add explicit else clause with comment

* use local_cache to get previous nodes results.

* Regenerate migrations

* Invalidate the cache after the dispatch() and node results are saved.

* Fix tests

* Fix test

* Make history_id mandatory

* Use cached workflow to fetch node

* Clear the cache manually in tests

* Pass in fake history_id to dispatch context
2026-03-05 13:08:15 +04:00
Tsering Paljor 8391771626 Move workflow rate limiting outside of async tasks (#4586)
* Add config for history rate limiting

* Refactor history handler with defaults

* Move workflow rate limiting check outside of celery task

* Add docstring and cleanup

* Add tests

* Add changelog

* Use the same expiry seconds for history and rate limiting

* DRY the history cache expiry seconds setting
2026-01-28 11:07:31 +04:00
Cezary bd072d1292 Run AI values generation in paralllel #4227 (#4263)
run AI field values generation in parallel
2025-12-03 21:18:21 +01:00
Davide Silvestri e22bf6fc14 Fix kuma history bug (#4269)
* Reduce loaded tools to reduce context; improved history summarizer

* Fix tests

* Added router

* Simplified router

* Address copilot feedback

* Fixed tool descriptions; added temperature parameter for the assistant

* Added translations

* Improve description for workflow/automation tool loader

* double-check sources are strings

* address Peter's feedback

* remove FF; added changelog entry
2025-11-17 19:00:29 +01:00
Peter Evans 7c9c83673a Tweak the periodic service's minute interval; impose minimum values depending on the env. (#4173)
* Allow users to choose, when the interval is minute, how many minutes can pass between intervals. A value of 15 means every 15 minutes since the last periodic run. I'm using this opportunity to also set minimum limits. Self-hosters can run every minute, but in SaaS it will be a higher value.

* The second/microsecond reset needs to happen at the beginning.

* Lint fixes

* Fix tests; add backend validation to ensure interval=minute minute values are >=settings.INTEGRATIONS_PERIODIC_MINUTE_MIN
2025-11-10 15:17:11 +00:00
Bram 5f1a456e3b Resolve "Two-factor authentication (2FA) support" (#4074) 2025-11-05 22:47:50 +01:00
Davide Silvestri 04902dcb46 AI Assistant 2/3: Add knowledge retrieval tool 2025-10-14 10:12:42 +02:00
Tsering Paljor f4bc28aa3e Rate Limit Workflow Runs 2025-09-08 16:38:18 +04:00
Jérémie Pardou be760cf460 Unify formula resolution handling 2025-08-05 10:32:27 +02:00
Tsering Paljor c38186b02f Add Workflow History for Automations 2025-07-28 15:42:06 +04:00
Petr Stribny 93b273a4f3 Resolve "Move charts to premium" 2025-04-10 08:38:02 +02:00
Przemyslaw Kukulski 7157ed076a Reduce deadlocks on rows endpoints 2025-04-09 14:43:43 +00:00
Davide Silvestri 845d4677db Resolve "Row enters view webhook event type" 2025-03-14 15:06:52 +01:00
Przemyslaw Kukulski 3858ff2252 Do not trace task scheduling in celery 2025-02-17 10:50:01 +00:00
Petr Stribny d778dd7970 Limit logging sign in actions 2024-11-19 19:56:22 +00:00
Przemyslaw Kukulski f5dbec08bf Resolve "Add new limit setting for import/export workspace" 2024-11-12 18:02:45 +00:00
Przemyslaw Kukulski 5a156f64e3 Import and export workspace applications 2024-11-11 10:50:20 +00:00
Petr Stribny a512bf9085 Resolve "Less frequent periodic field updates for unused/not accessed workspaces" 2024-08-21 15:57:17 +00:00
Cezary Statkiewicz aed83446bd 1911 ical feed 2024-07-23 14:19:26 +00:00
Bram Wiepjes a0b4751daa Allow disabling live support via env vars 2024-07-11 09:43:17 +02:00