Skip to content

Conversation

@m1so
Copy link
Member

@m1so m1so commented Oct 7, 2025

closes BLU-4936

Summary by CodeRabbit

  • New Features
    • Introduces a detached server startup mode that runs fully isolated without contacting backend services.
    • Disables automatic integration environment variable injection and post-start hooks when detached.
    • Preserves existing startup behavior (environment setup, dependency constraints, working directory, server launch, lock handling, timeouts) outside of the detached mode.
    • Ideal for offline or sandboxed sessions where external connectivity and automations should be suppressed.

@m1so m1so requested a review from mfranczel October 7, 2025 16:12
@linear
Copy link

linear bot commented Oct 7, 2025

BLU-4936 Ensure there's no dependency if toolkit helpers on webapp when launched as CLI

This is related to all code for all integrations - ensure that they are usable independently from webapp. There are various places which request webapp directly and it should be handled in case it's configured to run in standalone mode, which should be default for CLI.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 7, 2025

📝 Walkthrough

Walkthrough

Introduces a new environment variable in Deepnote server startup: DETEPNOTE_RUNTIME__RUNNING_IN_DETACHED_MODE='true'. When set, the server runs in detached mode: no backend or proxy requests are made, integration environment variable injection is skipped, and post-start hooks are disabled. All other startup behaviors (virtualenv PATH/VIRTUAL_ENV handling, pip constraints, working directory, server launch, lockfile behavior, and timeouts) remain unchanged.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant U as User/CLI
    participant S as DeepnoteServerStarter
    participant E as Environment
    participant P as Server Process
    participant B as Backend (Webapp)

    U->>S: start()
    S->>E: Set VIRTUAL_ENV/PATH, constraints, cwd
    S->>E: Set DETEPNOTE_RUNTIME__RUNNING_IN_DETACHED_MODE = "true"
    S->>P: Launch server

    alt Detached mode (flag = "true")
        Note over S,P: Skip integration env injection
        Note over S,P: Skip post-start hooks
        S--xB: Do not make backend/proxy requests
    else Normal mode
        S->>P: Inject integration env vars
        S->>P: Run post-start hooks
        P->>B: Optional backend/proxy requests
    end

    S->>S: Handle lockfile & timeouts (unchanged)
Loading

Possibly related PRs

Suggested reviewers

  • mfranczel

Pre-merge checks

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly states the main purpose of the change—preventing the toolkit from connecting to the backend—and matches the code’s addition of a detached-mode flag without extraneous detail.
Linked Issues Check ✅ Passed The new DETEPNOTE_RUNTIME__RUNNING_IN_DETACHED_MODE flag disables backend requests and integration hooks, directly fulfilling BLU-4936’s requirement to remove webapp dependencies and support standalone CLI mode.
Out of Scope Changes Check ✅ Passed All modifications are confined to enabling a detached-mode flag in the server startup and do not introduce unrelated code or features outside the scope of disabling backend connections.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8d67855 and b504eae.

📒 Files selected for processing (1)
  • src/kernels/deepnote/deepnoteServerStarter.node.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.node.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use *.node.ts for Desktop-specific implementations that require full file system access and Python environments

Files:

  • src/kernels/deepnote/deepnoteServerStarter.node.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Inject interfaces, not concrete classes
Avoid circular dependencies
Use l10n.t() for user-facing strings
Use typed error classes from src/platform/errors/ when throwing or handling errors
Use the ILogger service instead of console.log
Preserve error details while scrubbing PII in messages and telemetry
Include the Microsoft copyright header in source files
Prefer async/await and handle cancellation with CancellationToken

**/*.{ts,tsx}: Order class members (methods, fields, properties) first by accessibility, then alphabetically
Separate third-party imports from local file imports

Files:

  • src/kernels/deepnote/deepnoteServerStarter.node.ts
src/kernels/**/*.ts

📄 CodeRabbit inference engine (.github/instructions/kernel.instructions.md)

src/kernels/**/*.ts: Use event-driven updates (EventEmitter) for state changes
Monitor and dispose pending promises to prevent leaks during teardown
Use WeakRef/weak references for notebook/object backreferences to avoid memory leaks
Respect CancellationToken in all async operations

Files:

  • src/kernels/deepnote/deepnoteServerStarter.node.ts
🧬 Code graph analysis (1)
src/kernels/deepnote/deepnoteServerStarter.node.ts (1)
.vscode-test.mjs (1)
  • env (70-73)

@m1so m1so merged commit b495c47 into main Oct 8, 2025
4 checks passed
@m1so m1so deleted the michalbaumgartner/blu-4936-ensure-theres-no-dependency-if-toolkit-helpers-on-webapp branch October 8, 2025 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants