GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

@Yuxin-Qiao

@Yuxin-Qiao Yuxin-Qiao commented Aug 2, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

ocx doctor on Windows told users to set OPENCODEX_BUN_PATH even when the running service already uses that override, making the guidance circular (#848).

  • GET /api/system/memory now reports the service process's own runtime source (bundled / override / process) as a scalar enum, never the runtime path.
  • The doctor "Memory / runtime" section shows the Bun revision and, for an active override, identifies the override as active but unvalidated for automatic eager relay, without repeating the "set OPENCODEX_BUN_PATH" instruction. Bundled known-bad guidance is unchanged.
  • Docs: the windows-memory troubleshooting page is updated in all five locales.

Verification

  • bun run typecheck - passed
  • Focused: bun scripts/test.ts tests/doctor.test.ts tests/memory-watchdog.test.ts - 41 pass / 0 fail, including the new [Bug]: doctor repeats OPENCODEX_BUN_PATH guidance when a Bun canary override is already active #848 regression tests
  • Full: bun scripts/test.ts - 6869 pass, 8 skip; the 16 unique failing tests reproduce on a pristine origin/dev checkout with identical counts (environmental: bun missing from PATH in the isolated test env, missing gui/node_modules, provider-validation baseline); none touch changed files
  • bun run privacy:scan - passed
  • git diff --check - clean

Checklist

  • Scope stays focused on the doctor/API surface and avoids unrelated cleanup.
  • Docs updated where needed (English plus zh-cn, ja, ko, ru).
  • No new secrets or auth surfaces; the payload addition is a scalar enum.

Summary by CodeRabbit

  • New Features

    • ocx doctor now reports the Bun revision and whether the runtime is bundled or overridden through OPENCODEX_BUN_PATH.
    • Windows memory diagnostics provide clearer guidance when a runtime override is active.
  • Bug Fixes

    • Prevented duplicate or misleading upgrade instructions for active runtime overrides.
    • Clarified that memory metrics alone do not confirm a leak on the bundled runtime.
  • Documentation

    • Updated troubleshooting guidance in English, Japanese, Korean, Russian, and Simplified Chinese.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Yuxin-Qiao
fix(cli): make doctor runtime-origin aware for OPENCODEX_BUN_PATH gui…
be761e7
…dance (lidge-jun#848)

ocx doctor told Windows users to set OPENCODEX_BUN_PATH even when the
service already runs on that override, making the guidance circular.

- GET /api/system/memory now reports the service process's own runtime
  source (bundled/override/process) as a scalar enum; never the path.
- doctor's Memory/runtime section shows the Bun revision and identifies
  an active override instead of re-suggesting the env var; bundled
  known-bad guidance is unchanged.
- regression tests cover both bundled and override runtimes reporting
  the same version, plus endpoint-level override detection.
@Yuxin-Qiao
Yuxin-Qiao requested review from Ingwannu, Wibias and lidge-jun as code owners August 2, 2026 15:56
@github-actions github-actions Bot added the bug Something isn't working label Aug 2, 2026
@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The memory endpoint now returns Bun runtime-source metadata. ocx doctor displays the Bun revision and identifies active OPENCODEX_BUN_PATH overrides. Windows guidance and localized documentation reflect the bundled and override runtime cases.

Changes

Bun runtime diagnostics

Layer / File(s) Summary
Runtime metadata endpoint
src/server/management/system-routes.ts, tests/memory-watchdog.test.ts
The memory endpoint returns runtime.source. Tests cover supported sources and active OPENCODEX_BUN_PATH overrides.
Doctor runtime guidance
src/cli/doctor.ts, tests/doctor.test.ts
ocx doctor accepts and displays Bun revision and runtime-source metadata. Windows guidance distinguishes active overrides from bundled runtimes.
Localized runtime documentation
docs-site/src/content/docs/*/troubleshooting/windows-memory.md
Windows memory documentation describes Bun revision, runtime source, active overrides, and bundled-runtime heap-counter behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

  • [Bug]: doctor repeats OPENCODEX_BUN_PATH guidance when a Bun canary override is already active #848 — Covers the same src/cli/doctor.ts runtime-override guidance and regression tests.

Possibly related PRs

  • lidge-jun/opencodex#388 — Introduced the memory diagnostics extended by this PR.
  • lidge-jun/opencodex#734 — Implements related OPENCODEX_BUN_PATH runtime override handling.
  • lidge-jun/opencodex#887 — Adds related Bun runtime provenance fields and doctor guidance.

Suggested reviewers: lidge-jun, wibias, ingwannu

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: making CLI doctor guidance aware of the runtime origin for OPENCODEX_BUN_PATH.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot]
chatgpt-codex-connector Bot reviewed Aug 2, 2026
View reviewed changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: be761e7925

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/server/management/system-routes.ts
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 },

@chatgpt-codex-connector chatgpt-codex-connector Bot Aug 2, 2026

Copy link
Copy Markdown

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.

P2 Badge 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
coderabbitai[bot]
coderabbitai Bot reviewed Aug 2, 2026
View reviewed changes

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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.

Actionable comments posted: 1

🤖 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 `@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.
🪄 Autofix (Beta)

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: 4bd63f1f-5c1e-48d3-85e2-6d7a8a05d3f9

📥 Commits

Reviewing files that changed from the base of the PR and between f9b9440 and be761e7.

📒 Files selected for processing (9)
  • 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/troubleshooting/windows-memory.md
  • docs-site/src/content/docs/zh-cn/troubleshooting/windows-memory.md
  • src/cli/doctor.ts
  • src/server/management/system-routes.ts
  • tests/doctor.test.ts
  • tests/memory-watchdog.test.ts

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/cli/doctor.ts
Comment on lines +526 to +527
bunRevision?: string;
runtime?: { source: string };

@coderabbitai coderabbitai Bot Aug 2, 2026

Copy link
Copy Markdown
Contributor

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 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.

🤖 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 `@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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@lidge-jun

lidge-jun commented Aug 2, 2026

Copy link
Copy Markdown
Owner

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 (bunRuntimeSource: override / missing / process|bundled) and never tells the user to set OPENCODEX_BUN_PATH when that override is already active — see src/cli/doctor.ts:665-679 on that branch, which names #848 explicitly. The provenance pair (source+path) is recorded through every launcher, with legacy payloads read as unknown. Thanks for the clean write-up; the API-payload variant here lost out to the launch-marker approach because it cannot be spoofed by a stale service response.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lidge-jun lidge-jun closed this Aug 2, 2026
@lidge-jun lidge-jun mentioned this pull request Aug 2, 2026
fix: bound the six remaining retained-state leaks (#820 wave 2) #892
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@coderabbitai coderabbitai[bot] coderabbitai[bot] left review comments
@chatgpt-codex-connector chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] left review comments
@lidge-jun lidge-jun Awaiting requested review from lidge-jun lidge-jun is a code owner
@Ingwannu Ingwannu Awaiting requested review from Ingwannu Ingwannu is a code owner
@Wibias Wibias Awaiting requested review from Wibias

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

bug Something isn't working

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Yuxin-Qiao @lidge-jun
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.