Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

feat: skip job load in step logging (#3433)

cthomas9392adc8f5d2
diff --git a/letta/services/step_manager.py b/letta/services/step_manager.py
index c1034ebb1..32be82759 100644
--- a/letta/services/step_manager.py
+++ b/letta/services/step_manager.py
@@ -158,8 +158,6 @@ class StepManager:
if stop_reason:
step_data["stop_reason"] = stop_reason.stop_reason
async with db_registry.async_session() as session:
- if job_id:
- await self._verify_job_access_async(session, job_id, actor, access=["write"])
new_step = StepModel(**step_data)
await new_step.create_async(session, no_commit=True, no_refresh=True)
pydantic_step = new_step.to_pydantic()
diff --git a/tests/test_managers.py b/tests/test_managers.py
index c6a7e1e50..3d868eecc 100644
--- a/tests/test_managers.py
+++ b/tests/test_managers.py
@@ -46,7 +46,7 @@ from letta.jobs.types import ItemUpdateInfo, RequestStatusUpdateInfo, StepStatus
from letta.orm import Base, Block
from letta.orm.block_history import BlockHistory
from letta.orm.enums import ToolType
-from letta.orm.errors import NoResultFound, UniqueConstraintViolationError
+from letta.orm.errors import ForeignKeyConstraintViolationError, NoResultFound, UniqueConstraintViolationError
from letta.orm.file import FileContent as FileContentModel
from letta.orm.file import FileMetadata as FileMetadataModel
from letta.schemas.agent import CreateAgent, UpdateAgent
@@ -6565,7 +6565,7 @@ async def test_job_usage_stats_add_nonexistent_job(server: SyncServer, sarah_age
"""Test adding usage statistics for a nonexistent job."""
step_manager = server.step_manager
- with pytest.raises(NoResultFound):
+ with pytest.raises(ForeignKeyConstraintViolationError):
await step_manager.log_step_async(
agent_id=sarah_agent.id,
provider_name="openai",