Files
baserow/e2e-tests/playwright.config.ts
Davide Silvestri 74d6625a49 feat(assistant): run Kuma replies in the background (#6383)
* feat(assistant): stream Kuma background replies over HTTP

Behind assistant_background_runs, commit and enqueue the message then follow
Redis on the existing POST/200 cumulative JSON response. Resume the same run
without sending the prompt again. Keep refresh, multi-tab discovery, onboarding
and durable outcome recovery in the Kuma adapter and UI integration.

Part of #6346

* Remove unused Kuma chat run response header

* Register Kuma with the shared async streaming router

* Always execute Kuma messages in background runs

* Use chat run constant enums in Kuma

Kuma's model_unavailable error code moves to its own run constants,
because the engine no longer defines run type specific codes.

* Move the tool executor into Kuma

Kuma is its only user, and it is specific to pydantic-ai agents, so it does
not belong to the shared chat run engine.

* Return nothing from Kuma's interruption warning hook

The engine now prunes a run whatever the hook does, so it no longer reports
whether the warning was kept.

* Stop patching the removed ChatRunBuffer.finish

* Fix and simplify Kuma's background run adapter

- Save "nothing changed" when the model was unavailable or the prompt
  never reached it.
- Keep the progress line after a reconnect and build the compatibility
  records from their models, with the right text for runs that did nothing.
- Delete the in-request path, its cache-key Stop and the event bus.
- Map a second message to 409 directly and return one run shape in the
  chat API.
- Fix docstrings, help texts and the POST schema; drop overlapping tests and
  share run test helpers.

* Fix and simplify Kuma's run follower in the browser

- Keep local-only messages on refresh and show a queued run as queued.
- Settle a request aborted before it is sent and never show raw error pages.
- Fall back to the API for a new view whose broadcast is late.
- Stop a run through the engine.
- Delete the reader for the previous backend, the old cancel call and the
  UI location history.
- Share run test helpers and drop overlapping tests.

* Tighten Kuma's e2e tests, CI setup and docs

- Prove a live resume after a reload and drop a test that proved nothing new.
- Keep Kuma's panel closed in every browser context through the storage state.
- Drop the unused OpenAI key from the e2e setup.
- Rewrite the background replies section of the AI assistant docs.

* Handle Kuma runs whose sender lost access, and other review fixes

- A queued run whose sender can no longer use Kuma ends as access_lost
  without calling the model.
- A chat keeps asking runs for a title while its title is provisional.
- Test that a run captures and saves its onboarding target.
- Pass Phoenix settings to the dev export worker; pin CI's Kuma stub to
  Node 24.22.1.

* Fix Kuma's browser edge cases found in the re-review

- A send whose stream is refused after its run started re-reads the
  chat and counts as accepted.
- A chat read that ends after another chat was chosen is dropped, and
  only a 4xx forgets the tab's stored chat.
- An unsaved outcome stays shown while its run is the chat's latest.
- The status line shows that Kuma is answering.
- Empty stopped or failed answers show only their outcome.
- Logout clears Kuma's chats, messages and pending navigation.

* feat(assistant): follow Kuma replies through shared chat runs

* refactor(assistant): remove obsolete stream-limit recovery

* fix(assistant): simplify Kuma cutover and preserve legacy Stop

* fix(assistant): preserve existing Kuma API contracts

* refactor(assistant): match stream event kinds

* refactor(assistant): simplify execution and navigation

* fix(assistant): show that Kuma is cancelling after Stop

* test(assistant): cover the stale refresh guard and trashed workspaces

* refactor(assistant): close the run follower and drop the unused baseline

* refactor(chat-runs): share the run-in-progress error code

* docs(assistant): document the run limit and the deprecated chat status

* fix(assistant): give a duplicated tab its own Kuma tab id
2026-11-18 11:21:31 +01:00

94 lines
3.1 KiB
TypeScript

import type { PlaywrightTestConfig } from "@playwright/test";
import { devices } from "@playwright/test";
import path from "path";
// Resolve relative to this file so paths are correct regardless of cwd
// (VS Code Playwright extension runs from the workspace root, not e2e-tests/).
require("dotenv").config({ path: path.join(__dirname, ".env") });
const defaultBackendPort = process.env.E2E_BACKEND_PORT || "8070";
const defaultFrontendPort = process.env.E2E_FRONTEND_PORT || "3070";
export const baserowConfig = {
PUBLIC_WEB_FRONTEND_URL: process.env.PUBLIC_WEB_FRONTEND_URL
? process.env.PUBLIC_WEB_FRONTEND_URL
: `http://localhost:${defaultFrontendPort}`,
PUBLIC_BACKEND_URL: process.env.PUBLIC_BACKEND_URL
? process.env.PUBLIC_BACKEND_URL
: `http://localhost:${defaultBackendPort}`,
BUILDER_PREVIEW_URL:
process.env.BASEROW_BUILDER_PREVIEW_URL ??
process.env.PUBLIC_WEB_FRONTEND_URL ??
`http://localhost:${defaultFrontendPort}`,
BASEROW_FRONTEND_COOKIE_PREFIX:
process.env.BASEROW_FRONTEND_COOKIE_PREFIX ??
process.env.NUXT_PUBLIC_BASEROW_FRONTEND_COOKIE_PREFIX ??
process.env.E2E_FRONTEND_COOKIE_PREFIX ??
"baserow_e2e_",
};
/**
* Development config to be used when running locally
* See https://playwright.dev/docs/test-configuration.
*/
const config: PlaywrightTestConfig = {
testDir: path.join(__dirname, "tests"),
/* Maximum time one test can run for. */
timeout: 30 * 1000,
expect: {
/**
* Maximum time expect() should wait for the condition to be met.
* For example in `await expect(locator).toHaveText();`
*/
timeout: 10000,
},
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI ? true : false,
retries: !!process.env.CI ? 3 : 0,
workers: !!process.env.CI ? 1 : 3,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: !!process.env.CI ? [["blob"], ["html"]] : "list",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
actionTimeout: 0,
/* Base URL to use in actions like `await page.goto('/')`. */
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
video: "on-first-retry",
// Kuma's panel would otherwise open over the pages under test.
storageState: {
cookies: [],
origins: [
{
origin: baserowConfig.PUBLIC_WEB_FRONTEND_URL,
localStorage: [{ name: "baserow.rightSidebarOpen", value: "false" }],
},
],
},
nuxt: {
host: baserowConfig.PUBLIC_WEB_FRONTEND_URL,
// Disable fixture loading - test against running server, not local Nuxt app
fixture: false,
},
},
projects: [
{
name: "chrome",
use: {
...devices["Desktop Chrome"],
...(process.env.CI ? { channel: "chrome" } : {}),
},
},
{
name: "firefox",
use: {
...devices["Desktop Firefox"],
},
},
],
};
export default config;