What do you want to change?
I'd like to contribute two separate Senpi PRs: regional Kimi Code OAuth/API-key login and a fix for a Bun response-stream stall in CLI dispatcher setup. I'd coordinate the shared auth work with Pi and adoption with the OmO Senpi edition.
Why?
I couldn't use my international Kimi Coding subscription reliably in OmO. The login flow lacked a region choice. After getting .ai login working, requests still stalled. A loopback SSE test failed after configureHttpDispatcher() and passed when Bun kept its native fetch. The combined local changes restored my K2.8 and K3 plan/execute use. The new region-selection flow remains proposed.
How? (optional)
Verify the regional endpoints, persist the selected region with credentials, and preserve Senpi's identity headers. Keep the transport fix separate and test proxy, TLS, timeout, and Node decompression behavior. I'd check extension options and document required core changes in changes.md. Full shared evidence and acceptance criteria are included below.
Coordinated issues
Each proposal carries the same evidence and work plan so reviewers can see the full dependency chain. Each repository owns only the work listed for it.
| Repository |
Tracking issue |
Contribution |
| Senpi |
#1890 |
Separate regional authentication and Bun transport PRs. |
| Pi |
earendil-works/pi#9818 |
Coordinate the shared regional authentication change and verify it in Pi. |
| Oh My OpenAgent |
code-yeongyu/oh-my-openagent#8549 |
Adopt released Senpi fixes and verify the complete login flow in the Senpi edition. |
| Bun |
Investigation pending |
Reduce the transport failure before opening a runtime report or proposing a code fix. |
| Undici |
No issue proposed |
Current evidence does not establish an Undici defect. |
What failed, what worked locally, and the limits of the evidence
User experience
I hit two separate problems using Kimi Coding in the OmO Senpi edition. International authentication required a local workaround. After login worked, model requests still stalled under Bun.
The combined local changes restored kimi.ai authentication and execution for me. On September 20, 2026, I reported successful use of OmO's plan and execute skills/protocols with both K2.8 and K3 from my Kimi Coding subscription. Plan implementation was still running when I reported that result. This is my integration experience, separate from the captured minimal CLI checks below.
The upstream region selector, credential metadata, and API-key routing described here are proposed work. The local success does not establish that those features already exist or that the ongoing plan finished.
Regional login gap
The reported OmO path is /login, then OAuth or API key, then Kimi Coding. The method selector filters the provider list. Kimi Coding appears in API-key setup, but that path does not offer a region or associate the key with a regional endpoint. The provider implementations also lack an explicit OAuth region prompt.
In my account setup, the international .ai service offered Google and international phone login. The mainland .com service offered mainland phone and WeChat login and directed users outside mainland China toward .ai.
Two inspected screenshots support the different login experiences. One shows WeChat and a prompt to use Kimi.ai outside mainland China. The other shows an international phone selector, Google login, and a prompt to use kimi.com in mainland China. Their original labels appeared reversed. Neither screenshot includes an address bar or a completed device authorization, so neither proves an endpoint contract or successful polling.
The recovered auth patch changed the default host in installed OAuth code and its bundled Kimi module:
-const DEFAULT_OAUTH_HOST = "https://auth.kimi.com";
+const DEFAULT_OAUTH_HOST = "https://auth.kimi.ai";
The earlier investigation also used KIMI_CODE_OAUTH_HOST=https://auth.kimi.ai. It recorded that the hardcoded change printed the intended URL but did not wait for login, while the environment override recognized completion. My later recollection attributes working login to the patch. Both observations are retained because there is no captured authorization trace that reconciles them.
No separate polling correction was recovered. A comparison of the compiled OAuth file with its embedded original source found only the default-host change after import-path normalization. Current source already awaits device-token polling and handles pending, slow-down, denial, and expiry. A stale-process explanation was suggested, but not demonstrated. Login recognition needs a regression test before any polling rewrite.
The auth edits affected the Bun and Homebrew installations during the earlier investigation. The active Bun installation still had the changed default in the modular OAuth file and bundled Kimi module. The later streaming repair preserved these edits and changed only the HTTP dispatcher bundle.
Independent transport failure
The captured environment was Bun 1.3.14, macOS arm64, and @code-yeongyu/senpi@2026.9.19-2. The diagnostic worker recorded bundled Undici 8.10.2.
Direct Senpi and OmO CLI probes reached their 30-second deadline without an assistant event. Lower-level ModelRuntime returned HELLO in about 2.5 seconds. Calling the CLI's configureHttpDispatcher() before ModelRuntime reproduced the stall. HTTP headers arrived with status 200, but no assistant events arrived from the SSE body. Preserving Bun's native fetch completed the request.
A loopback HTTP server reproduced the failure without Kimi credentials or an external network. It sent a complete Anthropic SSE lifecycle through the real bundled dispatcher, ModelRuntime, and empty-assistant recovery. The fixture emitted message_start, a text block with HELLO, block completion, message_delta with end_turn, and message_stop. It asserted the text and successful terminal result.
The installed transport edit was in dist/bundle/chunks/chunk-PLZK7ABD.js, line 133:
-undici.install?.()
+process.versions.bun||undici.install?.()
This preserves Bun's native fetch and web constructors while retaining the Undici installation branch under Node. It is a diagnostic workaround. Bun's native fetch does not consume Senpi's configured Undici dispatcher, so the guard alone does not prove preservation of proxy, TLS, connection, or timeout settings.
| Check |
Recorded result |
| Loopback regression before the edit |
0 passed, 1 failed by timeout. |
| Same regression after the edit |
1 passed, 0 failed. |
| Live OmO CLI |
HELLO, exit 0, 4.1 seconds. |
| Live Senpi CLI |
HELLO, exit 0, 3.5 seconds. |
| Independent repeat of loopback regression |
1 passed, 0 failed. |
| Independent fresh OmO CLI |
HELLO, exit 0, 4.016 seconds. |
| Syntax and diagnostics |
node --check passed for the edited bundle; no LSP diagnostics reported on the bundle or regression. |
The minimal live probes used kimi-for-coding, isolated CLI state, and a short prompt. They refreshed existing credentials in memory and supplied an access token to an isolated CLI. They did not exercise browser login, persisted credentials after restart, API-key region selection, every Kimi model, Node execution, other providers, or the full upstream test suite. My K2.8/K3 plan and execute experience is separate evidence.
The transport repair left existing settings, credentials, OAuth patches, and thinkingCommits unchanged. Adapter checks did not reproduce the earlier thinking-buffer hypothesis as the cause of this failure. Extending the response-start timeout would not repair the demonstrated body-consumption failure.
The installed bundle's SHA-256 values were:
Before: e2834cb76f4ea9721888c829952f8a40e421cad679571e3cea643c54c60a2aa1
After: 7e382315d17064faee1d38d0215a2013bdfa65bda48066d4dbfd556d5e5b667d
The parent investigation independently verified the patched hash. Its local artifacts include a journal, regression fixture, live CLI probe, patch receipt, and rollback patch. Those files are not attached here. The fixture imports generated bundle chunks through machine-specific paths, and the live probe reads a local credential store. This report includes the relevant measurements and exact edits; the upstream work must supply a portable reproduction. Private transcripts, account data, and screenshots remain local.
Source findings, repository ownership, and current release context
Inspected revisions
On September 20, 2026, the source review checked Senpi main at cd317ee6472dde1658a75e644637691ba5d41bc1, Pi main at 3390bd93630965a12a0a1a5c36ce890ec22f7e1d, and OmO dev at 2dd4002e9de54a696f37fc830dd083ceae0df06d.
Senpi and Pi both own packages/ai/src/auth/oauth/kimi-coding.ts and packages/ai/src/providers/kimi-coding.ts:
Both implementations choose KIMI_CODE_OAUTH_HOST, then KIMI_OAUTH_HOST, then https://auth.kimi.com. Device authorization uses /api/oauth/device_authorization. Polling and refresh use /api/oauth/token on the selected host.
Login stores type, access, refresh, and expires, without a region or host. Refresh reads the environment again. OAuth request auth returns Bearer headers, without an API base URL. The provider base URL remains https://api.kimi.com/coding. API-key auth uses envApiKeyAuth and KIMI_API_KEY, without a regional prompt. An explicit model base-URL override is separate configuration.
Senpi also adds kimiCodeIdentityHeaders(). The examined Pi implementation does not. The shared regional change needs coordination, while each repository's identity-header and authentication contracts need their own review and tests.
Senpi's auth interfaces provide a select prompt, provider-scoped API-key environment metadata, OAuth credential metadata, and ModelAuth.baseUrl. These are possible implementation tools. Their behavior through lazy wrappers, serialization, account selection, and model resolution still needs verification.
Transport ownership
Senpi owns CLI HTTP dispatcher setup. The inspected source still calls undici.install?.() without a Bun guard when it installs globals.
That source also preserves deliberate caller fetch overrides and fixes proxy and timeout configuration at process startup for multi-session RPC. Its comment explains that Node 26 compressed responses can fail to decompress when fetch and the dispatcher come from different Undici implementations. An upstream Bun fix must preserve those behaviors.
OmO's Senpi adapter manifest now names Senpi 2026.9.20 in its peer and development dependencies. OmO #8545 adopted that release. This is newer than the measured failing installation. Source inspection confirms the relevant code remains, but the historical runtime measurements do not establish a fresh reproduction on the new package.
The local loopback result establishes a Senpi/Bun integration failure. It does not identify an internal Bun operation or establish that Undici itself is defective. It also does not establish that Pi has the same transport failure.
Endpoint contract still to verify
https://api.kimi.ai/coding is a candidate from the reported international use, not a verified API-key contract. Before implementing the regional mapping, I would verify the official Kimi Code CLI or provider documentation and record each region's authorization host, device path, token path, API base URL, required headers, supported key type, and model discovery behavior. A successful .ai website login does not prove that inference and refresh use the same service. Kimi Code subscription credentials must be distinguished from other Moonshot API products.
Regional authentication contribution and acceptance criteria
Proposed behavior
After choosing OAuth or API key and Kimi Coding, users can select "Mainland China" or "Outside mainland China". The choice describes the account's service region. It should stay with that credential or account slot.
OAuth should open the verification URL returned by the selected service and poll that same service until success, cancellation, or a defined failure. The CLI should report success only after writing the credential. Closing a browser window is not proof of token completion.
API-key setup should collect the region and key together and route requests to the matching verified Anthropic-compatible endpoint. Users should not need a separate models.json edit. Restart, token rotation, refresh, environment changes, and account switching must retain the saved region.
Implementation decisions
I would keep one kimi-coding provider unless a verified constraint requires otherwise. Region is account configuration, not a model ID. The source work starts in the OAuth and provider files, auth helpers and types, and provider documentation. It also needs tracing through the method/provider selectors, lazy OAuth wrappers, storage, account pools, cached auth, and request resolution.
The implementation needs explicit rules for these cases:
- Stored region owns refresh and inference routing for that credential.
- Environment configuration can support headless and new login flows without silently moving an existing credential between regions.
- Recognized values of
KIMI_CODE_OAUTH_HOST and KIMI_OAUTH_HOST need a documented mapping. Custom hosts need an explicit relationship to the API endpoint.
- Existing regionless credentials may have used the
.com default or the .ai override. Infer a region only where unambiguous; otherwise ask the user to confirm it.
- Explicit model endpoint overrides need a documented precedence rule.
- Account pools and auth caches must keep each account's region separate.
- Invalid metadata should produce a local actionable error. Cancellation, replacement, and storage failure must preserve existing credentials as appropriate.
Required verification
| Behavior |
Acceptance criterion |
| OAuth method filter and provider selection |
Both regions are reachable through the real login flow. |
| Device authorization |
Authorization and polling use the selected service; the browser URI comes from that service's response. |
| Completion |
Token success leads to credential persistence and a successful login result. |
| Pending and slow-down |
Polling follows the required cadence, with controlled time in fixtures. |
| Denial, expiry, cancellation, and malformed responses |
Each ends with the correct outcome and preserves prior credentials where appropriate. |
| Storage failure |
No successful login result appears before persistence succeeds. |
| Restart and refresh |
A fresh process uses the saved region; refresh rotation retains it when environment defaults change. |
| API-key method filter |
Kimi remains selectable and collects the region with the key. |
| API-key inference |
Each saved key routes to its selected, verified endpoint. |
| Legacy credentials and overrides |
Every chosen precedence branch has coverage. |
| Account switching |
Cached credentials and endpoints do not leak across accounts or regions. |
| Request completion |
The selected endpoint receives the intended auth and returns a successful terminal model result. |
I would first reproduce the missing selection, persistence, and routing behavior on current source. A separate login-not-recognized test must fail before changing the existing polling logic. Fixture coverage should use production orchestration and storage, subscribe before token completion, and exercise both regions and auth methods.
Verification would include repository checks, a built package in a fresh process, and the actual terminal selectors, including cancellation and return to the method picker. Live international authorization needs an available authorized account. Mainland live coverage also needs an authorized account. Simulated coverage and live account coverage will be reported separately.
The final combined check will cover login, saved credentials, the first model response, restart, and refresh with the transport fix applied. Each PR must also pass its own independent tests.
Pi coordination
Pi #6935 introduced subscription OAuth. I would agree with maintainers which repository should take the shared regional change first, then port source and tests while preserving each repository's auth contract. Generated Senpi bundles are not the upstream implementation. A Senpi test pass is not a Pi test pass.
Senpi transport contribution and acceptance criteria
Reproduce on current source
The transport PR would change dispatcher setup and its compatibility coverage. Authentication, provider recovery, model routing, and the OmO launcher belong to their separate contributions.
I would record the source revision, resolved Bun/Node/Undici versions, runtime support policy, and packaged dependency resolution. The history and tests of the Node decompression fix need review before changing global installation. If current source or a newer supported release already resolves the failure, the work should become release adoption instead.
The regression needs repository imports and an isolated child process. A loopback server should return the complete SSE lifecycle described above. The child should call the real dispatcher setup and consume the result through ModelRuntime and recovery. The test must assert text and terminal completion and show that the server sent a valid body.
An import error, credential failure, or missing executable is not the required failing result. Completion and abort handling should be registered before the request, with bounded deadlines and cleanup of the server, child, sockets, and listeners. Restoring only globalThis.fetch would leave other replaced constructors or dispatcher state behind, which is why process isolation matters.
Choose and verify the transport
I would compare preserving Bun's native transport with repairing the bundled Undici path. The npm implementation inside the Senpi bundle may differ from Bun's built-in module named undici. Tests must exercise the implementation the distributed CLI actually uses.
| Contract |
Required evidence |
| Bun SSE completion |
Text and successful terminal outcome arrive after real dispatcher setup. |
| Node decompression |
Compressed JSON and streamed responses decode with the configured transport. |
| Environment proxy routing |
A recording proxy and origin prove routing and bypass behavior. |
| Explicit Senpi proxy |
The configured proxy receives the request. |
| TLS and connection options |
The chosen path honors the supported settings or documents a maintainer-approved support change. |
| HTTP idle timeout |
Header and body stalls obey configured limits, including disabled timeout. |
| Deliberate fetch override |
A caller's replacement survives dispatcher configuration. |
| Reconfiguration and multi-session RPC |
Repeated setup and process-wide configuration restrictions retain their behavior. |
| Abort and network failure |
Requests reach a terminal result and leave no stuck CLI wait. |
Existing tests should cover these contracts where possible. A Bun-native branch that bypasses a supported option needs a maintainer decision before it can be described as a compatible fix. The local one-line guard does not settle that decision.
Verification must include the failing regression, related transport coverage, required repository checks, and a fresh built CLI against the loopback fixture. One bounded live Kimi request can supplement those tests where an authorized credential is available. Live credentials are not a CI dependency and must stay out of logs.
The eventual PR should include the actual source change, exact versions, failing and passing results, command exit codes, packaged CLI result, and any remaining compatibility limits.
OmO adoption, conditional runtime investigation, and planned PRs
OmO Senpi edition
Once Senpi publishes the fixes, I would check all dependency pins and lockfiles, engine patch hooks, and packaged-launcher tests. Authentication and transport may need separate release updates if they land independently. OmO should consume the engine changes and add wrapper changes only where its login integration blocks the new prompts or metadata.
Acceptance requires a fresh packaged OmO process under a supported Bun version, without the manual global-package workaround. Its /login must expose both regions for both auth methods and cover authorization completion, credential storage, regional request routing, first assistant result, restart, and refresh. Deterministic fixtures and live-account results must be reported separately.
The adoption PR should record the previous and new engine versions, merged upstream PRs, affected pins, patch compatibility, required checks, and packaged results. If OmO already consumes the fixes and exposes the complete flow, no adoption PR is needed. A temporary install-time patch would require a separate decision, an exact applicability check, regression coverage, and a removal condition.
Bun and Undici investigation
The current fixture still imports Senpi's bundled ModelRuntime. A standalone runtime report needs a smaller reproduction and a measured comparison before assigning ownership.
- Identify the actual npm or bundled Undici implementation. A bare
undici import under Bun may select its built-in compatibility module instead.
- Remove ModelRuntime and recovery one at a time while retaining the failure. Test import alone, dispatcher configuration, and global installation in separate fresh processes.
- Compare Bun
1.3.14, the current supported Bun release, and a supported Node release using the same dependency and fixture. Record exact versions, resolution, headers, body events, terminal outcomes, and exit codes.
- Check overlap with Bun #35145 and any current related fix. That PR concerns native-fetch proxy handling for selected dispatchers; it is not a demonstrated fix for this SSE failure.
- Contribute the reproduction to existing work if the cause matches. Open a new report only if the failure is distinct. Propose runtime code only after identifying the responsible implementation.
A Bun-only failure with identical npm code working in Node supports a Bun compatibility report. A failure in Node too requires investigating Undici versions and the dispatcher bridge. Success on current Bun may make this a supported-version or Senpi adoption issue instead. src/js/thirdparty/undici.js and test/js/first_party/undici/undici.test.ts appear in the related Bun PR, but the reduced reproduction must establish whether they own this failure.
The standalone fixture should use loopback HTTP, an assigned port, synthetic data, bounded cancellation, and complete cleanup. It must assert body delivery and termination, not just HTTP 200. A runtime report needs a runnable command and observed-versus-expected results. Neither a Bun code PR nor an Undici issue is currently committed work.
Proposed contribution sequence
| Contribution |
Planned title |
Completion requirement |
| Senpi auth |
feat(ai): support regional Kimi Code OAuth and API-key login |
Verified endpoint contracts, saved region, login tests, packaged checks, and explicit live-account coverage. |
| Pi auth |
Regional Kimi Code OAuth and API-key support, coordinated with Senpi |
Pi-specific implementation and verification after maintainer coordination. |
| Senpi transport |
fix(coding-agent): prevent Bun SSE stalls during HTTP dispatcher setup |
A current-source regression and every transport contract above. |
| OmO adoption |
fix(native): adopt regional Kimi login and Bun streaming fixes |
Released fixes, correct dependency resolution, and complete method-first login through first response. |
| Conditional Bun report |
SSE body stalls after bundled Undici global installation under Bun |
A standalone reproduction, runtime comparison, and duplicate check. |
These are planned changes, not descriptions of completed source PRs. The two Senpi PRs should remain independently reviewable. Their descriptions must state the implemented behavior and actual verification, not copy future acceptance criteria as completed results.
I would check extension options before changing core code. Senpi source changes to upstream-tracked files need the nearest changes.md entry with the change, reason an extension cannot handle it, and expected conflict areas. Senpi requires bun run check, bun run test, and applicable provider live tests. Maintainers own changelog edits.
Pi requires maintainer lgtm approval before a new contributor submits a PR; issue approval alone through lgtmi does not grant PR permission. Its documented checks include npm run check and ./test.sh. OmO contributions start from dev, use Bun workspace tooling, and need typecheck, build, tests, and applicable real-harness QA with evidence under .omo/evidence/, including its Senpi QA guidance. Exact instructions and commands must be checked in each implementation checkout.
Implementation handoff should retain verified endpoint and credential decisions, source revisions, changed paths, commands and exit codes, failed and passing regression evidence, packaged results, live versus simulated coverage, and unresolved maintainer decisions.
Related issues and PRs, overlap checks, and AI assistance
Related work
The September 20, 2026 review found these relevant items:
| Item |
Relationship |
| Senpi #1504 and merged #1571 |
K3 HTTP 500 and subscription identity headers. Preserve those headers. The loopback failure here receives HTTP 200. |
| Senpi #1733 and #1737 |
Thinking visibility and sanitation. The transport reproduction does not depend on changing that behavior. |
| Senpi #1808 |
Bun 1.3.x bundle startup compatibility involving Undici 8.10.2. Startup and streamed body completion need separate evidence. |
| Senpi #139 |
Stream idle recovery after a network drop. Relevant to preserving timeout behavior, without establishing this dispatcher-installation cause. |
| Pi #6935 |
Merged subscription OAuth implementation without explicit regional selection. |
| Bun #35145 |
Open proxy-dispatcher compatibility work. No demonstrated fix for the loopback SSE failure. |
| OmO #8469 and #8492 |
Model prompt detection and child-process provider inheritance, respectively. Separate from regional login and this transport failure. |
| OmO #8545 |
Adoption of Senpi 2026.9.20. The reported measurements used 2026.9.19-2. |
| Undici #5500 and #5502 |
Legacy Node dispatcher bridge and Content-Length handling. Related context only; no shared cause established. |
Targeted issue and PR searches covered auth.kimi.ai, Kimi regional support, and Senpi Undici/Bun stalls. No exact duplicate was found in those results. This is a scoped search result, not proof of absence. Current source, releases, and active work need another check before implementation and before any conditional runtime report.
AI assistance
I used coding agents to investigate the failures and prepare this proposal. The reported kimi.ai login and OmO plan/execute use with K2.8 and K3 are my own experience. The sections above distinguish recorded regression results, source findings, my reported integration use, and work that remains proposed.
What do you want to change?
I'd like to contribute two separate Senpi PRs: regional Kimi Code OAuth/API-key login and a fix for a Bun response-stream stall in CLI dispatcher setup. I'd coordinate the shared auth work with Pi and adoption with the OmO Senpi edition.
Why?
I couldn't use my international Kimi Coding subscription reliably in OmO. The login flow lacked a region choice. After getting
.ailogin working, requests still stalled. A loopback SSE test failed afterconfigureHttpDispatcher()and passed when Bun kept its native fetch. The combined local changes restored my K2.8 and K3 plan/execute use. The new region-selection flow remains proposed.How? (optional)
Verify the regional endpoints, persist the selected region with credentials, and preserve Senpi's identity headers. Keep the transport fix separate and test proxy, TLS, timeout, and Node decompression behavior. I'd check extension options and document required core changes in
changes.md. Full shared evidence and acceptance criteria are included below.Coordinated issues
Each proposal carries the same evidence and work plan so reviewers can see the full dependency chain. Each repository owns only the work listed for it.
What failed, what worked locally, and the limits of the evidence
User experience
I hit two separate problems using Kimi Coding in the OmO Senpi edition. International authentication required a local workaround. After login worked, model requests still stalled under Bun.
The combined local changes restored kimi.ai authentication and execution for me. On September 20, 2026, I reported successful use of OmO's plan and execute skills/protocols with both K2.8 and K3 from my Kimi Coding subscription. Plan implementation was still running when I reported that result. This is my integration experience, separate from the captured minimal CLI checks below.
The upstream region selector, credential metadata, and API-key routing described here are proposed work. The local success does not establish that those features already exist or that the ongoing plan finished.
Regional login gap
The reported OmO path is
/login, then OAuth or API key, then Kimi Coding. The method selector filters the provider list. Kimi Coding appears in API-key setup, but that path does not offer a region or associate the key with a regional endpoint. The provider implementations also lack an explicit OAuth region prompt.In my account setup, the international
.aiservice offered Google and international phone login. The mainland.comservice offered mainland phone and WeChat login and directed users outside mainland China toward.ai.Two inspected screenshots support the different login experiences. One shows WeChat and a prompt to use Kimi.ai outside mainland China. The other shows an international phone selector, Google login, and a prompt to use kimi.com in mainland China. Their original labels appeared reversed. Neither screenshot includes an address bar or a completed device authorization, so neither proves an endpoint contract or successful polling.
The recovered auth patch changed the default host in installed OAuth code and its bundled Kimi module:
The earlier investigation also used
KIMI_CODE_OAUTH_HOST=https://auth.kimi.ai. It recorded that the hardcoded change printed the intended URL but did not wait for login, while the environment override recognized completion. My later recollection attributes working login to the patch. Both observations are retained because there is no captured authorization trace that reconciles them.No separate polling correction was recovered. A comparison of the compiled OAuth file with its embedded original source found only the default-host change after import-path normalization. Current source already awaits device-token polling and handles pending, slow-down, denial, and expiry. A stale-process explanation was suggested, but not demonstrated. Login recognition needs a regression test before any polling rewrite.
The auth edits affected the Bun and Homebrew installations during the earlier investigation. The active Bun installation still had the changed default in the modular OAuth file and bundled Kimi module. The later streaming repair preserved these edits and changed only the HTTP dispatcher bundle.
Independent transport failure
The captured environment was Bun
1.3.14, macOS arm64, and@code-yeongyu/senpi@2026.9.19-2. The diagnostic worker recorded bundled Undici8.10.2.Direct Senpi and OmO CLI probes reached their 30-second deadline without an assistant event. Lower-level ModelRuntime returned
HELLOin about 2.5 seconds. Calling the CLI'sconfigureHttpDispatcher()before ModelRuntime reproduced the stall. HTTP headers arrived with status 200, but no assistant events arrived from the SSE body. Preserving Bun's native fetch completed the request.A loopback HTTP server reproduced the failure without Kimi credentials or an external network. It sent a complete Anthropic SSE lifecycle through the real bundled dispatcher, ModelRuntime, and empty-assistant recovery. The fixture emitted
message_start, a text block withHELLO, block completion,message_deltawithend_turn, andmessage_stop. It asserted the text and successful terminal result.The installed transport edit was in
dist/bundle/chunks/chunk-PLZK7ABD.js, line 133:This preserves Bun's native fetch and web constructors while retaining the Undici installation branch under Node. It is a diagnostic workaround. Bun's native fetch does not consume Senpi's configured Undici dispatcher, so the guard alone does not prove preservation of proxy, TLS, connection, or timeout settings.
HELLO, exit 0, 4.1 seconds.HELLO, exit 0, 3.5 seconds.HELLO, exit 0, 4.016 seconds.node --checkpassed for the edited bundle; no LSP diagnostics reported on the bundle or regression.The minimal live probes used
kimi-for-coding, isolated CLI state, and a short prompt. They refreshed existing credentials in memory and supplied an access token to an isolated CLI. They did not exercise browser login, persisted credentials after restart, API-key region selection, every Kimi model, Node execution, other providers, or the full upstream test suite. My K2.8/K3 plan and execute experience is separate evidence.The transport repair left existing settings, credentials, OAuth patches, and
thinkingCommitsunchanged. Adapter checks did not reproduce the earlier thinking-buffer hypothesis as the cause of this failure. Extending the response-start timeout would not repair the demonstrated body-consumption failure.The installed bundle's SHA-256 values were:
The parent investigation independently verified the patched hash. Its local artifacts include a journal, regression fixture, live CLI probe, patch receipt, and rollback patch. Those files are not attached here. The fixture imports generated bundle chunks through machine-specific paths, and the live probe reads a local credential store. This report includes the relevant measurements and exact edits; the upstream work must supply a portable reproduction. Private transcripts, account data, and screenshots remain local.
Source findings, repository ownership, and current release context
Inspected revisions
On September 20, 2026, the source review checked Senpi
mainatcd317ee6472dde1658a75e644637691ba5d41bc1, Pimainat3390bd93630965a12a0a1a5c36ce890ec22f7e1d, and OmOdevat2dd4002e9de54a696f37fc830dd083ceae0df06d.Senpi and Pi both own
packages/ai/src/auth/oauth/kimi-coding.tsandpackages/ai/src/providers/kimi-coding.ts:Both implementations choose
KIMI_CODE_OAUTH_HOST, thenKIMI_OAUTH_HOST, thenhttps://auth.kimi.com. Device authorization uses/api/oauth/device_authorization. Polling and refresh use/api/oauth/tokenon the selected host.Login stores
type,access,refresh, andexpires, without a region or host. Refresh reads the environment again. OAuth request auth returns Bearer headers, without an API base URL. The provider base URL remainshttps://api.kimi.com/coding. API-key auth usesenvApiKeyAuthandKIMI_API_KEY, without a regional prompt. An explicit model base-URL override is separate configuration.Senpi also adds
kimiCodeIdentityHeaders(). The examined Pi implementation does not. The shared regional change needs coordination, while each repository's identity-header and authentication contracts need their own review and tests.Senpi's auth interfaces provide a select prompt, provider-scoped API-key environment metadata, OAuth credential metadata, and
ModelAuth.baseUrl. These are possible implementation tools. Their behavior through lazy wrappers, serialization, account selection, and model resolution still needs verification.Transport ownership
Senpi owns CLI HTTP dispatcher setup. The inspected source still calls
undici.install?.()without a Bun guard when it installs globals.That source also preserves deliberate caller fetch overrides and fixes proxy and timeout configuration at process startup for multi-session RPC. Its comment explains that Node 26 compressed responses can fail to decompress when fetch and the dispatcher come from different Undici implementations. An upstream Bun fix must preserve those behaviors.
OmO's Senpi adapter manifest now names Senpi
2026.9.20in its peer and development dependencies. OmO #8545 adopted that release. This is newer than the measured failing installation. Source inspection confirms the relevant code remains, but the historical runtime measurements do not establish a fresh reproduction on the new package.The local loopback result establishes a Senpi/Bun integration failure. It does not identify an internal Bun operation or establish that Undici itself is defective. It also does not establish that Pi has the same transport failure.
Endpoint contract still to verify
https://api.kimi.ai/codingis a candidate from the reported international use, not a verified API-key contract. Before implementing the regional mapping, I would verify the official Kimi Code CLI or provider documentation and record each region's authorization host, device path, token path, API base URL, required headers, supported key type, and model discovery behavior. A successful.aiwebsite login does not prove that inference and refresh use the same service. Kimi Code subscription credentials must be distinguished from other Moonshot API products.Regional authentication contribution and acceptance criteria
Proposed behavior
After choosing OAuth or API key and Kimi Coding, users can select "Mainland China" or "Outside mainland China". The choice describes the account's service region. It should stay with that credential or account slot.
OAuth should open the verification URL returned by the selected service and poll that same service until success, cancellation, or a defined failure. The CLI should report success only after writing the credential. Closing a browser window is not proof of token completion.
API-key setup should collect the region and key together and route requests to the matching verified Anthropic-compatible endpoint. Users should not need a separate
models.jsonedit. Restart, token rotation, refresh, environment changes, and account switching must retain the saved region.Implementation decisions
I would keep one
kimi-codingprovider unless a verified constraint requires otherwise. Region is account configuration, not a model ID. The source work starts in the OAuth and provider files, auth helpers and types, and provider documentation. It also needs tracing through the method/provider selectors, lazy OAuth wrappers, storage, account pools, cached auth, and request resolution.The implementation needs explicit rules for these cases:
KIMI_CODE_OAUTH_HOSTandKIMI_OAUTH_HOSTneed a documented mapping. Custom hosts need an explicit relationship to the API endpoint..comdefault or the.aioverride. Infer a region only where unambiguous; otherwise ask the user to confirm it.Required verification
I would first reproduce the missing selection, persistence, and routing behavior on current source. A separate login-not-recognized test must fail before changing the existing polling logic. Fixture coverage should use production orchestration and storage, subscribe before token completion, and exercise both regions and auth methods.
Verification would include repository checks, a built package in a fresh process, and the actual terminal selectors, including cancellation and return to the method picker. Live international authorization needs an available authorized account. Mainland live coverage also needs an authorized account. Simulated coverage and live account coverage will be reported separately.
The final combined check will cover login, saved credentials, the first model response, restart, and refresh with the transport fix applied. Each PR must also pass its own independent tests.
Pi coordination
Pi #6935 introduced subscription OAuth. I would agree with maintainers which repository should take the shared regional change first, then port source and tests while preserving each repository's auth contract. Generated Senpi bundles are not the upstream implementation. A Senpi test pass is not a Pi test pass.
Senpi transport contribution and acceptance criteria
Reproduce on current source
The transport PR would change dispatcher setup and its compatibility coverage. Authentication, provider recovery, model routing, and the OmO launcher belong to their separate contributions.
I would record the source revision, resolved Bun/Node/Undici versions, runtime support policy, and packaged dependency resolution. The history and tests of the Node decompression fix need review before changing global installation. If current source or a newer supported release already resolves the failure, the work should become release adoption instead.
The regression needs repository imports and an isolated child process. A loopback server should return the complete SSE lifecycle described above. The child should call the real dispatcher setup and consume the result through ModelRuntime and recovery. The test must assert text and terminal completion and show that the server sent a valid body.
An import error, credential failure, or missing executable is not the required failing result. Completion and abort handling should be registered before the request, with bounded deadlines and cleanup of the server, child, sockets, and listeners. Restoring only
globalThis.fetchwould leave other replaced constructors or dispatcher state behind, which is why process isolation matters.Choose and verify the transport
I would compare preserving Bun's native transport with repairing the bundled Undici path. The npm implementation inside the Senpi bundle may differ from Bun's built-in module named
undici. Tests must exercise the implementation the distributed CLI actually uses.Existing tests should cover these contracts where possible. A Bun-native branch that bypasses a supported option needs a maintainer decision before it can be described as a compatible fix. The local one-line guard does not settle that decision.
Verification must include the failing regression, related transport coverage, required repository checks, and a fresh built CLI against the loopback fixture. One bounded live Kimi request can supplement those tests where an authorized credential is available. Live credentials are not a CI dependency and must stay out of logs.
The eventual PR should include the actual source change, exact versions, failing and passing results, command exit codes, packaged CLI result, and any remaining compatibility limits.
OmO adoption, conditional runtime investigation, and planned PRs
OmO Senpi edition
Once Senpi publishes the fixes, I would check all dependency pins and lockfiles, engine patch hooks, and packaged-launcher tests. Authentication and transport may need separate release updates if they land independently. OmO should consume the engine changes and add wrapper changes only where its login integration blocks the new prompts or metadata.
Acceptance requires a fresh packaged OmO process under a supported Bun version, without the manual global-package workaround. Its
/loginmust expose both regions for both auth methods and cover authorization completion, credential storage, regional request routing, first assistant result, restart, and refresh. Deterministic fixtures and live-account results must be reported separately.The adoption PR should record the previous and new engine versions, merged upstream PRs, affected pins, patch compatibility, required checks, and packaged results. If OmO already consumes the fixes and exposes the complete flow, no adoption PR is needed. A temporary install-time patch would require a separate decision, an exact applicability check, regression coverage, and a removal condition.
Bun and Undici investigation
The current fixture still imports Senpi's bundled ModelRuntime. A standalone runtime report needs a smaller reproduction and a measured comparison before assigning ownership.
undiciimport under Bun may select its built-in compatibility module instead.1.3.14, the current supported Bun release, and a supported Node release using the same dependency and fixture. Record exact versions, resolution, headers, body events, terminal outcomes, and exit codes.A Bun-only failure with identical npm code working in Node supports a Bun compatibility report. A failure in Node too requires investigating Undici versions and the dispatcher bridge. Success on current Bun may make this a supported-version or Senpi adoption issue instead.
src/js/thirdparty/undici.jsandtest/js/first_party/undici/undici.test.tsappear in the related Bun PR, but the reduced reproduction must establish whether they own this failure.The standalone fixture should use loopback HTTP, an assigned port, synthetic data, bounded cancellation, and complete cleanup. It must assert body delivery and termination, not just HTTP 200. A runtime report needs a runnable command and observed-versus-expected results. Neither a Bun code PR nor an Undici issue is currently committed work.
Proposed contribution sequence
feat(ai): support regional Kimi Code OAuth and API-key loginfix(coding-agent): prevent Bun SSE stalls during HTTP dispatcher setupfix(native): adopt regional Kimi login and Bun streaming fixesSSE body stalls after bundled Undici global installation under BunThese are planned changes, not descriptions of completed source PRs. The two Senpi PRs should remain independently reviewable. Their descriptions must state the implemented behavior and actual verification, not copy future acceptance criteria as completed results.
I would check extension options before changing core code. Senpi source changes to upstream-tracked files need the nearest
changes.mdentry with the change, reason an extension cannot handle it, and expected conflict areas. Senpi requiresbun run check,bun run test, and applicable provider live tests. Maintainers own changelog edits.Pi requires maintainer
lgtmapproval before a new contributor submits a PR; issue approval alone throughlgtmidoes not grant PR permission. Its documented checks includenpm run checkand./test.sh. OmO contributions start fromdev, use Bun workspace tooling, and need typecheck, build, tests, and applicable real-harness QA with evidence under.omo/evidence/, including its Senpi QA guidance. Exact instructions and commands must be checked in each implementation checkout.Implementation handoff should retain verified endpoint and credential decisions, source revisions, changed paths, commands and exit codes, failed and passing regression evidence, packaged results, live versus simulated coverage, and unresolved maintainer decisions.
Related issues and PRs, overlap checks, and AI assistance
Related work
The September 20, 2026 review found these relevant items:
Targeted issue and PR searches covered
auth.kimi.ai, Kimi regional support, and Senpi Undici/Bun stalls. No exact duplicate was found in those results. This is a scoped search result, not proof of absence. Current source, releases, and active work need another check before implementation and before any conditional runtime report.AI assistance
I used coding agents to investigate the failures and prepare this proposal. The reported kimi.ai login and OmO plan/execute use with K2.8 and K3 are my own experience. The sections above distinguish recorded regression results, source findings, my reported integration use, and work that remains proposed.