[WRONG BRANCH] fix(stream): gate macOS eager-relay on a verified Bun runtime - #56
[WRONG BRANCH] fix(stream): gate macOS eager-relay on a verified Bun runtime#56luvs01 wants to merge 1 commit into
eager-relay on a verified Bun runtime#56Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
eager-relay on a verified Bun runtimeeager-relay on a verified Bun runtime
⏳ DRAFT
What to do
Its title has been prefixed with |
📝 WalkthroughWalkthroughDarwin ChangesStream mode runtime gating
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Configuration
participant bunStreamCaps
participant BunRuntime
Configuration->>bunStreamCaps: Request eager-relay selection
bunStreamCaps->>BunRuntime: Check bunHasAsyncPullCancelFix
BunRuntime-->>bunStreamCaps: Return runtime status
bunStreamCaps-->>Configuration: Return eager decision or null
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
✅ Deterministic PR hygiene checks passed. |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs-site/src/content/docs/ja/troubleshooting/windows-memory.md`:
- Line 45: Synchronize the translated configuration paragraphs with the English
source by explicitly naming config.json and PUT /api/settings, and stating that
API changes apply to new turns without requiring a restart. Update
docs-site/src/content/docs/ja/troubleshooting/windows-memory.md:45-45,
docs-site/src/content/docs/ko/troubleshooting/windows-memory.md:39-39,
docs-site/src/content/docs/ru/troubleshooting/windows-memory.md:80-80, and
docs-site/src/content/docs/zh-cn/troubleshooting/windows-memory.md:39-39;
preserve each locale’s existing translation and streamMode behavior.
In `@docs-site/src/content/docs/troubleshooting/windows-memory.md`:
- Around line 63-65: Update the macOS gate documentation to describe the
currently running Bun runtime, including the runtime selected through
OPENCODEX_BUN_PATH, rather than implying it always uses the bundled runtime.
Apply this wording change at
docs-site/src/content/docs/troubleshooting/windows-memory.md lines 63-65 and
92-97, and the corresponding Japanese line 45, Korean line 39, Russian line 80,
and Simplified Chinese line 39. Retain “bundled runtime” terminology only for
the default update path.
In `@tests/bun-stream-caps.test.ts`:
- Around line 116-118: Update the test case around selectEagerPath to pass the
configured fixed-version threshold "1.4.0" instead of null, while preserving the
existing inputs and null expectation so it specifically verifies that version
1.3.14 is rejected by the version gate.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: c9f6137f-67bf-4f21-8e09-86ca8d2a19bd
📒 Files selected for processing (11)
docs-site/src/content/docs/ja/troubleshooting/windows-memory.mddocs-site/src/content/docs/ko/troubleshooting/windows-memory.mddocs-site/src/content/docs/ru/troubleshooting/windows-memory.mddocs-site/src/content/docs/troubleshooting/windows-memory.mddocs-site/src/content/docs/zh-cn/troubleshooting/windows-memory.mdsrc/lib/bun-stream-caps.tssrc/types.tsstructure/02_config-and-codex-home.mdstructure/04_transports-and-sidecars.mdstructure/05_gui-and-management-api.mdtests/bun-stream-caps.test.ts
|
|
||
| 3. **`streamMode: "eager-relay"` を使用して有界リレーにオプトインします。** 2 つの方法: | ||
| `config.json` を編集する (`"streamMode": "eager-relay"` を追加する) か、管理 API を呼び出します。`PUT /api/settings` と `{"streamMode":"eager-relay"}` は、再起動せずに新しいターンに適用されます。 **クラッシュのリスク警告:** Bun 1.3.14 では、#32111 の影響を受けるストリーム形状が使用されており、ストリームの途中でプロセスがクラッシュする可能性があります (Windows に限らず、どの OS でも)。サービス マネージャーはサービスを再起動しますが、実行中のリクエストは失敗します。 `"legacy-tee"` は現在のデフォルトを固定します。 Windows では、`"auto"` (デフォルト) によりランタイム ゲートが決定します。 macOS では、`"auto"` は常に T 上にあります。明示的な `"eager-relay"` はオプトインです。 | ||
| 3. **`streamMode: "eager-relay"` で bounded relay を明示的に選択します。** 設定方法は変わりませんが、macOS では bundled runtime に #32111 の修正が含まれると検証された場合にのみ有効になり、それまでは tee を使用します。Windows では既存の明示設定の動作を維持します。`"legacy-tee"` は tee を固定し、`"auto"` は Windows では runtime gate に従い、macOS では常に tee を使用します。 |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
Synchronize the translated configuration instructions with the English source.
The English page names config.json and PUT /api/settings, and states that the API applies to new turns without a restart. The four locale paragraphs only say that the configuration method is unchanged.
docs-site/src/content/docs/ja/troubleshooting/windows-memory.md#L45-L45: restore the concrete configuration methods and no-restart behavior.docs-site/src/content/docs/ko/troubleshooting/windows-memory.md#L39-L39: restore the concrete configuration methods and no-restart behavior.docs-site/src/content/docs/ru/troubleshooting/windows-memory.md#L80-L80: restore the concrete configuration methods and no-restart behavior.docs-site/src/content/docs/zh-cn/troubleshooting/windows-memory.md#L39-L39: restore the concrete configuration methods and no-restart behavior.
📍 Affects 4 files
docs-site/src/content/docs/ja/troubleshooting/windows-memory.md#L45-L45(this comment)docs-site/src/content/docs/ko/troubleshooting/windows-memory.md#L39-L39docs-site/src/content/docs/ru/troubleshooting/windows-memory.md#L80-L80docs-site/src/content/docs/zh-cn/troubleshooting/windows-memory.md#L39-L39
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs-site/src/content/docs/ja/troubleshooting/windows-memory.md` at line 45,
Synchronize the translated configuration paragraphs with the English source by
explicitly naming config.json and PUT /api/settings, and stating that API
changes apply to new turns without requiring a restart. Update
docs-site/src/content/docs/ja/troubleshooting/windows-memory.md:45-45,
docs-site/src/content/docs/ko/troubleshooting/windows-memory.md:39-39,
docs-site/src/content/docs/ru/troubleshooting/windows-memory.md:80-80, and
docs-site/src/content/docs/zh-cn/troubleshooting/windows-memory.md:39-39;
preserve each locale’s existing translation and streamMode behavior.
Source: Path instructions
| #32111 fix; today it is opt-in only (see below). On macOS it requires both | ||
| that verified runtime and explicit opt-in — flipping macOS `auto` is a | ||
| separate decision. |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n -C 6 'selectEagerPath|Bun\.version|OPENCODEX_BUN_PATH' srcRepository: luvs01/opencodex
Length of output: 16449
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- bun-stream-caps.ts ---'
sed -n '1,135p' src/lib/bun-stream-caps.ts
printf '%s\n' '--- bun-runtime.ts ---'
sed -n '1,215p' src/lib/bun-runtime.ts
printf '%s\n' '--- relevant launch/runtime references ---'
rg -n -C 5 'OPENCODEX_BUN_PATH|withProcessRuntimeProvenance|durableBunRuntime|reportedBunRuntimeSource|BUN_OVERRIDE_ENV|Bun\.version' src --glob '*.ts' --glob '*.mjs'
printf '%s\n' '--- documentation context ---'
for f in \
docs-site/src/content/docs/troubleshooting/windows-memory.md \
docs-site/src/content/docs/ja/troubleshooting/windows-memory.md \
docs-site/src/content/docs/ko/troubleshooting/windows-memory.md \
docs-site/src/content/docs/ru/troubleshooting/windows-memory.md \
docs-site/src/content/docs/zh-cn/troubleshooting/windows-memory.md
do
echo "### $f"
wc -l "$f"
sed -n '35,105p' "$f"
doneRepository: luvs01/opencodex
Length of output: 50372
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- all runtime override and launcher selection references ---'
rg -n -C 4 'OPENCODEX_BUN_PATH|bundledBunPath|process\.execPath|selectEagerPath\(' . \
-g '!node_modules' -g '!dist' -g '!build' -g '*.ts' -g '*.mjs' -g '*.json' -g '*.sh' \
| head -n 500
printf '%s\n' '--- exact English gate and option text ---'
nl -ba docs-site/src/content/docs/troubleshooting/windows-memory.md | sed -n '55,102p'
printf '%s\n' '--- exact translated stream-mode paragraphs ---'
for spec in \
'docs-site/src/content/docs/ja/troubleshooting/windows-memory.md:35:52' \
'docs-site/src/content/docs/ko/troubleshooting/windows-memory.md:30:46' \
'docs-site/src/content/docs/ru/troubleshooting/windows-memory.md:70:87' \
'docs-site/src/content/docs/zh-cn/troubleshooting/windows-memory.md:30:46'
do
file=${spec%%:*}
rest=${spec#*:}
start=${rest%%:*}
end=${rest##*:}
echo "### $file"
nl -ba "$file" | sed -n "${start},${end}p"
done
printf '%s\n' '--- precise selectEagerPath call arguments ---'
rg -n -U -C 3 'selectEagerPath\(' src --glob '*.ts'Repository: luvs01/opencodex
Length of output: 34135
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- launcher runtime selection ---'
sed -n '350,435p' bin/ocx.mjs
printf '%s\n' '--- English affected lines ---'
awk 'NR >= 55 && NR <= 102 { printf "%6d:%s\n", NR, $0 }' \
docs-site/src/content/docs/troubleshooting/windows-memory.md
printf '%s\n' '--- translated affected lines ---'
for spec in \
'docs-site/src/content/docs/ja/troubleshooting/windows-memory.md 35 52' \
'docs-site/src/content/docs/ko/troubleshooting/windows-memory.md 30 46' \
'docs-site/src/content/docs/ru/troubleshooting/windows-memory.md 70 87' \
'docs-site/src/content/docs/zh-cn/troubleshooting/windows-memory.md 30 46'
do
set -- $spec
file=$1
echo "### $file"
awk -v start="$2" -v end="$3" 'NR >= start && NR <= end { printf "%6d:%s\n", NR, $0 }' "$file"
doneRepository: luvs01/opencodex
Length of output: 11685
Use the running Bun runtime in the macOS gate documentation. selectEagerPath defaults to Bun.version, and OPENCODEX_BUN_PATH can select the runtime used by the service. Update docs-site/src/content/docs/troubleshooting/windows-memory.md#L63-L65, #L92-L97, and the corresponding ja#L45, ko#L39, ru#L80, and zh-cn#L39 text. Keep “bundled runtime” only for the default update path.
📍 Affects 5 files
docs-site/src/content/docs/troubleshooting/windows-memory.md#L63-L65(this comment)docs-site/src/content/docs/troubleshooting/windows-memory.md#L92-L97docs-site/src/content/docs/ja/troubleshooting/windows-memory.md#L45-L45docs-site/src/content/docs/ko/troubleshooting/windows-memory.md#L39-L39docs-site/src/content/docs/ru/troubleshooting/windows-memory.md#L80-L80docs-site/src/content/docs/zh-cn/troubleshooting/windows-memory.md#L39-L39
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs-site/src/content/docs/troubleshooting/windows-memory.md` around lines 63
- 65, Update the macOS gate documentation to describe the currently running Bun
runtime, including the runtime selected through OPENCODEX_BUN_PATH, rather than
implying it always uses the bundled runtime. Apply this wording change at
docs-site/src/content/docs/troubleshooting/windows-memory.md lines 63-65 and
92-97, and the corresponding Japanese line 45, Korean line 39, Russian line 80,
and Simplified Chinese line 39. Retain “bundled runtime” terminology only for
the default update path.
Source: Path instructions
| test("darwin + no rewrite + config-eager + known-bad runtime → tee", () => { | ||
| expect(selectEagerPath("darwin", false, "eager-relay", "1.3.14", null)).toBeNull(); | ||
| }); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Exercise the configured version boundary.
minFixed is null in this known-bad case. The assertion therefore exercises the “no threshold configured” branch. It does not prove that selectEagerPath rejects 1.3.14 when the fixed threshold is 1.4.0. Pass "1.4.0" as minFixed.
As per path instructions: a behavior change in src/ must have a focused regression test near the existing tests for that subsystem. This test should exercise the version gate, not only the unset-threshold fallback.
Proposed test correction
- expect(selectEagerPath("darwin", false, "eager-relay", "1.3.14", null)).toBeNull();
+ expect(selectEagerPath("darwin", false, "eager-relay", "1.3.14", "1.4.0")).toBeNull();📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| test("darwin + no rewrite + config-eager + known-bad runtime → tee", () => { | |
| expect(selectEagerPath("darwin", false, "eager-relay", "1.3.14", null)).toBeNull(); | |
| }); | |
| test("darwin + no rewrite + config-eager + known-bad runtime → tee", () => { | |
| expect(selectEagerPath("darwin", false, "eager-relay", "1.3.14", "1.4.0")).toBeNull(); | |
| }); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tests/bun-stream-caps.test.ts` around lines 116 - 118, Update the test case
around selectEagerPath to pass the configured fixed-version threshold "1.4.0"
instead of null, while preserving the existing inputs and null expectation so it
specifically verifies that version 1.3.14 is rejected by the version gate.
Source: Path instructions
Motivation
streamMode: "eager-relay"enable the eager SSE relay on macOS even when the bundled Bun runtime was not proven to contain the async-pull cancel fix (Bun#32111), exposing the process to a client-abort crash risk.Description
selectEagerPathnow permitsconfig-eagerondarwinonly whenbunHasAsyncPullCancelFix(version, minFixed)is true, keepingautoand known-bad runtimes on the tee path (src/lib/bun-stream-caps.ts).tests/bun-stream-caps.test.tsnow assertsdarwin + config-eagerstays null on a known-bad runtime and becomes eager only on a fixed runtime.src/types.ts,docs-site/**/troubleshooting/windows-memory.md, and supportingstructure/pages and localized docs).Testing
bun test tests/bun-stream-caps.test.ts, which passed (new and existing assertions succeeded).bun run typecheck(TS typecheck) which completed successfully.bun run privacy:scanwhich passed in-repo checks for privacy-sensitive changes.bun run test; the broader suite ran but encountered unrelated timeouts (notablytests/oauth-login-cli-live-update.test.tsandtests/grok-models-effort-list.test.ts) so the full-suite run was not clean for unrelated reasons.docs-site/but dependency installation failed due to external registry 403s, so the site build could not be completed in this environment.Codex Task
Summary by CodeRabbit
Bug Fixes
eager-relay,legacy-tee, andauto.Documentation