Skip to content

feat: Bash execution, PTC, and session isolation with full test coverage#63

Merged
usnavy13 merged 2 commits into
devfrom
feat/bash-and-interop
Mar 3, 2026
Merged

feat: Bash execution, PTC, and session isolation with full test coverage#63
usnavy13 merged 2 commits into
devfrom
feat/bash-and-interop

Conversation

@usnavy13
Copy link
Copy Markdown
Owner

@usnavy13 usnavy13 commented Mar 3, 2026

Summary

  • Bash execution: Added bash as a supported language with full nsjail sandbox execution
  • Programmatic Tool Calling (PTC): New POST /exec/programmatic endpoint enabling code to call externally-defined tools during execution, with continuation-based round-trip protocol
  • Session isolation fix: File references from shared agent uploads no longer blindly reuse the upload session — user_id ownership is checked to prevent cross-user state leakage
  • Comprehensive test coverage: Unit, integration (mocked), and functional (live endpoint) tests for all new features

Test Coverage Added

Functional tests (live endpoint, tests/functional/)

  • test_bash.py — 7 tests: echo, error handling, variables, loops, pipes, exit codes
  • test_ptc.py — 9 tests: initial execution, full tool-call round-trip with arguments, error results, invalid tokens, auth
  • test_exec_workflow.py — 2 new tests: cross-user session isolation with shared file references
  • test_files.py — 2 new tests: metadata["original-filename"] and full detail field verification

Integration tests (mocked, tests/integration/)

  • test_librechat_compat.py — 8 new tests: bash compat (3), PTC compat (4), metadata verification (1)
  • test_api_contracts.py — fixed validate_uploads mock in mock_file_service fixture

Unit tests (tests/unit/)

  • test_orchestrator.py — 5 new tests: TestAgentFileSessionIsolation covering all session lookup priority paths

Test plan

  • All lint checks pass (flake8, black, mypy, bandit)
  • pytest tests/unit/ — 460 passed
  • pytest tests/functional/ — 69 passed against rebuilt container
  • Session isolation test verified: upload session NOT reused across different users

🤖 Generated with Claude Code

usnavy13 added 2 commits March 3, 2026 19:11
…Calling (PTC)

- Updated the unified Docker image to support 13 language runtimes, adding Bash to the existing list.
- Introduced a new Programmatic Tool Calling (PTC) feature, allowing code execution to call external tools during runtime.
- Added a new API endpoint `/exec/programmatic` for executing code with tool calling support.
- Updated documentation and changelog to reflect the new features and changes in language support.
- Enhanced existing tests to cover the new Bash language and PTC functionality.
…r isolation

- Updated the ExecutionOrchestrator to ensure that sessions referenced by uploaded files are only reused if the user_id matches the current request, preventing cross-user session sharing.
- Added tests to verify session isolation when multiple users share an agent with attached files, ensuring each user receives their own session.
- Introduced new functional tests for Bash execution to confirm compatibility with existing API contracts and session handling.
- Enhanced existing tests to cover edge cases related to session management and file references.
@usnavy13 usnavy13 merged commit ef78196 into dev Mar 3, 2026
2 checks passed
djuillard pushed a commit to On-Behalf-AI/LibreCodeInterpreter that referenced this pull request Apr 21, 2026
feat: Bash execution, PTC, and session isolation with full test coverage
@usnavy13 usnavy13 deleted the feat/bash-and-interop branch May 7, 2026 02:20
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.

1 participant