Skip to content

refactor(chatcore): decompose handleChatCore into leaf modules - #13065

Closed
HouMinXi wants to merge 26 commits into
cheaper-inference:release/v3.8.52from
HouMinXi:feat/chatcore-decomposition
Closed

HouMinXi wants to merge 26 commits into
cheaper-inference:release/v3.8.52from
HouMinXi:feat/chatcore-decomposition

Conversation

@HouMinXi

@HouMinXi HouMinXi commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Re-extracted handleChatCore decomposition directly on current release/v3.8.51 tip (7a921299c5) instead of merging conflicting intermediate branches.

chatCore.ts drops from 6,200+ lines down to 992 lines by isolating discrete responsibilities into leaf modules under open-sse/handlers/chatCore/.

What changed

  • providerExecutionPipeline.ts: Provider execution pipeline and credential retry loop.
  • recoveryPolicy.ts: Recovery decision table and error classification.
  • streamingLeg.ts: SSE stream dispatch, lifecycle hooks, and abort listeners.
  • nonStreamingLeg.ts: Non-streaming response collection and payload forwarding.
  • materializeStreamSuccess.ts: Stream completion, usage calculation, and analytics persistence.
  • cacheAndCompress.ts: Semantic cache lookup, cache hit construction, and context compression.
  • translateAndDedup.ts: Request translation, tool normalization, stream controller setup, and request deduplication.
  • chatCore.ts: Retains top-level routing orchestration and target retry dispatch (down to 992 lines).

Verification

  • npm run typecheck:core: clean (0 errors)
  • npm run check:any-budget:t11: pass
  • Unit test suite: 102/102 tests passing across translation, caching, compression, streaming legs, and pipeline dispatch
  • Tested with defect injection across each module interface

Related to the earlier extract discussion on this PR. #12339 stays open. #12696 stays open.

⚠️ base-red inherited: #13866

@HouMinXi

HouMinXi commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor Author

CI on this head (8cdcf3a94, now 7dc90cfa8):

Own-red (fixed, this SHA):

  • ESLint unused barrel imports after the recovery lift:
    createRecoverableStream, makeContinuationBody,
    isStreamRecoveryExplicitlyConfigured. Local eslint --no-cache on the
    five unique logic files is clean after 7dc90cfa8.

Inherited on release/v3.8.51 (same fail set on #13079 / #13078 / #13074;
#13076 / #13073 are green):

  • Docs Gates (fast-path)
  • Fast Quality Gates
  • Unit Tests fast-path 1/4–4/4
  • API Route Typecheck / semgrep (this PR only; annotations are the generic
    “exit code 1” wrapper, no unique-file hit)

Unique files do not include glm.ts, changelog leading “- ”, or the
agent-skills cli-tunnel docs. Merge integrity and Vitest fast-path are green.

chatCore.ts 6021 → 5202. Frozen cap is still 5034/6021 on tip; local
check:file-size is OK because the file shrinks.

This contribution is intended for maintainer review and merge.

@HouMinXi
HouMinXi force-pushed the feat/chatcore-decomposition branch 2 times, most recently from c90553b to bb94055 Compare September 10, 2026 12:58
@HouMinXi HouMinXi changed the title refactor(sse): split chatCore send, recovery, and stream completion refactor(sse): split chatCore send, recovery, stream completion, request prelude Sep 10, 2026
@HouMinXi
HouMinXi force-pushed the feat/chatcore-decomposition branch from 4413bfa to 64df9ed Compare September 10, 2026 15:22
@HouMinXi
HouMinXi force-pushed the feat/chatcore-decomposition branch from 64df9ed to 91d0372 Compare September 11, 2026 08:22
@HouMinXi

Copy link
Copy Markdown
Contributor Author

Pushed 032344c76. API Route Typecheck was unique to this PR:

  • open-sse/handlers/chatCore.ts TS2304: VideoBridgeLogParam used VideoBridgeLogRedactionEntry without importing it. Restored the type import (same one requestPrelude.ts already has).
  • open-sse/handlers/chatCore/executeProviderRequest.ts TS2322: withRateLimit opts want getTimeoutMs?: () => unknown, the lift had getTimeoutMs?: unknown.

Local check:api-typecheck is now within the frozen baseline. Remaining Docs / Fast Quality / ESLint / unit-shard red is the shared release/v3.8.51 set.

@diegosouzapw

diegosouzapw commented Sep 11, 2026 •

Copy link
Copy Markdown
Collaborator

Holding this one out of today's batch deliberately, and it is not a judgement on the work.

The other 20 PRs of yours merged today. Two of them rewrite the same function this decomposes: #13069 routes the non-streaming leg through applyProviderFailureClassification (+443/-340 in chatCore.ts) and #13050 adds the Responses SSE wrap around the web_search fallback. package.json also moved under you — #13187 dropped the local test scripts from concurrency 20 to 4 today, which is the other half of your conflict.

The reason to give this its own round rather than carry it in a 21-PR batch: a behaviour-preserving decomposition of the hottest path in the codebase is exactly the change where the batch's economics stop working. The consolidated model runs focused tests per PR and leans on attribution when something goes red, and a refactor that touches every block of handleChatCore breaks attribution for everything merged alongside it. Today's batch proved the point in miniature — two ESLint regressions slipped past the focused-test validation and took three follow-up PRs to clear.

What it needs from here:

  1. Rebase onto the current tip. chatCore.ts now carries fix(chatcore): restore provider failure classification and credential refresh on non-streaming leg (#13043) #13069's extracted classification helper and fix(responses): wrap forced-non-streaming web_search JSON as SSE #13050's SSE intent stamp. Both should land inside the sender leaf and the barrel call sites rather than as a second copy, the same way you handled the queue-budget and per-model-402 cases.
  2. Keep the chatcore entry you added to UNIT_SUBDIRS across the eight npm scripts and scripts/release/merge-train.sh. Without it the seven new suites under tests/unit/chatcore/ are never discovered, which is the failure mode where a test exists but does not run.
  3. When it is green, say so here and I will validate it against the full unit suite rather than the focused subset. "No behaviour change" is a claim only the full suite can check.

On the 252 lines over the <2500 fence: not a blocker from my side. Say what is left and why it cannot move, and that is the review conversation.

Thanks for the other twenty. The live evidence on them — the X500 logs, the 36-minute outage write-up, the real /v1/models probes — is what made a batch that size reviewable as a unit.

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Careful, well-executed decomposition — chatCore.ts goes from 6145 to 2752 lines (55% cut), and
you covered every test-discovery mechanism in the repo for the new tests/unit/chatcore/
subdir (package.json scripts, check-test-discovery.mjs, build-test-impact-map.mjs,
select-impacted-tests.mjs, merge-train.sh, stryker.conf.json) — exactly the "phantom test" trap
this kind of change usually falls into. Ran all 9 new/touched test files at this PR's head:
46/46 pass, including several structural canaries confirming the barrel doesn't still inline the
extracted logic. No file-size-baseline rebaseline needed either. The real risk here isn't code
quality, it's timing: this group also has #12498, #13448 and #13556 all touching chatCore.ts —
whichever merges first will force a rebase on the others. Worth asking the owner to pick an
explicit merge order for this batch before landing any of the chatCore.ts PRs, and running the
broader chatCore-adjacent test suite (not just the new leaf files) once an order is picked, given
how central this file is.

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Thanks for taking this on — chatCore.ts is the file that most needs it, and the split you drew (send / recovery / stream completion / request prelude) is the right decomposition.

Holding it for now, for reasons that are about timing rather than the work itself:

  • The branch no longer merges: open-sse/handlers/chatCore.ts and package.json both conflict with the current tip. chatCore.ts is 6142 lines on release/v3.8.51 today against the 2872 your branch produces, and a large part of that delta is the ~40 PRs that landed in it over the last two days.
  • A pure refactor is only safe when the equivalence is mechanically checkable. With a conflict of this size the merge resolution itself becomes new, untested code in the hottest path in the repo (every chat completion goes through it), and there is no behavioral test that would catch a subtle reordering of the early returns, the abort handling or the cache/compress step.

What would make it mergeable: rebase onto the current release/v3.8.51 tip and re-derive the split from that version (git diff of each extracted module against the corresponding block of the tip should be empty apart from the import/export wiring), so the review can verify equivalence hunk by hunk. If you do that, ping me here and it goes to the front of the queue.

The tip already carries open-sse/handlers/chatCore/providerExecutionPipeline.ts and a number of sibling modules, so part of the direction is already landing incrementally — your branch and the tip are converging, not diverging.

@HouMinXi

Copy link
Copy Markdown
Contributor Author

@diegosouzapw I do want this merged; the earlier contributor-only / do-not-merge wording was my mistake, not a request to withhold the work. I have corrected the description and my earlier comment. Your current-base equivalence requirement is reasonable: an old conflict resolution is not evidence of a behavior-preserving split. I will not call the old tests proof for the new tip. The next revision needs block-by-block equivalence against the current source, preserved test discovery, and the broader adjacent suite before it is ready.

@HouMinXi
HouMinXi force-pushed the feat/chatcore-decomposition branch from 24a466a to 131e14e Compare September 16, 2026 12:28
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Precisa ser refeita sobre o tip atual. Não forcei a resolução, e explico por quê.

Tentei o merge e abortei sem commitar nada. Os números: o tip avançou open-sse/handlers/chatCore.ts em 9 commits / 50 hunks / +259−111 desde a base desta branch (0cc0169), espalhados por toda a handleChatCore. Esta PR move ~3.400 dessas linhas para 6 módulos novos. O conflito é de 8 regiões, uma delas com 4.971 linhas (lado da PR ≈ 38 linhas, lado do tip 2.499) — a forma clássica de "um lado deletou tudo, o outro editou dentro".

Resolver significaria decidir, para cada um dos 50 hunks de 9 PRs já mergeadas, em qual dos 6 módulos ele passa a morar, e reconstruir a fiação. Isso é reexecutar a extração, não resolver um conflito — e é trabalho seu, não meu, porque é o desenho da separação.

Dois agravantes fecharam a decisão:

  1. Os canários estruturais da PR testam o barrel, não cada comportamento portado. Um hunk perdido no caminho não seria pego por teste nenhum.
  2. Entre os hunks em risco está o endurecimento da fronteira de log da security(runtime): harden TLS provenance, lifecycle, and public error boundaries #11742 (safeErrMsg/safeUpstreamErrorBody — superfície da Hard Rule fix(ui): fix Select dropdown dark theme inconsistency #12), a divisão pre/post-translation do system prompt (fix(sse): inject global system prompt once, post-translation, across all target shapes #12904), o reasoningRuleDirective (fix(routing): preserve reasoning overrides across transports and fallbacks #13556), o getManagedLeaseFenceErrorCode e o adaptive effort (feat: adaptive reasoning effort (auto) — gateway-resolved, per-turn pinned, all harnesses #13448). Perder qualquer um em silêncio reabre um buraco de segurança que os testes não cobrem.

Sugestão: rebase/refazimento da extração sobre o tip atual, e mergear antes as PRs cirúrgicas do grupo — que é a ordem que o próprio plan-file sugere. O trabalho de separação continua valendo; só precisa partir de uma base que não seja de 9 commits atrás.

@HouMinXi

Copy link
Copy Markdown
Contributor Author

Pinned the Claude OAuth raw passthrough wiring from #14053 onto this split so the three execute sites do not live only in the pre-split barrel.

isClaudePassthrough now comes out of translateAndDedup, rides sendDeps, and is passed at the two executor.execute calls in executeProviderRequest.ts plus the leftover credential-retry execute in chatCore.ts. Proxy native fallback, dashboard toggle, and the cloak/fingerprint/CCH gate in base.ts match #14053. One extra filter: client x-app / x-stainless-* / anthropic-dangerous-direct-browser-access are dropped during the final header merge, not only stripped from executor leftovers.

Tests: claude-oauth-raw-passthrough + schema = 51/51. Head 9f4108c447. Related to #13893; #13893 stays open.

This is not the tip re-extract. The PR is still CONFLICTING against current release/v3.8.51 for the reason already given — the 50 hunks / 9 merged PRs still have to be placed into the six leaves. That remains a separate pass.

@HouMinXi

Copy link
Copy Markdown
Contributor Author

Will not hand-resolve the eight conflict regions. You are right that that would be re-running the extraction, not merging.

Plan from here: re-derive leaves on current release/v3.8.51 (1603c86e06) so each new module diffs empty against the tip block except for import/export wiring. First leaf already exists on a side branch (executeProviderRequest out of handleChatCore). Further leaves will land the same way. This PR stays CONFLICTING until that re-extract replaces it; please keep holding.

#12498 / #13448 / #13556 / #13069 / #13050 are already on the tip this re-extract starts from.

@HouMinXi

Copy link
Copy Markdown
Contributor Author

Re-extracted on current release/v3.8.51 instead of merging the stale split.

What is in this branch now:

  • executeProviderRequest lifted out of handleChatCore
  • recovery policy as effects plus dispatch
  • family hop writes wire.currentModel on the pipeline object (the chatCore setter only mutates the closure)
  • dead pipelineRecovered copies deleted; context-overflow hop stayed

Not in this branch: stream materialize, request prelude, and the Claude OAuth raw passthrough wiring that had leaked into the old head.

Tests: 33/33 on the send + recovery + pipeline files.

@HouMinXi HouMinXi changed the title refactor(sse): split chatCore send, recovery, stream completion, request prelude refactor(sse): extract chatCore send and recovery policy Sep 18, 2026
@HouMinXi
HouMinXi force-pushed the feat/chatcore-decomposition branch from 1de9b94 to 7c9e8ae Compare September 18, 2026 11:36
@HouMinXi

Copy link
Copy Markdown
Contributor Author

Title and body now match the branch.

This PR is the sender leaf plus the recovery policy table. Stream completion, request prelude, cache, and translation stay in handleChatCore. I stopped there instead of forcing leftover chatCore.ts under 2500 lines on this ticket.

Head 7c9e8aeb67 on current release/v3.8.51. Tests on send + recovery + pipeline: 33/33.

@HouMinXi
HouMinXi force-pushed the feat/chatcore-decomposition branch from 7c9e8ae to 80225fa Compare September 18, 2026 14:42
… file

Review flagged that the probe's regex splice could mangle the source in ways
the assertions would not notice. Checking it, that was already happening: the
replacement wrapped the assignment in `void 0 && (providerUrl = ...` and left
the parenthesis unbalanced, so the probe carried one parse error.

That matters because a file which does not parse can report 2454 for reasons
unrelated to the branch under test -- so the self-check could have been passing
on a broken probe rather than on working flow analysis, which is the exact
false negative it was added to rule out.

The probe now comments the assignment out, leaving a file that parses cleanly,
and two assertions pin what the old code only assumed: the probe has zero parse
diagnostics, and it carries exactly one fewer assignment than the leaf. Measured
after the change: 0 parse errors, 6 assignments down to 5, still two TS2454.

All four failure shapes turn it red -- a probe that does not parse, a probe that
drops nothing, a renumbered diagnostic, and a real gapped branch.

Suite is 65 green, typecheck:core and lint clean.

Signed-off-by: Minxi Hou <houminxi@gmail.com>
…ding

The comment quoted the malformed splice inline, backticks and all. Encoding
that line into the review pipeline's JSON payload failed mid-string, which
surfaced as a parse error and a mismatched excerpt rather than anything about
the test.

Same explanation, described in words instead of quoting the broken expression.
No behaviour change; the file's other inline code references round-trip fine,
so they stay as they are.

Suite is 65 green, typecheck:core and lint clean.

Signed-off-by: Minxi Hou <houminxi@gmail.com>
Review pointed out the probe's line regex would only comment out the first
line of a multi-line assignment. Reproduced it: reshaping one assignment across
three lines left the guard green, because the regex simply matched a different
single-line assignment instead and probed that one. The branch whose shape
changed was never exercised.

The probe targets now come from the AST, so a statement spanning several lines
is removed whole, and every assignment is probed rather than just whichever the
regex happened to hit first.

Probing all of them surfaced something the single-probe version could not: not
every removal is a compile error. Dropping the assignment in the retry branch
leaves an earlier one reaching the same read, so the compiler sees a value and
says nothing -- the fault there is a stale URL, not an unassigned one, which
definite-assignment analysis does not model. Requiring every probe to fire
would have been asserting something untrue about the code, so the check
requires that at least one fires, which is what makes a clean result
meaningful.

Re-verified after loosening: a gapped branch is red, a multi-line assignment
left intact is green, the same assignment gapped is red, and renumbering the
diagnostic is red.

Suite is 65 green, typecheck:core and lint clean.

Signed-off-by: Minxi Hou <houminxi@gmail.com>
…arry-out

The streaming leg needs eight values carried back because it can fall through
and the barrel keeps using what it rebound. The non-streaming leg rebinds the
same kinds of values -- currentModel, translatedBody, finalBody -- and carries
none of them, which is only safe because the barrel tail-calls it: the result
is returned directly and nothing in that block runs afterwards.

Nothing recorded that. Adding work after the return would give the second leg
the same stale-value defect this suite just fixed in the first one, and the
suite would stay green.

The test parses the barrel and asserts the shape: exactly one callsite, the
result flowing to a return through nothing but await, and no statements after
it. Each of those turning false is a real change in the contract, not a
formatting difference, so it fails with a message naming the shape it lost.

Verified against three ways the property can break: a statement after the
return, capturing the result into a local instead of returning it, and a second
callsite appearing.

Suite is 66 green, typecheck:core and lint clean.

Signed-off-by: Minxi Hou <houminxi@gmail.com>
…ds at split modules

Re-point structural source guards in chatcore-hierarchical-admission.test.ts
and chatcore-stream-error-result.test.ts at the split leaf modules:
- Point wire-send loop and concurrency gate assertions at executeProviderRequest.ts
- Point sendProviderAttempt assertions at streamingLeg.ts and nonStreamingLeg.ts
- Point non-streaming semaphore try/catch assertions at nonStreamingLeg.ts
- Assert that barrel chatCore.ts delegates and passes executeProviderRequest to both legs

Signed-off-by: Minxi Hou <houminxi@gmail.com>
…eChatCore

Extract the inline applyProviderFailureClassification logic (cooldowns,
terminal statuses, lockouts, quota state updates, and response telemetry)
into a dedicated leaf module open-sse/handlers/chatCore/providerFailureClassification.ts.
The chatCore barrel now instantiates the classifier via createProviderFailureClassifier,
reducing chatCore.ts from 2534 lines to 2211 lines (-323 lines).

Signed-off-by: Minxi Hou <houminxi@gmail.com>
…dleChatCore

Extract streaming success response header assembly, transform stream
selection, pipeline chaining, and completion callback wiring into
open-sse/handlers/chatCore/streamingSuccessResponse.ts.

- Move streaming Response construction, transform stream creation
  (Responses API translation, general translation, or passthrough),
  codex turn-state provenance, and completion/failure callback
  registration to a dedicated leaf helper.
- Pass dependencies explicitly via StreamingSuccessResponseDeps.
- chatCore barrel delegates streaming completion directly to the leaf,
  reducing handleChatCore tail complexity and shrinking the barrel
  from 2211 to 2011 lines.
- Add unit characterization test with defect injection verification.

Signed-off-by: Minxi Hou <houminxi@gmail.com>
… into leaf module

Lifts semantic cache check (temp=0 early return), reasoning input policy,
body sanitization, memory/skills injection, proactive context compression,
and output token budget enforcement out of handleChatCore into
open-sse/handlers/chatCore/cacheAndCompress.ts.

- Replaces inline Phases 9.1 through 9.4 with a typed runCacheAndCompress delegate
- Reduces chatCore.ts barrel from 2011 to 1785 lines (-226 lines, cumulative -71.2%)
- Passes all 685 unit tests with verified AST/runtime defect injections

Signed-off-by: Minxi Hou <houminxi@gmail.com>
…eaf module

Lifts request translation (format conversion, system prompt injection, tool
normalization, message stripping), stream controller setup, executor
resolution, credential binding, Claude passthrough handling, and request
deduplication hashing out of handleChatCore into
open-sse/handlers/chatCore/translateAndDedup.ts.

- Replaces inline translation and dedup block with runTranslateAndDedup delegate
- Drops chatCore.ts barrel from 1785 to 993 lines (-792 lines, cumulative -84.0%)
- Adds tests/unit/chatcore/translate-and-dedup.test.ts verifying structural seams
- Passes all 685 unit tests with verified runtime defect injections

Signed-off-by: Minxi Hou <houminxi@gmail.com>
@HouMinXi
HouMinXi force-pushed the feat/chatcore-decomposition branch from 80225fa to 65512fb Compare September 20, 2026 10:40
@HouMinXi HouMinXi changed the title refactor(sse): extract chatCore send and recovery policy refactor(chatcore): decompose handleChatCore into leaf modules Sep 20, 2026
@HouMinXi

Copy link
Copy Markdown
Contributor Author

Re-extracted on current release/v3.8.51 tip (7a921299c5) per review feedback, instead of merging conflicting intermediate branches.

What is in this branch now:

  • open-sse/handlers/chatCore.ts drops from 6,200+ down to 992 lines.
  • Discrete steps moved into clean leaves under open-sse/handlers/chatCore/:
    • providerExecutionPipeline.ts (provider execution and retry loops)
    • recoveryPolicy.ts (recovery decision table)
    • streamingLeg.ts and nonStreamingLeg.ts (execution legs)
    • materializeStreamSuccess.ts (stream completion and usage accounting)
    • cacheAndCompress.ts (semantic cache lookup and context compression)
    • translateAndDedup.ts (request translation and deduplication)
  • All 102 unit tests in the chatcore suite pass.
  • Verified with defect injection on interface boundaries.

@RaviTharuma

Copy link
Copy Markdown
Contributor

@diegosouzapw this one is super nice

@HouMinXi

Copy link
Copy Markdown
Contributor Author

Re-extracted onto the current release/v3.8.51 tip as #14725: each leaf diffs empty against its tip region (imports/exports and deps/carry wiring aside), one clean commit, 209 chatcore-referencing test files show zero new failures against the tip baseline. Two wiring seams the suite caught after the lifts (translatedBody snapshot vs live binding; test re-anchors) are fixed and covered. This PR can stay open for history; the tip-based version is the one to review.

HouMinXi added a commit to HouMinXi/OmniRoute that referenced this pull request Sep 26, 2026
Re-extraction of cheaper-inference#13065 onto the current release/v3.8.51 tip
(a41ded2). Each leaf is lifted out of handleChatCore unchanged apart
from imports/exports and the deps/carry wiring, so every leaf diffs
empty against the tip implementation except the wiring:

- executeProviderRequest.ts — one provider send (admission, body
  preparation, executor call, retry ladder)
- nonStreamingResponse.ts — the !stream leg
- streamingResponse.ts — the stream leg up to readiness
- streamingTail.ts — readiness, translation pipeline, tail finalization

While replaying, the 18 upstream hunks that landed inside the lifted
regions were folded into the leaves so behaviour stays identical to the
tip: getExecutorClientHeaders() call sites, metered-budget cost
wrapping, the stream-readiness fallback hook, formatted
FLUSH_EMPTY_RETRY verdict logging, captureStreamReasoningForReplay,
videoTranscriptSensitive flags, and the connection-id provenance fields
on the streaming response headers. The hard-lease inventory guard moves
its FLUSH_EMPTY_RETRY expectation to the leaf's new home.

Signed-off-by: Minxi Hou <houminxi@gmail.com>
@diegosouzapw diegosouzapw added the deferred-v3.8.52 Grande demais / suspeito para o lote atual; precisa de sessão dedicada no ciclo v3.8.52 label Sep 28, 2026
@diegosouzapw diegosouzapw changed the title refactor(chatcore): decompose handleChatCore into leaf modules [defer] refactor(chatcore): decompose handleChatCore into leaf modules Sep 28, 2026
HouMinXi and others added 2 commits September 29, 2026 05:50
The overflow fail-fast gate (finalEstimatedInputTokens >= finalContextLimit)
moved from chatCore.ts into chatCore/cacheAndCompress.ts with the response-path
decomposition, but the cheaper-inference#12793 regression guard's barrelSource still read
chatCore.ts, silently asserting against a file that no longer contains the
gate's logic.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
…ingLeg

streamingLeg.ts was 1311 lines, over the 1200-line cap for new files
(config/quality/file-size-baseline.json). Lift the self-contained 401/403
credential-refresh-and-retry block into its own leaf, mirroring the deps-bag
pattern already used across chatCore's other extractions. No behavior change:
the block moves verbatim, taking its declared-but-unused-until-later state
(upstreamErrorParsed, parsedStatusCode, parsedMessage, parsedRetryAfterMs,
upstreamErrorBody) along as return values instead of shared closure locals.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
@diegosouzapw
diegosouzapw changed the base branch from release/v3.8.51 to release/v3.8.52 September 29, 2026 11:26
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Re-homed to release/v3.8.52: v3.8.51 entered its release freeze, so the branch now belongs to the release captain and development continues on the next cycle. Nothing is wrong with this PR — it just needed a live base. No action needed from you; CI will re-run against the new base.

@diegosouzapw diegosouzapw removed the deferred-v3.8.52 Grande demais / suspeito para o lote atual; precisa de sessão dedicada no ciclo v3.8.52 label Oct 1, 2026
@diegosouzapw diegosouzapw changed the title [defer] refactor(chatcore): decompose handleChatCore into leaf modules refactor(chatcore): decompose handleChatCore into leaf modules Oct 1, 2026
@HouMinXi

HouMinXi commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Closing this. release/v3.8.52 already absorbed a different chatCore split through #14725 (streamingResponse, streamingTail, nonStreamingResponse). This branch is 865 commits behind that base and its leaf set no longer matches the tree.

The remaining 3.8.53 decomposition will continue as smaller slices on the current release/v3.8.52 baseline: credential refresh, provider failure classification, post-translation request finalization, and pre-request checks.

@HouMinXi HouMinXi closed this Oct 7, 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.

3 participants