Skip to content

fix: type background response stream reconnection - #106

Merged
qirh merged 12 commits into
mainfrom
perplexity/response-reconnect
Oct 15, 2026
Merged

qirh merged 12 commits into
mainfrom
perplexity/response-reconnect

Conversation

@qirh

@qirh qirh commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Add typed stream and starting_after retrieval parameters while preserving snapshot calls and the published retrieve(id, options) form. Document the expired-cursor fallback.

Behavior changes in responses.retrieve:

  • stream: true requires a typed starting_after containing a non-negative safe integer. Missing or invalid cursors and non-boolean stream flags raise TypeError before HTTP.
  • stream and starting_after are typed parameters. Values for them in a legacy or extra query are dropped.
  • Legacy request options preserve headers, retries, timeout, cancellation, idempotency, query settings, and allowlisted fetch settings, including the original dispatcher object. Fetch overrides for method, body, and headers remain rejected. Pass other request options as the third argument.
  • Only stream: true selects streaming in response and chat-completion creation.

A real background response resumed through 19 SSE events, including completion, and subsequent JSON retrieval returned a completed snapshot. A transport regression verifies dispatcher identity survives the legacy call form and that unsafe fetch overrides remain rejected.

@swatikumar-pplx swatikumar-pplx left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Tested: tsc/oxlint, tests pass; mock SSE confirmed typed events and backward-compatible retrieve(id, {headers}). Nit: stream: true without starting_after still type-checks.

@qirh
qirh force-pushed the perplexity/response-reconnect branch from 3e1b03a to 5ccd71b Compare October 14, 2026 18:01
@qirh
qirh changed the base branch from main to perplexity/decisions October 14, 2026 18:01
@qirh
qirh added this pull request to stack #108 October 14, 2026 18:01
@qirh
qirh force-pushed the perplexity/response-reconnect branch 3 times, most recently from e356d8e to f7ac676 Compare October 15, 2026 02:04
Base automatically changed from perplexity/decisions to main October 15, 2026 04:44
@qirh
qirh force-pushed the perplexity/response-reconnect branch from 14911f8 to b95c52b Compare October 15, 2026 04:44
@qirh
qirh merged commit 2d5bb13 into main Oct 15, 2026
6 checks passed
@qirh
qirh deleted the perplexity/response-reconnect branch October 15, 2026 05:01
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