René's URL Explorer Experiment


Title: feat(agent): add Ollama as an AI provider by sj-unit72 · Pull Request #574 · ycode/ycode · GitHub

Open Graph Title: feat(agent): add Ollama as an AI provider by sj-unit72 · Pull Request #574 · ycode/ycode

X Title: feat(agent): add Ollama as an AI provider by sj-unit72 · Pull Request #574 · ycode/ycode

Description: Summary Adds Ollama as a fifth AI provider, so the agent can run against Ollama Cloud or a self-hosted/OpenAI-compatible endpoint (LM Studio, vLLM, …). Discussed in #573. Ollama serves OpenAI-compatible Chat Completions under /v1, so this reuses the existing createChatCompletionsProvider rather than adding a new client — the same implementation openai.ts and xai.ts are built on. Changes New provider (lib/agent/providers/ollama.ts) wrapping the shared Chat Completions provider. The endpoint is threaded through from settings, not hardcoded. Settings card with the three fields any OpenAI-compatible endpoint needs: API endpoint URL (defaults to https://ollama.com/v1, free-text so a LAN address works), API key (optional — a local server doesn't authenticate), and model name (free-text). configured is endpoint+model based, not key based, so a keyless local Ollama isn't reported as unconfigured. Provider factory widened to (apiKey, options) and the resolved ai_ollama_base_url plumbed through, so the provider receives the user's endpoint. Free-form model ids resolve. providerOfModel / isAllowedModel became providerOfModelFrom / isAllowedModelFrom, taking the options list explicitly, and the project's Ollama model is injected as a dynamic AgentModelOption — so an arbitrary id (e.g. qwen3:8b) resolves for the picker and the allowlist. No module-level mutable state. Connection test hits ${baseUrl}/models (works with no key) and gates the returned model list, turning a typo'd model name into a clear error. Validates Ollama Cloud keys against the chat endpoint, because /v1/models returns 200 with the full catalog even for an invalid key. Chat route: tolerate client disconnects mid-run. Enqueueing into a closed controller threw ERR_INVALID_STATE inside the run's try/catch, logging a bogus Agent run failed: Controller is already closed. Events for a dead reader are now dropped. Chat route: run deadline actually enforced. MAX_RUN_MS was only checked between turns, so a provider request that stalled mid-turn (no bytes, no error) blocked the loop indefinitely — observed hung for 103 minutes against a 29-minute budget, with the browser holding its SSE connection open and the provider showing no usage. An AbortController armed for MAX_RUN_MS now cancels the in-flight fetch, and the run ends with the resumable time-limit message instead of a silent done. The timer is cleared on every exit path. Tests under scripts/ for base-URL normalization, streaming + tool-call emission, multi-turn tool round-trip, per-request resolution isolation across concurrent tenants, Ollama-only provider resolution, key validation, and both run-deadline paths (hung request aborts; healthy stream untouched). Test plan npm run lint and npx tsc --noEmit — both clean. Against a local Ollama (http://localhost:11434, no key): scripts/verify-ollama-provider.ts — 9/9, including a real tool_use from the 120-tool registry. scripts/verify-ollama-roundtrip.ts — 6/6: base-URL normalization (9/9 cases), two-turn tool call where the second turn does not re-call the tool, and an unreachable endpoint throwing rather than hanging. scripts/verify-ollama-resolution-isolation.ts — two concurrent tenants each resolve their own model; all 10 shipped models still resolve; an unknown id resolves to null rather than a default provider. Against Ollama Cloud with a real key: settings → Agent → Ollama → Test connection; then send a message in the builder and confirm a reply streams. Verify the keyless local path: leave the API key empty, endpoint http://localhost:11434/v1, and confirm the card reports configured and the connection test passes. Confirm an invalid Ollama Cloud key now fails the connection test (it previously passed, because /v1/models accepts any key). Confirm the credential/cost UI: no cost badge for Ollama models, and the key field is optional for Ollama only. Run-deadline regression: scripts/verify-run-deadline.ts (hung request → resumable error at the deadline) and scripts/verify-run-deadline-healthy.ts (healthy stream completes untouched).

Open Graph Description: Summary Adds Ollama as a fifth AI provider, so the agent can run against Ollama Cloud or a self-hosted/OpenAI-compatible endpoint (LM Studio, vLLM, …). Discussed in #573. Ollama serves OpenAI-compa...

X Description: Summary Adds Ollama as a fifth AI provider, so the agent can run against Ollama Cloud or a self-hosted/OpenAI-compatible endpoint (LM Studio, vLLM, …). Discussed in #573. Ollama serves OpenAI-compa...

Opengraph URL: https://github.com/ycode/ycode/pull/574

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:358caeef-702b-f2ce-278b-733330ad89fa
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idAAF4:2966C8:6928A:85B6B:6AFE420A
html-safe-nonce47a0edb0c5ebb60bbf3ae234ef9f425cfa1d4a28bd43419dfaed7a58c16fac5f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQUY0OjI5NjZDODo2OTI4QTo4NUI2Qjo2QUZFNDIwQSIsInZpc2l0b3JfaWQiOiI2NjA5NDIxMTU4MDkxNDczNDE4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmace6a39a3b72ded971a705f80f669c86d94e096d2efb19f770b40d40c0f806a102
hovercard-subject-tagpull_request:4619711225
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/ycode/ycode/pull/574/files
twitter:imagehttps://avatars.githubusercontent.com/u/19424303?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/19424303?s=400&v=4
og:image:altSummary Adds Ollama as a fifth AI provider, so the agent can run against Ollama Cloud or a self-hosted/OpenAI-compatible endpoint (LM Studio, vLLM, …). Discussed in #573. Ollama serves OpenAI-compa...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonef1a5901e2377b0af2a0b303f9528678f1475d04b9219dca1e993344196eaa07c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/ycode/ycode git https://github.com/ycode/ycode.git
octolytics-dimension-user_id65892203
octolytics-dimension-user_loginycode
octolytics-dimension-repository_id1165452593
octolytics-dimension-repository_nwoycode/ycode
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1165452593
octolytics-dimension-repository_network_root_nwoycode/ycode
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasec4447fdce9ed0f33af959d2b6680d0bc18212a6a
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/ycode/ycode/pull/574/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fycode%2Fycode%2Fpull%2F574%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fycode%2Fycode%2Fpull%2F574%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=ycode%2Fycode
Reloadhttps://github.com/ycode/ycode/pull/574/files
Reloadhttps://github.com/ycode/ycode/pull/574/files
Reloadhttps://github.com/ycode/ycode/pull/574/files
ycodehttps://github.com/ycode
ycodehttps://github.com/ycode/ycode
Codehttps://github.com/ycode/ycode
Issues7 (7)https://github.com/ycode/ycode/issues
Pull requests1 (1)https://github.com/ycode/ycode/pulls
Discussionshttps://github.com/ycode/ycode/discussions
Actionshttps://github.com/ycode/ycode/actions
Projectshttps://github.com/ycode/ycode/projects
Security and quality1 (1)https://github.com/ycode/ycode/security
Insightshttps://github.com/ycode/ycode/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fycode%2Fycode%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fycode%2Fycode%2Fissues%2Fnew%2Fchoose
sj-unit72https://github.com/sj-unit72
ycode:develophttps://github.com/ycode/ycode/tree/develop
sj-unit72:feat/ollama-provider-hermeshttps://github.com/sj-unit72/ycode/tree/feat/ollama-provider-hermes
Conversation 1 https://github.com/ycode/ycode/pull/574
Commits 9 https://github.com/ycode/ycode/pull/574/commits
Checks 0 https://github.com/ycode/ycode/pull/574/checks
Files changed https://github.com/ycode/ycode/pull/574/files
Please reload this pagehttps://github.com/ycode/ycode/pull/574/files
feat(agent): add Ollama as an AI provider https://github.com/ycode/ycode/pull/574/files#top
Show all changes 9 commits https://github.com/ycode/ycode/pull/574/files
bec39c3 feat(agent): add Ollama as an AI provider sj-unit72 Sep 23, 2026 https://github.com/ycode/ycode/pull/574/commits/bec39c37fc01b44005bcbda750ff4b2f2753b86f
335ce93 test(agent): verify Ollama resolution isolation per request sj-unit72 Sep 23, 2026 https://github.com/ycode/ycode/pull/574/commits/335ce934439392303115de97b4bc644f2435682e
dea3949 chore(agent): drop scratch Ollama race harnesses sj-unit72 Sep 23, 2026 https://github.com/ycode/ycode/pull/574/commits/dea3949ea5abf2feee11a24a5b3411a1dece6b86
54b6514 fix(agent): validate Ollama Cloud keys against the chat endpoint sj-unit72 Sep 23, 2026 https://github.com/ycode/ycode/pull/574/commits/54b651434c2f461e9286c8a4906796cfadb7e528
5364ff3 test(agent): verify the Ollama-only path through getAgentProvider sj-unit72 Sep 23, 2026 https://github.com/ycode/ycode/pull/574/commits/5364ff375d4bc8d30c107b17719989e71ebbff3f
0626d3f fix(agent): tolerate client disconnects mid-run in the chat SSE route sj-unit72 Sep 23, 2026 https://github.com/ycode/ycode/pull/574/commits/0626d3f5f0b59afc5d8cb5528398117446e430ed
cc3c62e fix(agent): abort a hung provider request at the run deadline sj-unit72 Sep 23, 2026 https://github.com/ycode/ycode/pull/574/commits/cc3c62ecb5fef6518b67e155843d1f1f4f0c2cf9
a45c2a9 chore(tests): use a documentation-range IP in the base-URL cases sj-unit72 Sep 23, 2026 https://github.com/ycode/ycode/pull/574/commits/a45c2a9c12eba1fdd1c2fdb82311280786e69061
2918bc2 style(agent): fix quote style in Ollama verify scripts sj-unit72 Sep 23, 2026 https://github.com/ycode/ycode/pull/574/commits/2918bc2a898daab6d39d1b00c05db2489f6cad2d
Clear filters https://github.com/ycode/ycode/pull/574/files
Please reload this pagehttps://github.com/ycode/ycode/pull/574/files
Please reload this pagehttps://github.com/ycode/ycode/pull/574/files
route.ts https://github.com/ycode/ycode/pull/574/files#diff-3ea517a48a7710507f9f4fb66d647a363c37853a9ee9271b1d4c20115a546d54
route.ts https://github.com/ycode/ycode/pull/574/files#diff-f0cac2f79753c0581abbb69d03a0abba1e2b8d33e6b6904b2498d62be0068742
route.ts https://github.com/ycode/ycode/pull/574/files#diff-b0d73c2a96f97a72cc54cd2c83e67ba0e31f5c41156f58644b761c0a6e78baf3
AgentKeyForm.tsx https://github.com/ycode/ycode/pull/574/files#diff-16e383beb7c50b1223202b161d2a3fc933711b0743b2a04a5ff6db88d2a0ed0f
AiChatPanel.tsx https://github.com/ycode/ycode/pull/574/files#diff-e59b380113131a9db69b2709af96e09bb264253c470d7126a2c2ff8c078f7d62
ChatComposer.tsx https://github.com/ycode/ycode/pull/574/files#diff-7d5cec1fd99f7b9b46d60d03116fdb06754f9e65eb4d214474c1c499b39ff0eb
ProviderLogo.tsx https://github.com/ycode/ycode/pull/574/files#diff-486a4540c754f39ed62f2955c46519d8b86722956fc666a165c6d87fbe4235d6
page.tsx https://github.com/ycode/ycode/pull/574/files#diff-b071c261bc89aeac939f718f406e3ab143ef0cf32a7abca11a1705a8e05cc891
icon.tsx https://github.com/ycode/ycode/pull/574/files#diff-da1db73679a43c8c9a761b6cdeb6b3c60aaad37182add216609de1304b53daf5
config.ts https://github.com/ycode/ycode/pull/574/files#diff-bccf9917e7ac863fc1070a8ef7b41c5e9835b6ca5ebda3c5dc78328b8c332b3d
models.ts https://github.com/ycode/ycode/pull/574/files#diff-32305e093fbea9ecd120c9ff2e8b5097deec7da9006614582a3ace54cb001086
index.ts https://github.com/ycode/ycode/pull/574/files#diff-68747aaef96eaeec9138cf43419df02c0a8ec1e0ff70e2200bd24cfecd83fb3f
ollama.ts https://github.com/ycode/ycode/pull/574/files#diff-632f1c004701f5418bcffa80d8a13a23d344d94e25cb990ba6e62f6a3a8f6c10
runtime.ts https://github.com/ycode/ycode/pull/574/files#diff-935dec7b5efa62c58032806f065ee86c40168b7882f9d231586106f54025fb78
api.ts https://github.com/ycode/ycode/pull/574/files#diff-49d517a3c6653cb9108c98a12d14e99f9a88bb5bcbff83a07a9347ef75cfed7d
verify-ollama-end-to-end.ts https://github.com/ycode/ycode/pull/574/files#diff-60ecc938d388d8be84c8c2900e0d56b0643235830e9fb48afc72d41283ceebd2
verify-ollama-key-validation.ts https://github.com/ycode/ycode/pull/574/files#diff-56c5e2c630c4d325ad8a3141b073822bff13f1cf2490fe4ee808520be5f6f0d3
verify-ollama-provider.ts https://github.com/ycode/ycode/pull/574/files#diff-cd474b35f46aa316e828e3d72287752b9acc10a62bd64382e2598241db3ff047
verify-ollama-resolution-isolation.ts https://github.com/ycode/ycode/pull/574/files#diff-b2fabef61aa21ff7b3c6229580dbebb0cc6cc97db3e5839f488b60f233ffaad3
verify-ollama-roundtrip.ts https://github.com/ycode/ycode/pull/574/files#diff-84cb24aa93f44ffae20c92c65f8f5aeaff6c552b050047171a419ac2e910dc4b
verify-run-deadline-healthy.ts https://github.com/ycode/ycode/pull/574/files#diff-c0056af95d98ecc64ff6bb48b3b8547f257704e58d1ec77656116b2e78fdfbea
verify-run-deadline.ts https://github.com/ycode/ycode/pull/574/files#diff-64123e1919ead59b58cff6d3292aa10438a7be09d949f1b587932bd7f50f9aaa
index.ts https://github.com/ycode/ycode/pull/574/files#diff-b5c5b3d03297cce43ffb834917bfdc3d10fc8aefa37979c5af23c2205d1bc88c
https://github.com/ycode/ycode/blob/develop/.github/CODEOWNERS#L1
app/(builder)/ycode/api/ai/chat/route.tshttps://github.com/ycode/ycode/pull/574/files#diff-3ea517a48a7710507f9f4fb66d647a363c37853a9ee9271b1d4c20115a546d54
View file https://github.com/sj-unit72/ycode/blob/2918bc2a898daab6d39d1b00c05db2489f6cad2d/app/(builder)/ycode/api/ai/chat/route.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/ycode/ycode/pull/574/{{ revealButtonHref }}
https://github.com/ycode/ycode/pull/574/files#diff-3ea517a48a7710507f9f4fb66d647a363c37853a9ee9271b1d4c20115a546d54
https://github.com/ycode/ycode/pull/574/files#diff-3ea517a48a7710507f9f4fb66d647a363c37853a9ee9271b1d4c20115a546d54
https://github.com/ycode/ycode/pull/574/files#diff-3ea517a48a7710507f9f4fb66d647a363c37853a9ee9271b1d4c20115a546d54
https://github.com/ycode/ycode/blob/develop/.github/CODEOWNERS#L1
app/(builder)/ycode/api/settings/agent/route.tshttps://github.com/ycode/ycode/pull/574/files#diff-f0cac2f79753c0581abbb69d03a0abba1e2b8d33e6b6904b2498d62be0068742
View file https://github.com/sj-unit72/ycode/blob/2918bc2a898daab6d39d1b00c05db2489f6cad2d/app/(builder)/ycode/api/settings/agent/route.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/ycode/ycode/pull/574/{{ revealButtonHref }}
https://github.com/ycode/ycode/pull/574/files#diff-f0cac2f79753c0581abbb69d03a0abba1e2b8d33e6b6904b2498d62be0068742
https://github.com/ycode/ycode/pull/574/files#diff-f0cac2f79753c0581abbb69d03a0abba1e2b8d33e6b6904b2498d62be0068742
https://github.com/ycode/ycode/pull/574/files#diff-f0cac2f79753c0581abbb69d03a0abba1e2b8d33e6b6904b2498d62be0068742
https://github.com/ycode/ycode/pull/574/files#diff-f0cac2f79753c0581abbb69d03a0abba1e2b8d33e6b6904b2498d62be0068742
https://github.com/ycode/ycode/pull/574/files#diff-f0cac2f79753c0581abbb69d03a0abba1e2b8d33e6b6904b2498d62be0068742
https://github.com/ycode/ycode/pull/574/files#diff-f0cac2f79753c0581abbb69d03a0abba1e2b8d33e6b6904b2498d62be0068742
https://github.com/ycode/ycode/pull/574/files#diff-f0cac2f79753c0581abbb69d03a0abba1e2b8d33e6b6904b2498d62be0068742
https://github.com/ycode/ycode/pull/574/files#diff-f0cac2f79753c0581abbb69d03a0abba1e2b8d33e6b6904b2498d62be0068742
https://github.com/ycode/ycode/pull/574/files#diff-f0cac2f79753c0581abbb69d03a0abba1e2b8d33e6b6904b2498d62be0068742
https://github.com/ycode/ycode/pull/574/files#diff-f0cac2f79753c0581abbb69d03a0abba1e2b8d33e6b6904b2498d62be0068742
https://github.com/ycode/ycode/pull/574/files#diff-f0cac2f79753c0581abbb69d03a0abba1e2b8d33e6b6904b2498d62be0068742
https://github.com/ycode/ycode/pull/574/files#diff-f0cac2f79753c0581abbb69d03a0abba1e2b8d33e6b6904b2498d62be0068742
Please reload this pagehttps://github.com/ycode/ycode/pull/574/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.