GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(cli): make doctor runtime-origin aware for OPENCODEX_BUN_PATH guidance (#848) by Yuxin-Qiao · Pull Request #898 · lidge-jun/opencodex Conversation
|
📝 WalkthroughWalkthroughThe memory endpoint now returns Bun runtime-source metadata. ChangesBun runtime diagnostics
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: be761e7925
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| platform: process.platform, | ||
| // Scalar enum only, never the runtime path: lets diagnostics tell a | ||
| // bundled runtime from an OPENCODEX_BUN_PATH override (#848). | ||
| runtime: { source: durableBunRuntime().source }, |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Derive the runtime source from the running executable
When a user follows the documented service workflow—sets OPENCODEX_BUN_PATH only in the install shell and reruns ocx service install—the Windows wrapper/WinSW definition bakes that path as the executable but does not propagate OPENCODEX_BUN_PATH into the service environment. Consequently, this call reevaluates the now-absent environment variable, reports bundled, and ocx doctor repeats the same circular override guidance that this change is intended to remove. Determine the source from process.execPath versus the bundled/override paths, or persist a non-sensitive source marker in the service definition; the new test currently masks the defect by setting the variable inside the already-running process.
AGENTS.md reference: docs-site/AGENTS.md:L7-L10
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
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 `@src/cli/doctor.ts`:
- Around line 526-527: Preserve the BunRuntimeSource contract by exporting and
reusing a union for bundled, override, and process values, and validate the
doctor response before storing it. Update formatServiceMemoryLines to handle all
three valid sources plus absent or invalid values so process is not treated as
bundled and unknown values remain safe. Add regression coverage for each valid
source and invalid input, and update the five Windows-memory pages if process
becomes user-visible.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 4bd63f1f-5c1e-48d3-85e2-6d7a8a05d3f9
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/cli/doctor.tssrc/server/management/system-routes.tstests/doctor.test.tstests/memory-watchdog.test.ts
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| bunRevision?: string; | ||
| runtime?: { source: string }; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🏁 Script executed:
#!/usr/bin/env bash set -euo pipefail rg -n -C 4 \ 'durableBunRuntime|runtime.*source|source.*override|source.*process|OPENCODEX_BUN_PATH' \ src tests docs-site
Repository: lidge-jun/opencodex
Length of output: 50376
🏁 Script executed:
#!/usr/bin/env bash set -euo pipefail printf '%s\n' '--- doctor outline ---' ast-grep outline src/cli/doctor.ts --match 'ServiceMemoryData' --view expanded || true printf '%s\n' '--- doctor type/fetch/format regions ---' rg -n -C 12 'type ServiceMemoryData|interface ServiceMemoryData|fetchServiceMemory|formatServiceMemoryLines|runtime\.source|source ===' src/cli/doctor.ts printf '%s\n' '--- runtime definition ---' cat -n src/lib/bun-runtime.ts | sed -n '20,75p' printf '%s\n' '--- doctor tests around runtime guidance ---' cat -n tests/doctor.test.ts | sed -n '330,465p' printf '%s\n' '--- all source and test references ---' rg -n -C 3 'runtime:\s*\{[^}]*source|runtime\.source|source:\s*"(bundled|override|process)"|source === "(bundled|override|process)"' src tests
Repository: lidge-jun/opencodex
Length of output: 39901
🏁 Script executed:
#!/usr/bin/env bash set -euo pipefail printf '%s\n' '--- doctor imports and report types ---' cat -n src/cli/doctor.ts | sed -n '1,45p' cat -n src/cli/doctor.ts | sed -n '515,550p' printf '%s\n' '--- durable runtime call sites and service artifact behavior ---' rg -n -C 8 'durableBunRuntime\(\)|durableBunPath\(\)|buildWindowsServiceScript|process\.execPath' src tests printf '%s\n' '--- language-page runtime wording ---' 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 if [ -f "$f" ]; then printf '\n--- %s ---\n' "$f" rg -n -C 2 'bundled runtime|bundled|OPENCODEX_BUN_PATH|运行时|ランタイム|рантайм|런타임' "$f" | head -80 else printf '%s\n' "MISSING: $f" fi done printf '%s\n' '--- standalone behavior verifier ---' python3 - <<'PY' from pathlib import Path import re doctor = Path("src/cli/doctor.ts").read_text() runtime = Path("src/lib/bun-runtime.ts").read_text() assert 'runtime?: { source: string };' in doctor assert 'typeof body.runtime.source === "string"' in doctor assert 'd.runtime?.source === "override"' in doctor assert '"process"' in runtime def parsed_source(value): # Mirrors fetchServiceMemory's present-string acceptance. return value if isinstance(value, str) else None def guidance_branch(source): # Mirrors formatServiceMemoryLines's Windows auto-known-bad branch. return "override" if source == "override" else "bundled-guidance" for value in ("bundled", "override", "process", "future", 17, None): accepted = parsed_source(value) print(f"input={value!r} stored={accepted!r} branch={guidance_branch(accepted)!r}") assert guidance_branch("process") == "bundled-guidance" assert guidance_branch("future") == "bundled-guidance" assert parsed_source("future") == "future" print("deterministic behavior matches the source branches") PY
Repository: lidge-jun/opencodex
Length of output: 50376
🏁 Script executed:
#!/usr/bin/env bash set -euo pipefail printf '%s\n' '--- Windows memory documentation files and runtime statements ---' find docs-site/src/content/docs -type f -path '*/troubleshooting/windows-memory.md' -print for f in $(find docs-site/src/content/docs -type f -path '*/troubleshooting/windows-memory.md' | sort); do printf '\n--- %s ---\n' "$f" rg -n -C 1 'bundled runtime|bundled|OPENCODEX_BUN_PATH' "$f" | head -40 done printf '%s\n' '--- service script runtime selection ---' cat -n src/service.ts | sed -n '45,53p' cat -n src/service.ts | sed -n '1261,1315p' printf '%s\n' '--- standalone behavior verifier ---' python3 - <<'PY' from pathlib import Path doctor = Path("src/cli/doctor.ts").read_text() runtime = Path("src/lib/bun-runtime.ts").read_text() assert 'runtime?: { source: string };' in doctor assert 'typeof body.runtime.source === "string"' in doctor assert 'd.runtime?.source === "override"' in doctor assert 'source: "process"' in runtime def fetch_stores(value): return value if isinstance(value, str) else None def format_branch(value): stored = fetch_stores(value) return "override branch" if stored == "override" else "non-override branch" for value in ("bundled", "override", "process", "future", 17, None): print(f"{value!r}: stored={fetch_stores(value)!r}, {format_branch(value)}") assert fetch_stores("future") == "future" assert format_branch("process") == "non-override branch" assert format_branch("future") == "non-override branch" print("source acceptance and formatting branches match the implementation") PY
Repository: lidge-jun/opencodex
Length of output: 11308
Preserve and validate the BunRuntimeSource contract.
src/lib/bun-runtime.ts:23-26,55-60 emits "bundled", "override", or "process". src/cli/doctor.ts:527,585 widens this value to string and accepts unknown strings. formatServiceMemoryLines handles only "override" at lines 633 and 666-670. Therefore "process" and unknown values omit the source label and show bundled-runtime guidance. "process" uses process.execPath when the bundled Bun binary is unavailable, so it is not necessarily bundled.
Export and reuse a BunRuntimeSource union. Validate the response before storing it. Handle "bundled", "override", "process", and absent or invalid values separately. Add regression tests for all three valid values and invalid input. Update the five Windows-memory pages if "process" becomes user-visible.
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/cli/doctor.ts` around lines 526 - 527, Preserve the BunRuntimeSource
contract by exporting and reusing a union for bundled, override, and process
values, and validate the doctor response before storing it. Update
formatServiceMemoryLines to handle all three valid sources plus absent or
invalid values so process is not treated as bundled and unknown values remain
safe. Add regression coverage for each valid source and invalid input, and
update the five Windows-memory pages if process becomes user-visible.
Source: Path instructions
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Closing as a duplicate: the #848 fix already landed in #892 via the wt5 workstream. On codex/wt2-zero-leak-impl, doctor reads the launch-time provenance marker ( |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.