Skip to content

[#281] Add provider-agnostic deferred tool loading - #282

Draft
superdav42 wants to merge 2 commits into
trunkfrom
feature/gh281-deferred-tool-loading
Draft

[#281] Add provider-agnostic deferred tool loading#282
superdav42 wants to merge 2 commits into
trunkfrom
feature/gh281-deferred-tool-loading

Conversation

@superdav42

@superdav42 superdav42 commented Aug 26, 2026

Copy link
Copy Markdown
Member

Summary

  • add an opt-in deferLoading flag to function declarations while preserving eager-loading defaults and serialized compatibility
  • add native tool-search configuration and model requirements so unsupported models are rejected when deferred loading is requested
  • add provider-scoped opaque message data so provider-native discovery items can be preserved in order without exposing provider wire formats in core

Scope

This PR defines the provider-agnostic contract only. OpenAI and Anthropic request serialization, response parsing, and model metadata updates remain provider-repository follow-ups. Client-executed tool discovery is intentionally excluded.

Implementation notes

  • Existing FunctionDeclaration calls remain valid, and deferLoading: false is omitted from serialized output.
  • PromptBuilder::usingToolSearch() explicitly requests native discovery.
  • Any deferred declaration also infers a required toolSearch model option, preventing silent eager fallback.
  • ProviderData records the originating provider ID with an opaque serializable payload; providers must validate ownership before replay.

Verification

  • composer test:unit — 1,181 tests, 4,350 assertions passed
  • composer lint — PHPCS and PHPStan passed

Resolves #281


aidevops.sh v3.32.290 plugin for OpenCode v1.18.23 with gpt-5.6-sol spent 2d 9h and 1,876,806 tokens on this with the user in an interactive session.

@superdav42 superdav42 added the origin:interactive Created by interactive user session label Aug 26, 2026
@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.05%. Comparing base (0a9a1b3) to head (ac965d2).

Additional details and impacted files
@@             Coverage Diff              @@
##              trunk     #282      +/-   ##
============================================
+ Coverage     86.60%   87.05%   +0.44%     
- Complexity     1335     1356      +21     
============================================
  Files            68       69       +1     
  Lines          4314     4402      +88     
============================================
+ Hits           3736     3832      +96     
+ Misses          578      570       -8     
Flag Coverage Δ
unit 87.05% <100.00%> (+0.44%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

origin:interactive Created by interactive user session

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add provider-agnostic deferred tool loading and tool discovery support

1 participant