Commit 87a70ad
fix: accept upstream SSE data without a space (#269)
## Summary
An upstream SSE field may omit the space after `data:`, but the live
HTTP reader currently discards that spelling before event normalization.
A valid unspaced stream consequently produces an empty completed
Responses output over HTTP and WebSocket, and the Messages loop misses
its tool call. An unspaced `data:[DONE]` also fails to stop a connection
that remains open.
Accept both spellings in the shared inference reader and retain the
existing `data: ` form for its consumers. Preserve the field value,
including additional whitespace, and recognize both exact completion
markers. This completes the live-transport boundary missing from the
decoder-only coverage in #236; the [SSE field grammar makes the space
optional](https://html.spec.whatwg.org/multipage/server-sent-events.html#parsing-an-event-stream).
Production changes are confined to `response_lines`: no new parser,
lifecycle state, public type, database schema, dependency, or delivery
queue. Already accepted data lines remain unchanged. Add coverage
through real HTTP/WebSocket clients, SQLite close/reopen and a
subsequent upstream continuation request, plus recorded Messages tool
rounds. Correct the search test fixture to use GET and verify the
successful tool result reaches the next model request.
## Test Plan
Exact commit `74b28f187a57f8d0bd41c2f884ea919b21a378f4` verified from a
clean detached worktree with a separate build directory, Rust 1.98.0,
and macOS:
- Against unchanged production on main `60126bb`, the final tests yield
seven intended failures and eleven passing controls. The isolated
patched build passes all eighteen. HTTP and WebSocket failures show
`response.completed` with `output: []`; Messages stops after one round
instead of two; the reader drops unspaced fields or times out after the
unspaced marker.
- Cover mixed spacing, empty values, Unicode, LF/CRLF, case-sensitive
field names, malformed JSON passthrough, meaningful extra whitespace,
exact and near-miss completion markers, the 256 KiB line boundary, and
chunk timeout behavior. Existing split-UTF-8, error, cancellation,
slow-consumer, and lifecycle tests also pass.
- `cargo test --locked --workspace --all-features`: 1,086 passed; eight
PostgreSQL tests and one existing doctest ignored.
- Forty-five fresh-process repeat runs pass: 40 reader boundary tests,
70 Messages tests, and 75 HTTP/WebSocket restart tests, including three
concurrent test processes.
- Workspace formatting, all-target/all-feature check and Clippy with
warnings denied; binary builds, launcher contracts, and source-install
CLI E2E with a development-profile wheel pass.
- Python: 111 passed, three installation-only skips. Cassette
validation: 113/113, 258 turns. No recorded cassette files were
modified.
- All applicable changed-file hooks pass. Remaining repository-wide
hooks pass; the known Apple Git hang in the all-files large-file hook
was avoided by running that hook on the complete changed-file set.
Validation uses local HTTP/database fixtures and existing recorded
streams. No live-model/GPU or new PostgreSQL execution is claimed. This
is an optional-space fix, not a claim of complete SSE framing
conformance.
Signed-off-by: Chuyue Wang <stevenwang0805@outlook.com>
Co-authored-by: Francisco Javier Arceo <arceofrancisco@gmail.com>1 parent 04ce90e commit 87a70ad
3 files changed
Lines changed: 381 additions & 10 deletions
File tree
- crates
- agentic-server-core
- src/executor
- tests
- agentic-server/tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
| 193 | + | |
| 194 | + | |
194 | 195 | | |
195 | 196 | | |
196 | 197 | | |
| |||
215 | 216 | | |
216 | 217 | | |
217 | 218 | | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
223 | 230 | | |
| 231 | + | |
224 | 232 | | |
225 | 233 | | |
226 | 234 | | |
| |||
239 | 247 | | |
240 | 248 | | |
241 | 249 | | |
| 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 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
242 | 367 | | |
243 | 368 | | |
244 | 369 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | | - | |
192 | | - | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
193 | 213 | | |
194 | 214 | | |
195 | 215 | | |
| |||
210 | 230 | | |
211 | 231 | | |
212 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
213 | 236 | | |
214 | 237 | | |
215 | 238 | | |
216 | 239 | | |
217 | 240 | | |
218 | 241 | | |
219 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
220 | 255 | | |
221 | 256 | | |
222 | 257 | | |
| |||
0 commit comments