Skip to content

fix: withConfig creates independent HTTP client from merged config (Closes #405) - #459

Merged
David-patrick-chuks-02 merged 11 commits into
Lilly-Protocol:mainfrom
Zhiyilang074811:fix-withconfig-405
Sep 6, 2026
Merged

fix: withConfig creates independent HTTP client from merged config (Closes #405)#459
David-patrick-chuks-02 merged 11 commits into
Lilly-Protocol:mainfrom
Zhiyilang074811:fix-withconfig-405

Conversation

@Zhiyilang074811

Copy link
Copy Markdown
Contributor

Summary

Fixes \LilySdk.withConfig\ to create a new HTTP client from the merged config instead of reusing the parent instance's transport. This ensures multi-tenant scenarios route requests to the correct baseUrl and credentials.

Changes

  • src/sdk.ts: Removed the duplicate/broken \withConfig\ implementation that passed \ his.httpClient\ to the new instance. Kept only the correct implementation that creates a fresh SDK instance without sharing the parent's transport.
  • tests/sdk-withconfig-routing.test.ts: Added integration tests verifying:
    • Derived instance routes requests through overridden baseUrl and credentials
    • Original instance continues routing to its own baseUrl/credentials

Acceptance Criteria

  • \sdk.withConfig({ baseUrl: 'https://tenant.example.com', apiKey: 'tenant-key' }).agents.list()\ sends requests to tenant.example.com with tenant-key
  • Overriding only apiKey/authToken changes auth headers on the wire
  • Original instance still routes to its own baseUrl/credentials
  • Explicitly injected custom HttpClient behavior preserved (no httpClient passed = new one created from config)

Closes #405

@Zhiyilang074811

Copy link
Copy Markdown
Contributor Author

Hi! Friendly ping — open for a couple of days, all checks passing. Ready for review when convenient. Thanks! 🙏

@Zhiyilang074811

Copy link
Copy Markdown
Contributor Author

Hi! Friendly ping — open for ~2 days, all checks passing. Ready for review when convenient. Thanks! 🙏

@David-patrick-chuks-02
David-patrick-chuks-02 merged commit b587a25 into Lilly-Protocol:main Sep 6, 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.

[Bounty: $90] Make LilySdk.withConfig route requests through the overridden baseUrl and credentials

3 participants