todo-43.1-typed-event-consumer-regression.md 2.8 KB

Todo 43.1 Typed Event Consumer Regression Plan

Status: done

Result

  • Runtime now consumes typed ChatAgent text_event output.
  • EventAgent now consumes typed provider provider_tool_call output.
  • Realistic fixtures exposed and fixed the legacy consumer mismatch.
  • Todo 43.2 completed strict source isolation and remaining fixture migration.

Goal

Restore the existing dual-agent production paths after Todo 43 introduced typed stream kinds but legacy consumers and fixtures still listened for kind="event".

Scope

  • Runtime consumes text_event from ChatAgent and preserves its name-only handoff behavior.
  • EventAgent argument generation consumes provider_tool_call and preserves provider-generated arguments.
  • Production-like test fixtures emit typed kinds instead of the legacy compatibility constructor.
  • Keep StreamItem.event(...) only as a temporary compatibility API for unrelated callers; new/updated production-path tests must not use it.
  • Do not add direct ChatAgent tool routing.

Files

  • Modify: src/agent_lab/application/runtime.py
  • Modify: src/agent_lab/application/event_agent.py
  • Modify: tests/test_debug_runtime.py
  • Modify: tests/test_event_agent.py

Plan

Plan

  1. Add or update tests so realistic ChatAgent fixtures emit text_event and EventAgent provider fixtures emit provider_tool_call.
  2. Verify tests fail because Runtime/EventAgent still consume only event.
  3. Change only the two legacy consumer checks to the correct typed kinds.
  4. Run focused and full regressions to prove no legacy path was silently lost.

Act

  • Update the minimum runtime fixture that drives text-event handoff to use StreamItem.text_event(...).
  • Update EventAgent LLM argument fixtures to use StreamItem.provider_tool_call(...).
  • Add explicit assertions that Runtime enqueues/executes the text event and EventAgent executes provider arguments without falling back.
  • Run the focused tests and confirm expected RED failures before production changes.
  • Update Runtime and EventAgent kind checks.
  • Re-run focused and full tests.

Observe

Confirm that:

  • Runtime receives a real typed text event and still emits chat_event_detected plus tool execution.
  • EventAgent receives a real provider tool call and returns its arguments.
  • No direct ChatAgent tool transcript behavior appears in this fix.
  • The compatibility constructor is not used to hide production-path type mismatches in the updated tests.

Update

  • Mark 43 and 43.1 done only after spec and quality reviews pass.
  • Commit this repair separately with the regression and compatibility risk in the message.

Verification

  • uv run pytest tests/test_debug_runtime.py tests/test_event_agent.py tests/test_openai_stream_parser.py -q
  • uv run pytest
  • git diff --check