Todo 45.4 Event Kernel Quality Boundaries Plan
Status: done
Result
Preserved EventAgent default/explicit configuration semantics, isolated plugin mutations, encapsulated validator state, and normalized non-JSON handler payloads through kernel and EventAgent integrations.
Goal
Close five reproducible quality-review gaps before treating the generic event kernel as the stable foundation for runtime modes and built-in plugins.
Scope
- Preserve configured
EventAgent.params.extra_body when a call does not provide an override.
- Detect missing required arguments nested under composed JSON Schemas such as
anyOf and oneOf, so eligible incomplete input can use fallback.
- Isolate nested resolved arguments from handler mutation and preserve consistent result/audit values.
- Stop exposing the registry's mutable internal validator object.
- Reject handler dictionaries that are not strict JSON-serializable and normalize them to
HANDLER_ERROR.
Boundaries
- Do not add direct ChatAgent tool mode, built-in event plugins, batch scheduling, or new UI behavior.
- Preserve
extra_body={} as an explicit override; only None means use the configured default.
- Do not broaden fallback to complete-invalid input; only recursively discovered missing-required errors qualify.
- Keep event payloads as dictionaries and reject, rather than coerce, sets, arbitrary objects, NaN, or Infinity.
Files
- Modify:
src/agent_lab/application/event_agent.py
- Modify:
src/agent_lab/application/events/kernel.py
- Modify:
src/agent_lab/application/events/registry.py
- Modify:
tests/test_event_agent.py
- Modify:
tests/test_event_kernel.py
Requirement Execution Loop
Plan
- Add one RED regression per reviewed issue and verify each fails for the reported reason.
- Fix configuration propagation and composed-schema error classification without changing valid call behavior.
- Deep-copy arguments at handler/result boundaries and encapsulate validator usage inside the registry.
- Validate handler payloads with the same strict JSON rules used for arguments.
- Run focused tests, full tests, diff checks, and renewed specification/quality reviews.
Act
- Call
EventAgent.handle() without extra_body while constructor params contain a marker; assert the provider receives the marker. Also assert explicit {} remains {}.
- Use
anyOf/oneOf branches containing required; assert missing data invokes fallback once, while nested complete-invalid data does not.
- Mutate a nested handler argument; assert the original request,
EventResult.arguments, and raw_arguments remain consistent and unchanged.
- Replace public validator retrieval with a registry-owned validation operation; prove callers cannot mutate future validation behavior.
- Return payloads containing
object(), set, NaN, and Infinity; assert stable HANDLER_ERROR and no downstream json.dumps() failure.
Observe
Confirm the kernel remains generic and deterministic-first while all externally observable results are JSON-safe, immutable from plugin side effects, and consistent for audit/comparison metrics.
Update
- Re-run final Todo 45 specification and quality reviews.
- Mark Todos 45 through 45.4 done only after fresh full verification.
Verification
UV_CACHE_DIR=.uv-cache uv run pytest tests/test_event_kernel.py tests/test_event_agent.py -q
UV_CACHE_DIR=.uv-cache uv run pytest
git diff --check