Skip to content

Split plan: #1311 openai-family abort support (4 units) #2799

Backlog

Description

@easonLiangWorldedtech

Split plan for #1311 (openai-family abort support, round 2)

#1311 carries 32 files and 500 changed executable lines, which is the whole mutation ceiling for one PR and too much to review as one object. This is the plan. It is issued BEFORE the first split PR opens.

Units

# branch scope (provider group + gate scope) source files changed executable lines (standalone) a+d (standalone)
u0 split/1311-u0-abort-plumbing shared abort/timeout plumbing utils/abort-signal.ts, utils/error-handler.ts, utils/request-timeout.ts, test-utils/errors.ts ~23 ~250
u1 split/1311-u1-openai-family openai.ts + the OpenAI-compatible base openai.ts, base-openai-compatible-provider.ts ~219 ~2160
u2 split/1311-u2-zai zai.ts (GLM-5.3 path) zai.ts ~22 ~577
u3 split/1311-u3-kimi-code kimi-code.ts + the Kimi OAuth refresh kimi-code.ts, fetchers/kimi-code.ts, integrations/kimi-code/oauth.ts, docs/architecture/tla/KimiOAuthRefresh.* ~235 ~2360

a+d is a screen, not the gate: the CI currency is changed executable lines, and every unit is well under 500. The two test-heavy units (u1, u3) exceed the 400 a+d soft cap and u3 the 1000 hard screen because their focused specs travel with them (1202-line oauth.spec.ts, 785-line base spec, 692-line openai spec, 333-line cancellation spec). Splitting a provider from its kill assertions would put the regression evidence in a later PR, which the split discipline forbids.

Topology and merge order

Stacked chain, all PRs target main, measured standalone against their own base:

  1. u0 (base dd30249147) -> 2. u1 (base u0) -> 3. u2 (base u1) -> 4. u3 (base u1)

Merge order: u0, u1, u2, u3. u3 depends only on u0+u1, so it may merge before u2.

Cross-unit contract points

  • createAbortError, mergeAbortSignalAndTimeout, isTimeoutAbort, rejectOnAbort, bridgeExternalAbortSignal, hasNumericHttpStatus, createTimeoutError: owned by u0. u1, u2 and u3 consume them and add no copies.
  • handleOpenAIRequestError: owned by u0. u1 and u2 only call sites.
  • The OpenAI-compatible base's per-request wiring: owned by u1; u2 (ZAiHandler extends it) and u3 (KimiCodeHandler extends OpenAiHandler) depend on it.

Content source of record

kind: commit, source = 822ed3e99eca595701da5c1549e1bb225113ff4e (#1311's final head), source-base = dd30249147159dad2d410845527a14a8e55d1463 (merge base). Each unit ports only its own file set from that commit; no unit carries content from another.

What #1311 becomes

#1311 stays open until u0..u3 land. Its body will point at this plan, and each unit PR cites this issue.

TLA+ and evidence notes

The TLA+ spec (docs/architecture/tla/KimiOAuthRefresh.tla + the two cfgs) travels with u3. TLC has not been run: the authoring machine has no Java, so TLA_JAR=<jar> ./check.sh KimiOAuthRefresh must run before u3 merges.

Activity

  1. easonLiangWorldedtech commented on Dec 2, 2026

    @easonLiangWorldedtech
    ContributorAuthor

    Dependency finding (measured, after trying provider-only branches):

    • A branch that carries only one provider's files cannot be pushed: the pre-push hook runs tsc, and every provider request site calls handleOpenAIRequestError, which u0 adds.
    • u2 (zai) additionally needs u1's OpenAI-compatible base wiring: on u0 alone, 10 of its 78 rows fail.

    So the units stay stacked for now, each with its own provider-scoped diff and budget recorded in its body. They become independent, provider-only pulls as the ancestors land:

    1. feat(api): add the shared abort, timeout and error plumbing (#1311 split u0) #2800 (u0, 18 exec lines) merges.
    2. feat(api): honour caller cancellation in the openai family (#1311 split u1) #2801 (u1, 228) merges.
    3. feat(api): honour caller cancellation in zai (#1311 split u2) #2802 and feat(api): honour caller cancellation in kimi code and its oauth refresh (#1311 split u3) #2803 rebase onto main: each diff then collapses to its own provider files and either can merge in any order.

    If you prefer the provider PRs to be independent before anything merges, the alternative is one of: (a) land u0 as the shared base first (it is 18 executable lines), or (b) accept each provider pull carrying u0's files as duplicates of #2800 — which creates the same file in four PRs and a conflict for whichever merges second, so I did not do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions