Repository navigation
fix(ai): preserve OpenAI types in packed declarations - #195098
Conversation
Keep OpenAI declaration imports external while retaining bundled runtime clients. The declared production dependency supplies the original namespace types, avoiding self-referential aliases after declaration bundling. Verified the packed consumer fails with TS2456 on clean main on Node and the pinned Bun fork, then passes on both with this fix. All 19 exports, the SDK packed consumer, and bundled-runtime checks pass.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR keeps OpenAI declarations external to the AI declaration bundle and documents their dependency resolution. Example: A TypeScript application imports packed @openclaw/ai with skipLibCheck: false.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenanceRegression provenance — verified: source commit Merge readiness✅ Ready for maintainer review Keep this PR: it makes a focused repair to packed TypeScript declarations while preserving intentional runtime bundling; no actionable patch defects were found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe AI package build turns provider source into runtime bundles and public declarations; external TypeScript consumers resolve those declarations through the package export map. flowchart LR
A[AI provider source] --> B[tsdown build]
B --> C[Bundled runtime clients]
B --> D[Public declarations]
D --> E[OpenAI dependency types]
D --> F[TypeScript consumer]
E --> F
Technical reviewBest possible solution: Keep the declaration-only externalization in the existing build owner while retaining bundled runtime clients and the declared OpenAI dependency. Do we have a high-confidence way to reproduce the issue? The body reports clean-main TS2456 reproduction on Node and the pinned Bun fork, and source confirms the relevant bundling path; no target code was executed and the linked failure log was inaccessible. Is this the best way to solve the issue? The existing bundler provides the exact declaration-only control needed, and the production dependency already supplies upstream types, making this the smallest complete repair. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 001e82fcf99b. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceDocs +2, Other +2. Total +4 across 2 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 8, 2026, 2:57 AM ET / 07:57 UTC. |
|
Merged via squash auto-merge.
|
Keep OpenAI declaration imports external while retaining bundled runtime clients. The declared production dependency supplies the original namespace types, avoiding self-referential aliases after declaration bundling. Verified the packed consumer fails with TS2456 on clean main on Node and the pinned Bun fork, then passes on both with this fix. All 19 exports, the SDK packed consumer, and bundled-runtime checks pass.
What Problem This Solves
TypeScript consumers of packed
@openclaw/aifail with TS2456 when checking declarations withskipLibCheck: false.User Impact
All public package entries can be imported and typechecked again. Runtime provider bundling and dependency versions are unchanged.
Why This Change Was Made
Bundling OpenAI 7.47.0 declarations collapses self-module namespace references into 41 self-referential aliases, such as
type ChatCompletionCreateParamsNonStreaming = ChatCompletionCreateParamsNonStreaming.Keep
openaiand its subpaths external only in the AI declaration bundle. The package already declaresopenaias a production dependency, so consumers resolve the upstream declarations without changing the bundled runtime.Evidence
Clean main
837f871caf188401ec38bf86028c45ec71c2cdddreproduces the TS2456 failure on Node 24.22.1 and the verified pinned Bun fork (1.4.4-canary.1+191755ec1). The generated failing chunk isclient-Cg-WLGuq.d.mts, matching the failure in run 42454905825. The declaration inputs and dependencies are identical between that PR head and the tested main.With this fix:
packages/ai/src/package.e2e.test.tspasses on Node and the pinned Bun fork, importing and typechecking all 19 public exports withskipLibCheck: false.test/scripts/tsdown-ai-package.test.tspasses, including the assertion that the OpenAI runtime remains bundled.packages/sdk/src/app-sdk-external-boundary.e2e.test.tspasses through the shared declaration machinery and packed external-consumer boundary.git diff --checkpass.Independent Codex autoreview of the local change against
837f871caf188401ec38bf86028c45ec71c2cdddcompletedscoped-cleanthrough P2 with no findings. This is a declaration-only fix: two files, four added lines; no runtime fallback or dependency change.