Skip to content

Conversation

@bjoaquinc
Copy link
Contributor

@bjoaquinc bjoaquinc commented Oct 29, 2025

📝 Summary

This adds errors_summary prompt so users can easily inject all errors in notebooks into agents or Cursor easily divided into notebooks and cells (with session_id and file path data included for each notebook):

Screenshot 2025-10-29 at 6 39 29 PM Screenshot 2025-10-29 at 6 42 19 PM

🔍 Description of Changes

This also:

  • DRYs up getting errors from notebooks and cells so that GetRuntimeCellData, GetNotebookErrors, and ErrorsSummary prompt all pull from tool context with errors that are of the same structure
  • Fixes tests for GetNotebookErrors
  • Removes redundant tests in test_cells.py
  • Adds "include_stderr" to manage verbosiity of prompt
  • Adds clean_output utility function to the stderr of all tools

📋 Checklist

  • I have read the contributor guidelines.
  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • I have added tests for the changes made.
  • I have run the code and verified that it works as expected.

@vercel
Copy link

vercel bot commented Oct 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
marimo-docs Ready Ready Preview Comment Oct 30, 2025 2:20am

mscolnick
mscolnick previously approved these changes Oct 29, 2025
@@ -56,12 +60,6 @@
traceback: list[str]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this different from MarimoErrorDetail?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope I forgot to remove it. I'll fix that thanks


for notebook in notebooks:
session_id = notebook.session_id
notebook_errors = context.get_notebook_errors(session_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want this get_notebook_error( to be include_stderr=True?

we may want to make include_stderr non-optional so it is explicit when used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was keeping it out of prompts because it dumps in the errors from all notebooks. But I think you mentioned most people use one notebook at a time so should be ok?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can leave it false then - but I'd make it explicit

suggested_fix="Try again with a valid cell ID.",
meta={"cell_id": cell_id},
)
return session_view.cell_operations[cell_id]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe some basic unit tests for these new context calls

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done! added this to test_base.py

maybe_cell_op=cell_op,
include_stderr=include_stderr,
)
if len(errors) > 0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: if errors:

# Sort by cell_id for stable output
summaries.sort(key=lambda s: s.cell_id)
return summaries
def _get_total_errors_count_without_stderr(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: _count_marimo_errors or _count_marimo_errors_without_stderr (if you need to be more verbose)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might remove this depending on how we handle STDERR in the fn

@mscolnick mscolnick merged commit 46bd376 into marimo-team:main Oct 30, 2025
35 of 37 checks passed
@bjoaquinc bjoaquinc deleted the tools-errors-improvement branch October 30, 2025 14:36
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.

2 participants