CopilotKit / CopilotKit/outpost
Pathfinder: parseJsonRpc joins multiple SSE data: lines with empty string
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7
- Forks
- 3
- Avg merge
- 7d 16h
- Merged PRs (30d)
- 15
Description
Spun out of the #112 review (non-blocking, edge case).
parseJsonRpc concatenates all data: payloads with ''. Per the SSE spec, data lines within one event join with \n, and separate events are distinct messages. So a reply chunked across multiple data: lines, or one carrying a notification plus the response, would concatenate into invalid JSON and throw. Harmless for the real server's current single-line, single-event tools/call reply (and it's live-tested), but brittle if the server ever streams/chunks.
Fix direction: parse per-event (split on blank lines), take the last data: event's payload, or join a single event's data lines with \n. Add a test with a multi-event / multi-data: body.
File: packages/outpost/ai/src/pathfinder.ts (parseJsonRpc).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in packages/outpost/ai/src/pathfinder.ts at parseJsonRpc and review how SSE data lines and event boundaries are currently handled. Add coverage for a multi-event or multi-data-line body, ensuring event payloads are separated correctly and data lines within one event join with newlines; done means the JSON-RPC response parses without invalid concatenation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 75/100