Skip to content

fix(handler): provide fallback for connectionId when undefined - #3130

Merged
diegosouzapw merged 1 commit into
diegosouzapw:mainfrom
androw:logfix
Jun 4, 2026
Merged

diegosouzapw merged 1 commit into
diegosouzapw:mainfrom
androw:logfix

Conversation

@androw

@androw androw commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add fallback when connectionId is undefined
  • Fix kilo calls not being logged to call_logs

Related Issues

Validation

  • npm run lint
  • npm run test:unit
  • npm run test:coverage
  • Coverage is still >= 60% for statements, lines, functions, and branches
  • SonarQube PR analysis is green or any remaining issues are explicitly documented below

Tests Added Or Updated

  • List every changed or added automated test file.
  • If no production code changed, state that here.

Coverage Notes

  • If this PR changes src/, open-sse/, electron/, or bin/, explain which tests cover the change.
  • If coverage moved down in any touched file, explain why and what follow-up task will recover it.

Reviewer Notes

  • Call out any risky areas, migrations, feature flags, or manual validation that reviewers should know about.

@androw
androw requested a review from diegosouzapw as a code owner June 3, 2026 22:31

@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 introduces a fallback for connectionId using credentials?.connectionId when saving call logs in open-sse/handlers/chatCore.ts. The reviewer noted that applying this fallback locally only addresses call logging, leaving other critical downstream systems (such as usage persistence, quota tracking, and request logging) vulnerable to receiving undefined. To ensure consistency, the reviewer suggested resolving the fallback once at the beginning of the handleChatCore function.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

requestedModel,
provider,
connectionId,
connectionId: connectionId || credentials?.connectionId || 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

While adding a fallback for connectionId in saveCallLog is helpful, applying this fallback locally only fixes call logging. Many other critical systems in handleChatCore rely on connectionId and will still receive undefined if the parameter is not provided. These include:

  1. Usage Persistence: persistFailureUsage (line 1702) and saveRequestUsage (line 5200)
  2. Quota Tracking: persistCodexQuotaState (lines 1771, 1825, 1830) which updates the provider connection in the database
  3. Request Logging & Pending Tracking: trackPendingRequest and appendRequestLog calls throughout the handler

If connectionId is undefined, updateProviderConnection(connectionId, ...) will be called with undefined, failing to persist the quota state.

Recommendation:
Resolve the fallback once at the very beginning of handleChatCore by reassigning the parameter:

connectionId = connectionId || credentials?.connectionId || undefined;

This ensures that all downstream logging, tracking, and database persistence systems automatically and consistently benefit from the fallback.

@kilo-code-bot

kilo-code-bot Bot commented Jun 3, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No New Issues Found | Recommendation: Merge (existing comment addressed)

Files Reviewed (1 file)
  • open-sse/handlers/chatCore.ts — fallback chain for connectionId in saveCallLog()

Reviewed by step-3.7-flash-20260528 · 319,230 tokens

@diegosouzapw
diegosouzapw merged commit bb87a59 into diegosouzapw:main Jun 4, 2026
2 checks passed
diegosouzapw added a commit that referenced this pull request Jun 4, 2026
…ic-asset build fix

- #3131 Kiro Opus 4.8 catalog (thanks @artickc)
- #3132 Kimi thinking-mode reasoning_content fix (thanks @bypanghu)
- #3130 connectionId fallback + kilo call logging (thanks @androw)
- build: standalone static-asset path fix (white login screen after build-output reorg)
- contributors hall: +@artickc +@bypanghu +@androw (15 total)
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…uzapw#3131/diegosouzapw#3132) + static-asset build fix

- diegosouzapw#3131 Kiro Opus 4.8 catalog (thanks @artickc)
- diegosouzapw#3132 Kimi thinking-mode reasoning_content fix (thanks @bypanghu)
- diegosouzapw#3130 connectionId fallback + kilo call logging (thanks @androw)
- build: standalone static-asset path fix (white login screen after build-output reorg)
- contributors hall: +@artickc +@bypanghu +@androw (15 total)
Poid-ZA pushed a commit to Poid-ZA/OmniRoute that referenced this pull request Aug 5, 2026
Poid-ZA pushed a commit to Poid-ZA/OmniRoute that referenced this pull request Aug 5, 2026
…uzapw#3131/diegosouzapw#3132) + static-asset build fix

- diegosouzapw#3131 Kiro Opus 4.8 catalog (thanks @artickc)
- diegosouzapw#3132 Kimi thinking-mode reasoning_content fix (thanks @bypanghu)
- diegosouzapw#3130 connectionId fallback + kilo call logging (thanks @androw)
- build: standalone static-asset path fix (white login screen after build-output reorg)
- contributors hall: +@artickc +@bypanghu +@androw (15 total)
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…uzapw#3131/diegosouzapw#3132) + static-asset build fix

- diegosouzapw#3131 Kiro Opus 4.8 catalog (thanks @artickc)
- diegosouzapw#3132 Kimi thinking-mode reasoning_content fix (thanks @bypanghu)
- diegosouzapw#3130 connectionId fallback + kilo call logging (thanks @androw)
- build: standalone static-asset path fix (white login screen after build-output reorg)
- contributors hall: +@artickc +@bypanghu +@androw (15 total)
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