Skip to content

Commit 4cfb5f4

Browse files
committed
Promote ChatGPT login hint to next action
1 parent edcb226 commit 4cfb5f4

5 files changed

Lines changed: 32 additions & 17 deletions

File tree

.codex/INSTALL.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ environment API, does not print the key, does not change proxy settings, and doe
103103
split. Tell the user to restart Codex App or open a new CLI process after any user environment
104104
variable change.
105105

106-
After a successful `install --start`, report the non-secret `chatgpt_login_hint` field. When it says
107-
`optional_setup_available`, tell the user they can keep the current API-key mode for third-party API
108-
plus global Fast, and that they should ask Codex to run `prepare-chatgpt-login` before switching
109-
Codex App to ChatGPT login for plugin marketplace, GitHub/Apps/connectors, manual Fast controls,
110-
status hints, and voice input.
106+
After a successful `install --start`, report the non-secret top-level `next_user_action` and
107+
`chatgpt_login_hint` fields. When `chatgpt_login_hint.status=optional_setup_available`, tell the
108+
user they can keep the current API-key mode for third-party API plus global Fast, and that they
109+
should ask Codex to run `prepare-chatgpt-login` before switching Codex App to ChatGPT login for
110+
plugin marketplace, GitHub/Apps/connectors, manual Fast controls, status hints, and voice input.
111111

112112
Before first enable or model-path setting changes, `install --start` verifies the candidate upstream
113113
and auth source by sending one Codex-style `POST /v1/responses` request with `stream=true`. This is

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ supports it, and the exact startup hook command. Use it to spot stale editable i
136136
executables, or hooks pointing at the wrong checkout.
137137
`status.provider_auth_preparation` and the `install --start` result explain whether provider auth is
138138
prepared for optional ChatGPT login, without printing keys. `install --start` also returns
139-
`chatgpt_login_hint`, a user-facing next-step hint that tells API-key users they can keep the
140-
current mode, or run `prepare-chatgpt-login` before switching to ChatGPT login for plugin
139+
top-level `next_user_action` and `chatgpt_login_hint` fields that tell API-key users they can keep
140+
the current mode, or run `prepare-chatgpt-login` before switching to ChatGPT login for plugin
141141
marketplace, GitHub/Apps/connectors, manual Fast controls, status hints, and voice input.
142142

143143
You can also open `http://127.0.0.1:8787/v1` in a browser. Browser-style HTML requests show a
@@ -586,8 +586,9 @@ python -m codex_fast_proxy status
586586
hook 命令,用来定位旧 Python、旧运行时或 hook 指向错误 checkout 的问题。
587587
`status.provider_auth_preparation``install --start` 结果会说明 provider auth 是否已经为可选
588588
ChatGPT 登录准备好,不会打印 key。`install --start` 还会返回 `chatgpt_login_hint`,明确告诉
589-
API-key 用户可以保持当前模式,或者在切换 ChatGPT 登录前先运行 `prepare-chatgpt-login`,以使用插件市场、
590-
GitHub/Apps/connectors、Fast 手动控制、状态提示和语音输入等 App UI 能力。
589+
API-key 用户可以保持当前模式;顶层 `next_user_action` 会提示如果要切换 ChatGPT 登录,应先运行
590+
`prepare-chatgpt-login`,以使用插件市场、GitHub/Apps/connectors、Fast 手动控制、状态提示和语音输入等
591+
App UI 能力。
591592

592593
也可以在浏览器打开 `http://127.0.0.1:8787/v1` 查看本地只读 dashboard。它会显示 proxy 状态、
593594
当前 upstream、Fast 策略、顶层诊断、最近脱敏请求、是否注入 priority、SSE 状态,以及最近一次 benchmark 摘要;不会展示

skills/codex-fast-proxy/SKILL.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,12 @@ python -m codex_fast_proxy uninstall
134134
not restart an already healthy proxy just because runtime code is stale.
135135
- If the user asks only to check for updates, run `check-update` and stop. It is read-only and must
136136
not pull, install, restart the proxy, edit Codex config, or write proxy state.
137-
- After a successful enable, report the JSON result and the `chatgpt_login_hint` message. If
138-
`chatgpt_login_hint.status=optional_setup_available`, tell the user they can keep API-key mode for
139-
third-party API plus global Fast, and should run `prepare-chatgpt-login` before switching Codex App
140-
to ChatGPT login for plugin marketplace, GitHub/Apps/connectors, manual Fast controls, status
141-
hints, and voice input. Avoid chaining unrelated work in the same turn.
137+
- After a successful enable, report the JSON result, the top-level `next_user_action`, and the
138+
`chatgpt_login_hint` message. If `chatgpt_login_hint.status=optional_setup_available`, tell the
139+
user they can keep API-key mode for third-party API plus global Fast, and should run
140+
`prepare-chatgpt-login` before switching Codex App to ChatGPT login for plugin marketplace,
141+
GitHub/Apps/connectors, manual Fast controls, status hints, and voice input. Avoid chaining
142+
unrelated work in the same turn.
142143

143144
## Sandbox and approval discipline
144145

@@ -171,7 +172,7 @@ For upstream URL changes after enable, prefer `set-upstream --upstream-base <url
171172

172173
- Treat the JSON output as the source of truth.
173174
- Report `provider`, `base_url`, `upstream_base`, `service_tier_policy`, `upstream_auth`, `running`,
174-
`diagnosis`, `provider_auth_preparation`, `chatgpt_login_hint`, `runtime_matches`,
175+
`diagnosis`, `provider_auth_preparation`, `chatgpt_login_hint`, `next_user_action`, `runtime_matches`,
175176
`needs_restart`, and backup or restore status.
176177
- Use `status.runtime` when diagnosing stale runtime, wrong Python executable, or a startup hook that
177178
points at a different checkout. Do not infer hook readiness from `~/.codex/hooks.json` alone.

src/codex_fast_proxy/manager.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ def chatgpt_login_hint(login: LoginDiagnosis, auth: dict[str, Any]) -> dict[str,
723723
"with ChatGPT to use richer Codex App UI features such as plugin marketplace, GitHub/Apps/"
724724
"connectors, manual Fast controls, status hints, and voice input."
725725
),
726+
"next_user_action": "Optional: keep current mode, or sign in with ChatGPT if you want the full Codex App UI.",
726727
}
727728
if auth["upstream_auth"] == "override_configured" and auth["upstream_api_key_available"]:
728729
return {
@@ -731,6 +732,7 @@ def chatgpt_login_hint(login: LoginDiagnosis, auth: dict[str, Any]) -> dict[str,
731732
"Optional: provider auth works now, but move it to a process or Windows user environment "
732733
"variable before relying on ChatGPT login."
733734
),
735+
"next_user_action": "Move the provider key to a persistent environment variable before switching to ChatGPT login.",
734736
}
735737
if login.chatgpt_auth:
736738
return {
@@ -739,6 +741,7 @@ def chatgpt_login_hint(login: LoginDiagnosis, auth: dict[str, Any]) -> dict[str,
739741
"ChatGPT login is detected, but provider auth is not split. Prepare upstream provider auth "
740742
"before relying on this setup for third-party model requests."
741743
),
744+
"next_user_action": "Run prepare-chatgpt-login and set-upstream --upstream-api-key-env before relying on ChatGPT login.",
742745
}
743746
return {
744747
"status": "optional_setup_available",
@@ -747,6 +750,10 @@ def chatgpt_login_hint(login: LoginDiagnosis, auth: dict[str, Any]) -> dict[str,
747750
"full Codex App UI, such as plugin marketplace, GitHub/Apps/connectors, manual Fast controls, "
748751
"status hints, and voice input, run prepare-chatgpt-login before switching Codex App to ChatGPT login."
749752
),
753+
"next_user_action": (
754+
"Keep API-key mode, or run prepare-chatgpt-login before switching Codex App to ChatGPT login "
755+
"for plugin marketplace, GitHub/Apps/connectors, manual Fast controls, status hints, and voice input."
756+
),
750757
}
751758

752759

@@ -1815,6 +1822,7 @@ def command_install(args: argparse.Namespace) -> int:
18151822

18161823
login = detect_login_mode(paths.codex_home)
18171824
auth = upstream_auth_status(paths, settings)
1825+
login_hint = chatgpt_login_hint(login, auth)
18181826
print(json_line({
18191827
"status": "installed",
18201828
"provider": provider,
@@ -1831,7 +1839,8 @@ def command_install(args: argparse.Namespace) -> int:
18311839
"upstream_api_key_persistent": auth["upstream_api_key_persistent"],
18321840
"chatgpt_login_compatible": bool(auth["upstream_api_key_persistent"]) if login.chatgpt_auth else None,
18331841
"provider_auth_preparation": provider_auth_preparation(login, auth),
1834-
"chatgpt_login_hint": chatgpt_login_hint(login, auth),
1842+
"chatgpt_login_hint": login_hint,
1843+
"next_user_action": login_hint["next_user_action"],
18351844
"backup_path": str(backup_path),
18361845
"started": True,
18371846
"config_switched": True,
@@ -2222,6 +2231,7 @@ def command_status(args: argparse.Namespace) -> int:
22222231
config_matches = bool(settings and config_base_url == settings.base_url)
22232232
needs_restart = bool(pending_restart or (healthy and not runtime_matches))
22242233
behavior = fast_behavior(settings, login)
2234+
login_hint = chatgpt_login_hint(login, auth) if settings else None
22252235
diagnosis = status_diagnosis(
22262236
settings,
22272237
running=running,
@@ -2262,7 +2272,8 @@ def command_status(args: argparse.Namespace) -> int:
22622272
"upstream_api_key_persistent": auth["upstream_api_key_persistent"],
22632273
"chatgpt_login_compatible": bool(auth["upstream_api_key_persistent"]) if login.chatgpt_auth else None,
22642274
"provider_auth_preparation": provider_auth_preparation(login, auth) if settings else None,
2265-
"chatgpt_login_hint": chatgpt_login_hint(login, auth) if settings else None,
2275+
"chatgpt_login_hint": login_hint,
2276+
"next_user_action": login_hint["next_user_action"] if login_hint else None,
22662277
"config_base_url": config_base_url,
22672278
"config_matches": config_matches,
22682279
"startup_hook": hook_status["ready"],

tests/test_manager.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,7 @@ def test_chatgpt_login_hint_reports_optional_setup_after_enable(self) -> None:
613613

614614
self.assertEqual(hint["status"], "optional_setup_available")
615615
self.assertIn("prepare-chatgpt-login", hint["message"])
616+
self.assertIn("prepare-chatgpt-login", hint["next_user_action"])
616617
self.assertIn("plugin marketplace", hint["message"])
617618
self.assertIn("voice input", hint["message"])
618619

@@ -643,6 +644,7 @@ def test_install_start_outputs_chatgpt_login_hint(self) -> None:
643644

644645
self.assertEqual(result["chatgpt_login_hint"]["status"], "optional_setup_available")
645646
self.assertIn("prepare-chatgpt-login", result["chatgpt_login_hint"]["message"])
647+
self.assertIn("prepare-chatgpt-login", result["next_user_action"])
646648
self.assertNotIn("provider-secret", output_text)
647649

648650
def test_validate_upstream_rejects_userinfo_query_and_fragment(self) -> None:

0 commit comments

Comments
 (0)