@minniexcode/codex-switch 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.CN.md +6 -4
  2. package/README.md +13 -4
  3. package/dist/app/add-provider.js +1 -0
  4. package/dist/app/bridge.js +2 -1
  5. package/dist/app/switch-provider.js +2 -1
  6. package/dist/commands/handlers.js +1 -0
  7. package/dist/domain/config.js +45 -1
  8. package/dist/domain/providers.js +1 -0
  9. package/dist/runtime/copilot-adapter.js +326 -70
  10. package/dist/runtime/copilot-bridge-worker.js +27 -2
  11. package/dist/runtime/copilot-bridge.js +192 -10
  12. package/dist/runtime/copilot-cli.js +7 -0
  13. package/dist/runtime/copilot-installer.js +59 -1
  14. package/dist/runtime/copilot-sdk-loader.js +4 -1
  15. package/docs/Design/codex-switch-v0.1.0-design.md +32 -152
  16. package/docs/Design/codex-switch-v0.1.1-design.md +15 -26
  17. package/docs/Design/codex-switch-v0.1.2-design.md +65 -0
  18. package/docs/PRD/codex-switch-prd-v0.1.0.md +65 -217
  19. package/docs/PRD/codex-switch-prd-v0.1.1.md +26 -0
  20. package/docs/PRD/codex-switch-prd-v0.1.2.md +41 -0
  21. package/docs/Tests/testing.md +1 -1
  22. package/docs/cli-usage.md +12 -4
  23. package/docs/codex-switch-command-design.md +1 -1
  24. package/docs/codex-switch-product-overview.md +7 -3
  25. package/docs/codex-switch-product-research.md +2 -2
  26. package/docs/codex-switch-technical-architecture.md +84 -1115
  27. package/package.json +1 -1
  28. package/docs/Design/codex-switch-copilot-integration-design.md +0 -517
  29. package/docs/Design/codex-switch-v0.0.10-design.md +0 -669
  30. package/docs/Design/codex-switch-v0.0.11-design.md +0 -824
  31. package/docs/Design/codex-switch-v0.0.12-design.md +0 -343
  32. package/docs/Design/codex-switch-v0.0.4-design.md +0 -874
  33. package/docs/Design/codex-switch-v0.0.5-design.md +0 -932
  34. package/docs/Design/codex-switch-v0.0.6-design.md +0 -708
  35. package/docs/Design/codex-switch-v0.0.7-design.md +0 -862
  36. package/docs/Design/codex-switch-v0.0.8-design.md +0 -132
  37. package/docs/Design/codex-switch-v0.0.9-design.md +0 -182
  38. package/docs/Design/codex-switch-v0.0.9-to-v0.0.12-roadmap.md +0 -413
  39. package/docs/PRD/codex-switch-prd-v0.0.10.md +0 -406
  40. package/docs/PRD/codex-switch-prd-v0.0.11.md +0 -577
  41. package/docs/PRD/codex-switch-prd-v0.0.12.md +0 -279
  42. package/docs/PRD/codex-switch-prd-v0.0.5-to-v0.1.0.md +0 -446
  43. package/docs/PRD/codex-switch-prd-v0.0.8.md +0 -62
  44. package/docs/PRD/codex-switch-prd-v0.0.9.md +0 -166
  45. package/docs/PRD/codex-switch-prd.md +0 -650
  46. package/docs/Tests/test-report-0.0.5.md +0 -163
  47. package/docs/Tests/test-report-0.0.7.md +0 -118
  48. package/docs/Tests/testing-bridge-v0.0.9.md +0 -367
@@ -1,163 +0,0 @@
1
- # Test Report: 0.0.5
2
-
3
- Date: 2026-05-13
4
-
5
- ## Environment
6
-
7
- - Platform: Windows (`win32`)
8
- - Node.js: `v24.11.1`
9
- - npm: `11.13.0`
10
- - Workspace: `C:\Users\A200477427\Developers\Github\codex-switch`
11
-
12
- ## Commands Run
13
-
14
- ```bash
15
- npm run build
16
- npm test
17
- ```
18
-
19
- ## Overall Result
20
-
21
- - Build: PASS
22
- - Test suites: 5/5 PASS
23
-
24
- Suite results:
25
-
26
- - `domain`: PASS
27
- - `app`: PASS
28
- - `cli`: PASS
29
- - `dev-sandbox`: PASS
30
- - `e2e`: PASS
31
-
32
- ## Coverage Added In This Pass
33
-
34
- New test assets:
35
-
36
- - `tests/dev-sandbox.spec.js`
37
- - `tests/e2e.spec.js`
38
- - `docs/testing.md`
39
-
40
- Updated wiring:
41
-
42
- - `tests/helpers.js`
43
- - `tests/run-tests.js`
44
-
45
- ## Detailed Results
46
-
47
- ### 1. Domain Suite
48
-
49
- Status: PASS
50
-
51
- Focus:
52
-
53
- - config patch planning
54
- - managed profile view generation
55
- - provider normalization and masking
56
- - runtime drift helpers
57
- - backup list helpers
58
-
59
- ### 2. App Suite
60
-
61
- Status: PASS
62
-
63
- Focus:
64
-
65
- - list/current/status
66
- - add/edit/show/remove
67
- - import/export
68
- - switch/login/rollback
69
- - setup
70
- - doctor
71
- - lock conflict and rollback behavior
72
-
73
- ### 3. CLI Suite
74
-
75
- Status: PASS
76
-
77
- Focus:
78
-
79
- - arg parsing
80
- - help rendering
81
- - JSON success/failure envelopes
82
- - interactive add/edit/remove/import/export/rollback/setup flows
83
- - config commands
84
-
85
- ### 4. Dev Sandbox Suite
86
-
87
- Status: PASS
88
-
89
- Fixture:
90
-
91
- - `dev-codex/local-sandbox`
92
-
93
- Validated with the built CLI command dispatcher against the real development fixture:
94
-
95
- - `list --json`
96
- - `current --json`
97
- - `status --json`
98
- - `config show --json`
99
- - `backups list --json`
100
- - `doctor --json`
101
-
102
- Observed state during test:
103
-
104
- - active profile: `packycode`
105
- - managed providers: `freemodel`, `packycode`
106
- - status issues: `0`
107
- - backups found: `>= 1`
108
-
109
- ### 5. End-to-End Suite
110
-
111
- Status: PASS
112
-
113
- Fixture strategy:
114
-
115
- - copy `dev-codex/local-sandbox` into a temp directory
116
- - run write commands against the temp copy
117
- - keep the repository fixture unchanged
118
-
119
- Validated flows:
120
-
121
- - `switch freemodel` updates active profile and refreshes `auth.json`
122
- - `rollback` restores `config.toml` and `auth.json`
123
- - `add` creates a provider in `providers.json`
124
- - `edit` updates note and tags
125
- - `remove --force` deletes a non-active provider
126
- - `add --create-profile` creates a managed profile section in `config.toml` when a same-named `[model_providers.*]` runtime section already exists
127
- - destructive removal of the active provider fails with `PROFILE_IN_USE`
128
- - `import --merge` replaces overlapping providers and keeps merged state valid
129
- - `export` writes a valid providers file
130
- - `backups list` skips corrupt backup folders with warnings
131
- - `rollback missing-backup` fails with `BACKUP_NOT_FOUND`
132
- - corrupt `backups/latest.json` fails with `ROLLBACK_FAILED`
133
- - `setup` adopt flow works through CLI dispatch with mocked Codex CLI availability
134
-
135
- Validated mixed workflows:
136
-
137
- - `add -> switch -> edit -> show -> config show -> export -> rollback`
138
- - `import --merge -> switch --no-login -> remove -> doctor -> backups list -> rollback <backup-id>`
139
-
140
- ## Release Confidence
141
-
142
- Current confidence for `0.0.5`: medium-high.
143
-
144
- Why:
145
-
146
- - core read and write workflows now have automated coverage
147
- - the development fixture is exercised directly by the built CLI
148
- - backup/rollback behavior is covered by both existing and new tests
149
-
150
- ## Residual Risks
151
-
152
- - `setup` is not yet covered as a true subprocess end-to-end command because it depends on interactive adopt input and external `codex` availability
153
- - `rollback-latest` still has no direct dedicated test case even though `rollback` coverage is strong
154
- - `README.md` still shows version `0.0.4` in the documentation text and should be updated separately
155
-
156
- ## Recommended Pre-Release Checklist
157
-
158
- Before the next publish:
159
-
160
- - run `npm test`
161
- - run a manual smoke check of `node dist/cli.js --help`
162
- - run one real local `switch --no-login` against a temp `--codex-dir`
163
- - update user-facing docs if the package version changes
@@ -1,118 +0,0 @@
1
- # Test Report: 0.0.7
2
-
3
- Date: 2026-05-14
4
-
5
- ## Environment
6
-
7
- - Platform: Windows (`win32`)
8
- - Workspace: `C:\Users\A200477427\Developers\Github\codex-switch`
9
- - Node.js: `v24.11.1`
10
- - npm: `11.13.0`
11
-
12
- ## Scope
13
-
14
- This report covers the current automated suite plus the new built-CLI entrypoint checks added in `tests/cli-e2e.spec.js`.
15
-
16
- Chinese summary:
17
-
18
- - `npm test` is not compile-only. It rebuilds `dist/` and then runs the full automated suite.
19
- - `add` now has explicit built-CLI non-interactive regression coverage.
20
- - `migrate` is verified in two ways: built CLI non-interactive failure contract, plus injected interactive workflow coverage.
21
- - `setup` is verified as deprecated and must fail with `COMMAND_DEPRECATED`.
22
-
23
- ## Commands Run
24
-
25
- ```bash
26
- npx tsc --noEmit
27
- npm test
28
- ```
29
-
30
- ## Overall Result
31
-
32
- - TypeScript check: PASS
33
- - Build and suites: PASS
34
- - Full suite total: `39 passed, 0 failed`
35
-
36
- Suite results:
37
-
38
- - `commands`: PASS (`10/10`)
39
- - `cli-e2e`: PASS (`7/7`)
40
- - `interaction`: PASS (`8/8`)
41
- - `runtime`: PASS (`2/2`)
42
- - `workflows`: PASS (`12/12`)
43
-
44
- ## Built CLI Command Matrix
45
-
46
- Read commands covered through the built CLI entrypoint:
47
-
48
- - `--help`
49
- - `--version`
50
- - `list --json`
51
- - `show --json`
52
- - `current --json`
53
- - `status --json`
54
- - `config show --json`
55
- - `config list-profiles --json`
56
- - `backups list --json`
57
- - `doctor --json`
58
-
59
- Write commands covered through the built CLI entrypoint on temp copies:
60
-
61
- - `init --json`
62
- - `add --json`
63
- - `add --create-profile --json`
64
- - `edit --json`
65
- - `switch --json`
66
- - `remove --force --json`
67
- - `import --json`
68
- - `export --force --json`
69
- - `rollback --json`
70
-
71
- Negative contract checks through the built CLI entrypoint:
72
-
73
- - `add` against a missing profile without `--create-profile`
74
- - removing the active provider profile
75
- - `rollback <missing-id>`
76
- - `migrate --overwrite --json`
77
- - `setup --json`
78
-
79
- ## Key Findings
80
-
81
- ### 1. `npm test` behavior
82
-
83
- `npm test` rebuilds the project first and then executes the JavaScript test harness in `tests/run-tests.js`. It is not a compile-only command.
84
-
85
- ### 2. `add`
86
-
87
- Validated behaviors:
88
-
89
- - succeeds non-interactively when all required flags are provided
90
- - creates `providers.json` entries with derived `envKey`
91
- - supports `--create-profile` to add missing profile and model provider sections
92
- - fails with `PROFILE_NOT_FOUND` when targeting a missing profile without `--create-profile`
93
-
94
- ### 3. `migrate`
95
-
96
- Validated behaviors:
97
-
98
- - built CLI non-interactive path currently fails by design with `INVALID_ARGUMENT`
99
- - error payload includes adoptable profile metadata and a suggestion to run in an interactive TTY
100
- - interactive adopt flow remains covered in `tests/workflows.spec.js` through runtime injection
101
-
102
- This means the current implementation does not support a full non-interactive `migrate` workflow yet. The new tests lock that behavior in as an explicit contract instead of silently leaving it unverified.
103
-
104
- ### 4. Repository sandbox observations
105
-
106
- Observed from the checked-in `dev-codex/local-sandbox` fixture during this run:
107
-
108
- - active profile: `freemodel`
109
- - managed providers in `list --json`: `alpha`, `bestmodel`, `beta`, `freemodel`
110
- - `doctor --json` returns `healthy: false` in this automation environment because runtime probing reports `CODEX_NOT_INSTALLED`
111
- - the `doctor` issue is environmental, not a providers/config parse failure
112
-
113
- ## Residual Risks
114
-
115
- - prompt-driven subprocess automation for true interactive `migrate` is still not covered end-to-end
116
- - Windows sandbox restrictions currently block nested `child_process` launches with `EPERM`, so automated command checks run through the built CLI entrypoint in-process instead of spawning `node dist/cli.js`
117
- - `rollback-latest` still lacks a dedicated direct test
118
- - backup corruption coverage is still focused on selected cases rather than an exhaustive matrix
@@ -1,367 +0,0 @@
1
- # `0.0.9` Bridge Automated Testing Guide
2
-
3
- This document defines the automated test strategy for the `0.0.9` Copilot bridge release.
4
-
5
- ## Goal
6
-
7
- The release must prove that the managed Copilot bridge can:
8
-
9
- - resolve the correct provider target
10
- - start, stop, and report status through the public CLI surface
11
- - reuse one healthy instance for the same provider
12
- - replace an existing managed instance for a different provider
13
- - recover from preferred-port conflicts using another 5-digit port
14
- - persist recovered ports into `providers.json` and `config.toml`
15
- - clean up newly started workers when persistence fails
16
- - surface stale runtime-state diagnostics through `status` and `doctor`
17
-
18
- ## Test Layers
19
-
20
- Bridge coverage is intentionally split across four layers.
21
-
22
- ### 1. Runtime Layer
23
-
24
- File: `tests/runtime.spec.js`
25
-
26
- Use this layer for low-level worker/runtime behaviors:
27
-
28
- - bridge HTTP health endpoint behavior
29
- - worker fallback defaults
30
- - port conflict recovery
31
- - single-instance replacement at the runtime-state layer
32
- - direct `probeCopilotBridgeRuntime()` status behavior
33
-
34
- ### 2. Workflow Layer
35
-
36
- File: `tests/workflows.spec.js`
37
-
38
- Use this layer for app use cases and filesystem side effects:
39
-
40
- - `startBridge`
41
- - `stopBridge`
42
- - `statusBridge`
43
- - `switchProvider`
44
- - `runDoctor`
45
- - persistence and rollback behavior
46
-
47
- ### 3. Command Layer
48
-
49
- File: `tests/commands.spec.js`
50
-
51
- Use this layer for registry, argument parsing, and dispatch wiring:
52
-
53
- - nested command parsing
54
- - help text
55
- - `executeCommand()` dispatch for `bridge start|stop|status`
56
- - mismatch-guard and unresolved-target error contracts
57
-
58
- ### 4. Built CLI Layer
59
-
60
- File: `tests/cli-e2e.spec.js`
61
-
62
- Use this layer only for a small number of user-visible end-to-end checks:
63
-
64
- - `bridge start --json`
65
- - `bridge status --json`
66
- - `bridge stop --json`
67
- - stable JSON error envelopes for bridge failures
68
-
69
- ## Shared Fixtures And Helpers
70
-
71
- ### Existing helpers
72
-
73
- - `tests/helpers.js`
74
- - `makeSandboxCopy()`
75
- - `makeEmptyCodexDir()`
76
- - `runBuiltCli()`
77
- - `runJsonCli()`
78
- - `tests/workflows.spec.js`
79
- - `makeFixture()`
80
- - `withCodexAvailable()`
81
- - `withFakeCopilotSdk()`
82
- - `getFreePort()`
83
- - `requestJson()`
84
- - `tests/commands.spec.js`
85
- - `makeTempCodexDir()`
86
- - `writeBridgeFixture()`
87
- - `withFakeCopilotSdk()`
88
-
89
- ### Environment hooks
90
-
91
- Mock bridge-oriented tests should continue to use:
92
-
93
- - `CODEX_SWITCH_COPILOT_RUNTIME_DIR`
94
- - `CODEX_SWITCH_RUNTIME_STATE_DIR`
95
-
96
- These keep SDK loading and runtime-state persistence isolated inside temporary directories.
97
-
98
- ## Required Automated Coverage
99
-
100
- ### Runtime tests
101
-
102
- Required scenarios:
103
-
104
- - healthy in-process bridge serves `/healthz`
105
- - worker fallback port remains `41415`
106
- - `ensureCopilotBridge()` reuses a healthy worker for the same provider
107
- - `ensureCopilotBridge()` replaces a different managed provider instance
108
- - `ensureCopilotBridge()` recovers from preferred-port conflicts
109
- - `ensureCopilotBridge()` reports startup failures with `BRIDGE_START_FAILED`
110
-
111
- Recommended additions when extending runtime coverage:
112
-
113
- - `probeCopilotBridgeRuntime()` with missing state
114
- - `probeCopilotBridgeRuntime()` with stale state and no active Copilot provider
115
- - `probeCopilotBridgeRuntime()` with base URL mismatch
116
- - `probeCopilotBridgeRuntime()` with failed healthcheck
117
-
118
- ### Workflow tests
119
-
120
- Required scenarios:
121
-
122
- - explicit `bridge start|status|stop`
123
- - `bridge stop` idempotency without runtime state
124
- - recovered-port persistence into `providers.json` and `config.toml`
125
- - cleanup when recovered-port persistence fails for a newly started worker
126
- - cleanup when recovered-port persistence fails after replacing a previous worker
127
- - providers rollback when config projection update fails
128
- - stale runtime-state surfaced by `status` and `doctor` while a direct provider is active
129
- - `switchProvider()` keeps bridge cleanup semantics on failure
130
-
131
- Recommended additions when extending workflow coverage:
132
-
133
- - active-provider bridge target resolution without explicit provider argument
134
- - sole Copilot provider resolution without explicit provider argument
135
- - explicit mismatch guard for `bridge stop`
136
- - explicit mismatch guard for `bridge status`
137
- - `BRIDGE_TARGET_UNRESOLVED` for non-interactive multi-provider ambiguity
138
-
139
- ### Command tests
140
-
141
- Required scenarios:
142
-
143
- - nested `bridge` command parsing
144
- - bridge help text rendering
145
- - `executeCommand()` dispatches `bridge start|status|stop`
146
-
147
- Recommended additions when extending command coverage:
148
-
149
- - `executeCommand()` mismatch guard for `bridge stop`
150
- - `executeCommand()` mismatch guard for `bridge status`
151
- - `executeCommand()` unresolved target failures
152
-
153
- ### Built CLI tests
154
-
155
- Required scenarios:
156
-
157
- - `bridge start|status|stop` through the built CLI entrypoint
158
- - read-command JSON envelope remains stable while `doctor` now may report multiple issue codes
159
-
160
- Recommended additions when extending CLI coverage:
161
-
162
- - `bridge status` stale runtime-state envelope
163
- - `bridge start` unresolved-target envelope
164
-
165
- ## Fast Execution Order
166
-
167
- When time is limited, implement and verify tests in this order:
168
-
169
- 1. `tests/commands.spec.js`
170
- 2. `tests/workflows.spec.js`
171
- 3. `tests/cli-e2e.spec.js`
172
- 4. `tests/runtime.spec.js`
173
-
174
- This order catches the highest-value regressions first:
175
-
176
- - wiring regressions
177
- - persistence/cleanup regressions
178
- - user-visible CLI regressions
179
- - low-level runtime regressions
180
-
181
- ## Running The Suite
182
-
183
- Build and run all tests:
184
-
185
- ```bash
186
- npm test
187
- ```
188
-
189
- This runs:
190
-
191
- ```bash
192
- npm run build
193
- node tests/run-tests.js
194
- ```
195
-
196
- ## Release Gate For `0.0.9`
197
-
198
- Treat bridge automation as release-ready only when all of the following are true:
199
-
200
- - `commands`, `runtime`, `workflows`, and `cli-e2e` all pass
201
- - `bridge start|stop|status` are covered at both app and CLI layers
202
- - single-instance reuse and replacement are covered
203
- - recovered-port persistence and cleanup failure paths are covered
204
- - stale runtime-state diagnostics are covered in both `status` and `doctor`
205
-
206
- ## Remaining Manual Smoke Checks
207
-
208
- Automated coverage does not replace a final real-environment smoke pass.
209
-
210
- Before shipping, still run a logged-in Copilot smoke check for:
211
-
212
- - real `bridge start`
213
- - real `bridge status`
214
- - one real request through `/v1/chat/completions`
215
- - real `bridge stop`
216
- - real `switch <copilot-provider>` reuse/replacement behavior
217
-
218
- ## Minimal Manual Smoke Checklist
219
-
220
- Use this short checklist after the automated suite passes and after you have logged into Copilot in the real target environment.
221
-
222
- ### Preconditions
223
-
224
- - run from the repository root
225
- - use the real Codex directory you intend to validate
226
- - ensure the target Copilot provider already exists in `providers.json`
227
- - ensure the optional Copilot SDK is installed
228
- - ensure you are logged into Copilot before starting the live smoke pass
229
-
230
- Suggested placeholder values:
231
-
232
- - `<CODEX_DIR>`: your real Codex directory
233
- - `<COPILOT_PROVIDER>`: the Copilot-backed provider name you want to validate
234
-
235
- ### 1. Confirm the automated gate is still green
236
-
237
- ```bash
238
- npm test
239
- ```
240
-
241
- Expected result:
242
-
243
- - build succeeds
244
- - all automated suites pass
245
-
246
- ### 2. Start the real managed bridge
247
-
248
- ```bash
249
- node dist/cli.js bridge start <COPILOT_PROVIDER> --json --codex-dir <CODEX_DIR>
250
- ```
251
-
252
- Expected result:
253
-
254
- - command exits successfully
255
- - JSON payload reports the requested provider
256
- - payload includes `host`, `port`, and `baseUrl`
257
- - `reused` is `false` on the first successful start unless a healthy matching bridge is already running
258
-
259
- ### 3. Confirm bridge status
260
-
261
- ```bash
262
- node dist/cli.js bridge status <COPILOT_PROVIDER> --json --codex-dir <CODEX_DIR>
263
- ```
264
-
265
- Expected result:
266
-
267
- - command exits successfully
268
- - `health.ok` is `true`
269
- - `active` is `true`
270
- - `matches` is `true`
271
-
272
- ### 4. Send one real request through the bridge
273
-
274
- Use the `baseUrl` and API key from the selected provider record. Replace `<BRIDGE_BASE_URL>` and `<BRIDGE_API_KEY>` with real values from your environment.
275
-
276
- ```bash
277
- curl -sS <BRIDGE_BASE_URL>/chat/completions \
278
- -H "Content-Type: application/json" \
279
- -H "Authorization: Bearer <BRIDGE_API_KEY>" \
280
- -d "{\"model\":\"gpt-4o-mini\",\"messages\":[{\"role\":\"user\",\"content\":\"Reply with the single word OK.\"}]}"
281
- ```
282
-
283
- Expected result:
284
-
285
- - HTTP request succeeds
286
- - response contains a completion payload
287
- - model output proves the request reached the live bridge successfully
288
-
289
- If your shell or environment prefers the OpenAI-style path, validate the same request against:
290
-
291
- ```text
292
- <BRIDGE_BASE_URL>/chat/completions
293
- ```
294
-
295
- ### 5. Verify same-provider reuse
296
-
297
- Run the start command again:
298
-
299
- ```bash
300
- node dist/cli.js bridge start <COPILOT_PROVIDER> --json --codex-dir <CODEX_DIR>
301
- ```
302
-
303
- Expected result:
304
-
305
- - command exits successfully
306
- - `reused` is `true`
307
- - reported `port` remains stable
308
-
309
- ### 6. Verify switch reuse or replacement behavior
310
-
311
- Run a real switch into the Copilot provider:
312
-
313
- ```bash
314
- node dist/cli.js switch <COPILOT_PROVIDER> --json --codex-dir <CODEX_DIR>
315
- ```
316
-
317
- Expected result:
318
-
319
- - command exits successfully
320
- - provider/profile switch succeeds
321
- - if the same healthy bridge is already running, it is reused
322
- - if another managed bridge instance was active, it is replaced cleanly
323
-
324
- If you have a second Copilot provider available, also validate explicit replacement:
325
-
326
- ```bash
327
- node dist/cli.js bridge start <SECOND_COPILOT_PROVIDER> --json --codex-dir <CODEX_DIR>
328
- ```
329
-
330
- Expected result:
331
-
332
- - previous managed instance is replaced
333
- - status for the new provider is healthy
334
- - no stale runtime-state mismatch is left behind
335
-
336
- ### 7. Stop the managed bridge
337
-
338
- ```bash
339
- node dist/cli.js bridge stop <COPILOT_PROVIDER> --json --codex-dir <CODEX_DIR>
340
- ```
341
-
342
- Expected result:
343
-
344
- - command exits successfully
345
- - payload reports `stopped: true`
346
-
347
- ### 8. Confirm shutdown state
348
-
349
- ```bash
350
- node dist/cli.js bridge status <COPILOT_PROVIDER> --json --codex-dir <CODEX_DIR>
351
- ```
352
-
353
- Expected result:
354
-
355
- - command may either report inactive bridge health or a missing runtime state, depending on the exact environment state
356
- - it must not falsely report a healthy active managed bridge after stop
357
-
358
- ### Manual Pass Criteria
359
-
360
- Treat the live smoke pass as complete only when all of the following are true:
361
-
362
- - `bridge start` succeeds in a logged-in real environment
363
- - `bridge status` reports a healthy active bridge
364
- - one real request succeeds through the bridge
365
- - repeated `bridge start` reuses the same healthy instance
366
- - `switch <copilot-provider>` preserves expected reuse/replacement behavior
367
- - `bridge stop` shuts the managed instance down cleanly