Problem
packages/agent/test/trajectory-plugin-chat-roundtrip.e2e.test.ts is currently skipped because it times out waiting for trajectory LLM call data to appear in the database.
Root cause
The test's mock messageService.handleMessage calls runtime.useModel inside runWithTrajectoryContext, which logs the LLM call via trajectoryLogger.logLlmCall. However, the trajectory plugin's persistence is driven by its MESSAGE_RECEIVED and MESSAGE_SENT event handlers:
MESSAGE_RECEIVED → starts a trajectory, creates a step
MESSAGE_SENT → completes the step, persists steps_json to DB
The server's generateChatResponse emits both events (lines 3324 and 3414 of server.ts), but the test's runtime.emitEvent mock forwards events to trajectoryLoggerPlugin.events[eventName] — which may not receive the correct payload shape or timing for the trajectory step lifecycle to complete.
As a result, logLlmCall adds data to an in-memory step that never gets flushed to the trajectories table's steps_json column.
Fix required
Wire the test mock's event pipeline so that:
MESSAGE_RECEIVED is emitted before messageService.handleMessage runs
MESSAGE_SENT is emitted after the response, with the correct message payload
- The trajectory plugin's
MESSAGE_SENT handler calls completeStep → persistTrajectory
This ensures the LLM call data lands in steps_json and the detail API returns it.
Files
packages/agent/test/trajectory-plugin-chat-roundtrip.e2e.test.ts (test)
packages/agent/src/api/server.ts (event emission, lines 3320-3430)
@elizaos/plugin-trajectory-logger (event handlers)
Problem
packages/agent/test/trajectory-plugin-chat-roundtrip.e2e.test.tsis currently skipped because it times out waiting for trajectory LLM call data to appear in the database.Root cause
The test's mock
messageService.handleMessagecallsruntime.useModelinsiderunWithTrajectoryContext, which logs the LLM call viatrajectoryLogger.logLlmCall. However, the trajectory plugin's persistence is driven by itsMESSAGE_RECEIVEDandMESSAGE_SENTevent handlers:MESSAGE_RECEIVED→ starts a trajectory, creates a stepMESSAGE_SENT→ completes the step, persistssteps_jsonto DBThe server's
generateChatResponseemits both events (lines 3324 and 3414 ofserver.ts), but the test'sruntime.emitEventmock forwards events totrajectoryLoggerPlugin.events[eventName]— which may not receive the correct payload shape or timing for the trajectory step lifecycle to complete.As a result,
logLlmCalladds data to an in-memory step that never gets flushed to thetrajectoriestable'ssteps_jsoncolumn.Fix required
Wire the test mock's event pipeline so that:
MESSAGE_RECEIVEDis emitted beforemessageService.handleMessagerunsMESSAGE_SENTis emitted after the response, with the correctmessagepayloadMESSAGE_SENThandler callscompleteStep→persistTrajectoryThis ensures the LLM call data lands in
steps_jsonand the detail API returns it.Files
packages/agent/test/trajectory-plugin-chat-roundtrip.e2e.test.ts(test)packages/agent/src/api/server.ts(event emission, lines 3320-3430)@elizaos/plugin-trajectory-logger(event handlers)