fix: restore the trimmed execution trace#9618
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
77e2f46 to
8aadc48
Compare
Contributor
There was a problem hiding this comment.
No issues found across 5 files
Architecture diagram
sequenceDiagram
participant UserCell as "User Cell Code"
participant Executor as "DefaultExecutor"
participant CauseChain as "Exception Chain"
participant MarimoRuntime as "MarimoRuntimeException"
participant Hooks as "Post-Execution Hooks"
participant Traceback as "write_traceback()"
participant Frontend as "User Notebook UI"
Note over UserCell,Frontend: Runtime Exception Flow
UserCell->>Executor: execute_cell() or execute_cell_async()
Executor->>Executor: exec(cell.body, glbls)
alt Exception raised in user code
UserCell-->>Executor: BaseException (e.g., ValueError)
Executor->>CauseChain: Strip executor.py frame from e.__traceback__
Note over Executor,CauseChain: Sets e.__traceback__ = e.__traceback__.tb_next
Executor->>MarimoRuntime: raise MarimoRuntimeException from e
Note over Executor,MarimoRuntime: User's traceback starts at user code, not executor.py
end
MarimoRuntime-->>Hooks: run_result.exception (MarimoRuntimeException)
Hooks->>Hooks: traceback.format_exception(run_result.exception)
Hooks->>CauseChain: Access __cause__.__traceback__ (user-code frames only)
CauseChain-->>Hooks: Formatted traceback string
Hooks->>Traceback: write_traceback(formatted_traceback)
alt Code mode
Traceback->>Frontend: broadcast_notification with raw traceback data
else Run mode
alt show_tracebacks enabled
Traceback->>Frontend: sys.stderr._write_with_mimetype (highlighted)
else show_tracebacks disabled
Traceback->>Frontend: No traceback sent
end
end
Note over UserCell,Frontend: Traceback now includes full execution path from user code
612a55b to
6d9c8c1
Compare
8aadc48 to
772f9e3
Compare
mscolnick
reviewed
May 20, 2026
772f9e3 to
2415611
Compare
6d9c8c1 to
0500e7d
Compare
mscolnick
approved these changes
May 20, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Restores user-facing (trimmed) execution tracebacks after the executor refactor by stripping the internal DefaultExecutor frame at the exception source, and removing downstream string-based traceback trimming in messaging/hooks.
Changes:
- Strip the executor’s own frame from caught exceptions in
DefaultExecutor(sync + async) before wrapping inMarimoRuntimeException. - Remove
_trim_tracebackusage and implementation so traceback formatting relies on the already-trimmed exception. - Update/add tests to assert the executor frame is absent and adjust snapshots accordingly.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
marimo/_runtime/executor/executor.py |
Strips the executor frame from exception tracebacks before wrapping. |
marimo/_messaging/tracebacks.py |
Removes string-based traceback trimming; highlights/broadcasts the passed traceback as-is. |
marimo/_runtime/runner/hooks_post_execution.py |
Stops trimming formatted tracebacks before highlighting. |
tests/_runtime/test_executor_evaluator.py |
Adds assertions that executor frames are removed from cause tracebacks (sync/async). |
tests/_server/test_scratchpad_integration.py |
Updates snapshot expectations to match trimmed tracebacks. |
tests/_messaging/test_tracebacks.py |
Removes unit test coverage for deleted _trim_traceback. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Summary
This fix is a followup to #9617 and #9616 and restores the truncated stacktrace to the user's notebook.
Before fix:
After fix: