Skip to content

feat(deps): manually rebuild captured notebook environments #1968

Description

@rgbkrk

This was generated by AI during triage.

Current triage (2026-07-10)

Priority: P3 (nice-to-have)
Related: #1954 (unified env resolution design)

Problem

Captured notebooks are fully self-describing but have no user-facing controls for the two common "I want to reset this" cases:

  1. Rebuild env from scratch. Env got corrupted somehow, or user wants to pick up a newer package version. Today the user has to manually edit the .ipynb to clear metadata.runt.env_id and reopen. (If we ship auto-detect + recover in a companion issue, this becomes a manual escape hatch rather than the primary recovery path.)

  2. Refresh deps from defaults. Daemon's default_packages setting changed (e.g. we added dx to the UV base set). Existing notebooks stay on their captured dep list by design (write-once, per issue design: unify env resolution so prewarmed notebooks maintain the same env across reopens #1954 § Capture timing). A user who wants to pick up the new defaults has no UI for it.

Design sketch

Both controls live in the deps header UI alongside the existing add/remove package actions.

Rebuild env:

  • Button: "Rebuild environment."
  • Confirm dialog: "This deletes the current environment and installs fresh from your captured deps. Continue?"
  • Action: delete {cache}/{unified_hash}/, clear metadata.runt.env_id (so the next launch re-captures with a fresh env_id).

Refresh deps from defaults:

  • Button: "Reset deps to workspace defaults."
  • Confirm dialog: lists the current captured deps that will be removed and the new default deps that will replace them.
  • Action: overwrite metadata.runt.{uv,conda}.dependencies with the current daemon.default_uv_packages() / daemon.default_conda_packages() (stripped of base), clear metadata.runt.env_id, next launch captures fresh.

Both share the "clear env_id, trigger fresh capture" mechanic. Worth factoring a single reset_notebook_env(strategy: RebuildSame | RefreshDefaults) call on the daemon.

Out of scope

  • Automatic drift detection / prompt ("your defaults changed, want to refresh?"). Not needed yet; users who want this can hit the button.
  • Env version pinning. Would be a separate feature.

Acceptance

  • Deps header has both buttons, gated on the notebook being in a captured state.
  • Rebuild deletes the current env dir and triggers fresh capture on next launch.
  • Refresh-defaults overwrites captured deps with current workspace defaults and triggers fresh capture.
  • Integration test: after Rebuild, unified_env_on_disk no longer hits at the pre-rebuild hash and a new launch recreates it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    daemonruntimed daemon, kernel management, sync serverenhancementNew feature or requestfrontendWebview, React, TypeScript UInotebook-dependenciesUV, Conda, Pixi, inline deps, environment managementpriority:p3Low priority backlog or opportunistic workstatus:needs-designNeeds product or architecture shaping before implementationuxVisual polish and interaction design

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions