Skip to content

fix: autohands generate deletes start_here.ipynb when ipynb-py-convert is missing #330

Closed

Description

@Jammy2211

Overview

autohands generate <project> deletes the tracked root start_here*.ipynb (generate.py:150) before build_util.py_to_notebook shells out to ipynb-py-convert. When that converter is not on PATH (it is missing from ~/venv/PyAuto313), the run dies with FileNotFoundError, leaving start_here.ipynb deleted and a stray temp.py in the workspace. This hit 3 workspaces on 2026-11-04 during workspace-hygiene-sweep-1104; they were restored from git.

Plan

  • Preflight check: before anything destructive, confirm ipynb-py-convert is on PATH. If it is missing, exit non-zero, saying how to install it and "Nothing was modified" (the same pattern as the unknown-project guard).
  • Warn, without stopping, when the local assistant checkout used for the Colab Gemini context is behind origin/main (local refs only, no fetch). A stale assistant silently rewrote 239 notebooks' context in the same session.
  • Add a regression test that runs generate with an empty PATH for the converter and asserts the workspace is untouched.
  • Tier: glance — merge mode: human /prm (no auto-merge authorized this session)
Detailed implementation plan
  • autohands/generate.py: after the COLAB_PROJECTS validation, add if shutil.which("ipynb-py-convert") is None: sys.exit(...).
  • autohands/build_util.py: add assistant_behind_origin(root) -> int | None, which runs git rev-list --count HEAD..origin/main and returns None on any error. generate.py prints a WARNING when it is greater than 0.
  • tests/test_generate_validates_project.py: add a missing-converter test using a PATH that has python3 and git but no ipynb-py-convert; assert a non-zero exit, a clean git status, start_here.ipynb present, and no temp.py.
  • Run pytest tests/test_generate_validates_project.py tests/test_gemini_instructions.py.

Original Prompt

PyAutoMind/draft/bug/pyautohands/generate_missing_converter_deletes_start_here.md (filed 2026-11-04).

Activity

  1. Jammy2211 commented on Nov 4, 2026

    @Jammy2211
    CollaboratorAuthor

    Shipped in #331 (merged, CI green 3/3): generate now preflights ipynb-py-convert before deleting anything and warns when the assistant checkout is behind origin/main.

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