Skip to content

[WRONG BRANCH] fix(ollama): bound pending native tool calls - #385

Draft
luvs01 wants to merge 1 commit into
mainfrom
codex/fix-memory-exhaustion-vulnerability-in-ollama-native
Draft

[WRONG BRANCH] fix(ollama): bound pending native tool calls#385
luvs01 wants to merge 1 commit into
mainfrom
codex/fix-memory-exhaustion-vulnerability-in-ollama-native

Conversation

@luvs01

@luvs01 luvs01 commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Prevent a remotely-controlled Ollama-native upstream from exhausting the proxy process by unboundedly retaining provider-controlled tool names and an unlimited number of pending tool calls.
  • Ensure retained provider data (tool names and per-call bookkeeping) is accounted to the existing translator budget so aggregate in-memory retention is limited.

Description

  • Add hard limits and accounting to the native Ollama parser: introduce NATIVE_TOOL_NAME_MAX_BYTES = 1024, NATIVE_MAX_PENDING_TOOL_CALLS = 128, and a small NATIVE_TOOL_CALL_BOOKKEEPING_BYTES overhead, and enforce them during nativeMessageEvents. (file: src/adapters/ollama-native.ts)
  • Charge retained tool-name bytes plus bookkeeping to the translator budget before storing a new pending NativeStreamToolCall, and fail admission when the budget or per-call/pending-count bounds are exceeded. (file: src/adapters/ollama-native.ts)
  • Add focused regression tests that exercise oversized tool names, excessive pending-call counts, and aggregate retained-name budget enforcement. (file: tests/ollama-native-parser.test.ts)

Testing

  • Ran the focused adapter tests with bun test tests/ollama-native-parser.test.ts and the modified suite passed (29 tests, 0 failures).
  • Ran type checking with bun run typecheck and it succeeded.
  • Started the full test suite bun run test for broader confidence; the run surfaced unrelated pre-existing failures in Lab automation / API auth and a long-running chat-completions timeout, so only the focused Ollama-native tests and typecheck are relied on for this change.

Codex Task

@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: cffdacb9-2cf0-4b4a-8c61-4a0bdd160ae3


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 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-08-31T01:00:57.842256Z 8adc6f4 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.

@github-actions

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 31, 2026
@github-actions github-actions Bot changed the title fix(ollama): bound pending native tool calls [WRONG BRANCH] fix(ollama): bound pending native tool calls Aug 31, 2026
@github-actions

Copy link
Copy Markdown

⏳ DRAFT

  • wrong target branch (main); retarget to dev.

What to do

  • Retarget this PR to dev — all contributions go to dev.

Its title has been prefixed with [WRONG BRANCH].
This pull request is being kept as a draft automatically. Once every issue above is resolved, it will be marked ready for review again.

@github-actions
github-actions Bot marked this pull request as draft August 31, 2026 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aardvark bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant