Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- Add LogBuffer class to runtime.ts: sync push(), async flush(), auto-flush on threshold (10 entries) or timer (5s) - Replace 3 blocking adapter.log() callsites with logBuffer.push() (action, evaluator, model logs are now fire-and-forget) - Public runtime.log() preserves backward compat (push + immediate flush) - Add flushLogs() to IAgentRuntime interface - Add optional logBatch() to IDatabaseAdapter with plugin-sql implementation (groups by entityId for RLS, single multi-row INSERT per group) - Add createBatch() to LogStore - Add idx_logs_type_created and idx_logs_room_created indexes - runtime.stop() drains buffer before shutdown - Update tests to flush buffer before asserting on adapter.log calls Full payloads preserved — no truncation. Perf win comes from non-blocking writes and batch inserts. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
c4833ed to
405e744
Compare
- Extract shared LogWriteParams type across core + SQL plugin - Fix flush race condition with drain loop for entries pushed during in-flight flush - Use Promise.allSettled for partial-failure visibility in batch fallback - Add failedEntries pattern to avoid duplicate retries on partial batch failure - Add warning logs instead of silent error swallowing - Expand test coverage: boundary conditions, error handling, destroy behavior, timer behavior, AgentRuntime integration, SQL createBatch (21 new tests) - Remove verbose comments, inline single-caller flushLoop(), trim noise
Move LogBuffer class out of runtime.ts into its own utility file to reduce runtime.ts bloat.
|
We did not carry this in the current merge train. The direction may be useful, but it needs a fresh rebase and focused validation proving batching and drain semantics are correct under real runtime load before we can take it. Please resubmit as a narrower PR with end-to-end tests and clear behavior guarantees. |
|
Closing — draft PR with only 2/5 tasks completed and no recent activity. Feel free to reopen when this is ready for review. |
Summary
runtime.ts— syncpush(), asyncflush(), payload truncation (stripsstateto summary, caps at 256KB)adapter.log()callsites withlogBuffer.push()— action, evaluator, and model logs are now fire-and-forgetlogBatch()toIDatabaseAdapterwith plugin-sql implementation (groups by entityId for RLS, single multi-row INSERT per group)idx_logs_type_createdandidx_logs_room_createdDB indexesruntime.stop()drains buffer before shutdown;flushLogs()exposed onIAgentRuntimeTest plan
bun run buildpasses on@elizaos/coreand@elizaos/plugin-sqlbun test packages/core/src/__tests__/runtime.test.ts)stateidx_logs_type_created,idx_logs_room_createdindexes created after migrationidx_logs_run_idon(body->>'runId')needs custom SQL migration (Drizzle doesn't support expression indexes in schema DSL)🤖 Generated with Claude Code