Skip to content

P2: Validate adapter event task IDs before persisting #10

@vamgan

Description

@vamgan

Problem

runTask() persists adapter events exactly as emitted.

Relevant code:

  • src/runtime.ts:189-193
  • contract test helper: src/testing.ts:59-66

If an adapter emits an event for a different taskId, the event is stored under that other task while logs are appended under the local task ID.

Impact

A buggy adapter can corrupt another task's event stream or make logs/events inconsistent.

Suggested fix

In RuntimeService, either:

  • validate event.taskId === task.id and reject/fail the task, or
  • normalize emitted events with { ...event, taskId: task.id } before persistence.

Keep adapter contract tests, but do not rely on adapter tests as the only runtime isolation guard.

Acceptance criteria

  • Runtime tests cover an adapter emitting a mismatched task ID.
  • No event can be persisted to a different task during a run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions