Commit Graph

26 Commits

Author SHA1 Message Date
cthomas
3b0b2cbee1 fix: unbounded file to pydantic conversion (#8292)
* fix: unbounded file to pydantic conversion

* remove var name
2026-01-12 10:57:48 -08:00
cthomas
cfde955313 feat: prevent unbounded file queries (#8285) 2026-01-12 10:57:48 -08:00
cthomas
442d9accae fix: return 404 for file not found [LET-6698] (#8137)
fix: return 404 for file not found
2026-01-12 10:57:47 -08:00
jnjpng
591420876a fix: correct decorator order for trace_method and raise_on_invalid_id (#7226)
Swap the order of @trace_method and @raise_on_invalid_id decorators
across all service managers so that @trace_method is always the first
wrapper applied to the function (positioned directly above the method).

This ensures the ID validation happens before tracing begins, which is
the intended execution order.

Files modified:
- agent_manager.py (23 occurrences)
- archive_manager.py (11 occurrences)
- block_manager.py (7 occurrences)
- file_manager.py (6 occurrences)
- group_manager.py (9 occurrences)
- identity_manager.py (10 occurrences)
- job_manager.py (7 occurrences)
- message_manager.py (2 occurrences)
- provider_manager.py (3 occurrences)
- sandbox_config_manager.py (7 occurrences)
- source_manager.py (5 occurrences)
- step_manager.py (13 occurrences)
2025-12-17 17:31:02 -08:00
Kian Jones
08ccc8b399 fix: prevent db connection pool exhaustion in file status checks (#6620)
Problem: When listing files with status checking enabled, the code used
asyncio.gather to check and update status for all files concurrently. Each
status check may update the file in the database (e.g., for timeouts or
embedding completion), leading to N concurrent database connections.

Example: Listing 100 files with status checking creates 100 simultaneous
database update operations, exhausting the connection pool.

Root cause: asyncio.gather(*[check_and_update_file_status(f) for f in files])
processes all files concurrently, each potentially creating DB updates.

Solution: Check and update file status sequentially instead of concurrently.
While this is slower, it prevents database connection pool exhaustion when
listing many files.

Changes:
- apps/core/letta/services/file_manager.py:
  - Replaced asyncio.gather with sequential for loop
  - Added explanatory comment about db pool exhaustion prevention

Impact: With 100 files:
- Before: Up to 100 concurrent DB connections (pool exhaustion)
- After: 1 DB connection at a time (no pool exhaustion)

Note: This follows the same pattern as PR #6617 and #6619 which fixed
similar issues in file attachment and multi-agent tool execution.
2025-12-15 12:02:34 -08:00
Kian Jones
45065297a0 feat: runtime validation for ids for internal managers calls (#5544)
* claude coded first pass

* fix test cases to expect errors instead

* fix this

* let's see how letta-code did

* claude

* fix tests, remove dangling comments, retrofit all managers functions with decorator

* revert to main for these since we are not erroring on invalid tool and block ids

* reorder decorators

* finish refactoring test cases

* reorder agent_manager decorators and fix test tool manager

* add decorator on missing managers

* fix id sources

* remove redundant check

* uses enum now

* move to enum
2025-10-24 15:13:47 -07:00
Ari Webb
967cc3decf move exceptions out of folders and sources [LET-4631] (#5444) 2025-10-24 15:12:11 -07:00
Sarah Wooders
a8e6afc12c fix: allow for >50 files to be attached to an agent [LET-4606] (#5139) 2025-10-07 17:50:49 -07:00
Kian Jones
b8e9a80d93 merge this (#4759)
* wait I forgot to comit locally

* cp the entire core directory and then rm the .git subdir
2025-09-17 15:47:40 -07:00
Kian Jones
22f70ca07c chore: officially migrate to submodule (#4502)
* remove apps/core and apps/fern

* fix precommit

* add submodule updates in workflows

* submodule

* remove core tests

* update core revision

* Add submodules: true to all GitHub workflows

- Ensure all workflows can access git submodules
- Add submodules support to deployment, test, and CI workflows
- Fix YAML syntax issues in workflow files

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* remove core-lint

* upgrade core with latest main of oss

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-09 12:45:53 -07:00
Kian Jones
fecf6decfb chore: migrate to ruff (#4305)
* base requirements

* autofix

* Configure ruff for Python linting and formatting

- Set up minimal ruff configuration with basic checks (E, W, F, I)
- Add temporary ignores for common issues during migration
- Configure pre-commit hooks to use ruff with pass_filenames
- This enables gradual migration from black to ruff

* Delete sdj

* autofixed only

* migrate lint action

* more autofixed

* more fixes

* change precommit

* try changing the hook

* try this stuff
2025-08-29 11:11:19 -07:00
Matthew Zhou
9871bffdf2 fix: Add check status update flag to list (#4177) 2025-08-25 16:21:33 -07:00
Matthew Zhou
2ceb144afb feat: Add better error catching for files upload (#4145) 2025-08-24 16:46:57 -07:00
Matthew Zhou
99af0039fc fix: Fix test managers state transition tests (#3551) 2025-07-24 15:14:00 -07:00
Matthew Zhou
d629f47d75 fix: Fix state transitions for file processing (#3541) 2025-07-24 13:48:08 -07:00
Matthew Zhou
6e008ac983 fix: Comment out caching temporarily for file metadata (#3510) 2025-07-23 14:24:28 -07:00
Matthew Zhou
d74db3e89a feat: Add transition state validation (#3509) 2025-07-23 14:08:41 -07:00
Matthew Zhou
e2a6f94b60 feat: Support exporting/importing sources and files for agent file (#3414) 2025-07-18 16:20:18 -07:00
Matthew Zhou
327640d99f feat: add include_detailed_per_source_metadata flag to sources metadata endpoint (#3371) 2025-07-16 17:10:41 -07:00
Matthew Zhou
ec4f4ffe7f feat: Add caching for files operations (#3321) 2025-07-14 14:08:27 -07:00
Matthew Zhou
c3f4a66504 feat: Add duplication handling behavior (#3273) 2025-07-10 13:16:01 -07:00
Matthew Zhou
6c578acb43 feat: Add endpoint to get source statistics (#3206) 2025-07-07 14:02:44 -07:00
Matthew Zhou
954675396f feat: Add pinecone for cloud embedding (#3160) 2025-07-03 22:37:55 -07:00
Matthew Zhou
e495fb2ef2 feat: Various file fixes and improvements (#3125) 2025-07-01 15:21:52 -07:00
Matthew Zhou
efca9d8ea0 feat: Only add suffix on duplication (#3120) 2025-07-01 13:48:38 -07:00
cthomas
82dd311011 chore: create file manager (#2693) 2025-06-07 16:14:41 -07:00