Repository navigation
refactor: extract Responses lifecycle to open-sse/utils/stream/responsesLifecycle.ts (Issue #3594) - #3926
refactor: extract Responses lifecycle to open-sse/utils/stream/responsesLifecycle.ts (Issue #3594)#3926oyi77 wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new utility file open-sse/utils/stream/responsesLifecycle.ts to handle OpenAI Responses API stream lifecycle events, including ID normalization, backfilling completed outputs, and stripping request echoes to prevent oversized SSE events. The review feedback highlights two main issues: first, there are unused imports (convertOpenAIToResponsesToolCall and uuidv4) that should be removed; second, according to the repository style guide, adding production code in open-sse/ requires corresponding unit tests to be added in the tests/ directory.
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.
| import { convertOpenAIToResponsesToolCall } from "../handlers/responseTranslator.ts"; | ||
| import { v4 as uuidv4 } from "uuid"; | ||
|
|
||
| import { stringifyIdValue } from "./utils.ts"; | ||
| import { JsonRecord } from "./types.ts"; |
There was a problem hiding this comment.
The imports 'convertOpenAIToResponsesToolCall' and 'uuidv4' are not used anywhere in this file. Removing unused imports keeps the codebase clean and prevents potential linter or build errors.
| import { convertOpenAIToResponsesToolCall } from "../handlers/responseTranslator.ts"; | |
| import { v4 as uuidv4 } from "uuid"; | |
| import { stringifyIdValue } from "./utils.ts"; | |
| import { JsonRecord } from "./types.ts"; | |
| import { stringifyIdValue } from "./utils.ts"; | |
| import { JsonRecord } from "./types.ts"; |
| @@ -0,0 +1,203 @@ | |||
| import { convertOpenAIToResponsesToolCall } from "../handlers/responseTranslator.ts"; | |||
There was a problem hiding this comment.
According to the Repository Style Guide (Rule 9), changing production code in 'open-sse/' requires including corresponding tests. Please add unit tests for the newly extracted Responses lifecycle utility functions in the 'tests/' directory.
References
- Always include tests when changing production code (src/, open-sse/, electron/, bin/).
…sesLifecycle.ts Part of Issue diegosouzapw#3594 modularization. Extracted OpenAI Responses API lifecycle handling from the monolithic stream.ts. Exports: - normalizeResponsesSseIds, markPendingRequestCleared - pushUniqueResponsesOutputItems, backfillResponsesCompletedOutput - stripResponsesLifecycleEcho
d606740 to
4ac62a4
Compare
|
Thanks, @oyi77 🙏. These stream extractions are currently additive — the new modules under |
Part of modularization effort (Issue #3594).
Extracts OpenAI Responses API lifecycle handling from the monolithic
open-sse/utils/stream.tsinto a dedicated module.Changes:
open-sse/utils/stream/responsesLifecycle.ts(203 lines)normalizeResponsesSseIds,markPendingRequestCleared,pushUniqueResponsesOutputItems,backfillResponsesCompletedOutput,stripResponsesLifecycleEchoTesting: No behavior change. Existing stream tests pass.
Follow-up PRs will extract: types (#3917), utils (#3918), errors (#3919), textualToolCalls (#3920), sseFormatters (#3923), openaiChunks (#3924), claudeLifecycle (#3925), and streamCore.