Skip to content

refactor(openai-shim): extract response adapters - #2072

Merged
kevincodex1 merged 4 commits into
Twigpine:mainfrom
jatmn:de-mono2-response-adapters
Aug 7, 2026
Merged

kevincodex1 merged 4 commits into
Twigpine:mainfrom
jatmn:de-mono2-response-adapters

Conversation

@jatmn

@jatmn jatmn commented Jul 31, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • move raw/XML fallback sequencing, stream-adapter dependency wiring, completed response conversion, and Gemini response conversion into openaiShim/responseAdapters.ts
  • preserve the public parseTextToolCalls and parseXmlToolCalls exports through the facade
  • move the raw/XML tool-call sequence test into paired responseAdapters.test.ts
  • reduce openaiShim.ts from 1,208 to 1,019 lines (19 additions, 208 deletions)

Why

The facade still owned response-adapter assembly after the earlier transport and Gemini-stream extractions landed on main. This gives that responsibility an explicit source/test owner without depending on any other follow-up extraction.

Rebased onto upstream main at c327805e. The architecture guard and geminiStreamConversion.test.ts pairing already exist on main; this PR only adds the responseAdapters module and wires the facade to it.

Impact

No intended user-facing or provider behavior change. The facade delegates through the same converters and retains its public parser API.

Validation

  • bun test src/services/api/openaiShim/responseAdapters.test.ts — 5 pass
  • bun test src/services/api/openaiShim.architecture.test.ts — 2 pass
  • bun test src/services/api/openaiShim.test.ts --test-name-pattern "facade parseTextToolCalls" — 1 pass
  • bun run typecheck — pass
  • bun run typecheck:type-tests — pass (10 files checked)

Contributor checklist

  • Reviewed CONTRIBUTING.md and AGENTS.md.
  • No linked issue; this is focused post-extraction architecture housekeeping.
  • OpenAI-compatible and Gemini conversion paths were tested.
  • No UI changes or screenshots required.

Summary by CodeRabbit

  • Bug Fixes

    • Improved compatibility when converting OpenAI and Gemini responses into the app’s standard message format.
    • Preserved text, tool-call, stop-reason, and usage details across streaming and non-streaming responses.
    • Improved sequencing for tool calls parsed from text and XML formats.
  • Tests

    • Added coverage for response conversion, streaming events, usage metadata, stop reasons, and tool-call sequencing.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change extracts response conversion and tool-call parsing from openaiShim.ts into responseAdapters.ts. It adds shared parser IDs, provider adapters, delegation wiring, and focused stream and conversion tests.

Changes

Response adapter extraction

Layer / File(s) Summary
Shared tool-call parser contract
src/services/api/openaiShim/responseAdapters.ts, src/services/api/openaiShim.ts, src/services/api/openaiShim.test.ts, src/services/api/openaiShim/responseAdapters.test.ts
Tool-call parsers use shared sequential IDs. openaiShim.ts re-exports the centralized parser functions. Tests verify text and XML fallback sequencing.
Provider response conversion
src/services/api/openaiShim/responseAdapters.ts, src/services/api/openaiShim/responseAdapters.test.ts
The adapter layer handles Anthropic and Gemini SSE conversion, OpenAI streaming and non-streaming conversion, Gemini message conversion, stop reasons, tool-use content, and usage metadata.
Shim delegation wiring
src/services/api/openaiShim.ts
Local conversion implementations are removed. OpenAI streaming and Gemini response handling delegate to responseAdapters.ts.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested labels: enhancement

Suggested reviewers: kevincodex1, 0xfandom, chioarub

🚥 Pre-merge checks | ✅ 7
✅ Passed checks (7 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Risk Surface Disclosed ✅ Passed The PR extracts existing OpenAI/Gemini response and stream conversion code; it adds no fetch, auth, routing, permission, or execution changes, and states no provider behavior change or blocker.
No Hidden Policy Change ✅ Passed The isolated PR changes only adapter extraction and tests; moved implementations and facade wiring preserve existing parsing, stream, conversion, logging, and header behavior.
Title check ✅ Passed The title is concise, scoped, and accurately describes extracting response adapters from the OpenAI shim.
Description check ✅ Passed The description covers the change, rationale, impact, validation, and relevant notes, with only minor template-heading differences.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@jatmn
jatmn force-pushed the de-mono2-response-adapters branch 2 times, most recently from 9025a84 to 59ffd82 Compare July 31, 2026 14:54
@jatmn
jatmn force-pushed the de-mono2-response-adapters branch from 59ffd82 to eac082d Compare August 7, 2026 02:13

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/services/api/openaiShim/responseAdapters.ts`:
- Around line 90-155: Add focused colocated regression tests in
responseAdapters.test.ts that invoke the exported geminiSseToAnthropic and
openaiStreamToAnthropic wrappers with representative SSE responses. Assert
emitted content, usage metadata, and terminal stop behavior for both Gemini and
OpenAI streams, covering the dependency wiring passed into convertGeminiStream
and convertOpenAIStream.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3ae023d5-c99d-442f-8756-23c259fe507f

📥 Commits

Reviewing files that changed from the base of the PR and between c327805 and eac082d.

📒 Files selected for processing (4)
  • src/services/api/openaiShim.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/openaiShim/responseAdapters.test.ts
  • src/services/api/openaiShim/responseAdapters.ts
💤 Files with no reviewable changes (1)
  • src/services/api/openaiShim.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: smoke-and-tests (22)
  • GitHub Check: typecheck
  • GitHub Check: smoke-and-tests (24.11.x)
🧰 Additional context used
📓 Path-based instructions (10)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript strict mode and ESM imports throughout the source code.

Run bun run typecheck and bun run typecheck:type-tests for TypeScript changes when applicable.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/openaiShim/responseAdapters.ts
**/*.{tsx,ts}

📄 CodeRabbit inference engine (AGENTS.md)

Use React and Ink patterns for terminal UI components.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/openaiShim/responseAdapters.ts
src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.ts: Prefer existing service, provider, settings, permission, and UI patterns over introducing new abstractions.
Use chalk for terminal color and execa for child-process execution when those capabilities are needed.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/openaiShim/responseAdapters.ts
src/services/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Use existing service and provider integration patterns when implementing API, MCP, OAuth, wiki, voice, or related integrations.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/openaiShim/responseAdapters.ts
**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Add or update tests when behavior changes, and run the narrowest useful focused test checks.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Do not add new Python code, Python provider paths, or Python dependencies without explicit maintainer approval.

**/*.{ts,tsx,js,jsx}: Follow the existing code style in touched source files, prefer small readable changes, avoid unrelated reformatting, and keep comments useful and concise.
Preserve existing repository patterns unless intentionally refactoring them, and avoid broad rewrites or unnecessary generated changes.
Review AI-assisted code for correctness, style consistency, unnecessary changes, and adherence to project architecture before submitting it.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/openaiShim/responseAdapters.ts
**/*.{test,spec}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.{test,spec}.{ts,tsx,js,jsx}: Add or update tests when a code change affects behavior.
Use focused tests such as bun test ./path/to/test-file.test.ts when validating a narrowly scoped change.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Update documentation when setup, commands, or user-facing behavior changes.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/openaiShim/responseAdapters.ts

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/openaiShim/responseAdapters.ts
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}

⚙️ CodeRabbit configuration file

{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}: Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny. Block on silent default changes, hidden fallback expansion, credential reuse mistakes, hardcoded provider assumptions, or new network reach that is not intentional and documented.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/openaiShim/responseAdapters.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts

Comment thread src/services/api/openaiShim/responseAdapters.ts
Add focused regression tests for geminiSseToAnthropic and
openaiStreamToAnthropic through the responseAdapters facade wiring.

Validated with: bun test src/services/api/openaiShim/responseAdapters.test.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/services/api/openaiShim/responseAdapters.test.ts`:
- Around line 91-134: Extend the test “geminiSseToAnthropic wrapper emits
content, usage, and terminal stop” to locate and assert the emitted
function-call content block has the tool-use type, name “Read”, and input {
file_path: “a.ts” }. Also assert the corresponding content-block stop event when
emitted by the stream contract, while preserving the existing stop reason,
usage, and message-stop assertions.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 921701e8-f430-4019-b23d-e9e715a82ef4

📥 Commits

Reviewing files that changed from the base of the PR and between eac082d and bab9597.

📒 Files selected for processing (1)
  • src/services/api/openaiShim/responseAdapters.test.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (10)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript strict mode and ESM imports throughout the source code.

Run bun run typecheck and bun run typecheck:type-tests for TypeScript changes when applicable.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
**/*.{tsx,ts}

📄 CodeRabbit inference engine (AGENTS.md)

Use React and Ink patterns for terminal UI components.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.ts: Prefer existing service, provider, settings, permission, and UI patterns over introducing new abstractions.
Use chalk for terminal color and execa for child-process execution when those capabilities are needed.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
src/services/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Use existing service and provider integration patterns when implementing API, MCP, OAuth, wiki, voice, or related integrations.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Add or update tests when behavior changes, and run the narrowest useful focused test checks.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Do not add new Python code, Python provider paths, or Python dependencies without explicit maintainer approval.

**/*.{ts,tsx,js,jsx}: Follow the existing code style in touched source files, prefer small readable changes, avoid unrelated reformatting, and keep comments useful and concise.
Preserve existing repository patterns unless intentionally refactoring them, and avoid broad rewrites or unnecessary generated changes.
Review AI-assisted code for correctness, style consistency, unnecessary changes, and adherence to project architecture before submitting it.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
**/*.{test,spec}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.{test,spec}.{ts,tsx,js,jsx}: Add or update tests when a code change affects behavior.
Use focused tests such as bun test ./path/to/test-file.test.ts when validating a narrowly scoped change.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Update documentation when setup, commands, or user-facing behavior changes.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}

⚙️ CodeRabbit configuration file

{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}: Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny. Block on silent default changes, hidden fallback expansion, credential reuse mistakes, hardcoded provider assumptions, or new network reach that is not intentional and documented.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts

Comment thread src/services/api/openaiShim/responseAdapters.test.ts
Extend the responseAdapters geminiSseToAnthropic wrapper test to cover
tool_use content_block_start, input_json_delta, and content_block_stop.
Remove stale post-extraction imports from the openaiShim facade.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/services/api/openaiShim/responseAdapters.test.ts (1)

1-33: 📐 Maintainability & Code Quality | 🔵 Trivial

Run and report the required focused checks.

Run bun test src/services/api/openaiShim/responseAdapters.test.ts, bun run typecheck, and bun run typecheck:type-tests. Report the exact commands and results in the PR.

As per coding guidelines, “Run bun run typecheck and bun run typecheck:type-tests for TypeScript changes when applicable.” As per path instructions, “run targeted tests plus bun run typecheck; report exact validation commands in the PR.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/services/api/openaiShim/responseAdapters.test.ts` around lines 1 - 33,
Run the focused test and both required TypeScript checks: bun test
src/services/api/openaiShim/responseAdapters.test.ts, bun run typecheck, and bun
run typecheck:type-tests. Report each exact command and its result in the PR.

Sources: Coding guidelines, Path instructions

src/services/api/openaiShim.ts (1)

71-93: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Add facade-level parser export coverage.

The parser tests import both functions directly from responseAdapters.ts. Add a focused test that imports them from openaiShim.ts and asserts the re-exports.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/services/api/openaiShim.ts` around lines 71 - 93, Add a focused test for
the facade exports from openaiShim.ts, importing parseTextToolCalls and
parseXmlToolCalls through that module and asserting they are re-exported
correctly, while retaining the existing direct responseAdapters.ts parser
coverage.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/services/api/openaiShim.ts`:
- Around line 71-93: Add a focused test for the facade exports from
openaiShim.ts, importing parseTextToolCalls and parseXmlToolCalls through that
module and asserting they are re-exported correctly, while retaining the
existing direct responseAdapters.ts parser coverage.

In `@src/services/api/openaiShim/responseAdapters.test.ts`:
- Around line 1-33: Run the focused test and both required TypeScript checks:
bun test src/services/api/openaiShim/responseAdapters.test.ts, bun run
typecheck, and bun run typecheck:type-tests. Report each exact command and its
result in the PR.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3eb5e502-755e-4309-a485-bb0976ee6d12

📥 Commits

Reviewing files that changed from the base of the PR and between bab9597 and 74ba480.

📒 Files selected for processing (3)
  • src/services/api/openaiShim.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/openaiShim/responseAdapters.test.ts
💤 Files with no reviewable changes (1)
  • src/services/api/openaiShim.test.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (10)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript strict mode and ESM imports throughout the source code.

Run bun run typecheck and bun run typecheck:type-tests for TypeScript changes when applicable.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
  • src/services/api/openaiShim.ts
**/*.{tsx,ts}

📄 CodeRabbit inference engine (AGENTS.md)

Use React and Ink patterns for terminal UI components.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
  • src/services/api/openaiShim.ts
src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.ts: Prefer existing service, provider, settings, permission, and UI patterns over introducing new abstractions.
Use chalk for terminal color and execa for child-process execution when those capabilities are needed.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
  • src/services/api/openaiShim.ts
src/services/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Use existing service and provider integration patterns when implementing API, MCP, OAuth, wiki, voice, or related integrations.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
  • src/services/api/openaiShim.ts
**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Add or update tests when behavior changes, and run the narrowest useful focused test checks.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Do not add new Python code, Python provider paths, or Python dependencies without explicit maintainer approval.

**/*.{ts,tsx,js,jsx}: Follow the existing code style in touched source files, prefer small readable changes, avoid unrelated reformatting, and keep comments useful and concise.
Preserve existing repository patterns unless intentionally refactoring them, and avoid broad rewrites or unnecessary generated changes.
Review AI-assisted code for correctness, style consistency, unnecessary changes, and adherence to project architecture before submitting it.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
  • src/services/api/openaiShim.ts
**/*.{test,spec}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.{test,spec}.{ts,tsx,js,jsx}: Add or update tests when a code change affects behavior.
Use focused tests such as bun test ./path/to/test-file.test.ts when validating a narrowly scoped change.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Update documentation when setup, commands, or user-facing behavior changes.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
  • src/services/api/openaiShim.ts

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
  • src/services/api/openaiShim.ts
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}

⚙️ CodeRabbit configuration file

{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}: Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny. Block on silent default changes, hidden fallback expansion, credential reuse mistakes, hardcoded provider assumptions, or new network reach that is not intentional and documented.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
  • src/services/api/openaiShim.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/services/api/openaiShim/responseAdapters.test.ts
🔇 Additional comments (4)
src/services/api/openaiShim.ts (2)

45-45: LGTM!

Also applies to: 128-169, 939-939


393-415: 🩺 Stability & Availability

Preserve the Anthropic SSE passthrough. It remains routed through anthropicSsePassthrough, with abort cancellation and idle-timeout handling intact.

src/services/api/openaiShim/responseAdapters.test.ts (2)

35-46: 🎯 Functional Correctness

Keep the shared parser-ID test independent of test order.

responseAdapters.ts uses one shared sequential tool-call ID generator. If this test asserts fixed numeric IDs, an earlier parser call can change the expected values. Assert the prefixes and relative sequence, or reset the generator in test setup.

As per path instructions, “Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions.”

Source: Path instructions


48-89: LGTM!

Also applies to: 91-153, 155-195

Add a focused openaiShim.test.ts case that imports parseTextToolCalls and
parseXmlToolCalls through the public facade and asserts shared sequencing.
@jatmn
jatmn marked this pull request as ready for review August 7, 2026 03:12

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@kevincodex1
kevincodex1 merged commit deb9194 into Twigpine:main Aug 7, 2026
6 checks passed
@jatmn
jatmn deleted the de-mono2-response-adapters branch August 10, 2026 02:12
@jatmn jatmn self-assigned this Aug 10, 2026
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.

2 participants