Skip to content

Recover from failed cells and add cppjit.undo - #177

Draft
conrade-ctc wants to merge 1 commit into
compiler-research:mainfrom
chicagotrading:undo-failed-inputs-upstream
Draft

conrade-ctc wants to merge 1 commit into
compiler-research:mainfrom
chicagotrading:undo-failed-inputs-upstream

Conversation

@conrade-ctc

Copy link
Copy Markdown
Collaborator

In a notebook, a cell that fails to compile should not force a restart. With
compiler-research/CppInterOp#1174, this PR makes that work for a large class
of cases:

  • A failed cppdef or cppexec leaves the interpreter as it was, also when
    it fails to link or its initializer throws.
  • cppjit.undo() withdraws the last successful cppdef or cppexec, and
    drops the Python proxies that the undone code made outdated.
  • gbl.Cpp.Undo no longer withdraws its own JIT call wrapper.

test/test_failed_input.py shows each case as notebook cells. Five cases
need an upstream LLVM change. They are expected failures, and each reason
names the upstream PR. docs/Undo.md describes the behavior.

This needs CppInterOp with GetInputCount, so CI fails until
CppInterOp#1174 merges and the pin moves.

🤖 Done with the help of Claude Code (Opus 5.5, human in the loop)

A failed cppdef or cppexec leaves the interpreter as it was before the
call, also when a C++ exception unwinds past CppInterOp.

cppjit.undo() withdraws the last successful cppdef or cppexec. It
returns to an input-count checkpoint, so the JIT call wrappers that
cppjit adds between cells do not count. It also drops the proxies that
the undone code made outdated, in every scope.

gbl.Cpp.Undo calls CppInterOp from C, so it cannot withdraw its own JIT
call wrapper.

test_failed_input.py shows each case as notebook cells. A case that
needs an upstream LLVM change is an expected failure that names it.

Requires CppInterOp with GetInputCount.

Co-developed-with-the-help-of: Claude Code (Opus 5.5, human in the loop)
@conrade-ctc
conrade-ctc force-pushed the undo-failed-inputs-upstream branch from df95363 to 2f3bf6a Compare November 6, 2026 01:15

This branch has not been deployed

No deployments
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.

1 participant