Skip to content

fix(tinytorch): stop module start/resume dead-ending on tracking/disk desync - #2026

Closed
Shashank-Tripathi-07 wants to merge 1 commit into
harvard-edge:devfrom
Shashank-Tripathi-07:fix/tinytorch-module-start-resume-deadlock
Closed

fix(tinytorch): stop module start/resume dead-ending on tracking/disk desync#2026
Shashank-Tripathi-07 wants to merge 1 commit into
harvard-edge:devfrom
Shashank-Tripathi-07:fix/tinytorch-module-start-resume-deadlock

Conversation

@Shashank-Tripathi-07

Copy link
Copy Markdown
Collaborator

Summary

tito module start and tito module resume can deadlock each other when .tito/progress.json's tracking (started_modules) desyncs from the actual notebook on disk under modules/. Each command's own failure message points at the other, and neither ever mentions the actual fix.

Area

  • Book (textbook content, figures, exercises)
  • StaffML (interview questions, challenges)
  • Kits (hardware labs)
  • Infrastructure (CI/CD, scripts, config)
  • TinyTorch (modules, tests, milestones)

Changes

  • tito/commands/module/workflow.py: start_module now checks whether the notebook directory actually exists before trusting the is_module_started flag, and recreates it from src/ when it doesn't, instead of refusing with 'already started'.
  • resume_module now does the same check before calling _open_jupyter, recreating the notebook from src/ instead of dead-ending inside _open_jupyter with 'directory not found'.
  • The normal case (notebook genuinely present) is unchanged in both commands.

Testing

  • Rendered the book locally (quarto render)
  • Ran tests (pytest tests/)
  • Ran tito module test NN for affected module(s)
  • Manual verification (describe below)

Reproduced the exact desync on a real, install.sh-created TinyTorch environment: started module 01, then deleted modules/01_tensor/ while leaving .tito/progress.json untouched (the same state tito system reset --keep-progress produces). Before the fix: tito module start 01 refused with 'already started', tito module resume 01 then failed with 'Module directory not found: 01_tensor', a closed loop with no escape mentioned in either message. After the fix: both commands detect the missing notebook, print a clear 'was started before, but its notebook is missing, recreating it from source' message, regenerate the notebook via the same _create_module_from_src path used for a genuinely new module, and proceed normally (resume goes on to open Jupyter Lab, confirmed via a real running server). Also confirmed the untouched case: starting an already-started module whose notebook genuinely still exists still correctly refuses and points to resume, unchanged from before.

Related Issues

None filed. Found while auditing every tito command against a real, isolated TinyTorch install to check which work correctly.


By submitting this PR, you agree to release your contribution under the project's license.

… desync

started_modules/completed_modules tracking in .tito/progress.json and the
actual notebook under modules/ can go out of sync (e.g. tito system reset
--keep-progress clears modules/ but intentionally preserves tracking).
When that happens, module start refused with 'already started', pointing
to module resume, and module resume then failed inside _open_jupyter with
'directory not found', pointing back at nothing. Neither message ever
mentioned the actual fix (module reset --force).

Both commands now check whether the notebook actually exists before
trusting the tracking flag, and recreate it from src/ when it doesn't,
the same way a genuinely new module is created. The normal already-started
path (notebook genuinely present) is unchanged.
@Shashank-Tripathi-07

Copy link
Copy Markdown
Collaborator Author

Superseded by #2092, which combines this with #2026 since both touch the same file (tito/commands/module/workflow.py). Closing to avoid two PRs churning the same file back to back.

@Shashank-Tripathi-07
Shashank-Tripathi-07 deleted the fix/tinytorch-module-start-resume-deadlock branch August 19, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tinytorch TinyTorch framework core type: bug bug in rendering

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant