Skip to content

Add missing file detection keywords for REPL mode#60

Merged
usnavy13 merged 2 commits into
usnavy13:devfrom
On-Behalf-AI:main
Mar 3, 2026
Merged

Add missing file detection keywords for REPL mode#60
usnavy13 merged 2 commits into
usnavy13:devfrom
On-Behalf-AI:main

Conversation

@AI-Flow-Logic
Copy link
Copy Markdown
Contributor

Body:

Description

When Python REPL mode is enabled, files generated with to_excel() and other pandas export methods are not captured in the API response. The files array comes back empty even though the file is successfully created in
/mnt/data/.

This is because the keyword list in src/services/execution/runner.py that triggers file detection in REPL mode is missing several common file-writing methods.

This change extends the keyword list to include: to_excel, to_json, to_parquet, to_html, to_xml, to_feather, to_pickle, and dump() (for json.dump, pickle.dump, yaml.dump patterns).

Fixes #59

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Tested by executing Python code via the /exec endpoint with REPL mode enabled:

  • to_excel() — previously returned empty files array, now correctly captures the .xlsx file
  • to_csv() — confirmed still working (was already in the keyword list)
  • open() / write() — confirmed still working
  • Verified that REPL mode performance is not impacted (keyword check remains a simple string match)

Test configuration:

  • LibreCodeInterpreter: latest
  • Python execution image: latest (GHCR)
  • REPL_ENABLED=true
  • STATE_PERSISTENCE_ENABLED=true

Checklist:

  • My code follows the style guidelines of this project - ok
  • I have performed a self-review of my own code - ok
  • I have commented my code, particularly in hard-to-understand areas - not necessary
  • I have made corresponding changes to the documentation - not necessary
  • My changes generate no new warnings - ok
  • I have added tests that prove my fix is effective or that my feature works - no, minor modification, manual tests
  • New and existing unit tests pass locally with my changes - no, minor modification, manual tests
  • Any dependent changes have been merged and published in downstream modules - no, no dependent changes needed

  Added missing file-writing keywords to the REPL mode file detection list.
  Previously, files created with pandas to_excel() and other export methods
  were not captured because the keyword list only included: open(), savefig,
  to_csv, write(), .save().

  Added: to_excel, to_json, to_parquet, to_html, to_xml, to_feather,
  to_pickle, dump() (for json.dump, pickle.dump, yaml.dump).

  This fix ensures generated files are properly detected and returned
  in the API response when using REPL mode (Python only).
Fix REPL file detection for pandas export methods
@AI-Flow-Logic AI-Flow-Logic requested a review from usnavy13 as a code owner March 3, 2026 09:06
usnavy13
usnavy13 previously approved these changes Mar 3, 2026
Copy link
Copy Markdown
Owner

@usnavy13 usnavy13 left a comment

Choose a reason for hiding this comment

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

Looks good. Clean, minimal bug fix — extends the REPL file detection keyword list with missing pandas export methods and dump(). No correctness or security concerns; false positives only trigger an extra file scan (~1s), not incorrect behavior.

@usnavy13 usnavy13 changed the base branch from main to dev March 3, 2026 15:38
@usnavy13 usnavy13 dismissed their stale review March 3, 2026 15:38

The base branch was changed.

@usnavy13 usnavy13 merged commit 533a098 into usnavy13:dev Mar 3, 2026
1 check failed
djuillard pushed a commit to On-Behalf-AI/LibreCodeInterpreter that referenced this pull request Apr 21, 2026
Add missing file detection keywords for REPL mode
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.

REPL mode file detection missing common pandas export methods (to_excel, to_json, etc.)

2 participants