Repository navigation
Conversation
Validation: original physical regression panicked before repair; fresh native binding and JS glue, three executable initialization modes, new three-variant Rust fixture, original One motion iOS production bundle, 151 strict-order integration tests and cargo fmt --all --check pass.
…mbiguous Validation: exact fixture after autofix integration passed three configurations; same Rust bytes passed empty/ambiguous/effectful-star Node controls and all 151 strict_execution_order cases before formatting integration; cargo fmt check passed.
MarioJames
added a commit
to LobeHub-Enterprise-CPC/Lobehub-CPC
that referenced
this pull request
Oct 21, 2026
… a rolldown chunk panic Importing it through the device-gateway-client barrel (export *), next to the dynamic import of the same package, makes rolldown panic in vite build:main (symbol TUNNEL_CHUNK_SIZE is not in any chunk; rolldown/rolldown#11227). A dedicated ./executionSignal subpath keeps the shared helper without the barrel.
MarioJames
added a commit
to LobeHub-Enterprise-CPC/Lobehub-CPC
that referenced
this pull request
Oct 22, 2026
…87) * 🗃️ feat(database): per-tenant schemas replaying the shared migration chain Every tenant gets schema tenant_<h24> with owner/runtime roles; the existing migration chain is replayed in it with public qualifiers rewritten, so schema files and hashes stay identical to canary. A small tenant-only chain adds tenant_metadata and sso_providers, and a platform chain holds tenant routing metadata. Requests run on a per-tenant pool pinned by search_path. db:migrate and the image run the platform chain, then the OSS and distribution chains (@lobechat/business-tenant) on every active tenant. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01N6dFq18xTQsuCi7BmT36Gn * 🔐 feat(tenant): per-tenant data keys, object keys and Redis keyspace KEY_VAULTS_SECRET is the only master key; tenant data keys are derived with HKDF and resolved from the current tenant on every call. S3 keys map to t/{tenantId}/{key}, Redis keys to t:{tenantId}:..., and both fail closed outside a tenant. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01N6dFq18xTQsuCi7BmT36Gn * ✨ feat(tenant): control plane Console provisions and drives tenants through /api/internal/control-plane/{tenant-provision, credentials, lifecycle, overview} with service-token auth, idempotent provisioning per operationId and versioned lifecycle events. Console creates the schema and roles; LobeHub validates the bundle, checks ownership, migrates, writes the marker and directory, and verifies the runtime role reaches nothing outside its schema (pg_search's own pdb schema allowed). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01N6dFq18xTQsuCi7BmT36Gn * ✨ feat(tenant): /t/{slug} routing in the proxy and the SPA The proxy is the one place that reads the tenant: /t/{slug} backend paths are rewritten with an HMAC-signed tenant header, tenant-less backend requests get 400 TENANT_REQUIRED, and unknown tenants get a static page. The SPA carries the prefix as its router basename and prefixes its own same-origin requests. Slug rules match Console. Co-authored-by: rdmclin2 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01N6dFq18xTQsuCi7BmT36Gn * ✨ feat(tenant): tenant gate on route handlers, callbacks and background jobs Every backend route handler runs inside its tenant via withTenantRequest. Callbacks the server schedules for itself (QStash, workflows, agent hooks, video and bot webhooks, OAuth redirects) are addressed to the tenant that scheduled them, and deployment-wide jobs fan out per tenant. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01N6dFq18xTQsuCi7BmT36Gn * ✨ feat(auth): better-auth and SSO per tenant better-auth is built per tenant at /t/{slug}/api/auth with lh_<h24> cookies scoped to the tenant path. SSO comes only from the tenant's sso_providers written by Admin: standard OIDC and custom OAuth2 run generically, and the upstream presets in src/libs/better-auth/sso (unchanged) get the tenant's credentials through tenant-sso.ts. AUTH_SSO_PROVIDERS, AUTH_<PROVIDER>_*, AUTH_COOKIE_PREFIX and AUTH_ALLOWED_EMAILS are removed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01N6dFq18xTQsuCi7BmT36Gn * ✨ feat(fts-search): capture install and Elasticsearch reindex per tenant Capture functions and triggers are installed in each tenant schema using current_schema(); the Elasticsearch namespace is suffixed with the tenant hash, and startup reindex runs per tenant with its own checkpoint dir. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01N6dFq18xTQsuCi7BmT36Gn * 📝 docs: self-hosting for multi-tenant deployments SSO is configured per tenant in Admin; env examples, Dockerfile, docker-compose and Grafana compose drop the removed variables; full-text search docs describe the per-tenant reindex. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01N6dFq18xTQsuCi7BmT36Gn * ✅ test(database): pin the key vault tenant in server-mode user and OIDC adapter tests These suites encrypt outside a request, which now requires a tenant scope. Pin the gatekeeper to a test tenant (on the class in user.test, since getUserKeyVaults calls initWithEnvKey by name), and use a non-authenticating v1 envelope for the decrypt-failure case: the legacy format is rejected by design. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01N6dFq18xTQsuCi7BmT36Gn * 🐛 fix(tenant): repair CI setup and tenant request routing * ✅ test(e2e): visit /community instead of the legacy /discover redirect The Next.js /discover redirect matches the raw path and does not apply under /t/{slug}/, so the tenant-prefixed visit returned 404. Visit the destination route directly. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MX2Ci9rACeEjj9yNHyaWDr * ♻️ refactor(tenant): reuse business tenant context and directory persistence * 🐛 fix: integrate tenant authentication and application routing * 🐛 fix: align resource sorting with the request contract * 🔒 fix: require verified tenant shutdown and external completion receipts * 🐛 fix: align PGlite tenant fixtures and repair test types * ♻️ refactor(db): unify Drizzle migration configuration * ♻️ refactor(tenant): simplify Console control plane authentication * ♻️ refactor(env): consolidate URL configuration and remove unused tenant helpers * ♻️ refactor(tests): group new tenant module tests in tests directories * 🐛 fix(ci): use Git diff format for Discord dependency patch * ♻️ refactor(tenant): verify readiness without duplicate metadata * 📝 docs(tenant): keep CPC readiness orchestration in Console * 🐛 fix(tenant): harden SSO storage and durable execution * ♻️ refactor: expose private database models for enterprise tenants * 🐛 修复多租户注册、编辑保存与 UI 兼容 * 🐛 接通租户 Bridge 路由与配置迁移 * 🐛 修复听写状态与推荐头像类型契约 * 🐛 fix(ci): pin patched UI version for clean pnpm installs * 🐛 fix(test): provide tenant callback URL helpers in server mocks * 🐛 fix(e2e): focus the editor and await conversation fixtures * 🧪 test(proxy): verify project deep links in tenant scope * 🧪 test(e2e): await pin state and ready conversation input * 🐛 fix(auth): rebuild tenant auth when its database session is replaced A datasource update gives the tenant a new database session and retires the old pool. The cached better-auth instance kept the old session, so every session read failed with stale-connection-version until restart. * 🐛 fix(sso): treat the Feishu enterprise email as verified Feishu always reported emailVerified=false, so SSO admission refused every first login. The organisation-assigned enterprise email is now preferred and verified; personal and union_id fallback addresses stay unverified. * ⚡️ perf(tenant): share strict admission reads per tenant Each tenant transaction read the platform directory twice. The pre-connect check now uses facts within the admission TTL; the check after the drain lock stays strict and concurrent strict checks share one read that starts after each caller. * 🐛 fix(tenant): keep the tenant prefix on full-page navigation and file links File proxy URLs are /t/{slug}/f/{id}; parsers matched only /f/ and full-page navigations went to unprefixed paths, landing on the tenant-required page. Tenant business drafts, input history and cache scopes are namespaced by tenant, since all tenants share one origin. * 🗃️ fix(db): declare channel scope keys as table unique constraints Composite foreign keys reference (channel_id, id). As unique indexes they were generated after those keys, so the Enterprise tenant baseline only installed after hand-reordering. Table constraints are created with the table. * 🔒 fix(auth): derive a per-tenant better-auth secret and close provider token endpoints A secret shared by every tenant let a session cookie (and the session_data cache cookie, which skips the database) issued by tenant A be renamed and replayed on tenant B. Each tenant instance now signs with HKDF(AUTH_SECRET, 'lobehub:tenant-auth:<tenantId>'). /get-access-token and /refresh-token are unused by the app and refresh through the provider token URL with better-auth's own fetch; for tenant SSO that URL is tenant-chosen, so both are disabled. AUTH_SECRET is the only master secret; BETTER_AUTH_SECRET is no longer read. * 🔒 fix(auth): bind every server-minted token to its tenant All tenants share one JWKS signing key, so a signature alone cannot say which tenant a token is for. Internal, CLI sandbox, hetero operation, workspace device, tunnel and OIDC access tokens now carry a signed 'tid' claim and are only honoured by the matching tenant. The lambda -> async call names its user in the signed internal JWT instead of the separately encrypted X-lobe-chat-auth header, which is removed. Operation tokens without the operation claims are rejected (no legacy fallback), and the CLI sandbox server URL points at the tenant path. * 🔒 fix(tenant): key process caches by tenant and harden storage keys and secrets - Process-local caches and in-memory state (messenger config, Redis fallback, hetero trace/persistence state, channel watch, Telegram guest session, device-flow refresh, onboarding channel, expertise queue) are keyed by tenant. - Logical object keys reject '.', '..', empty segments, backslashes and control characters; skill ZIP entries that are not a plain relative path are dropped. - Bearer / service secrets are compared in constant time. * 🔒 fix(security): route user- and tenant-chosen URLs through the SSRF-safe transport Provider base URLs typed in by users, tenant SSO discovery/token/userinfo endpoints, MCP servers, connector OAuth, ComfyUI servers, WeChat iLink hosts, attachment and file URLs now go through request-filtering-agent (connect-time IP check, also on redirects). Platform-configured endpoints keep the plain transport. Provider connectivity checks no longer echo upstream bodies. Attachment file names are reduced to one safe key segment, and the ComfyUI runtime calls its image route under the tenant path (it was refused with TENANT_REQUIRED). Tenant SSO uses the endpoints Admin saved and fetches discovery only when one is missing; discovery requests are shared, failures are cached for a minute and the resolved endpoints are part of the tenant auth instance key, so a failed fetch is not pinned. OIDC honours tokenEndpointAuthentication, and SSRF_ALLOW_IP_ADDRESS_LIST entries are trimmed. * 🐛 fix: remove unavailable cloud seed sign-in probe * 🐛 fix: keep intentional sign-out from reentering on stale 401s * 🐛 fix: let auth SDK own the tenant password sign-in redirect * 🐛 fix(auth): explain an unavailable workspace on the sign-in and sign-up pages When the tenant gate refused auth requests for a frozen, expired or offline workspace, sign-in reported that SSO providers failed to load, sent existing users to sign-up (or a password sign-in to email verification), and sign-up showed a generic failure. These pages now recognise the gate's tenant codes and show the workspace-unavailable explanation; the session recovery screen shares the same code list and now includes TENANT_EXPIRED. A refusal raised after the request was admitted (the tenant was frozen or taken offline while it ran, or its database refused) used to surface as Better Auth's empty 500, a check-user/resolve-username 500 or an SSO 503. It now reaches the auth route and every auth endpoint answers with the gate's { code } body, and a tenant database refusal wrapped by the driver maps to its gate code. * 🐛 fix(control-plane): report why a lifecycle event failed with codes shared with Admin Missing strict-stop cutover, unconfirmed work stop, a failed close, drain or resume now each record their own code instead of LIFECYCLE_FAILED, and event conflicts use LIFECYCLE_EVENT_CONFLICT / LIFECYCLE_VERSION_CONFLICT as Admin does. A failed POST carries the code in its body; operator-fixable failures answer 409, transient ones 503 with Retry-After. LobeHub keeps a byte-identical copy of Console's contracts/tenant-control-plane/lifecycle-failure-codes.json, and a unit test requires LIFECYCLE_FAILURE_CODES to match the codes it assigns to LobeHub. * 🔥 refactor(tenant): drop the legacy-worker strict-stop cutover gate The multi-tenant runtime has never been installed for users, so there are no legacy replicas that run without registering tenant claims. The strict-stop cutover record only guarded against those, and blocked every fresh install from freezing or taking a tenant offline. Process claims, heartbeats and verified retirement still certify the stop. * 🐛 fix(memory): embed search queries with the memory embedding provider Memory search embedded queries with the default files provider, while every memory write uses the branding provider under business features. Without a key for the default provider each search failed with InvalidProviderAPIKey. * 🐛 fix(tenant): answer tRPC requests refused at the gate as tRPC errors The gate answered refused tRPC calls with its bare { code } body, which the client cannot parse: every request to a closed workspace logged "Unable to transform response from server", lost the refusal code and was retried. tRPC routes now answer a refusal as a tRPC error per call carrying the code, with the gate's status and headers, and the client stops retrying it. * ✅ test(auth): follow the tenant-scoped business auth and the deployment branding The tenant isolation suite called business auth outside a tenant scope and without the email registration policy every provisioned tenant has, so it failed before any assertion; it also expected the session_data cookie cache that business auth disables on purpose. The passkey and email template tests expected upstream LobeHub branding instead of the deployment's branding slots. * feat: add tenant endpoint projection and canonical public routing * fix: harden tenant endpoint fallback and cache boundaries * 🐛 fix(oidc): keep desktop authorization under the tenant entry The desktop callback redirected to the root /oauth/callback/* pages, dropping the tenant prefix, and a signed-out visitor on the login prompt saw a permanently disabled confirm button. Redirect result pages through the active public entry and send signed-out visitors to the tenant sign-in, returning to the interaction afterwards. * 🐛 fix(desktop): keep the tenant path when joining remote server URLs new URL('/path', remoteUrl) resolves against the origin and drops /t/{slug}, so Desktop login, token refresh, the backend proxy and every remote call were refused with TENANT_REQUIRED. Add buildRemoteUrl/resolveRemoteUrl to @lobechat/utils and use it in the main process, renderer (server version, avatars, file links, remote URL selector) and CLI; normalize the configured address so the path prefix is kept and trailing slashes are dropped. * 🐛 fix(tenant): build download and asset URLs on the app address Downloads and server-relative asset paths were joined onto the page origin. On desktop that is the renderer's own origin, so file proxy links of the remote tenant were not recognised and the fallback proxy URL pointed at the renderer; on a custom-domain entry the fallback added /t/{slug}, which the custom host refuses. Add getAppBaseUrl/resolveAppUrl (remote tenant address on desktop, origin plus tenant path on web) and use them for file downloads, community avatars and banners, and OAuth app logos. * 🐛 fix(tenant): return OAuth flows to the tenant app address Skill, connector, social and Market sign-in redirect URIs were built on the page origin (or APP_URL on the server), so a tenant's OAuth flow came back to a root page that has no tenant. Build them with buildAppUrl (origin plus tenant path on web) and pass the tenant's public entry to the server creds runtime. * ⚡️ perf(tenant): admit jobs entering by tenant id from the admission snapshot enterTenantId read the platform directory on every job. Share the same TTL-bounded admission facts (and in-flight read) that request re-checks use, so a burst of jobs costs one platform read per TTL window. * ♻️ refactor(tenant): build every tenant address from its active entry in the tenant package Absolute app links were assembled in many places from the page origin or a hard-coded /t/{slug}, so copied and shared links on web dropped the tenant and server fallbacks ignored the active entry. The tenant package now owns them: - client: app address (the bootstrapped active public URL, or the desktop remote address the electron store pushes in), useAppBaseUrl, buildAppUrl, resolveAppUrl, appRelativePath, and the same-origin request prefixer; useAppOrigin and the app-level helpers are gone. - routing: buildTenantEntryUrl/tenantAppPath and mapTenantAppPath, so server public URLs and workspace paths never rebuild the tenant prefix themselves. - server: the tenant scope always carries its active entry; better-auth, the OIDC provider, auth routes, global config and SSO callbacks use it instead of /t/{slug} fallbacks, and the auth SPA config returns the active address. * 🐛 fix(oidc): mount all advertised endpoints under tenant entry * 🐛 fix(oidc): persist anonymous session and PAR artifacts * 🔒 fix(model-runtime): never lend instance provider credentials in business builds Business builds are multi-tenant: a request without its own key fell back to the instance *_API_KEY / *_PROXY_URL / AZURE_* / AWS_* / VERTEXAI_* credentials, so any tenant could spend the deployment's keys outside its router and budget. The same held for the OpenAI TTS route. Those values now read as unset in business builds; upstream deployments keep the fallback. * ✨ feat(tenant-settings): read feature flags and system models from tenant settings Business builds read the current tenant's `feature_flags` and `system_models` (spec FR-TS-02, FR-TS-03) through `@lobechat/business-config/tenant-settings` instead of FEATURE_FLAGS, COMMAND_GOVERNANCE_ENABLED, SYSTEM_AGENT, DEFAULT_FILES_CONFIG, MULTIMODAL/VISUAL_UNDERSTANDING_* and the memory model variables. Channels and command governance become the `channel` and `command_governance` flags evaluated per user. * ✅ test: align instance proxy and media analysis tests with business builds * ✨ feat(auth): read tenant login methods from tenant settings Business builds take email/password, magic link and email verification from the tenant's `frontend_login_methods` (spec FR-TS-07, written by Admin) instead of AUTH_DISABLE_EMAIL_PASSWORD, AUTH_ENABLE_MAGIC_LINK and AUTH_EMAIL_VERIFICATION. The tenant auth instance cache key includes them, so a saved change rebuilds only that tenant's instance. * 🔥 chore: remove unused deprecated createAzureOpenai * 🗃️ refactor(database): regenerate unmerged platform and tenant migrations by module None of these migrations has reached a deployed environment, so they are regenerated from the final schemas instead of replaying the intermediate steps: - platform: 0000_platform_baseline, 0001_tenant_runtime_claims (external work receipts folded in, the strict-stop cutover table never created), 0002_tenant_endpoints. - tenant: 0000_tenant_sso_providers in its final form (jsonb configs with object checks, bridge_config), 0001_oidc_pre_auth_artifacts (custom). The final snapshots are identical to the previous chains. The text-to-jsonb SSO upgrade test goes with the upgrade step it covered. * 🐛 fix(database): resolve server globalConfig in database tests * ✨ feat(migration): offline secret re-encryption and object copy for the legacy tenant import * 🐛 fix(oidc): persist provider PAR client metadata before login Index PAR records from provider Request Object metadata without mutating the protocol payload or inferring a user session. Reject malformed or conflicting metadata before storage. Validate real public and Basic client PAR behavior, provider recreation, tenant-independent PostgreSQL persistence, consume and expiry. Basic requests missing body client_id retain the provider standard 400 response. * 🐛 fix(chat): preserve classified stream errors across wrapping Carry the canonical errorType when wrapping parsed HTTP errors in Error instances so state normalization preserves NoAvailableChannel and provider metadata. Keep explicit classifications authoritative and retain the existing unknown-error fallback. Cover the actual fetch-sse parser, transport wrapper and shared normalizer for channel availability and provider authentication errors. * 🐛 fix(auth): honor tenant email sign-in methods across login steps * 🐛 fix(database): contain disconnected borrowed tenant database clients * 🐛 fix(auth): disable password reset when tenant password login is off * 🐛 fix(chat-input): honor the token counter flag and gate the ring on the effective topic model The context window ring checked the agent default model while the token breakdown counts against the topic-pinned model, so switching models in the composer could hide a computable ring or show an uncomputable one. * 🐛 fix(image): enforce the image generation flag across entry points * 🐛 fix(chat-input): judge agent mode by the topic-pinned model Agent/Chat mode, approval toggle and placeholder gated tool use on the agent default model while the topic could pin another one. Composer surfaces now use the effective model; task execution controls keep the assignee's default model since they have no topic context. * 🐛 fix(tenant): preserve safe readiness diagnostics * 🐛 fix: guard sequence privilege checks by relation kind * 🐛 修复入口缓存命中跨 TTL 的瞬时拒绝 * 🔒 fix(mcp): redact credentials from MCP logs and error messages sanitizeForLogging only dropped stdio env, so HTTP auth tokens, client secrets, header values and URL credentials reached server logs when a connector tool sync or call failed, and fetch failures echoed the raw URL (query secrets included) through ssrf-safe-fetch, MCP and tRPC errors back to logs and the UI. Route every MCP log site through one sanitizer, rebuild thrown errors and their cause chains as sanitized copies with known secret values removed, sanitize URLs in ssrf-safe-fetch logs and errors, and log only a fingerprint of the credential-bearing client cache key. * 🐛 fix(mcp): key cached MCP clients by stdio args serializeParams replaced the args array with the literal string "args", so stdio servers differing only in args shared one cached client and could reuse another user's credentials. Canonicalize nested keys and keep args content and order in the cache key. * 🔒 fix(trpc): send credential-bearing inputs as mutations, not GET queries tRPC queries are GET requests with the input in the URL, so MCP auth/headers, API keys, ComfyUI vault options, heterogeneous agent env, M2M client secrets and WeChat QR tickets reached access, proxy and CDN logs. Convert those twelve procedures to mutations so the input travels in the POST body, and update their callers. * 🐛 fix(spa): render tenant SPA shells per request in production builds The SPA shell route handlers still exported generateStaticParams from the static upstream shells, so production builds prerendered them and the tenant bootstrap's request.headers read failed with DYNAMIC_SERVER_USAGE (500 on /t/<slug>/signin). Make them force-dynamic and guard every route using the tenant page bootstrap. * 🐛 fix(channel): process channel runs inside each available tenant The channel worker queried tenant tables outside any tenant scope, so in a multi-tenant deployment it logged TENANT_REQUIRED every tick and never became healthy. A coordinator now fans out over available tenants (forEachTenant) with one worker per tenant, retires workers of tenants that disappear, and keeps the tenant claim for native runs that outlive the tick. * 🐛 fix(channel): fail the worker check when tenant migration chains are missing Entering a tenant verifies its migration history against chain files read from the working directory; a worker image without them skipped every tenant with TENANT_NOT_READY while reporting healthy. Chains can now assert their sources without a database, and worker.mjs --check runs that for every registered chain. * 🐛 fix(tenant): prefix browser-loaded asset URLs with the tenant path Avatars are stored as origin-agnostic /webapi paths and fetch() calls get the tenant prefix, but <img src>, media and download links are loaded by the browser as written and hit the proxy without a tenant (TENANT_REQUIRED). Rewrite URL attributes of loading elements at the DOM boundary with the same rules as the tenant fetch, and resolve CSS background URLs through the same helper. * 🔒 fix(tenant): answer unknown tenant slugs on backend paths like tenantless requests Pages under an unknown /t/<slug> already looked like no tenant, but backend paths (webapi, trpc, auth, oidc, files) answered 404 NOT_FOUND instead of the tenantless 400 TENANT_REQUIRED, revealing which tenants exist. Resolve an unknown slug to exactly the route the same path gets without a tenant and keep the real reason in the server log (FR-RT-06). * 🐛 fix(sso): fall back to a profile name when the IdP sends no name claim Tenant OIDC and custom OAuth2 providers (and presets built without overrides, e.g. Keycloak, Zitadel) had no name mapping, so an IdP user without a name, such as a Clerk user with only a username, failed with name_is_missing. Resolve the display name from name, given/family name, preferred_username, nickname, username, login, email, then sub in one shared mapping. * ✅ test(auth): run tenant isolation tests outside the enterprise checkout runtime_configs comes from the enterprise tenant chain, so in a standalone checkout the fixture insert failed and all six isolation tests were skipped. Seed the registration policy only where the table exists and assert the session cache cookie according to the active auth configuration. * 🐛 fix(sso): show tenant SSO display names and logos on sign-in and profile The sign-in page listed tenant SSO providers by id only: the providers route returned just the distribution's list, so custom display names and logos set in Admin never reached the browser. Serve each tenant provider's public metadata (id, name, HTTPS logo) from the tenant-scoped route and render the logo with a built-in icon fallback on sign-in and in linked accounts. * 🐛 fix(generation): say no model is available instead of blaming a provider With no image or video model in the tenant directory, the generation page fell back to the hard-coded default and warned that its provider (Google) was disabled. Show that no generation model is available, keep generation disabled, and stop reuse-settings from throwing for a model that has since been removed. * 🐛 fix(agent-runtime): connect to Redis with the configured password, user, db and TLS * 🐛 fix(memory): search and write memory vectors with the memory embedding model * ✨ feat(tenant): find the user's organization by email on the root path and remember the last one - The root path renders an email-only organization finder: one match goes straight to that organization's sign-in, several open a picker. Lookups use a dedicated least-privilege role that reads only users(email, banned, ban_expires) across tenant schemas, with per-candidate integrity checks (incomplete answers are 503, never "no organization"), rate limits and a concurrency gate. - The last organization entered on the default host is remembered in an HttpOnly cookie: bare entries return there, /t/{slug} updates it; it is read and written only on top-level document navigations. Custom domains keep their own host and do not write it. - Redirects that drop the visitor's URL context end with an empty fragment. Next rebuilds proxy Location headers and drops it, so the proxy rewrites to an internal route handler that issues the 302 from a signed header (503 when it cannot be signed). - Tenant sign-in pages show the current organization "name (slug)" and a switch link below the form on every step; the title stays TITU Work. Sign-in continues seamlessly from the finder. - Desktop handoff snapshot API for the desktop sign-in flow; lobehub-desktop is no longer auto-consented and the consent page warns about desktop authorization. - The tenant-required page is replaced by the finder. * 🔒 fix(oidc): keep request parameters, tokens and identifiers out of OIDC logs OIDC routes, the provider adapter and the market OIDC router logged full request URLs, response headers and bodies (Set-Cookie, Location, token responses), state and handoff ids, grant ids, claims and raw error objects. Debug and console output now keeps only redacted URLs, header names, status codes and machine-readable error codes (describeError); the desktop callback no longer puts error messages into its redirect URL. Sentinel tests enable every debug namespace and assert no secret reaches the output. * ✨ feat(oidc): give desktop id_tokens organization display claims id_tokens carry tenant_name and tenant_slug from the platform directory, and for lobehub-desktop has_other_organizations (another enterable organization for the same email, using the finder's candidate rules and lookup role, current tenant excluded). They are display-only: userinfo and access tokens never carry them, and identity stays on iss/sub and the access token's tid. All three share one 1s budget and are omitted on any failure, timeout or busy lookup gate, so they never delay or fail a sign-in or refresh. * ✨ feat(desktop): sign in to an organization through email discovery or a known tenant address - Two-phase cloud sign-in: the platform finder or a known /t/{slug} / custom-domain entry, verified id_token (RS256, exact audience) and access-token tid, then an explicit confirmation card before the new organization becomes active; same-identity re-logins skip it. - Connecting or switching keeps the signed-in organization, tokens, refresh and gateway until a new one is confirmed; a cancelled, failed or timed-out switch leaves the signed-in panel intact. - The card and status panel show "name (slug)"; switching is offered unless the account is known to belong to a single organization. - Handoff polling waits only on HANDOFF_NOT_FOUND; endpoint changes (409) restart discovery; credential requests do not follow redirects; logs carry no state, challenge or URLs. - The backend proxy answers tRPC without a remote server with a tRPC-shaped 401. * 📝 docs(acceptance): bake local endpoints into hand-built desktop bundles * 📝 docs(acceptance): keep a desktop install from relinking the root checkout's shared packages * 📝 docs(acceptance): check every outbound service target before local acceptance Adds L-S28: a local Work instance without MARKET_BASE_URL falls back to the public Market from the server side, which browser-only evidence cannot see. Verify Market, device gateway, object storage, mail and model targets on both client and server before accepting a local run. * 🐛 fix(auth): explain SSO failures on the auth error page ACCESS_DENIED, ACCOUNT_NOT_LINKED, INVALID_SCOPE and OAUTH_CODE_VERIFICATION_FAILED had no copy, so an identity provider cancel, an unlinked same-email account or a misconfigured provider all showed "unknown error". Found in the Clerk external-IdP SSO acceptance (O3). * ✨ feat(tenant): check the remembered organization's session before entering it from the root The root page used to send a visitor with a remembered organization straight to that organization's root, so an expired session landed on that organization's sign-in page even when the person now belonged elsewhere. It now goes through the organization's session entry (/__entry): a valid session enters the organization, a missing or revoked one goes back to the organization finder, an organization refusing admission shows its unavailable page, and an infrastructure failure is a 503 that retries the entry. - The entry is decided before endpoint moves and memory writes; it only answers top-level document GETs, never writes the memory cookie and builds every target from the directory. - Tenant gate errors carry their source (admission or infrastructure), including the claim re-check, so a database failure is never shown as a frozen or signed-out organization. - The session lookup skips the cookie cache and refresh, hides this organization's session-data cookies (a damaged one used to fail the lookup) and expires them on the response, so revoked sessions lose every chunk. Plan: 1016-root-entry-session v3, reviewed by the peer agent and ChatGPT. * ✅ test(tenant): prove the session entry never renews a session past the refresh threshold * ✅ test(tenant): expect tenant public base URLs in agent context, document and task links * ✨ feat(tenant): reach each organization's own Market instance with a tenant-signed identity - Trusted-client tokens carry the tenant and never a workspace or acting-as in tenant mode - Fail closed before any outbound Market call when signing or the session lookup fails - Report tool-call telemetry per tenant with fixed event ids and bounded retries - Pass Market edit capabilities and content-sync state through discover, and tag detached items - Re-resolve the user's email when re-signing sandbox receipts during reconcile * 🐛 fix(market): surface Market not-found and skill-connection errors with their real codes Market detail procedures wrapped every failure as INTERNAL_SERVER_ERROR, so a missing or cross-tenant group rendered a generic error instead of the not-found page; they now go through mapMarketError and the group page renders NotFound on NOT_FOUND. connectCallTool matched NOT_CONNECTED/TOKEN_EXPIRED in the human message while the SDK carries the code in error.code, so it always 500'd; it now maps them to PRECONDITION_FAILED with a stable errorData code (not UNAUTHORIZED, which drives the re-login flows) and the client prompts to connect only on that discriminator. * fix(database): adapt tenant materializer to optional pg_search migration Upstream 0090 now wraps CREATE EXTENSION pg_search in an availability DO block. Tenant owners must never create extensions, so the exact reviewed template is rewritten into an installed-check, and every tenant statement passes a lexer-aware safety gate (comments, quotes, dollar bodies) before any query runs. * ✨ feat(gateway): enforce tenant-isolated gateway protocol in Work and clients Work mints dedicated gateway tickets bound to a re-checked authorization source, serves admission/authorize/tool-result/finalize-abandoned internal routes, carries the original accepted version through queues and notifiers, claims dispatch attempts once, and closes mux, LLM relay, tunnel and metrics at their entry points without removing upstream code. Agent and device clients verify tenant, principal and lease deadlines, renew on the original source before expiry, and stop retrying on source or protocol rejection. Includes the byte-exact contract copy. * ✨ feat(desktop): connect desktop and CLI through the tenant gateway protocol Desktop and CLI exchange tickets with their own bound credentials, renew on the original authorization, echo dispatch attempts, drop stale local queues on disconnect or generation change, and keep tunnel, metrics sampling, mux and client LLM entry points closed. Accepting a workspace share now requires the device's signed-in user to manage that workspace. * 🐛 fix(database): accept reviewed upstream reissues of 0090 and 0093 Upstream rewrote two published shared migrations, so tenants that ran the original files now fail the strict history check. Only the official OSS tenant migrator accepts these two exact old-to-current SHA256 pairs at their journal position, tag and when; every other chain stays strict, the ledger is never rewritten and readiness still checks the active provider. * 🐛 fix(gateway): keep watchdog cleanup away from resumed parents Child cleanup and parent interruption now use conditional updates bound to the original version, link and live status; resume re-checks the parent's own version and only leaves waiting_for_async_tool. A found Redis state no longer reports finalized while the stored child still runs, and Redis scans match the deployment key prefix. * 🐛 fix(gateway): send gateway identity credentials as bearer * 🐛 fix(gateway): admit internal host on existing root routes * 🐛 fix(market): retain tenant identity when importing skill ZIPs * 🐛 fix(desktop): guard onboarding remote calls and save feedback * 🐛 fix(gateway): use GET for tenant device reads * 🐛 fix: reject disabled tunnel requests before dispatch * 🐛 fix: preserve validated frozen agent model params * 🐛 fix(chat): reconcile answered question cards after legacy resume * 🐛 fix(device): preserve workspace gateway authorization errors * 🐛 fix(gateway): settle synchronous device dispatch results * ♻️ refactor(tenant): share one backend prefix table between proxy and browser fetch * 🐛 fix(desktop): build renderer app address from the committed tenant entry The cloud-mode selector returned the platform origin, so avatars, copied links and OAuth redirect URIs lost /t/{slug} and hit TENANT_REQUIRED. Follow the main process: cloudTenant.entryUrl, else the legacy self-hosted address, else none. * ♻️ refactor(tenant): resolve desktop asset URLs through the tenant package useRemoteAssetUrl duplicated resolveAppUrl; replace it with useAppAssetUrl next to the app address it reads, and cover the committed-tenant avatar case. * 🐛 fix(database): generate the nullable oidc user_id change in the shared chain * ♻️ refactor(sso): support only OIDC and generic OAuth 2.0 in tenant SSO Retire SAML and the named OAuth2 vendors: soft-delete stored rows, drop saml_config, skip any remaining unsupported row in the loader. The oidc user_id change now lives in the shared chain instead of the tenant chain. * 🐛 fix(tenant): re-resolve the organization when a backend call reports TENANT_ENDPOINT_CHANGED * ♻️ refactor(proxy): answer fragment-clearing navigations with a meta-refresh page instead of a signed internal redirect * 🐛 fix(sso): check the OAuth2 preset after the config is known to be an object * 🐛 fix(tenant): build shared links under the tenant app address Acceptance copy-link, agent document share links and the app_url injected into the model used the bare origin, so opened links landed on organization discovery. Use getAppBaseUrl/buildAppUrl. * ♻️ refactor(gateway): share one withExecutionSignal between desktop and CLI * ♻️ refactor(gateway): mint the gateway identity in one shared provider for desktop and CLI * ✅ test(cli): mock SETTINGS_DIR for the sandbox shell test * 🐛 fix(acceptance-review): run the review API inside the tenant scope The route was the only tenant-bound backend handler without withTenantRequest, so reviewAuth and the database failed with TENANT_REQUIRED. Add a guard test that every backend route is wrapped or one of the proxy's tenantless surfaces. * ♻️ refactor(tenant): move the reserved slug rules into the tenant package The registrar rules are pure but lived in src/features and were imported by apps/server. Move them (with the workspace-mirrored segment list they derive from) to @lobechat/business-tenant/routing and leave a one-line re-export at the old path until apps/server imports the package. * ♻️ refactor(proxy): move the tenant layer out of define-config into proxy/tenant * 🔒 fix(cli): bind stored credentials to the server that issued them * 🐛 fix(auth): bound the per-tenant SSO snapshot cache like the auth instances * 🧹 chore(oidc): drop the deployment-root desktop redirect URIs that no tenant can serve * 🐛 fix(desktop): partition local state and caches by the signed-in organization The desktop renderer has no /t/{slug} document, so tabs, pins, recents, drafts and the SWR/replica cache scope were shared across organizations. Partition them by the committed tenant id (reported by preload from the token's tid), and reload at the app root when another organization is committed so the previous organization's in-memory state is never written into the new bucket. * 🧹 chore(tenant): leave backend calls to the fetch patch and document the prefix rule Page navigation uses withCurrentTenantPath; fetch/XHR/EventSource keep plain backend paths. Drop the redundant explicit prefix on the clear-session call. * 🐛 fix(tenant): deliver widget ticks, stale-step redrives, bot replays and expertise rejection to the tenant Four async producers still built callbacks without the /t/{slug} prefix and were refused with TENANT_REQUIRED. They now use buildTenantCallbackUrl, widget-tick joins the per-tenant cron fan-out, and deferred bot replays are queued as tenant jobs because they have no agent operation row. A source scan in the test suite keeps new producers on the helper. * 🐛 fix(database): count only active tenant pools against capacity An idle pool being evicted kept its slot until its sockets closed, so the first request of a cold tenant failed with TENANT_UNAVAILABLE even though room had been made. Retired and closing pools now have their own bound. * 🔒 fix(desktop): pair the tenant entry with its own token and never follow redirects with it * 🗃️ fix(database): keep the executed tenant migration 0001 and append the SSO retirement migrations after it * 🐛 fix(gateway-client): reconnect on retryable auth failures and keep a stable connectionId * 🐛 fix(migrate): isolate failing tenant migrations and run them once per release under an advisory lock * ♻️ refactor(tenant): confirm lifecycle stops with process heartbeat leases instead of per-request platform claims * ✨ feat(trusted-client): send x-lobe-trust-client-id with every trust token and surface Market refusals on the userinfo proxy * ✅ test(governance): pin the per-tenant /t/{slug} addressing Market's sandbox must use * ♻️ refactor(auth): run tenant SSO as generic OIDC and custom OAuth 2.0 only A tenant row is never mapped to a built-in vendor preset any more: an oidc row named okta/google/microsoft is plain OIDC discovery, an oauth2 row runs only with preset 'custom', anything else is skipped with a bounded log. Drops the preset table, env assembly, the unused platform env SSO registry and providers, the built-in/alias provider id helpers, the socialProviders plumbing and the client signIn.social/linkSocial branches that keyed on provider id. * ♻️ refactor(tests): colocate tenant tests with the modules they cover Move the tests/ directories created for tenant work next to the modules they cover, keep real-infrastructure suites in __tests__, split the oversized control-plane service suite by scenario, and restore the GatewayManager lifecycle cases that the merge of the duplicate suites had dropped. Relative fixture and migration paths follow the moved files. * ♻️ refactor(routing): read reserved slugs and backend paths from business-tenant The server imported reservedSlugs from the Next feature folder and re-exported isBackendPath through the proxy routing file. Both already live in @lobechat/business-tenant/routing, so import them from there and drop the duplicate feature file and the re-export. * ♻️ refactor(agent-runtime): keep parent resume in the service layer gatewayAuthorization/finalize imported resumeAbandonedParent from a router-hono handler, an upward dependency that closed a services -> router -> services cycle. Move the implementation and its test beside the other agentRuntime services; the handlers and the finalize service now import it from there. * ♻️ refactor(tenant): share one snapshot cache and stop admission re-verifying every five seconds The directory, admission-by-id and endpoint routing snapshots each carried their own copy of the read-start timing, in-flight coalescing and invalidation logic. They now share modules/Tenant/snapshotCache.ts: a bounded LRU with a five-second bound measured from the read start, coalesced and strictly ordered reads, negative entries for unknown slugs, and per-tenant invalidation that refuses only that tenant's in-flight reads. Database verification evidence is cached per tenant, connection, credential and schema version and is no longer repeated on a timer; lifecycle events and rotations drop it. A first verification slower than the admission bound is still refused. The sessions, verification and OIDC provider maps are LRU-bounded. The control-plane primitives the request path needs (endpoint service and contract, lifecycle failure and state, directory secret AAD, connection construction, runtime database verification) move into modules/Tenant, so the module no longer imports services/tenantControlPlane; the service files re-export them. Fixes the reconcile path that lost its openDirectoryData import. * ♻️ refactor(bot): share the tenant-pinned listener lifecycle across long-connection platforms Discord, Slack, Feishu, QQ and WeChat each carried the same start/stop bookkeeping: a single in-flight start, a stop-in-progress guard, and the tenant stop pin that is held until teardown succeeds so a failed stop can be retried. Move it into TrackedPlatformClient; the clients keep only their platform-specific start and stop. * 🐛 fix(agent-runtime): bound and reclaim per-tenant Redis connections Every tenant that touched the agent runtime kept its own ioredis connection for the life of the process. Cap the base clients at 128, evict the least recently used idle one, reclaim idle connections after a minute, and refuse to grow when all are busy. Commands and unexecuted pipelines keep their connection alive, held proxies resolve the tenant connection again on the next call, and an idle connection is disconnected rather than quit so a stalled server cannot pile up closing sockets. * 🔒 fix(gateway): keep the agent and device service tokens to their own audience The internal gateway API accepted either service token on every route, so the device gateway's token could finalize agent operations. Resolve the audience from the token that matched, reject a body that names the other audience, restrict finalize-abandoned to the agent token, and fail closed when both audiences are configured with the same credential. The root-entry test now sends the device token with its device-audience authorize body, which the old fixture only passed because any token was accepted. * 🐛 fix(database): rewrite tenant migration qualifiers lexically and read the chains asynchronously materializeTenantStatement rewrote every public. in a statement, including data literals and dollar-quoted data. It now walks the SQL lexer and changes only real schema qualifiers plus the relation names in to_regclass and ::regclass literals, keeping data strings, comments and unrelated quoted identifiers; the safety check ignores data literals too. The rewrite stays linear for bulk data migrations. Reading and hashing the shared, tenant and enterprise chains was synchronous on the request path. The files are now read asynchronously and cached per file by mtime and size, while the journal is read every time, so a chain that gains a migration is never answered from a stale snapshot. * 🔒 feat(trusted-client): put the signing client id in the trust token as a plaintext kid The trust token is now `<clientId>.<ciphertext>`, so Market opens it with that one client's secret instead of trying every tenant's. The SDK (0.42) cannot send a request header, so the kid rides inside the token and the `x-lobe-trust-client-id` helpers from df279c7f68 (`trustedClientHeaders`, `generateTrustedClientHeaders`, `getTrustedClientHeadersForSession`, the two header constants) are withdrawn. The signed payload already carries the same `clientId`, which is what binds the kid to the token on Market's side; a client id that cannot be a kid fails closed as TRUST_SIGNING_FAILED. The userinfo proxy sends only the token again and keeps the 401/403/429 pass-through and the 502 for an unreachable Market. Adds a cross-repo contract fixture (identical to Market's) that the real SDK signer's output is asserted against. * 🔒 fix(trusted-client): sign only a UUID tenant id into the trust token Work checked `[\w.-]{1,64}` while Market took any 1-128 characters. Both sides now require the lowercase canonical UUID Console generates, and the shared fixture lists the accepted and rejected samples that the signer is asserted against. * 🐛 fix(migrate): exit non-zero when a tenant migration fails in the standalone CLI, keep boot tolerant The migration entry (db:migrate, the image's migrate.cjs/docker.cjs run as a Job) now exits 1 after reporting every tenant when any tenant chain failed, so release orchestration can rely on the exit status. Boot paths pass --tolerate-tenant-failures and keep serving the other tenants. * 🔒 fix(gateway): refuse to start when the agent and device gateway service tokens are equal Equal tokens cannot establish an audience boundary and made every /api/internal/gateway call answer 503 only at request time. Fail in instrumentation register() with the variable names and consequence. * ✅ test(market): sign UUID tenant ids and expect the kid-prefixed trust token in the server tests Market now needs a canonical UUID tenant id and the token reads <clientId>.<ciphertext>; the four suites that run the real signer used acme/tenant-a/beta and bare token values. * 🔒 fix(governance): fail closed when the command_governance flag cannot be read An unreadable flag used to count as off, so /api/governance/check answered allowed:true during a runtime-config outage. Enforcement now rejects with GovernanceUnavailableError: the check endpoint answers 503 GOVERNANCE_UNAVAILABLE (a server error callers deny on and may retry, not a rule verdict), and the builtin tool executor and sandbox service refuse to run the command with a non-policy message. An explicitly off flag still allows. File-path and execution policy and audit writes keep their best-effort posture. * ✨ feat(market): surface an unbound Market trusted client at tenant startup Probe GET /api/trusted-client/binding once per available tenant in the background at startup and warn with the tenant and the Market code (CLIENT_TENANT_MISMATCH for a client Console never bound, other refusals, instance not ready, Market unreachable), so the problem shows before the first user request fails as an anonymous 401. Warn-only: Market never gates a tenant or the process. * 🔥 chore(auth): remove the retired deployment-wide SSO variables, hints and developer guide AUTH_SSO_PROVIDERS and the AUTH_<PROVIDER>_* typings have no reader left (the presets are deleted and tenant SSO takes its credentials from sso_providers). Drop the never-set typing and its stale comment, the Casdoor/Logto webhook warnings keyed on AUTH_SSO_PROVIDERS, and point the renamed-provider hints at per-organization SSO. Rewrite the upstream 'add a provider' guide for tenant OIDC / generic OAuth 2.0. * 🐛 fix(agent-runtime): stop an unexecuted pipeline from pinning a tenant Redis connection forever A pipeline/multi counted as a pending command from its creation until exec, so one that was built and never executed kept its tenant connection busy for good and, at 128 such tenants, made new tenants fail with TENANT_REDIS_CAPACITY. Creating one sends nothing: count the exec as the running work and hold the connection for a bounded 30s after creation instead. * ♻️ refactor(tenant): take the schema pattern and reserved slugs from Console's contract - tenant schema names are tenant_ + 24 hex only; add tenantOwnerRoleForSchema, assertTenantSchemaName and isTenantId for the Enterprise migration runner and the wire schemas - RESERVED_SLUGS is contracts/tenant-control-plane/reserved-slugs.json; a test fails when a route served here is missing from it - add Console's schemas, fixtures, naming and reserved-slug contract files (byte-identical copies) * ✨ feat(control-plane): hold the receiving schemas to Console's fixtures and serve tenant-manifest - bundles are strict LobeHub-kind with the contract schema and role patterns; tenant ids are lower-case UUIDs - contractFixtures.test.ts runs the receiving schemas over Console's accepted and refused samples and checks real service answers against the published JSON Schema - GET /tenant-manifest reports the schema version a new tenant is bound to, so Console no longer needs it in an environment variable * ♻️ refactor(control-plane): follow Console's split of tenant-manifest into TITU Work and Admin shapes * 📝 docs(gateway): sync the tenancy contract with ticket-bound device identity and per-gateway service tokens * 🔒 fix(gateway): sign the device and connection into the gateway ticket and enforce them on the server The workspace device hub trusted the deviceId and connectionId a client reported, so a member could displace or intercept another member's device. Work now binds both into the signed ticket and into its authorization record: - the identity request carries deviceId and connectionId (64 and 128 bytes); a workspace device must be one the caller may operate (the existing devices row and canOperateWorkspaceDevice decide), a personal one is the caller's own - authorize checks connect and renew against the record's claims and re-checks the entitlement; dispatch and result match the device and connection the attempt was minted for - the workspace connect token becomes a gateway-enrollment attestation that only pins tenant and principal; it is not a ticket - tickets minted without the claims are refused, with no fallback The Gateway takes device and connection only from the ticket and rejects a disagreeing URL hint. * ✅ test(gateway): cover device identity minting, renewal, dispatch and enrollment against real rows and Redis * 🔒 fix(gateway): have every client ask Work for a ticket that names its own device and connection The ticket now carries the device and connection the socket speaks for, so the device client, agent client, CLI and desktop settle their device identity before the identity exchange, send both ids with it, and compare the signed claims with their own before dialling. Workspace enrollment uses the attestation only to pin tenant and principal; the dial itself needs a fresh ticket. The desktop derives the device from the account the committed login belongs to. * 🗃️ feat(database): own the governance and Channel tables in the tenant-only chain The command governance and Channel models lived in CPC while their DDL lived in the Enterprise tenant chain, so CPC on its own had models without tables and its Channel suites were excluded from the public database run. 0004_governance_channel_tables (hand-written with --custom, with the snapshot drizzle-kit generated for the same models) creates them when none exists, and when all of them exist, as they do on tenants that ran the Enterprise chain, creates nothing and verifies columns, types, nullability, defaults, constraints, indexes, triggers and the revision functions, failing on a difference or a partial set. The foreign keys to users and the revision triggers are part of it. The Channel suites now run standalone from this chain; getTestDB runs a distribution chain before the tenant-only chain so the nested checkout exercises the verifying path. The readiness column check reads rows.length, which the PGlite client has and rowCount it lacks. * 🔒 fix(tenant): require a Console-generated UUID tenantId on the endpoints contract Syncs the endpoints and lifecycle-failure-codes contract copies with Console. * 🐛 fix(gateway-client): reconnect after an expired gateway token and stop on policy closes An auth_expired frame (or an expired local authority) now schedules a reconnect when an identity provider can renew the token and nobody disconnected meanwhile. A 1002/1003/1007/1008 close is terminal even when its error frame was lost, and reconnect delays use equal jitter so the 30s cap does not synchronise clients. The device client drops its section banners to stay under the 800-line file limit. * 🔒 fix(governance): fail closed when the switch, rules or policy cannot be loaded Command, file-path and execution-policy checks now reject (503 GOVERNANCE_UNAVAILABLE, or a SERVICE_UNAVAILABLE tRPC error for the device policy fetch) instead of resolving to allowed when the switch value is malformed, a rule or policy lookup fails, or a rule pattern is invalid or of an unknown type. Only an explicitly disabled switch or a successfully evaluated absent/disabled policy allows. Absolute denied roots such as /etc/secrets now match as path prefixes (they could never match before), with dot segments resolved first. Audit write failures are logged as errors. * 🔥 chore(share): drop the share-visitor-run feature and its dead client and test references The visitor run, share gate tool set and abuse guards were removed with the feature. Remove the leftover shareChat endpoints called from the client, the upload and gateway branches that only served visitors, and the tests that pinned them. * ✅ test(server): repair the failing server tests and read provider disable flags correctly Pin the tenant harness and gateway-authorization mocks in 42 failing test files, read provider settings through isProviderDisableBrowserRequest when resolving the LLM execution site, probe channel_messages with an unqualified to_regclass so tenant schemas resolve, and give the real-PG database run its own key-vault master key. * 🗃️ fix(database): keep the shared migration chain identical to canary The nullable oidc user_id DDL already lives in tenant-chain 0001_oidc_pre_auth_artifacts, so the shared-chain 0181 added for the same change is removed. * ♻️ refactor(database): let tenant chains declare the schema they are authored against Enterprise generates its tenant chain under the tenant_template placeholder; it now reuses this rewriter through sourceSchema instead of its own replace. * 🛡️ fix(database): refuse CONCURRENTLY in tenant migrations and replay the shared rewrite fixture The whole tenant chain runs in one transaction, so CONCURRENTLY index statements are rejected before any SQL is sent. A test replays Console's statement-rewrite contract. * 📝 chore(contracts): add Console's tenant migration statement-rewrite fixture copy * 🐛 fix(desktop): import withExecutionSignal through a subpath to avoid a rolldown chunk panic Importing it through the device-gateway-client barrel (export *), next to the dynamic import of the same package, makes rolldown panic in vite build:main (symbol TUNNEL_CHUNK_SIZE is not in any chunk; rolldown/rolldown#11227). A dedicated ./executionSignal subpath keeps the shared helper without the barrel. * ✨ feat(tenant-discovery): expose a server-to-server tenant lookup for the landing site POST /api/internal/tenant-discovery/lookup lets a trusted backend resolve which tenants an email can sign in to, so the landing page can route users to their tenant. It reuses the public discovery eligibility (active tenants, banned users excluded) and answers {tenants:[{id,slug,name,url,signinUrl}]}; the sign-in URL never echoes the email. The caller authenticates with its own Bearer token, LOBEHUB_TENANT_DISCOVERY_TOKEN; a missing, short or Console-equal token disables the endpoint with 503. The end-user clientIp is required so every lookup is limited per IP, per mailbox and globally under its own Redis prefix. The proxy admits only the exact root path, and the body reader is shared with the public endpoint. * 🐛 fix(channel): isolate unconfirmed writers and stop same-round discussion holds (#106) * 🐛 fix(channel): isolate writers whose termination cannot be confirmed A Channel run held its member for as long as `writer_released` stayed false, and only a physical confirmation ever sets it. When that confirmation never comes (an unreachable device, a device that reports an unknown outcome after the execution limit, or a native executor that disappeared), nothing in the application released the member, so every later request for it stayed queued. Add `channel_runs.isolated_at` (tenant chain 0005) and let the worker isolate such a writer once its execution limit plus `CHANNEL_LIMITS.terminationGraceMs` has passed: publication is revoked, a job its lost executor left open is failed, its native session is rotated so the next turn starts from a reconstructed snapshot, and an `execution_isolated` audit records that physical termination is still unconfirmed. `writer_released` and `physical_stopped` keep meaning physical confirmation; the worker keeps stopping isolated device writers and records a later confirmation as before. The active-member index, claim, resetSession, advanceDiscussions and the client activity/receipt selection no longer treat an isolated writer as occupying its member. Session rotation and isolation move to channelWriter.ts, which keeps ChannelModel from growing. * ♻️ refactor(database): move discussion candidate publication rules into channelDiscussion Extract the freshness/yield/stale gate and the post-publication discussion bookkeeping from ChannelModel.publish into gateDiscussionCandidate and recordDiscussionPublication, next to the other discussion transaction helpers. Behavior is unchanged; publish keeps the Channel lock, the sequence allocation and the audit records. * 🐛 fix(channel): stop same-round discussion replies from holding peers Turns in a discussion round run concurrently and every reply of a round is delivered to all participants when the next round opens. The publication freshness check still treated a reply published by another participant in the same round as an unseen message, so slower drafts were held and executed again as revisions, sometimes more than once per round. Exclude replies published by runs of the same discussion and round from that check. Any other message after the candidate's cutoff still holds it for one same-session revision, and summaries are unchanged. The discussion prompt now says that same-round replies never hold a candidate. Tests that encoded the old hold are rewritten, and a case keeps the remaining hold path covered. * chore(contracts): sync Console tenant-destruction contract and Market datasource schema * feat(control-plane): tenant destruction barrier, drain and unregister with durable terminal state * fix(tenant): treat TENANT_DESTROYED as terminal in queue, discovery and sign-in * ✨ feat(oidc): bridge the login prompt on the server and require explicit desktop consent - A login interaction goes to a server route (/oidc/interaction/{uid}/login) instead of the consent SPA: without a tenant session it 303s straight to sign-in and comes back to itself; a desktop no_session request with a session finishes the login step without the "continue as" card. Extra authentication reasons (prompt=login, max_age, ...) end with login_required; other clients keep the card. - The interaction policy requires this transaction's explicit consent for lobehub-desktop even with an existing grant or without prompt=consent; prompt=none answers consent_required. - Consent POST accepts only same-origin submissions, checks the interaction uid and that the signed-in account is the interaction's before any grant is touched; session cookies ride on every response. - The consent card shows the authorized account; a failed session lookup on the fallback card offers a retry instead of a sign-in redirect; sign-in recognizes the new route as desktop. * 🐛 fix(oidc): explain a declined desktop authorization and fix the error page markup - The desktop callback forwards access_denied, consent_required, login_required and interaction_required as the error page reason instead of a generic invalid request; any other value and error_description are never echoed. - The OAuth error page renders its description and button as Result children, so no block element sits inside the subtitle <p> (React hydration error). * ✅ test(oidc): pin the brand when checking the Market client name * 🔥 chore(migration): remove the one-off legacy tenant migration tools The offline secret re-encryption and object copy for the single-tenant import now live in TiTuWork-Deploy (deploy/tenant-migration/tools), which already carries the later api_keys key_hash recomputation and the separate source/target object-store accoun…
Validation: owning fixture regenerated and passed INSTA_UPDATE=no in wrap-all, on-demand, strict-off modes. Snapshot delta contains comments only. No reachability algorithm changes.
Member
|
This condition misses a star target that has exports nobody imports. The #11634 places every such target with its barrel, and its fixture also covers the empty and ambiguous targets from yours. Closing this in favor of #11634. Thanks for working on this! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Strict execution order could panic during chunk placement when a consumer-local re-export barrel retained an
export *loading edge with no visible, unambiguous export names. This includes an empty ESM module and a star whose contributed names later became ambiguous. Tree shaking kept the target included, but consumer-local traversal left its reachability bits empty.Preserve the retained direct loading edge when no visible binding route can carry it. Named binding routes still select their own leaves. Filtering the existing name map matches the sibling re-export retention rule and keeps linear traversal cost. The regression includes empty and ambiguous star targets in wrap-all, on-demand and strict-off modes, and asserts one dependent initialization.
Validation: reproduced both panic shapes before repair. Fresh native binding controls now build and evaluate empty, ambiguous-only and effectful ambiguous stars, with the side effect occurring exactly once. All 151 strict-order integration tests pass. After integrating the formatting bot commit, the unchanged Rust implementation and the three-mode fixture pass again, along with
cargo fmt --all --check. Independent medium review approved the original repair and identified the now-reproduced ambiguous-name case. This PR contains only these reachability fixes; downstream validation also needs the separate exports-kind determinism repair.Maintenance update: merged current main e3355e0 with a normal merge and regenerated the existing three-mode snapshot for the current output-comment format. The snapshot change contains comments only; the owning fixture passes with
INSTA_UPDATE=noin wrap-all, on-demand, and strict-off modes. No reachability algorithm changes. The earlier Vite legacy-watch missing-manifest failure has not been classified by this focused check. AI assistance was used for this maintenance.