-
Notifications
You must be signed in to change notification settings - Fork 0
[WRONG BRANCH] fix(stream): gate macOS eager-relay on a verified Bun runtime
#56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,8 +60,9 @@ runtime the leak itself remains an upstream problem: | |
| - **A gated alternative stream path** — a bounded single-reader relay that | ||
| removes the unbounded buffering shape entirely. On Windows it becomes the | ||
| default automatically once a bundled Bun release verifiably carries the | ||
| #32111 fix; today it is opt-in only (see below). On macOS it stays opt-in | ||
| even after such a release — flipping macOS `auto` is a separate decision. | ||
| #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. | ||
|
Comment on lines
+63
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ 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. 📍 Affects 5 files
🤖 Prompt for AI AgentsSource: Path instructions |
||
|
|
||
| Real-world RSS improvement from these changes is **awaiting verification by | ||
| Windows users** — we do not claim the leak is fixed. | ||
|
|
@@ -74,8 +75,8 @@ restart it. | |
|
|
||
| 1. **Wait for a bundled runtime update.** Once a Bun release verifiably | ||
| carries the fixes, opencodex will bump the bundled runtime and the safer | ||
| stream path turns on automatically on Windows (macOS keeps requiring the | ||
| explicit opt-in below). | ||
| stream path turns on automatically on Windows (macOS also keeps requiring | ||
| the explicit opt-in below). | ||
|
|
||
| 2. **Run a Bun runtime you trust with `OPENCODEX_BUN_PATH`.** This is | ||
| unvalidated territory — you are running opencodex on a runtime we have not | ||
|
|
@@ -88,12 +89,12 @@ restart it. | |
| 3. **Opt into the bounded relay with `streamMode: "eager-relay"`.** Two ways: | ||
| edit `config.json` (add `"streamMode": "eager-relay"`), or call the | ||
| management API — a `PUT /api/settings` with `{"streamMode":"eager-relay"}` | ||
| applies to new turns without a restart. **Crash risk warning:** on Bun | ||
| 1.3.14 this uses the stream shape affected by #32111, which can crash the | ||
| process mid-stream (on any OS, not just Windows). The service manager will | ||
| restart it, but in-flight requests fail. `"legacy-tee"` pins the current | ||
| default. On Windows, `"auto"` (default) lets the runtime gate decide. On | ||
| macOS, `"auto"` always stays on tee; explicit `"eager-relay"` is the opt-in. | ||
| applies to new turns without a restart. On Windows this explicit mode | ||
| retains its existing operator-controlled behavior. On macOS it is effective | ||
| only after the bundled runtime is verified to carry the #32111 fix; until | ||
| then macOS stays on tee. `"legacy-tee"` pins the current default, and | ||
| `"auto"` lets the Windows runtime gate decide while always staying on tee on | ||
| macOS. | ||
|
|
||
| If you try any of these on a real Windows workload, please report the before | ||
| and after `ocx doctor` memory sections on | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -113,8 +113,12 @@ describe("selectEagerPath (platform policy matrix)", () => { | |||||||||||||
| .toEqual({ useEagerRelay: true, reason: "auto-fixed-runtime" }); | ||||||||||||||
| }); | ||||||||||||||
|
|
||||||||||||||
| test("darwin + no rewrite + config-eager → eager", () => { | ||||||||||||||
| expect(selectEagerPath("darwin", false, "eager-relay", "1.3.14", null)) | ||||||||||||||
| test("darwin + no rewrite + config-eager + known-bad runtime → tee", () => { | ||||||||||||||
| expect(selectEagerPath("darwin", false, "eager-relay", "1.3.14", null)).toBeNull(); | ||||||||||||||
| }); | ||||||||||||||
|
Comment on lines
+116
to
+118
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Exercise the configured version boundary.
As per path instructions: a behavior change in 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
Suggested change
🤖 Prompt for AI AgentsSource: Path instructions |
||||||||||||||
|
|
||||||||||||||
| test("darwin + no rewrite + config-eager + fixed runtime → eager", () => { | ||||||||||||||
| expect(selectEagerPath("darwin", false, "eager-relay", "1.4.0", "1.4.0")) | ||||||||||||||
| .toEqual({ useEagerRelay: true, reason: "config-eager" }); | ||||||||||||||
| }); | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
Synchronize the translated configuration instructions with the English source.
The English page names
config.jsonandPUT /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
Source: Path instructions