Skip to main content
The Zeus message queue covers two layers: the user-facing message queue that lets users queue messages while the Agent is processing, and the backend event persistence system that ensures reliable delivery.

User Message Queue

When the Agent is processing a response, users can continue typing and queue additional messages instead of waiting.

Behavior

Queue UI

The queue panel appears above the chat input when messages are queued:
  • Edit (pencil icon) — inline-edit the queued message content
  • Send Now (↑ arrow icon) — stop current generation and send this message immediately
  • Remove (trash icon) — delete from queue

Truncated Context

When a response is stopped mid-stream, the partial AI content is preserved in the conversation history and used as context for subsequent messages. It is also persisted to the database so it survives page refresh.

Conversation & File Rollback

Users can roll back to any previous conversation turn, similar to Cursor’s fork model.

Conversation Rollback

  1. Hover over a user message → click the Rollback button (↺)
  2. Messages after the rollback point are dimmed (40 % opacity), not deleted
  3. A fork divider appears with a Cancel Rollback option
  4. New messages are appended below the divider
  5. Chat history sent to the backend only includes messages up to the fork point

File Rollback

When the user rolls back, sandbox files modified after the fork point are restored to their earlier state:
Cancel rollback reverses the process, restoring the latest file versions from preRollbackFiles.

File Recovery on Refresh

Sandbox files are restored from database events — not just the live E2B sandbox — so files persist even after the sandbox expires. Content is lazy-loaded: when the user clicks a file tab whose content is empty, the frontend calls GET /api/sandbox/read-file to fetch it from the sandbox on demand.

Event Persistence

RealtimeEventSaver

RealtimeEventSaver is responsible for batch-persisting real-time SSE events to the database:

Configuration


Message Batching

Frontend Message Merging

The frontend merges rapid successive text updates to avoid excessive re-rendering:

Chat History Construction

The frontend loads the current session’s message history from the Zustand Store, excludes the message currently being sent, and passes it to the backend. The backend converts it to LangChain message types, limiting to a maximum of 30 messages.

Concurrency & Isolation


Session Recovery

The system supports recovery after session interruption:

Save Triggers

  • After a tool call completes
  • After a message is sent
  • During HITL interruption (via Checkpointer)

Recovery Flow


Messages

Complete message flow, request parameters, and state management

Retry Policy

Error handling, retry strategies, and fallback mechanisms