Skip to content

Public URLSession configuration seam on API - #44

Merged
odrobnik merged 2 commits into
mainfrom
agent/issue-43
Oct 30, 2026
Merged

odrobnik merged 2 commits into
mainfrom
agent/issue-43

Conversation

@odrobnik

Copy link
Copy Markdown
Contributor

Resolves #43.

Added configuration: / streamConfiguration: (both URLSessionConfiguration? = nil) to API.init and the OpenAI, ChatGPTCodex, Anthropic, GoogleAPI and LMStudio initialisers, plus a public use(sessionConfiguration:streamConfiguration:). With neither argument given, the 360 s / 600 s defaults are unchanged. If only configuration is given, the stream session derives from a copy of it with 600 s timeouts, so one stub covers both sessions. Anthropic streaming now uses streamSession instead of a private session. New PublicSessionSeamTests uses plain import Providers to stub generateImages and createResponseStream. ChatGPTCodexLiveTests no longer needs @testable. Build, the relevant tests and swiftlint --strict pass locally on macOS only; Linux, Windows and Android are unchecked. Not changed: the many URLSession.shared calls in the Assistants, Conversations and Traces extensions, and the Google embeddings call, still bypass the seam; moving them to session would change their timeouts. OpenAIResponsesWebSocket also keeps its own session.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T09:48:06.985372Z b8d4549 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b8d454977b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/Providers/API/API.swift Resolved
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@odrobnik odrobnik left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Follow-up review of f766808. The session pair is now guarded by a lock, so use(...) is safe while requests are starting. The configuration: / streamConfiguration: parameters are passed through the OpenAI, ChatGPTCodex, Anthropic, GoogleAPI and LMStudio initialisers. OllamaAPI inherits the base init, so it gets the seam without changes. Defaults are unchanged: with neither argument given, the 360 s / 600 s sessions are built as before. When only configuration is given, the stream session derives from a copy of it with 600 s timeouts, so one stub covers both. Anthropic streaming now goes through streamSession, so the seam covers it. The new tests import Providers without @testable and stub generateImages and createResponseStream, which meets the acceptance criteria. I did not build or run anything; all six CI jobs are green. I found no remaining issues. The URLSession.shared calls the description lists as out of scope are a known limit.

👍 No findings.

Reviewed by Claude

@odrobnik
odrobnik merged commit ecbf3bc into main Oct 30, 2026
6 checks passed
@odrobnik
odrobnik deleted the agent/issue-43 branch October 30, 2026 10: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.

Providers: public URLSession configuration seam on API (stub/proxy HTTP without @testable)

1 participant