Repository navigation
Commit a8773dd
authored
fix: identify reasoning-first content-plus-tool streams as assistant (#470)
## Fix
Identify the assistant on the first reasoning delta of OpenAI
content-plus-tool streams, including ordered blocks. LangChain otherwise
constructs a generic message and drops the parsed tool calls needed by
LangGraph TypeScript MCP Apps. Preserve configured role overrides and
later chunks.
Scope: two role additions in `src/helpers.ts`, plus four real HTTP
regression cases in the existing provider test and an Unreleased
changelog entry. No fixture, integration, dependency, or unrelated
protocol changes.
## Actual local red → green
Unchanged deployed app image
`014b6a344a9e42380067bc65dfb5fe6b2e5ff2e2cbd7d1630fc07534aea945f4` and
deployed aimock wrapper
`0bc93747cefeea3629a64226b20830ff815ddc38055b72fdc3b54a1da5ee9366`:
```json
{"key": "d6:langgraph-typescript/mcp-apps", "state": "red", "signal": {"slug": "langgraph-typescript", "featureType": "mcp-apps", "backendUrl": "http://127.0.0.1:11401", "url": "http://127.0.0.1:11401/demos/mcp-apps", "fixtureFile": "mcp-apps.json", "turns_completed": 0, "total_turns": 1, "failure_turn": 1, "turn_durations_ms": [], "errorDesc": "waitForTurnComplete: turn 1 did not complete within 30000ms (reason=surface-missing, runsFinished=1, count=1, attrPresent=true, runningNow=false, runStartCount=1)", "errorClass": "conversation-error", "diagnostics": {"userMsgCount": 1, "apiRequestCount": 3, "apiRequests": [{"url": "http://127.0.0.1:11401/api/copilotkit-mcp-apps", "duration": 12, "transferSize": 747, "status": 200}, {"url": "https://cdn.copilotkit.ai/announcements.json", "duration": 57, "transferSize": 0, "status": 0}, {"url": "http://127.0.0.1:11401/api/copilotkit-mcp-apps", "duration": 1183, "transferSize": 54267, "status": 200}], "pageErrors": [], "chatContainerExists": true, "url": "http://127.0.0.1:11401/demos/mcp-apps", "title": "LangGraph (TypeScript) - MCP Apps", "bodyTextSnippet": "Open Excalidraw and sketch a system diagram with a client, server, and database.\n\nSketching a client \u2192 server \u2192 database diagram in Excalidraw.\n\nDraw a flowchart\nSketch a system diagram\nAI can make mistakes. Please verify important information.", "assistantMsgCount": 1, "consoleLogs": ["[error] Access to fetch at 'https://cdn.copilotkit.ai/announcements.json' from origin 'http://127.0.0.1:11401' has been blocked by CORS policy: Response to preflight request doesn't pass access control check:", "[error] Failed to load resource: net::ERR_FAILED", "[warning] [CopilotKit Inspector] Failed to load announcement TypeError: Failed to fetch\n at g.fetch (<anonymous>:88:31)\n at e.fetchAnnouncement (http://127.0.0.1:11401/_next/static/chunks/8c3ed0a6.b9af3fe", "[error] Access to font at 'https://fonts.gstatic.com/s/plusjakartasans/v12/LDIoaomQNQcsA88c7O9yZ4KMCoOg4Ko20yygg_vb.woff2' from origin 'http://127.0.0.1:11401' has been blocked by CORS policy: Request header ", "[error] Failed to load resource: net::ERR_FAILED"], "requestFailures": ["GET https://cdn.copilotkit.ai/announcements.json => net::ERR_FAILED", "GET https://fonts.gstatic.com/s/plusjakartasans/v12/LDIoaomQNQcsA88c7O9yZ4KMCoOg4Ko20yygg_vb.woff2 => net::ERR_FAILED"]}}, "observedAt": "2026-09-18T13:18:57.163Z"}
```
Same shared D6 MCP Apps probe, unchanged app, freshly built candidate
aimock with unchanged deployed wrapper fixtures:
```json
{"key": "d6:langgraph-typescript/mcp-apps", "state": "green", "signal": {"slug": "langgraph-typescript", "featureType": "mcp-apps", "backendUrl": "http://127.0.0.1:11403", "url": "http://127.0.0.1:11403/demos/mcp-apps", "fixtureFile": "mcp-apps.json", "turns_completed": 1, "total_turns": 1, "turn_durations_ms": [3793]}, "observedAt": "2026-09-18T13:21:28.289Z"}
```
An isolated two-line overlay on the exact deployed wrapper also passes
the same D6, establishing causality separately from newer aimock main.
Native Playwright screenshot visually confirms Client → Server →
Database in the Excalidraw iframe. Runtime capture contains
ACTIVITY_SNAPSHOT and RUN_FINISHED.
## Provider red → green
Four new real HTTP tests (legacy/ordered blocks × default/custom role)
failed because the first reasoning delta omitted role, then passed. All
85 targeted provider controls pass. Official Dockerfile builds locally
with desktop-linux. Typecheck, formatter, lint pass. Full suite: 224
files passed, 1 existing skipped; 7,292 tests passed, 49 existing
skipped. Initial suite with a shared dependency symlink failed unrelated
adoption entrypoint tests; replacing the symlink with a proper offline
lockfile install resolved all failures without code changes. Final test
run used Node 22.16.0 and four workers.
No staging acceptance or deployment claim. No pinning in staging.3 files changed
Lines changed: 62 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1028 | 1028 | | |
1029 | 1029 | | |
1030 | 1030 | | |
1031 | | - | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
1032 | 1040 | | |
1033 | 1041 | | |
1034 | 1042 | | |
| |||
1153 | 1161 | | |
1154 | 1162 | | |
1155 | 1163 | | |
1156 | | - | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
1157 | 1173 | | |
1158 | 1174 | | |
1159 | 1175 | | |
| |||
0 commit comments