Revert "feat: bring back use message packing for timezone [LET-6846]" (#9302)

Revert "feat: bring back use message packing for timezone [LET-6846] (#9256)"

This reverts commit c5017cccdef95b84fc585b26a0ddc5b7e44eb7c9.
This commit is contained in:
Ari Webb
2026-02-05 11:14:08 -08:00
committed by Caren Thomas
parent 644f7b9d5d
commit 5c6ca705f1
7 changed files with 12 additions and 194 deletions

View File

@@ -790,81 +790,6 @@ def test_initial_sequence(client: Letta):
# assert agent.timezone == "America/New_York"
def test_agent_timezone_none_no_message_packing(client: Letta):
"""Test that agent created without timezone has timezone=None and messages are not JSON wrapped."""
agent = client.agents.create(
memory_blocks=[{"label": "human", "value": ""}, {"label": "persona", "value": ""}],
model="anthropic/claude-haiku-4-5-20251001",
embedding="openai/text-embedding-3-small",
# No timezone specified
)
try:
# Verify timezone is None
retrieved_agent = client.agents.retrieve(agent_id=agent.id)
assert retrieved_agent.timezone is None, f"Expected timezone to be None, got {retrieved_agent.timezone}"
# Send a message
test_message = "Hello, this is a test message without timezone"
client.agents.messages.create(
agent_id=agent.id,
messages=[MessageCreateParam(role="user", content=test_message)],
)
# List messages and find the user message
messages = client.agents.messages.list(agent_id=agent.id).items
user_messages = [m for m in messages if m.message_type == "user_message"]
assert len(user_messages) > 0, "Expected at least one user message"
# The user message content should be the raw text (not JSON wrapped)
# When timezone is None, the message is stored as-is and retrieved as-is
latest_user_message = user_messages[0]
assert latest_user_message.content == test_message, f"Expected raw message '{test_message}', got '{latest_user_message.content}'"
finally:
client.agents.delete(agent_id=agent.id)
def test_agent_timezone_set_message_packing(client: Letta):
"""Test that agent created with timezone has messages JSON wrapped with timestamp."""
agent = client.agents.create(
memory_blocks=[{"label": "human", "value": ""}, {"label": "persona", "value": ""}],
model="anthropic/claude-haiku-4-5-20251001",
embedding="openai/text-embedding-3-small",
timezone="America/Los_Angeles",
)
try:
# Verify timezone is set
retrieved_agent = client.agents.retrieve(agent_id=agent.id)
assert retrieved_agent.timezone == "America/Los_Angeles", f"Expected timezone 'America/Los_Angeles', got {retrieved_agent.timezone}"
# Send a message
test_message = "Hello, this is a test message with timezone"
client.agents.messages.create(
agent_id=agent.id,
messages=[MessageCreateParam(role="user", content=test_message)],
)
# List messages and find the user message
messages = client.agents.messages.list(agent_id=agent.id).items
user_messages = [m for m in messages if m.message_type == "user_message"]
assert len(user_messages) > 0, "Expected at least one user message"
# The user message content should be unpacked to just the message text
# (The API unpacks the JSON wrapper before returning)
latest_user_message = user_messages[0]
assert latest_user_message.content == test_message, (
f"Expected unpacked message '{test_message}', got '{latest_user_message.content}'"
)
# Test that updating timezone works
client.agents.update(agent_id=agent.id, timezone="America/New_York")
updated_agent = client.agents.retrieve(agent_id=agent.id)
assert updated_agent.timezone == "America/New_York", f"Expected updated timezone 'America/New_York', got {updated_agent.timezone}"
finally:
client.agents.delete(agent_id=agent.id)
def test_attach_sleeptime_block(client: Letta):
agent = client.agents.create(
memory_blocks=[{"label": "human", "value": ""}, {"label": "persona", "value": ""}],