agents: include allow-list hint in disallowed model override error#82979
agents: include allow-list hint in disallowed model override error#82979crhan wants to merge 1 commit into
Conversation
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. for the current error path: source and existing tests show a disallowed one-off model override reaches the Real behavior proof Next step before merge Security Review detailsBest possible solution: Keep the scope reduced to one consistent allow-list hint across CLI and chat model-override rejection paths, without reviving the stale Codex docs workaround. Do we have a high-confidence way to reproduce the issue? Yes for the current error path: source and existing tests show a disallowed one-off model override reaches the Is this the best way to solve the issue? Yes, the reduced patch is a narrow maintainable way to solve the remaining error-message gap and mirrors an existing peer hint. The merge gate that remains is contributor-supplied real behavior proof, not a code-design blocker. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 635b947e32e0. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f87138719e
ℹ️ 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".
| 3. Mirror the OAuth profile from `auth-profiles.json` to the per-agent | ||
| Codex home so the spawned codex app-server can pick it up. If you | ||
| already signed in via the standalone codex CLI: | ||
|
|
||
| ```bash | ||
| mkdir -p ~/.openclaw/agents/<agent-id>/agent/codex-home | ||
| cp ~/.codex/auth.json ~/.openclaw/agents/<agent-id>/agent/codex-home/ | ||
| chmod 600 ~/.openclaw/agents/<agent-id>/agent/codex-home/auth.json |
There was a problem hiding this comment.
Don't require copying standalone Codex auth
For users who followed the preceding openclaw models auth login --provider openai-codex step, this new instruction points at ~/.codex/auth.json, which often will not exist and is not the OpenClaw auth store. The Codex harness already reads OpenClaw auth profiles and bridges them into the app-server (extensions/codex/src/app-server/auth-bridge.ts resolves the openai-codex profile and sends account/login/start), so documenting a manual copy from standalone Codex can make fresh OpenClaw OAuth setups fail at cp or pick up stale personal Codex credentials instead of the selected OpenClaw profile.
Useful? React with 👍 / 👎.
| runtime**. "Auto mode" does not currently choose the codex runtime | ||
| automatically based on plugin availability — without an explicit | ||
| `agentRuntime.id`, OpenAI-family model refs (`openai/*`, `openai-codex/*`) | ||
| resolve to the PI runtime even when `@openclaw/codex` is installed. This is |
There was a problem hiding this comment.
Don't say enabled Codex auto mode still falls back to PI
When the Codex plugin is registered, this statement is no longer true: resolveAgentHarnessPolicy() returns implicit codex for normal openai/* models, and selectAgentHarnessDecision() only falls back to PI for that implicit policy when getRegisteredAgentHarness("codex") is missing; the existing selection test also covers the default Codex path. As written, users who have installed/enabled @openclaw/codex are told they must add explicit agentRuntime.id to avoid PI even though auto mode will select the Codex harness once it is available, contradicting the route summary and basic deployment examples on the same page.
Useful? React with 👍 / 👎.
Mirror the existing helpful hint from src/auto-reply/reply/get-reply-directives-apply.ts:72 onto the parallel error thrown in src/agents/agent-command.ts when an explicit model override is rejected by the visibility policy. Existing test (src/commands/agent.test.ts:1068) uses toThrow(string) substring matching, so appending the hint is backward compatible and no test changes are required. See openclaw#82979 review thread for the broader context: this PR was originally larger but ClawSweeper correctly pointed out that openclaw#82864 already lands the routing fixes I had documented as a workaround, so the docs hunks have been dropped.
f871387 to
9928680
Compare
Comment on PR #82979 explaining scope reduction
Thanks @clawsweeper for the careful review — you're right that I've also pushed the same scope reduction in a force-push: Apologies for the noise on the docs side. |
|
Closing this — once #82864 lands in a stable release, the underlying routing path that originally drove me to this allow-list error message will not be the common code path anymore, so the remaining 1-line hint here doesn't justify maintainer review time. The hint is still mirrored in src/auto-reply/reply/get-reply-directives-apply.ts:72 for the auto-reply path which is what most users hit. Thanks @clawsweeper for the review and for pointing at #82864. |
Summary
Append the
agents.defaults.modelsallow-list hint to theModel override "X" is not allowed for agent "Y"error thrown bysrc/agents/agent-command.ts. A peer code path insrc/auto-reply/reply/get-reply-directives-apply.ts:72alreadyincludes a helpful hint
(
Add ${rejectedRef} to agents.defaults.models or pick an allowed model with /model list.); this brings the agent-command path toparity.
This PR was originally scoped to include
docs/openai.mdanddocs/codex-harness.mdrewrites based on observed behavior on the2026.5.12 stable release. ClawSweeper review on current
maincorrectly pointed out that #82864
(
Fix OpenAI Codex runtime provider routing) already addressesthe underlying routing / auth-bridging gap, so those docs as
written on
mainare accurate; my proposed rewrites would haveregressed them. I've dropped the docs hunks. The remaining
change is the additive error-message hint, which ClawSweeper
flagged as "plausible" and is independent of the routing fix.
Change
src/agents/agent-command.ts(~line 926):Backward compatibility
Existing test (
src/commands/agent.test.ts:1068) usestoThrow(string)which is substring matching, so the additionalhint at the tail does not break it. No test changes required.
(Optional follow-up: bring
src/gateway/http-utils.ts:105toparity — it uses
toEqual({ errorMessage })exact matching andwould require updating the test, so excluded to keep scope
minimal.)
Related
Resolved on
mainby Fix OpenAI Codex runtime provider routing #82864; this PR is unrelated to thatrouting fix but the user-facing error hint helps anyone who
encounters the allow-list semantics for unrelated reasons.
already implemented (correctly, on
main).