Skip to content

[codex] emit outbound events for streamed results#29

Merged
DorianZheng merged 1 commit intomainfrom
codex/stream-agent-intermediate-results
Apr 9, 2026
Merged

[codex] emit outbound events for streamed results#29
DorianZheng merged 1 commit intomainfrom
codex/stream-agent-intermediate-results

Conversation

@DorianZheng
Copy link
Copy Markdown
Member

What changed

This PR makes AgentLite expose streamed outbound messages through the SDK event surface.

It adds a shared outbound send helper in AgentImpl that:

  • normalizes outbound text with the existing outbound formatter
  • sends the message through the resolved channel
  • emits the message.out event with the final text and timestamp

Existing internal outbound paths now use that helper, including streamed container output, scheduler-delivered messages, IPC-delivered messages, and remote-control responses.

It also adds regression tests covering message.out emission and ensuring internal-only content stays suppressed.

Why it changed

The runtime already supported intermittent agent output at the container level, but SDK consumers did not get a clean outbound event when those chunks were actually delivered. message.out was part of the public event types, but the implementation did not emit it.

Impact

Consumers can now subscribe to agent.on('message.out', ...) and observe partial/intermittent outbound messages consistently across the existing send paths.

Root cause

Outbound delivery logic was duplicated across a few internal paths and bypassed the public message.out event entirely.

Validation

  • npm test -- --run src/message-events.test.ts src/container-runner.test.ts
  • npm test -- --run src/task-scheduler.test.ts
  • repository commit hook ran prettier --write "src/**/*.ts"

@DorianZheng DorianZheng marked this pull request as ready for review April 9, 2026 15:34
@DorianZheng DorianZheng merged commit 7d0a733 into main Apr 9, 2026
2 checks passed
@DorianZheng DorianZheng deleted the codex/stream-agent-intermediate-results branch April 9, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant