mirror of
https://github.com/openai/codex.git
synced 2026-05-01 20:02:05 +03:00
app-server: propagate nested experimental gating for AskForApproval::Reject (#14191)
## Summary
This change makes `AskForApproval::Reject` gate correctly anywhere it
appears inside otherwise-stable app-server protocol types.
Previously, experimental gating for `approval_policy: Reject` was
handled with request-specific logic in `ClientRequest` detection. That
covered a few request params types, but it did not generalize to other
nested uses such as `ProfileV2`, `Config`, `ConfigReadResponse`, or
`ConfigRequirements`.
This PR replaces that ad hoc handling with a generic nested experimental
propagation mechanism.
## Testing
seeing this when run app-server-test-client without experimental api
enabled:
```
initialize response: InitializeResponse { user_agent: "codex-toy-app-server/0.0.0 (Mac OS 26.3.1; arm64) vscode/2.4.36 (codex-toy-app-server; 0.0.0)" }
> {
> "id": "50244f6a-270a-425d-ace0-e9e98205bde7",
> "method": "thread/start",
> "params": {
> "approvalPolicy": {
> "reject": {
> "mcp_elicitations": false,
> "request_permissions": true,
> "rules": false,
> "sandbox_approval": true
> }
> },
> "baseInstructions": null,
> "config": null,
> "cwd": null,
> "developerInstructions": null,
> "dynamicTools": null,
> "ephemeral": null,
> "experimentalRawEvents": false,
> "mockExperimentalField": null,
> "model": null,
> "modelProvider": null,
> "persistExtendedHistory": false,
> "personality": null,
> "sandbox": null,
> "serviceName": null
> }
> }
< {
< "error": {
< "code": -32600,
< "message": "askForApproval.reject requires experimentalApi capability"
< },
< "id": "50244f6a-270a-425d-ace0-e9e98205bde7"
< }
[verified] thread/start rejected approvalPolicy=Reject without experimentalApi
```
---------
Co-authored-by: celia-oai <celia@openai.com>
This commit is contained in:
@@ -1319,6 +1319,7 @@ Examples of descriptor strings:
|
||||
|
||||
- `mock/experimentalMethod` (method-level gate)
|
||||
- `thread/start.mockExperimentalField` (field-level gate)
|
||||
- `askForApproval.reject` (enum-variant gate, for `approvalPolicy: { "reject": ... }`)
|
||||
|
||||
### For maintainers: Adding experimental fields and methods
|
||||
|
||||
@@ -1335,6 +1336,28 @@ At runtime, clients must send `initialize` with `capabilities.experimentalApi =
|
||||
|
||||
3. In `app-server-protocol/src/protocol/common.rs`, keep the method stable and use `inspect_params: true` when only some fields are experimental (like `thread/start`). If the entire method is experimental, annotate the method variant with `#[experimental("method/name")]`.
|
||||
|
||||
Enum variants can be gated too:
|
||||
|
||||
```rust
|
||||
#[derive(ExperimentalApi)]
|
||||
enum AskForApproval {
|
||||
#[experimental("askForApproval.reject")]
|
||||
Reject { /* ... */ },
|
||||
}
|
||||
```
|
||||
|
||||
If a stable field contains a nested type that may itself be experimental, mark
|
||||
the field with `#[experimental(nested)]` so `ExperimentalApi` bubbles the nested
|
||||
reason up through the containing type:
|
||||
|
||||
```rust
|
||||
#[derive(ExperimentalApi)]
|
||||
struct ProfileV2 {
|
||||
#[experimental(nested)]
|
||||
approval_policy: Option<AskForApproval>,
|
||||
}
|
||||
```
|
||||
|
||||
For server-initiated request payloads, annotate the field the same way so schema generation treats it as experimental, and make sure app-server omits that field when the client did not opt into `experimentalApi`.
|
||||
|
||||
4. Regenerate protocol fixtures:
|
||||
|
||||
Reference in New Issue
Block a user