Skip to content

fix(colab): ask for a restart only when an upgraded module is already loaded #217

Closed

Description

@Jammy2211

Overview

The 2026.11.12.1 Colab bootstrap (setup_colab._ensure_jax_floor, #216) raises ColabRestartRequired whenever jax or numpy is already imported after upgrading. Importing autonerves.setup_colab itself loads numpy (not jax), so on live Colab (manifest 2026-11-12: jax 0.11.1, numpy 2.4.6) it upgrades only jax and then always demands a restart. Heart's Colab gate (verify_install check F) fails with setup cell rc=1 (PyAutoLabs/PyAutoHeart release-integrate run 43238247828), so Heart reads RED until a fixed Nerves is released.

Plan

  • Nerves: upgrade only what is below the floor (jax+jaxlib together; numpy only if <2.2; the matching CUDA plugin when jax is upgraded on a GPU runtime). Raise ColabRestartRequired only if an upgraded module (jax/jaxlib, or numpy) is already in sys.modules, and name what was upgraded. On Colab jax isn't loaded before the setup cell, so most users get no restart.
  • Heart check F: if the setup cell raises ColabRestartRequired, re-run it once in a fresh process (what a user does after restarting). Fail only if that second run fails.
  • Tests for both. Check F clears at the next release, because it audits the released bootstrap.

Tier: judge — merge mode: human /prm

Prompt: PyAutoMind draft/bug/autonerves/colab_restart_only_when_upgraded_module_imported.md

🤖 Generated with Claude Code

Activity

  1. Jammy2211 commented on Nov 12, 2026

    @Jammy2211
    CollaboratorAuthor

    Shipped to main (#218 and PyAutoLabs/PyAutoHeart#337 merged); it reaches Colab users with the next release.

    • Nerves: only what is below the floor is upgraded, and a restart is requested only if an upgraded module is already loaded. A live-Colab simulation (jax 0.11.1, numpy 2.4.6, real pip) upgraded jax with no restart and ran jax 0.12.0.1 in the same process.
    • Heart check F re-runs the cell once after a restart request, as a user would.
    • Check F (which audits the released bootstrap) reads red until that release.
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions