# MB-X session restore scripts Generated by `mbx session restore-script generate`. ## Scope These scripts are registry-aware wrappers around MB-X CLI. They intentionally do **not** hardcode provider_session_id/thread_id. Runtime session ids are read from the current MB-X workspace/project configuration when the script runs. App-server URL: `ws://127.0.0.1:4570` Targets: - `laoan` -> `open-laoan.bat` / `restore-laoan.bat` (alias of `case_analysis.analyst`) - `xiaoshen` -> `open-xiaoshen.bat` / `restore-xiaoshen.bat` (alias of `case_analysis.reviewer`) - `case_analysis.analyst` -> `open-case-analysis-analyst.bat` / `restore-case-analysis-analyst.bat` - `case_analysis.reviewer` -> `open-case-analysis-reviewer.bat` / `restore-case-analysis-reviewer.bat` - `dev.developer.ana` -> `open-dev-developer-ana.bat` / `restore-dev-developer-ana.bat` - `dev.reviewer.ana` -> `open-dev-reviewer-ana.bat` / `restore-dev-reviewer-ana.bat` - `experiment.experimenter` -> `open-experiment-experimenter.bat` / `restore-experiment-experimenter.bat` - `experiment.reviewer` -> `open-experiment-reviewer.bat` / `restore-experiment-reviewer.bat` - `dev.developer.exp` -> `open-dev-developer-exp.bat` / `restore-dev-developer-exp.bat` - `dev.reviewer.exp` -> `open-dev-reviewer-exp.bat` / `restore-dev-reviewer-exp.bat` ## Managed Session Reuse Multiple role ids can intentionally point to the same managed Codex window. Running any role wrapper in the same group opens or restores that same registered thread. - `project-wuji.laoan`: `case_analysis.analyst`, `dev.developer.ana`, `experiment.experimenter`, `dev.developer.exp` - `project-wuji.xiaoshen`: `case_analysis.reviewer`, `dev.reviewer.ana`, `experiment.reviewer`, `dev.reviewer.exp` ## Usage 1. Run `00-start-codex-app-server-4570.bat` if the Codex app-server is not running. 2. The scripts preflight both `python` and Codex CLI (`codex.cmd` / `codex.exe` / `codex`) in the same cmd/BAT PATH used to launch the wrapper. If Codex is missing, fix PATH or set the workspace provider command to an absolute executable path before retrying. 3. Run `open-laoan.bat` / `open-xiaoshen.bat` first for non-destructive open/reuse. It can recover stale/missing PID cases by resuming the existing thread, but it will not terminate an alive recorded PID. 4. If status says PID is alive but the visible window is still missing or not the old-history window, run `restore-laoan.bat` / `restore-xiaoshen.bat`; it asks for `REOPEN` before calling `mbx session reopen --terminate-existing`. 5. For audited automation only, callers may set `MBX_CONFIRM=REOPEN` before running a restore script to skip the interactive prompt. Do not use this for casual double-click operation. 6. After open/restore, verify the visible Codex window contains the old chat history. `session history --contains` is useful evidence, but it is not a substitute for visible-window proof. 7. Regenerate these scripts after role/session binding, project root, app-server URL, or MB-X source path changes: ```powershell python -m mbx.cli session restore-script generate --project project-wuji ``` ## Risk boundary `restore-*.bat` may terminate the recorded old remote TUI process. For `management.admin` and `management.observer`, real destructive close/reopen validation is a management high-risk action and must be recorded by the management/project workflow. Formal manual recovery guide: `doc/operation/MB-X会话窗口手动恢复指南.md` Workspace root used by generated wrappers: `D:\manage_system`