Skip to content

fix(plugin): fall back on Python AST recursion errors - #1094

Merged
mldangelo-oai merged 1 commit into
openai:mainfrom
WenJing95:fix/python-outline-recursion
Sep 30, 2026
Merged

mldangelo-oai merged 1 commit into
openai:mainfrom
WenJing95:fix/python-outline-recursion

Conversation

@WenJing95

Copy link
Copy Markdown
Contributor

Summary

Ran into this one late: a long enough Python expression makes ast.parse() throw RecursionError, even well under the 64 KiB preview limit. Nothing caught it, so rank-input generation just died instead of falling back to a source preview.

Changes

  • Catch RecursionError with the other parse errors so it uses the existing fallback.
  • Added regression tests with a real long expression.

Testing

Tests pass.

Risk and rollout

Small. Only previews that hit RecursionError behave differently, and they now use the fallback we already had.

Public disclosure review

  • No customer, partner, prospect, or user identities, data, or identifying details are included.
  • No credentials, personal data, private source, scan findings, or nonpublic links or tickets are included.
  • I reviewed the branch name, title, description, commits, changes, comments, logs, screenshots, attachments, and links for public disclosure.

@github-actions github-actions Bot added the bug Something isn't working label Sep 30, 2026

@mldangelo-oai mldangelo-oai left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you for catching this and adding regression coverage with a real Python expression. I verified all three new cases on Python 3.12: they pass with this change and fail when the added RecursionError catch is removed.

The tests cover both preview entry points, the source and simple-outline fallbacks, and the byte limit. The CLI case also checks that the affected file stays in the rank input and processing continues to the next file. Reusing the existing fallback keeps this fix small and focused.

CI is green too, including all required platform checks, the portable source checks, and the full Python suite (1,223 passed, 8 skipped). Looks good to merge!

@mldangelo-oai
mldangelo-oai merged commit 6c4b791 into openai:main Sep 30, 2026
49 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 30, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants