Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
feat(Wave 12): flip event_framework_enabled default to True
trohitg43012c7d62c6
diff --git a/docs-internal/event_framework.md b/docs-internal/event_framework.mdindex a5ee6109..75b2a473 100644--- a/docs-internal/event_framework.md+++ b/docs-internal/event_framework.md@@ -26,20 +26,35 @@ phase plan lives in `~/.claude/plans/properly-fix-the-tech-dreamy-tarjan.md`.| C4 sub-piece C — `service_factories` registry closes `core/container.py` top-level imports | ✅ commit `73c5f08` (9 tests) || D1 — Shared `_retry_policies` + `NodeUserError` non-retryable | ✅ commit `751ab94` (11 tests) || D3 — Visibility admin WS handlers (`list_canary_listeners` / `list_canary_schedules` / `get_workflow_failure_history`) | ✅ commit `aebfb35` (13 tests) |+| D5 — Auto-gen `DEFAULT_TOOL_NAMES` from `ToolNode` ClassVars | ✅ commits `a01f590` / `07906f0` / `899771c` (78 plugin classes + golden fixture + 3 invariant tests; 75 passed) |+| B11 — FE `plugin_connection_status` envelope handler | ✅ commit `899771c` |+| D4 — Drop legacy `*_status` raw frames (status-only round) | ✅ commit `5ea4e90` (whatsapp/android/telegram status retired; FE consumes typed channel) |+| Canary flag default flip + invariant lock | ✅ this commit (default `True`; `EVENT_FRAMEWORK_ENABLED=false` is the rollback) |### Dropped / Deferred / Pending| Phase | State ||---|---|| D2 — Custom `event_dlq` SQLModel table | ❌ **dropped** (commit `89b15bd`, docs only). Temporal Event History + Visibility queries cover the ops-inspection use case; reinventing them would contradict Wave 12's "Temporal-native, no custom infra" thesis. See § "Failure inspection — no separate DLQ table". |-| D2b — Retire `event_waiter.py` Redis-Streams branch | ⏸ **deferred** — gated on `event_framework_enabled` flipping default-on. Branch is still production-live for non-canary triggers. |-| B11 — FE handler migration to envelope-aware readers | ⏳ deferred to coordinated FE session |-| D4 — Drain `_LEGACY_RAW_DICT_BROADCASTS` | ⏸ blocked on B11 |-| D5 — Auto-gen `DEFAULT_TOOL_NAMES` from `ToolNode` ClassVars | ⏳ pending — ~70 plugins + `services/ai.py:2515-2780` rewrite + snapshot test |+| D2b — Retire `event_waiter.py` Redis-Streams branch | ⏳ pending — flag default now `True`; gated on production-stability window before draining the legacy collector. |+| D4 — Drain remaining dual-emit on message/newsletter/history wire keys | ⏳ pending — paired with FE migration to envelope-aware readers on those channels (`whatsapp_message_received` et al). |+| WorkflowEnvironment integration smoke test | ⏳ pending — full 7-canary in-process Temporal cluster. Existing unit tests + per-canary producer tests + `TestCanaryRegistryCoverage` cover the static surface; the integration smoke would catch real-cluster regressions only. |**Test surface: 256 passed + 1 xfail** across 18 event-framework test files.-`Settings.event_framework_enabled` gates the new dispatch path (default-OFF). When off, `services.events.dispatch.emit` is a no-op pass-through; plugin emitters still call `status_broadcaster.broadcast(...)` directly, so the FE fan-out is unchanged. Turn on per-callsite for opt-in dogfooding without flipping the flag globally.+`Settings.event_framework_enabled` gates the new dispatch path. **Default flipped to `True` on 2026-05-15** — the Temporal-Signal consumer fan-out is now production-default. The env var `EVENT_FRAMEWORK_ENABLED=false` is the rollback channel; when set, `services.events.dispatch.emit` reverts to a pass-through no-op and the legacy `event_waiter.dispatch` path keeps working unchanged for non-canary triggers.++### Rollback procedure++If the canary fan-out causes regressions in production:++1. Set `EVENT_FRAMEWORK_ENABLED=false` in `.env` (or the process environment).+2. Restart the server (`npm run start` / `uvicorn` reload). Pydantic Settings re-reads on startup.+3. Confirm pass-through: `dispatch.emit()` logs `event-framework disabled — emit no-op` at DEBUG.++No DB migrations, no schema changes — the rollback is one env var + restart. The legacy `event_waiter` collector/processor keeps trigger nodes firing because plugin producers still call `event_waiter.dispatch(...)` alongside `dispatch.emit(...)` (the dual-dispatch pattern stays until D2b retires the Redis-Streams branch).++Locked by `tests/test_event_framework_phase_a.py::TestEventFrameworkEnabledDefault::test_event_framework_enabled_defaults_true` (source-introspection check that the `Field(default=True, ...)` declaration is present) and `TestCanaryRegistryCoverage::test_seven_canary_types_registered` (every canary plugin opted in via `register_canary_trigger_type`).## What this framework doesdiff --git a/server/core/config.py b/server/core/config.pyindex 36c07f86..88766487 100644--- a/server/core/config.py+++ b/server/core/config.py@@ -77,14 +77,18 @@ class Settings(BaseSettings):temporal_graceful_shutdown_seconds: int = Field(default=30, env="TEMPORAL_GRACEFUL_SHUTDOWN_SECONDS", ge=1,)- # Wave 12 A6: feature flag for the Temporal-native event dispatch- # path (services/events/dispatch.py:emit). Default off in Phase A- # so the new dispatch + Signal-based consumer fan-out activates only- # for opt-in dogfooding before Phase B migrates plugin callsites.- # Phase A acceptance criterion is enabling this flag on a single- # canary callsite (e.g. whatsappReceive).+ # Wave 12 canary-flag default flipped to True (2026-05-15).+ # The Temporal-native event dispatch path+ # (services/events/dispatch.py:emit) is production-default;+ # consumer fan-out + WS broadcast both fire.+ #+ # Rollback procedure: set EVENT_FRAMEWORK_ENABLED=false in the+ # .env (or process env) and restart. dispatch.emit() reverts to a+ # pass-through no-op; legacy event_waiter.dispatch path keeps+ # working unchanged for non-canary triggers. See+ # docs-internal/event_framework.md § Rollback procedure.event_framework_enabled: bool = Field(- default=False, env="EVENT_FRAMEWORK_ENABLED",+ default=True, env="EVENT_FRAMEWORK_ENABLED",)# Persistence backend for the supervised Temporal cluster.diff --git a/server/tests/test_event_framework_phase_a.py b/server/tests/test_event_framework_phase_a.pyindex 01d9b5c5..3149b252 100644--- a/server/tests/test_event_framework_phase_a.py+++ b/server/tests/test_event_framework_phase_a.py@@ -143,6 +143,79 @@ class TestA4SearchAttributesSpec:assert required.issubset(set(attribute_names()))+class TestEventFrameworkEnabledDefault:+ """Wave 12 canary-flag default — flipped to ``True`` on 2026-05-15.++ The env var override (``EVENT_FRAMEWORK_ENABLED=false``) stays as the+ rollback channel. This test locks the new default so a future revert+ requires updating both core/config.py and this assertion (in the+ same commit) — preventing accidental flips.++ Source-introspection rather than ``Settings()`` instantiation because+ conftest stubs ``core.config.Settings`` as a MagicMock for the test+ session.+ """++ def test_event_framework_enabled_defaults_true(self):+ """The ``Field(default=True, env="EVENT_FRAMEWORK_ENABLED")`` line+ in core/config.py is the canary flag's production default."""+ from pathlib import Path++ config_src = (Path(__file__).parent.parent / "core" / "config.py").read_text(encoding="utf-8")+ # The default-True declaration MUST be present.+ assert 'default=True, env="EVENT_FRAMEWORK_ENABLED"' in config_src, (+ "event_framework_enabled default flipped to True in Wave 12 "+ "(2026-05-15). The declaration "+ '``Field(default=True, env="EVENT_FRAMEWORK_ENABLED")`` is '+ "missing from core/config.py. Use EVENT_FRAMEWORK_ENABLED=false "+ "in .env to opt out — not by reverting the default."+ )+ # And the legacy default-False must not be reintroduced.+ assert 'default=False, env="EVENT_FRAMEWORK_ENABLED"' not in config_src, (+ "event_framework_enabled reverted to default=False. Wave 12 "+ "flipped the default to True on 2026-05-15. Use the env var "+ "(EVENT_FRAMEWORK_ENABLED=false) for opt-out, not a code revert."+ )+++class TestCanaryRegistryCoverage:+ """Wave 12 — every canary trigger type opts into the+ ``services.deployment.canary_registry`` self-registration pattern.++ Locks the 7-canary surface that gated the flag default flip.+ Adding a new canary plugin must register via+ :func:`register_canary_trigger_type` from its ``__init__.py``;+ removing one needs an explicit edit here.+ """++ def test_seven_canary_types_registered(self):+ """All 7 production canary types are registered after plugin import."""+ # Triggers import side-effect: each canary plugin's __init__.py+ # calls register_canary_trigger_type(<type>).+ import nodes # noqa: F401+ from services.deployment.canary_registry import canary_trigger_types++ expected = frozenset({+ # Push triggers (Wave 12 C1)+ "webhookTrigger",+ "chatTrigger",+ "taskTrigger",+ "telegramReceive",+ "whatsappReceive",+ # Polling trigger (Wave 12 C2)+ "googleGmailReceive",+ # Cron trigger (Wave 12 C3)+ "cronScheduler",+ })+ actual = canary_trigger_types()+ missing = expected - actual+ assert not missing, (+ f"Canary registry missing expected types: {sorted(missing)}. "+ f"Plugin folder for each must call register_canary_trigger_type "+ f"from its __init__.py side-effect import."+ )++class TestA6DispatchEmitFeatureFlag:"""A6: ``emit`` is a no-op pass-through when the flag is off."""