Skip to content

fix(cursor): normalize and smooth agent streams#133

Open
ssakone wants to merge 2 commits into
kaitranntt:mainfrom
ssakone:fix/cursor-stream-tool-normalization
Open

fix(cursor): normalize and smooth agent streams#133
ssakone wants to merge 2 commits into
kaitranntt:mainfrom
ssakone:fix/cursor-stream-tool-normalization

Conversation

@ssakone

@ssakone ssakone commented Jul 11, 2026

Copy link
Copy Markdown

Summary

  • emit Cursor thinking as OpenAI reasoning_content and keep reasoning separate in non-streaming responses
  • normalize whitespace and control characters in tool call IDs so generated calls match returned tool results
  • report non-stream token usage and avoid duplicate [DONE] markers in OpenAI streams
  • coalesce bursty protobuf deltas at a 16 ms display cadence while preserving immediate first output and flushing before tool-call boundaries

Test plan

  • gofmt -w internal/runtime/executor/cursor_executor.go internal/runtime/executor/cursor_executor_test.go
  • go test ./...
  • go test -race ./internal/runtime/executor -run 'Test(CursorStreamCoalescer|NormalizeToolCallID)' -count=10
  • go build -o test-output ./cmd/server
  • validate OpenAI and Anthropic streaming tool calls against an isolated server
  • benchmark direct and downstream-proxied streams for cadence, first output, and completion latency

ssakone added 2 commits July 11, 2026 00:57
Emit structured reasoning, sanitize tool-call identifiers, avoid duplicate stream terminators, and report non-stream usage consistently.
Coalesce bursty protobuf updates at display cadence while preserving immediate first output and tool-call ordering.
@ssakone ssakone changed the title fix(cursor): normalize reasoning and tool streams fix(cursor): normalize and smooth agent streams Jul 11, 2026
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.

1 participant