Skip to content

fix(combo): default chaos SSE to comment-only for OpenAI-compatible clients - #10128

Merged
diegosouzapw merged 5 commits into
diegosouzapw:release/v3.8.50from
herjarsa:fix/chaos-sse-compat
Aug 13, 2026
Merged

diegosouzapw merged 5 commits into
diegosouzapw:release/v3.8.50from
herjarsa:fix/chaos-sse-compat

Conversation

@herjarsa

Copy link
Copy Markdown
Contributor

Problem

auto/chaos and auto/best-chaos combos dispatch N models in parallel via handleChaosChat, which emits a custom SSE event event: omni-chaos-part with a data: payload carrying type: "omni-chaos-part" metadata for every panel model.

OpenAI SDK validators and @ai-sdk/openai-compatible expect every SSE data: line to match either {choices:[...]} (a chunk) or {error:...}. The custom omni-chaos-part event's data: line triggers a schema validation invalid_union error on every auto/chaos stream, even for clients that never asked for the multi-panel protocol.

Fix

Make the custom event opt-in via stream_options.include_chaos_parts:

Client behavior Before this fix After this fix
Default (no opt-in) event: omni-chaos-part + data: {type:"omni-chaos-part",...} emitted per model — breaks OpenAI SDK Only SSE comment : chaos N ok/fail model emitted per model (comments are ignored by all SSE parsers per spec)
Opt-in (stream_options.include_chaos_parts: true) Same as before (always-on) Full custom event emitted for protocol-aware IDEs that split panels

Changes

  • chaosEngine.ts: serializeChaosPart(part, isFinal, emitCustomEvent = false) — third param controls custom event emission. handleChaosChat reads body.stream_options?.include_chaos_parts and passes the flag through.
  • chaosEngine.test.ts: 3 new test cases covering comment-only default, opt-in custom event, and error-all-fail path.

Testing

  • 14/14 tests pass (chaosEngine.test.ts + chaosVirtualCombo.test.ts)
  • Type-check clean on touched files (no new errors)

Impact

  • Backward-compatible: default behavior changes from "always emit custom event" to "comment-only". No existing client that doesn't use include_chaos_parts will see custom events (they were already ignored by those clients).
  • No breaking change to protocol-aware clients: they must now opt in via stream_options.include_chaos_parts: true.

diegosouzapw and others added 4 commits August 8, 2026 00:08
…ouzapw#189, diegosouzapw#190)

Bumps: nanoid ^3.3.17 (was transitive, now overridden), dompurify ^3.4.13
(with monaco-editor scoped override). Closes Dependabot diegosouzapw#189, diegosouzapw#190.

Remaining diegosouzapw#182-diegosouzapw#188 (js-yaml + mermaid) already closed by diegosouzapw#9651 merge —
awaiting Dependabot re-scan.

npm audit → 0 vulnerabilities.
…egosouzapw#190

Closes Dependabot diegosouzapw#189 (dompurify 3.4.13) and diegosouzapw#190 (nanoid 3.3.17). npm audit → 0.
_tasks is a SEPARATE nested git repo (gitignored). The pattern _tasks/ (trailing
slash) ignores only a directory, not a SYMLINK named _tasks. A self-referential
_tasks symlink can slip in via git add -A and, once pulled, checkout materializes
it over the real _tasks repo (destroying plans/specs/hands-off). Anchored /_tasks
ignores the symlink too, preventing re-capture.
@herjarsa
herjarsa requested a review from diegosouzapw as a code owner August 11, 2026 19:13
@diegosouzapw
diegosouzapw changed the base branch from main to release/v3.8.50 August 13, 2026 08:36
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
@diegosouzapw
diegosouzapw merged commit a2e5bd1 into diegosouzapw:release/v3.8.50 Aug 13, 2026
14 of 16 checks passed
@diegosouzapw

Copy link
Copy Markdown
Owner

Merged into release/v3.8.50 — thank you @herjarsa for the contribution! It was validated on a combined merge-train (static gates + affected tests + vitest) together with 30 sibling PRs before landing.

muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…lients (diegosouzapw#10128)

* fix(deps): bump nanoid, dompurify for 2 new Dependabot alerts (diegosouzapw#189, diegosouzapw#190)

Bumps: nanoid ^3.3.17 (was transitive, now overridden), dompurify ^3.4.13
(with monaco-editor scoped override). Closes Dependabot diegosouzapw#189, diegosouzapw#190.

Remaining diegosouzapw#182-diegosouzapw#188 (js-yaml + mermaid) already closed by diegosouzapw#9651 merge —
awaiting Dependabot re-scan.

npm audit → 0 vulnerabilities.

* fix(repo): harden .gitignore to also ignore a _tasks symlink (/_tasks)

_tasks is a SEPARATE nested git repo (gitignored). The pattern _tasks/ (trailing
slash) ignores only a directory, not a SYMLINK named _tasks. A self-referential
_tasks symlink can slip in via git add -A and, once pulled, checkout materializes
it over the real _tasks repo (destroying plans/specs/hands-off). Anchored /_tasks
ignores the symlink too, preventing re-capture.

* fix(combo): default chaos SSE to comment-only for OpenAI-compatible clients

---------

Co-authored-by: diegosouzapw <diegosouzapw@users.noreply.github.com>
Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouza.pw@outlook.com>
Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>
Co-authored-by: herjarsa <herjarsa@users.noreply.github.com>
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
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.

2 participants