Skip to content

fix(config): honor provider model and timeout defaults - #194

Merged
jddunn merged 2 commits into
framerslab:masterfrom
jipeng6036-del:fix/113-provider-default-config
Oct 9, 2026
Merged

jddunn merged 2 commits into
framerslab:masterfrom
jipeng6036-del:fix/113-provider-default-config

Conversation

@jipeng6036-del

@jipeng6036-del jipeng6036-del commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The configuration factory used defaultModel and timeout, which these providers never read. Pass the existing defaults as defaultModelId and requestTimeout, and remove OpenRouter's unused retry setting.

Linked issues

Fixes #113

Type of change

  • Bug fix

How this was verified

Exact baseline/patch verification on Linux, Node 22 and pnpm 10 with locked dependencies and Postgres:

  • All four regressions fail on the baseline for the expected missing-model/60000-vs-120000 assertions and pass on the patch.
  • Full suite: baseline 9,254 passed; patch 9,258 passed. Both have 64 skipped and 5 todo. Every original test outcome is unchanged.
  • Build, lint, typecheck, package exports, the built QuickJS smoke test, and all 117 Batch-1 tests pass on both revisions. Lint reports the same 262 warnings and no errors.

The suite uses the upstream CI argument layout (vitest run -- --coverage), which does not enable coverage; explicit coverage stops on both revisions because the locked dependencies lack @vitest/coverage-v8. Windows installation also stops at the native better-sqlite3 build without Visual Studio C++ tools. No coverage or Windows test pass is claimed.

Migration notes

None.

Checklist

  • Tests cover the changed behavior.
  • Docs are updated (no change needed; the existing description already states these defaults).
  • The title follows Conventional Commits.
  • No secrets or private data are included.
  • Every automated review thread is settled.
  • I have read this change and can explain every line.

Summary by Sourcery

Correct provider configuration defaults so model selection and request timeouts are applied as intended.

Bug Fixes:

  • Honor configured default model identifiers and request timeouts for OpenAI, OpenRouter, and Ollama providers.

Enhancements:

  • Remove the unused OpenRouter retry setting.

Tests:

  • Add regression coverage for provider default models and Ollama's extended request timeout.

Summary by CodeRabbit

  • Updates
    • Standardized provider settings for default models and request timeouts. OpenAI and OpenRouter retain 60-second timeouts, and Ollama retains a 120-second timeout and its local-model default.
    • OpenRouter no longer specifies an explicit retry count; OpenAI retains three retries.
  • Tests
    • Added checks for provider default models and Ollama’s request timeout.

@sourcery-ai

sourcery-ai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Fixes provider initialization by using the configuration keys that provider implementations actually consume, preserving the intended model and timeout defaults while removing an unused OpenRouter retry option. New tests validate all three default model IDs and Ollama’s extended request timeout without contacting external services.

File-Level Changes

Change Details Files
Align provider configuration keys with the properties consumed by the provider implementations.
  • Rename model defaults to defaultModelId for OpenAI, OpenRouter, and Ollama.
  • Rename timeout defaults to requestTimeout for OpenAI and Ollama.
  • Remove OpenRouter’s unused maxRetries setting.
src/core/config/AgentOSConfig.ts
Add regression coverage for configured model defaults and the Ollama timeout.
  • Initialize providers with mocked model-discovery network calls and verify each provider’s default model ID.
  • Intercept Ollama requests and verify the 120-second timeout is applied.
  • Restore Axios adapters, globals, and environment variables after each test.
src/core/config/__tests__/AgentOSConfig.providers.test.ts

Assessment against linked issues

Issue Objective Addressed Explanation
#113 Pass each provider's configured default model using the provider-supported defaultModelId key so model-less requests resolve to the intended defaults for OpenAI, OpenRouter, and Ollama. ✅
#113 Pass provider-supported timeout settings using requestTimeout, preserving the intended 60-second timeout for OpenAI and OpenRouter and 120-second timeout for Ollama. ✅
#113 Remove the unsupported OpenRouter maxRetries configuration rather than passing a setting that the provider does not read. ✅

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: framerslab/agentos/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 14ec6114-6a4f-45c3-affe-c103320055a7
📥 Commits

Reviewing files that changed from the base of the PR and between a5f0d51 and 2e7f20d.

📒 Files selected for processing (2)
  • src/core/config/AgentOSConfig.ts
  • src/core/config/__tests__/AgentOSConfig.providers.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

OpenAI, OpenRouter, and Ollama provider configurations now use defaultModelId and requestTimeout. Tests check the three default model IDs and Ollama’s /tags request timeout.

Changes

Provider configuration

Layer / File(s) Summary
Provider defaults and validation
src/core/config/AgentOSConfig.ts, src/core/config/__tests__/AgentOSConfig.providers.test.ts
OpenAI, OpenRouter, and Ollama now set defaultModelId and requestTimeout. OpenRouter no longer sets an explicit retry count. Tests check provider model defaults and confirm that Ollama /tags requests use a 120,000 ms timeout.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 2e7f2

Provider model and timeout defaults now take effect as intended. Tests cover the model defaults and the Ollama timeout. No merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check Passed The description includes all template sections, explains the configuration fix, links issue #113, identifies the change as a bug fix, documents verification results and limitations, states migration i…
Title check Passed The title is concise, follows Conventional Commits, and clearly describes the provider configuration fix for model and timeout defaults.
Linked Issues check Passed Issue #113 requires provider defaults to use defaultModelId and requestTimeout for OpenAI, OpenRouter, and Ollama. The diff applies these keys with the requested values. It removes OpenRouter's un…
Out of Scope Changes check Passed The changes stay within issue #113. The configuration edits correct the provider keys and remove the unsupported OpenRouter retry setting. The added tests verify the changed provider behavior. No unre…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Fix provider model and timeout defaults

🐞 Bug fix 🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• Pass model and timeout defaults using the keys OpenAI, OpenRouter, and Ollama actually read.
• Remove OpenRouter’s unused retry setting and add regression tests for provider initialization and
 Ollama’s timeout.
Diagram

graph TD
  Env["Environment"] --> Factory["Config factory"] --> Manager["Provider manager"] --> OpenAI["OpenAI provider"]
  Manager --> OpenRouter["OpenRouter provider"]
  Manager --> Ollama["Ollama provider"]
Loading
High-Level Assessment

Fixing the factory is the narrowest approach: the providers already support defaultModelId and requestTimeout. Adding aliases to each provider would broaden their contracts without addressing the incorrect configuration at its source.

Files changed (2) +68 / -7

Bug fix (1) +6 / -7
AgentOSConfig.tsUse supported provider default keys +6/-7

Use supported provider default keys

• Passes model defaults as 'defaultModelId' and timeouts as 'requestTimeout' for OpenAI, OpenRouter, and Ollama. Removes 'maxRetries' from OpenRouter because that provider does not read it.

src/core/config/AgentOSConfig.ts

Tests (1) +62 / -0
AgentOSConfig.providers.test.tsCover configured models and Ollama timeout +62/-0

Cover configured models and Ollama timeout

• Adds three provider-initialization assertions for default model IDs and one request assertion for Ollama’s 120-second timeout. Stubs model discovery and HTTP requests to keep the tests offline.

src/core/config/tests/AgentOSConfig.providers.test.ts

@sourcery-ai sourcery-ai 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.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/core/config/AgentOSConfig.ts" line_range="235" />
<code_context>
-        defaultModel: 'openai/gpt-4o-mini',
-        maxRetries: 3,
-        timeout: 60000,
+        defaultModelId: 'openai/gpt-4o-mini',
+        requestTimeout: 60000,
       },
</code_context>
<issue_to_address>
**Calls use unavailable OpenAI**

When openAI is not configured and OpenRouter or Ollama is the available provider, `createAgentOSConfig` leaves the system defaults as OpenAI, and `GMI.getModelAndProviderForLLMCall` chooses those before provider defaults. Calls therefore route to missing OpenAI or select an OpenAI model instead of the configured provider model.

Update the system defaults or model-selection logic so calls use the configured provider and its defaults when OpenAI is unavailable.

Also at `src/core/config/AgentOSConfig.ts:265`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread src/core/config/AgentOSConfig.ts Resolved
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (1) 📎 Requirement gaps (1) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Model-less gateway calls use costly model 📎 Requirement gap ≡ Correctness
Description
createModelProviderManagerConfig sets OpenRouter’s defaultModelId to openai/gpt-4o-mini, but
resolveModelOption reads the separate runtime registry, where the OpenRouter text default remains
openai/gpt-4o. When generateText is called without a model—either with provider: 'openrouter'
or with OpenRouter auto-detected—it passes the registry value onward explicitly, bypassing the
configured mini default.
Code

src/core/config/AgentOSConfig.ts[235]

+        defaultModelId: 'openai/gpt-4o-mini',
Evidence
The provider configuration names openai/gpt-4o-mini, while the independent runtime text-default
registry names openai/gpt-4o. For both provider-only and auto-detected model-less calls, public
model resolution reads the registry before generateText passes the resolved model to the provider,
so the provider’s configured default is not used.

OpenRouter model and timeout defaults take effect
src/core/config/AgentOSConfig.ts[228-236]
src/api/runtime/provider-defaults.ts[46-49]
src/api/model.ts[423-438]
src/api/generateText.ts[2010-2012]
src/api/runtime/provider-defaults.ts[54-57]
src/api/model.ts[424-434]
src/api/model.ts[412-420]
src/api/generateText.ts[2012-2012]
src/api/generateText.ts[2059-2063]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Model-less public OpenRouter calls resolve to `openai/gpt-4o` through the runtime registry instead of using the configured `openai/gpt-4o-mini` default.
## Fix Focus Areas
- src/core/config/AgentOSConfig.ts[228-236]
- src/api/runtime/provider-defaults.ts[46-49]
- src/api/runtime/provider-defaults.ts[54-57]
- src/api/model.ts[423-438]
## Recommended Fix
Set OpenRouter’s text default in the runtime registry to `openai/gpt-4o-mini` so it matches the provider configuration. Add a model-less `generateText` regression test that verifies the selected model, including provider-only and auto-detected OpenRouter resolution.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Gateway model mismatch goes untested 📘 Rule violation ≡ Correctness
Description
The new provider-default tests assert provider.defaultModelId after initialization but never make
a model-less completion request. Their only request-path assertion checks Ollama's model-list
timeout, leaving the OpenRouter public resolution path and the OpenAI and OpenRouter completion
timeouts unverified.
Code

src/core/config/tests/AgentOSConfig.providers.test.ts[R49-51]

+    const provider = manager.getProvider(providerId);
+    if (!provider) throw new Error(`Missing provider: ${providerId}`);
+    expect(provider.defaultModelId).toBe(modelId);
Evidence
The added assertions inspect a provider property and an Ollama model-list request. They do not
exercise the model-less public call where the configured OpenRouter default is bypassed.

AGENTS.md: Test Observable Behavior Through Real Paths: AGENTS.md: Test Observable Behavior Through Real Paths
src/core/config/tests/AgentOSConfig.providers.test.ts[42-60]
src/api/generateText.ts[2010-2012]
src/api/runtime/provider-defaults.ts[46-49]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The added tests inspect configured defaults without checking which model or timeout reaches a completion request.
## Fix Focus Areas
- src/core/config/__tests__/AgentOSConfig.providers.test.ts[42-60]
## Recommended Fix
Add focused tests that initialize providers from the factory configuration, issue model-less requests through the relevant real paths with mocked transport, and assert the outgoing models and request timeouts.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can show, collapse, or hide each part of a finding: code, evidence, and all

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

defaultModel: 'openai/gpt-4o-mini',
maxRetries: 3,
timeout: 60000,
defaultModelId: 'openai/gpt-4o-mini',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Model-less gateway calls use costly model 📎 Requirement gap ≡ Correctness

createModelProviderManagerConfig sets OpenRouter’s defaultModelId to openai/gpt-4o-mini, but
resolveModelOption reads the separate runtime registry, where the OpenRouter text default remains
openai/gpt-4o. When generateText is called without a model—either with provider: 'openrouter'
or with OpenRouter auto-detected—it passes the registry value onward explicitly, bypassing the
configured mini default.
Agent Prompt
## Issue description
Model-less public OpenRouter calls resolve to `openai/gpt-4o` through the runtime registry instead of using the configured `openai/gpt-4o-mini` default.

## Fix Focus Areas
- src/core/config/AgentOSConfig.ts[228-236]
- src/api/runtime/provider-defaults.ts[46-49]
- src/api/runtime/provider-defaults.ts[54-57]
- src/api/model.ts[423-438]

## Recommended Fix
Set OpenRouter’s text default in the runtime registry to `openai/gpt-4o-mini` so it matches the provider configuration. Add a model-less `generateText` regression test that verifies the selected model, including provider-only and auto-detected OpenRouter resolution.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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.

Confirmed that these are distinct paths. generateText calls resolveModelOption, and createProviderManager in src/api/model.ts builds a separate single-provider configuration; neither reads this factory's provider entries. The OpenRouter registry text default is also openai/gpt-4o on the base revision a5f0d51. This PR is limited to #113's unrecognized provider configuration keys. It does not change that public API registry or claim that all model-less API calls now select mini.

@jddunn
jddunn merged commit c5860d4 into framerslab:master Oct 9, 2026
9 checks passed
@jddunn

jddunn commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Thanks. Merged as c5860d4. Released in 0.13.10.

github-actions Bot pushed a commit that referenced this pull request Oct 9, 2026
## [0.13.10](v0.13.9...v0.13.10) (2026-10-09)

### fix

* **config:** honor provider model and timeout defaults (#194) ([c5860d4](c5860d4))

### docs

* fifth round of audit follow-ups to the guides (#171) ([e64d2d6](e64d2d6))
* **publication:** publish the structured reply guide (#191) ([a5f0d51](a5f0d51))
* the gmi() guide and agent({ runtime: 'gmi' }) (#192) ([e6c6305](e6c6305))
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.

AgentOSConfig passes provider config keys the providers never read

2 participants