Fix max recursion depth error during Sphinx hot reload #28
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.
During Sphinx hot reloads (e.g., with esbonio), configuration objects can contain circular references, causing
get_safe_configto infinitely recurse when serializing to TOML.Changes
visited: set[int]parameter toget_safe_configto detect circular referencesvisitedafter processing, allowing the same object to be referenced from different paths (A→C, B→C) while preventing true cycles (A→B→C→A)Test Coverage
Added
test_no_recursion_error_on_rebuildto verify rebuild scenarios don't cause recursion errors.Original prompt
This section details on the original issue you should resolve
<issue_title>[BUG] Max depth reached error when hot reloading via sphinx (e.g. with esbonio)</issue_title>
<issue_description>There currently seems to be a bug where sphinx errors due to this extension as it reaches the max depth recursion.
Error:
This continues until:
Steps to reproduce:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.