feat(workspace): event_log module + EventLogConfig (#119 PR-2) - #2548
Merged
Conversation
Adds workspace/event_log.py with an in-memory EventLog backend and a disabled no-op variant, plus EventLogConfig nested in ObservabilityConfig (backend / ttl_seconds / max_entries). The event log is the append-and-query buffer that the canvas Activity tab and platform `/activity` endpoint will read in PR-3 of the #119 stack. Two backends ship in this PR: - InMemoryEventLog: bounded ring buffer with TTL eviction, monotonic ids that survive eviction so cursors don't break, thread-safe for concurrent appends from heartbeat + main loop + A2A executor. - DisabledEventLog: no-op for `backend: disabled` — opts the workspace out without crashing callers that propagate event ids. Schema-only PR — no consumers wired yet. Wiring lands in PR-3. Test coverage: - 34 new test_event_log.py tests (100% line coverage on event_log.py) - 9 new test_config.py tests for EventLogConfig parsing - Concurrency stress with 8 threads × 200 appends — verifies unique monotonic ids under contention - TTL + max_entries eviction with injected clock (no time.sleep) - Disabled backend contract pinned Closes #207. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
HongmingWang-Rabbit
requested a review
from hongmingwang-moleculeai
as a code owner
May 3, 2026 07:17
HongmingWang-Rabbit
enabled auto-merge
May 3, 2026 07:18
The wheel-build drift gate caught it correctly: any new top-level module under workspace/ must be listed in TOP_LEVEL_MODULES so its `from event_log import …` statements get rewritten to `from molecule_runtime.event_log import …` at package time. Without this entry, the published wheel ships event_log.py un-rewritten and crashes at runtime with ModuleNotFoundError on first heartbeat. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
🔒 Auto-merge disabled — new commit ( |
HongmingWang-Rabbit
pushed a commit
that referenced
this pull request
Jun 12, 2026
…Rs (stop comment flood)' (#2548) from fix/merge-queue-silent-base-skip into main
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR-2 of the #119 hermes-style architecture series. Adds the workspace event log primitive — an append-and-query buffer that the canvas Activity tab and platform `/activity` endpoint will read in PR-3.
Why
Hermes ships a declarative observability block; molecule-core scattered the same knobs across env vars + hard-coded constants. Adopting the same shape pre-positions us for per-workspace tuning of cadence + retention without code changes, and gives platform-side fan-out a stable backend interface to swap (memory → redis) in a follow-up.
Eviction contract (load-bearing)
The workspace runtime is long-lived, so an unbounded list would leak. Every `append` prunes by both TTL (default 1h) and `max_entries` (default 10k). Reader cursors that fall behind past the eviction frontier see a contiguous tail without an error — the cursor protocol guarantees "events with id > since that are still resident", not "every event ever appended". A reader that needs at-least-once delivery polls faster than the eviction TTL.
Test plan
Stack
🤖 Generated with Claude Code