Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Jan 20, 2026

Summary

  • unify stream-error payload/event construction via shared sendMessageError helpers
  • refactor StreamManager failure handling to build + persist a single payload
  • update AIService + mock stream player emitters to reuse the shared error event
  • add tests for error event construction + API key hint coercion

Why

  • keep error shaping consistent across emitters while preserving existing behavior
  • reduce drift when new error emitters are added or errorType rules evolve

Implementation notes

  • stream error payloads now flow through StreamErrorPayload helpers (createErrorEvent, coerceStreamErrorTypeForMessage)
  • StreamManager splits payload building from persistence to keep ordering identical

Testing

  • bun test src/node/services/utils/sendMessageError.test.ts
  • bun test src/node/services/agentSession.preStreamError.test.ts
  • make typecheck
  • make static-check

Regression Risk

Low — refactor-only helper reuse.


Generated with mux • Model: openai:gpt-5.2-codex • Thinking: xhigh • Cost: $21.13

- centralize StreamErrorMessage shaping helper

- simplify AgentSession stream-error emission

---

_Generated with `mux` • Model: `openai:gpt-5.2-codex` • Thinking: `xhigh` • Cost: `9.70`_
- centralize error event construction across emitters

- consolidate StreamManager failure payload handling

---

_Generated with `mux` • Model: `openai:gpt-5.2-codex` • Thinking: `xhigh` • Cost: `1.13`_
@ammario ammario merged commit 5d31642 into main Jan 21, 2026
22 checks passed
@ammario ammario deleted the stream-error-dry branch January 21, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants