mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 16:40:49 +00:00
fix(models): normalize provider runtime selection (#71259)
* fix(models): normalize provider runtime selection * fix(models): reverse codex-only runtime migration * fix(models): default runtime selection to pi * fix(status): label model runtime clearly * fix(status): align pi runtime label * fix(plugins): align tool result middleware runtime naming * fix(models): validate runtime overrides
This commit is contained in:
@@ -172,8 +172,8 @@ For the full registration API, see [SDK Overview](/plugins/sdk-overview#registra
|
||||
|
||||
Bundled plugins can use `api.registerAgentToolResultMiddleware(...)` when they
|
||||
need async tool-result rewriting before the model sees the output. Declare the
|
||||
targeted harnesses in `contracts.agentToolResultMiddleware`, for example
|
||||
`["pi", "codex-app-server"]`. This is a trusted bundled-plugin seam; external
|
||||
targeted runtimes in `contracts.agentToolResultMiddleware`, for example
|
||||
`["pi", "codex"]`. This is a trusted bundled-plugin seam; external
|
||||
plugins should prefer regular OpenClaw plugin hooks unless OpenClaw grows an
|
||||
explicit trust policy for this capability.
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ These are in-process OpenClaw hooks, not Codex `hooks.json` command hooks:
|
||||
- `before_message_write` for mirrored transcript records
|
||||
- `agent_end`
|
||||
|
||||
Plugins can also register harness-neutral tool-result middleware to rewrite
|
||||
Plugins can also register runtime-neutral tool-result middleware to rewrite
|
||||
OpenClaw dynamic tool results after OpenClaw executes the tool and before the
|
||||
result is returned to Codex. This is separate from the public
|
||||
`tool_result_persist` plugin hook, which transforms OpenClaw-owned transcript
|
||||
@@ -35,8 +35,8 @@ The harness is off by default. New configs should keep OpenAI model refs
|
||||
canonical as `openai/gpt-*` and explicitly force
|
||||
`embeddedHarness.runtime: "codex"` or `OPENCLAW_AGENT_RUNTIME=codex` when they
|
||||
want native app-server execution. Legacy `codex/*` model refs still auto-select
|
||||
the harness for compatibility, but they are not shown as normal model/provider
|
||||
choices.
|
||||
the harness for compatibility, but runtime-backed legacy provider prefixes are
|
||||
not shown as normal model/provider choices.
|
||||
|
||||
## Pick the right model prefix
|
||||
|
||||
@@ -56,10 +56,12 @@ app-server harness. Direct API-key access for `openai/gpt-5.5` is supported
|
||||
once OpenAI enables GPT-5.5 on the public API.
|
||||
|
||||
Legacy `codex/gpt-*` refs remain accepted as compatibility aliases. Doctor
|
||||
compatibility migration rewrites legacy primary `codex/*` refs to `openai/*`
|
||||
and records the Codex harness policy separately. New PI Codex OAuth configs
|
||||
should use `openai-codex/gpt-*`; new native app-server harness configs should
|
||||
use `openai/gpt-*` plus `embeddedHarness.runtime: "codex"`.
|
||||
compatibility migration rewrites legacy primary runtime refs to canonical model
|
||||
refs and records the runtime policy separately, while fallback-only legacy refs
|
||||
are left unchanged because runtime is configured for the whole agent container.
|
||||
New PI Codex OAuth configs should use `openai-codex/gpt-*`; new native
|
||||
app-server harness configs should use `openai/gpt-*` plus
|
||||
`embeddedHarness.runtime: "codex"`.
|
||||
|
||||
`agents.defaults.imageModel` follows the same prefix split. Use
|
||||
`openai-codex/gpt-*` when image understanding should run through the OpenAI
|
||||
@@ -86,9 +88,9 @@ Legacy sessions created before harness pins are treated as PI-pinned once they
|
||||
have transcript history. Use `/new` or `/reset` to opt that conversation into
|
||||
Codex after changing config.
|
||||
|
||||
`/status` shows the effective non-PI harness next to `Fast`, for example
|
||||
`Fast · codex`. The default PI harness remains `Runner: pi (embedded)` and does
|
||||
not add a separate harness badge.
|
||||
`/status` shows the effective model runtime. The default PI harness appears as
|
||||
`Runtime: OpenClaw Pi Default`, and the Codex app-server harness appears as
|
||||
`Runtime: OpenAI Codex`.
|
||||
|
||||
## Requirements
|
||||
|
||||
|
||||
@@ -406,7 +406,7 @@ read without importing the plugin runtime.
|
||||
```json
|
||||
{
|
||||
"contracts": {
|
||||
"agentToolResultMiddleware": ["pi", "codex-app-server"],
|
||||
"agentToolResultMiddleware": ["pi", "codex"],
|
||||
"externalAuthProviders": ["acme-ai"],
|
||||
"speechProviders": ["openai"],
|
||||
"realtimeTranscriptionProviders": ["openai"],
|
||||
@@ -427,7 +427,7 @@ Each list is optional:
|
||||
| Field | Type | What it means |
|
||||
| -------------------------------- | ---------- | --------------------------------------------------------------------- |
|
||||
| `embeddedExtensionFactories` | `string[]` | Deprecated embedded extension factory ids. |
|
||||
| `agentToolResultMiddleware` | `string[]` | Harness ids a bundled plugin may register tool-result middleware for. |
|
||||
| `agentToolResultMiddleware` | `string[]` | Runtime ids a bundled plugin may register tool-result middleware for. |
|
||||
| `externalAuthProviders` | `string[]` | Provider ids whose external auth profile hook this plugin owns. |
|
||||
| `speechProviders` | `string[]` | Speech provider ids this plugin owns. |
|
||||
| `realtimeTranscriptionProviders` | `string[]` | Realtime-transcription provider ids this plugin owns. |
|
||||
|
||||
@@ -146,15 +146,15 @@ OpenClaw only runs against the protocol surface it has been tested with.
|
||||
|
||||
### Tool-result middleware
|
||||
|
||||
Bundled plugins can attach harness-neutral tool-result middleware through
|
||||
Bundled plugins can attach runtime-neutral tool-result middleware through
|
||||
`api.registerAgentToolResultMiddleware(...)` when their manifest declares the
|
||||
targeted harness ids in `contracts.agentToolResultMiddleware`. This trusted
|
||||
targeted runtime ids in `contracts.agentToolResultMiddleware`. This trusted
|
||||
seam is for async tool-result transforms that must run before PI or Codex feeds
|
||||
tool output back into the model.
|
||||
|
||||
Legacy bundled plugins can still use
|
||||
`api.registerCodexAppServerExtensionFactory(...)` for Codex app-server-only
|
||||
middleware, but new result transforms should use the harness-neutral API.
|
||||
middleware, but new result transforms should use the runtime-neutral API.
|
||||
The Pi-only `api.registerEmbeddedExtensionFactory(...)` hook is deprecated for
|
||||
tool-result transforms; keep it only for bundled compatibility code that still
|
||||
needs direct Pi embedded-runner events.
|
||||
|
||||
@@ -93,7 +93,7 @@ releases.
|
||||
<Step title="Migrate Pi tool-result extensions to middleware">
|
||||
Bundled plugins should replace Pi-only
|
||||
`api.registerEmbeddedExtensionFactory(...)` tool-result handlers with
|
||||
harness-neutral middleware.
|
||||
runtime-neutral middleware.
|
||||
|
||||
```typescript
|
||||
// Before: Pi-only compatibility hook
|
||||
@@ -103,11 +103,11 @@ releases.
|
||||
});
|
||||
});
|
||||
|
||||
// After: Pi and Codex app-server dynamic tools
|
||||
// After: Pi and Codex runtime dynamic tools
|
||||
api.registerAgentToolResultMiddleware(async (event) => {
|
||||
return compactToolResult(event);
|
||||
}, {
|
||||
harnesses: ["pi", "codex-app-server"],
|
||||
runtimes: ["pi", "codex"],
|
||||
});
|
||||
```
|
||||
|
||||
@@ -116,7 +116,7 @@ releases.
|
||||
```json
|
||||
{
|
||||
"contracts": {
|
||||
"agentToolResultMiddleware": ["pi", "codex-app-server"]
|
||||
"agentToolResultMiddleware": ["pi", "codex"]
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -626,7 +626,7 @@ canonical replacement.
|
||||
Covered in "How to migrate → Migrate Pi tool-result extensions to
|
||||
middleware" above. Included here for completeness: the Pi-only
|
||||
`api.registerEmbeddedExtensionFactory(...)` path is deprecated in favor of
|
||||
`api.registerAgentToolResultMiddleware(...)` with an explicit harness
|
||||
`api.registerAgentToolResultMiddleware(...)` with an explicit runtime
|
||||
list in `contracts.agentToolResultMiddleware`.
|
||||
</Accordion>
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ methods:
|
||||
| `api.registerCli(registrar, opts?)` | CLI subcommand |
|
||||
| `api.registerService(service)` | Background service |
|
||||
| `api.registerInteractiveHandler(registration)` | Interactive handler |
|
||||
| `api.registerAgentToolResultMiddleware(...)` | Harness tool-result middleware |
|
||||
| `api.registerAgentToolResultMiddleware(...)` | Runtime tool-result middleware |
|
||||
| `api.registerEmbeddedExtensionFactory(factory)` | Deprecated PI extension factory |
|
||||
| `api.registerMemoryPromptSupplement(builder)` | Additive memory-adjacent prompt section |
|
||||
| `api.registerMemoryCorpusSupplement(adapter)` | Additive memory search/read corpus |
|
||||
@@ -113,12 +113,12 @@ methods:
|
||||
|
||||
<Accordion title="When to use tool-result middleware">
|
||||
Bundled plugins can use `api.registerAgentToolResultMiddleware(...)` when
|
||||
they need to rewrite a tool result after execution and before the harness
|
||||
feeds that result back into the model. This is the trusted harness-neutral
|
||||
they need to rewrite a tool result after execution and before the runtime
|
||||
feeds that result back into the model. This is the trusted runtime-neutral
|
||||
seam for async output reducers such as tokenjuice.
|
||||
|
||||
Bundled plugins must declare `contracts.agentToolResultMiddleware` for each
|
||||
targeted harness, for example `["pi", "codex-app-server"]`. External plugins
|
||||
targeted runtime, for example `["pi", "codex"]`. External plugins
|
||||
cannot register this middleware; keep normal OpenClaw plugin hooks for work
|
||||
that does not need pre-model tool-result timing.
|
||||
</Accordion>
|
||||
|
||||
Reference in New Issue
Block a user