Skip to content

fix(oauth): handle null state in Cline exchange - #1016

Closed
wlfonseca wants to merge 1 commit into
cheaper-inference:release/v3.5.4from
wlfonseca:fix/cline-oauth-null-state
Closed

wlfonseca wants to merge 1 commit into
cheaper-inference:release/v3.5.4from
wlfonseca:fix/cline-oauth-null-state

Conversation

@wlfonseca

Copy link
Copy Markdown
Contributor

Summary

  • fix Cline OAuth exchange validation by accepting state: null and normalizing empty/null state before token exchange
  • improve OAuth modal/manual exchange UX with clearer validation error details for callback/code submission
  • update unit tests to match current Qoder transport behavior and default Gemini token limit so pre-commit suite is stable

@sonarqubecloud

sonarqubecloud Bot commented Apr 5, 2026

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request updates the OAuth exchange logic to support the 'cline' provider, improves error reporting in the frontend modal, and refactors Qoder unit tests to use fetch mocking instead of local CLI scripts. It also adjusts the Gemini token limit and makes the OAuth schema more flexible for non-PKCE flows. Feedback was provided to improve the normalization of the 'state' parameter by trimming whitespace to handle empty strings more robustly.


if (action === "exchange") {
const { code, redirectUri, codeVerifier, state } = body;
const normalizedState = typeof state === "string" && state.length > 0 ? state : undefined;

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.

medium

The normalization of state to undefined when it is an empty string or null is a good fix for providers like Cline. However, consider using .trim() to also handle strings containing only whitespace, which are effectively empty in the context of OAuth state.

Suggested change
const normalizedState = typeof state === "string" && state.length > 0 ? state : undefined;
const normalizedState = typeof state === "string" && state.trim().length > 0 ? state : undefined;

@diegosouzapw
diegosouzapw changed the base branch from main to release/v3.5.4 April 7, 2026 21:34
@diegosouzapw
diegosouzapw self-requested a review as a code owner April 7, 2026 21:34
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Thanks @wlfonseca for this great contribution! 🎉 The PR has been integrated into the release/v3.5.5 branch and will be part of the next release. We appreciate your effort!

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Thanks @wlfonseca! 🎉 The PR has been manually squashed and merged into release/v3.5.5 to avoid some heavy test conflicts!

@diegosouzapw diegosouzapw mentioned this pull request Apr 22, 2026
This was referenced Apr 30, 2026
Poid-ZA pushed a commit to Poid-ZA/OmniRoute that referenced this pull request Aug 5, 2026
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 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