Skip to content

fix(web-search): release OpenAI sidecar probe when sidecar validation returns early - #643

Closed
luvs01 wants to merge 4 commits into
devfrom
codex/fix-runturn-search-probe-lease-leak
Closed

luvs01 wants to merge 4 commits into
devfrom
codex/fix-runturn-search-probe-lease-leak

Conversation

@luvs01

@luvs01 luvs01 commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Motivation

  • Prevent a probe-lease leak when OpenAI web-search sidecar auth is resolved but executeResponsesSidecars returns a pre-dispatch Response (for example on malformed tool-result input) before the runTurn cleanup runs.
  • The leak can retain a quota-recovery probe on a pool account and delay its recovery under narrow conditions, so the runtime must release the lease on early validation exits.

Description

  • Call sidecarState.openAiSidecar?.releaseProbeLease?.() before returning when executeResponsesSidecars returns a Response to ensure any acquired probe lease is released immediately. (src/server/responses/core.ts).
  • Add a focused regression test that stubs prepareResponsesSidecarAuth to simulate a held probe lease and asserts a pre-dispatch 400 response releases the probe and does not dispatch the adapter. (tests/responses/responses-run-turn-web-search.test.ts).
  • Keep the change narrowly scoped to releasing the resolved OpenAI sidecar probe on early-sidecar validation failures and add a test fixture to exercise that specific path.

Testing

  • Ran the focused regression: bun test tests/responses/responses-run-turn-web-search.test.ts --timeout 30000 which passed (16 tests, 0 failures).
  • Ran static checks and project validation: bun run typecheck (passed), bun run structure:check (passed), and bun run privacy:scan (passed).
  • bun run test:changed could not be executed in this checkout due to a missing comparison ref (dev/origin/dev/upstream/dev), so focused regression coverage was used instead.

Codex Task


Devin Review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Sep 26, 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: Repository: luvs01/opencodex/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: d8557cb5-ebe4-468f-8ef6-b54e7284822b


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.

@github-actions github-actions Bot added the bug Something isn't working label Sep 26, 2026
devin-ai-integration[bot]

This comment was marked as resolved.

@github-actions

Copy link
Copy Markdown

✅ Deterministic PR hygiene checks passed.

Co-Authored-By: Epinephrine <luvs01@hanmail.net>
@devin-ai-integration

Copy link
Copy Markdown

Fixed in 7266ca2 — see reply above.

…e settles

A fetch-based web-search stream keeps the account's quota-recovery probe
while it is live (a later in-stream sidecar outcome may still clear the
cooldown), but when the routed model answers without calling web_search
no outcome ever consumes it. Hand the lease back through the stream's
own completion/cancel tracker and the terminal no-body return, matching
the release ownership executeResponsesRunTurn already uses.

Co-Authored-By: Epinephrine <luvs01@hanmail.net>
devin-ai-integration[bot]

This comment was marked as resolved.

The streamed-sidecar probe test only covered web-search completion;
add the cancellation path (tracked stream cancel settles the lease) and
the media-bridge stream, which shares the same ownership handoff.

Co-Authored-By: Epinephrine <luvs01@hanmail.net>
@luvs01

luvs01 commented Sep 27, 2026

Copy link
Copy Markdown
Owner Author

이관됨: lidge-jun#6047

@luvs01

luvs01 commented Sep 27, 2026

Copy link
Copy Markdown
Owner Author

동일 수정이 상류 저장소에 제출되어 이 포크 PR의 목적은 달성됐습니다.

@luvs01 luvs01 closed this Sep 27, 2026
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