Problem
wp-gym still works around REST replay by writing a temporary PHP wrapper that constructs WP_REST_Request, calls rest_do_request(), and parses the JSON output. That is generic WordPress runtime behavior, not an eval-specific concern.
The current Codebox http-response observation is useful for preview HTTP requests, but it does not replace the in-process REST execution path needed for deterministic WordPress API scenarios where callers need the same semantics as rest_do_request().
Desired Codebox primitive
Add a generic Codebox runtime command or observation, for example:
wordpress.rest-request, or
ObservationSpec.type = "wordpress-rest-response"
The primitive should accept:
- HTTP method.
- REST path, with
/wp-json normalization handled generically.
- Headers.
- Optional request body.
- Optional response body inclusion policy.
It should return structured JSON with:
- status.
- headers.
- normalized response data/body.
- error diagnostics when WordPress returns or throws an error.
- artifact refs when response bodies are too large to inline.
Acceptance criteria
- A caller can execute a REST route inside the same disposable WordPress runtime without writing PHP wrapper files.
- The command/observation is generic and does not mention
wp-gym, rewards, graders, scenarios, task sets, or model evals.
- Runtime policy gates the primitive like other WordPress runtime commands.
- Smoke coverage proves a registered REST route can be called and returns structured output.
wp-gym can remove its stepRestWithCodeboxPhp() fallback after consuming this primitive.
Downstream evidence
Current workaround lives in wp-gym/src/index.js in stepRestWithCodeboxPhp().
Problem
wp-gymstill works around REST replay by writing a temporary PHP wrapper that constructsWP_REST_Request, callsrest_do_request(), and parses the JSON output. That is generic WordPress runtime behavior, not an eval-specific concern.The current Codebox
http-responseobservation is useful for preview HTTP requests, but it does not replace the in-process REST execution path needed for deterministic WordPress API scenarios where callers need the same semantics asrest_do_request().Desired Codebox primitive
Add a generic Codebox runtime command or observation, for example:
wordpress.rest-request, orObservationSpec.type = "wordpress-rest-response"The primitive should accept:
/wp-jsonnormalization handled generically.It should return structured JSON with:
Acceptance criteria
wp-gym, rewards, graders, scenarios, task sets, or model evals.wp-gymcan remove itsstepRestWithCodeboxPhp()fallback after consuming this primitive.Downstream evidence
Current workaround lives in
wp-gym/src/index.jsinstepRestWithCodeboxPhp().