Skip to content

Build the browser sandbox template only when an app declares a browser session #1018

Open

Description

@czpython

What happened

druks sandboxes build, which a deploy runs, builds the sandbox of every declared workflow plus two it always adds, in backend/druks/cli.py:

asyncio.run(prepare_sandbox_templates(extra=(Bridge.sandbox, BrowserSession.sandbox)))

The chat bridge is right: chat is a builtin app. The browser sandbox is a guess. On an installation whose apps declare no BrowserSession, nothing ever starts a browser sandbox: an agent borrows a browser only through a declared session, and the login window on Settings → Connections → Browser opens only for a declared session. The build still runs, about two minutes, at every deploy where the base image moved, which with :latest tags is most deploys.

Proposal

Add the browser sandbox to the extras only when an installed app declared a session. The browser_sessions registry holds every declaration after app.discover() has run, and it is what the Browser settings page lists, so the condition is browser_sessions.all(). One line in the CLI.

An app that later declares a session gets its image at that deploy, since the build runs on every deploy. The "run druks sandboxes build" error a missing template raises stays correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions