Repository navigation
feat(openclaw_agent): consume rollout-scoped Gym MCP metadata - #2733
cwing-nvidia wants to merge 5 commits into
Conversation
Keep OpenClaw's session-event extraction and verifier forwarding with the dynamic MCP handoff work so the complete path can be validated together. Signed-off-by: Chris Wing <[email protected]>
Translate seeded MCP metadata into each invocation's ephemeral OpenClaw config so resources tools are callable without sharing signed tokens across rollouts. Signed-off-by: Chris Wing <[email protected]>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Live Workplace rollout evidenceA real OpenClaw Selected stored fields: {
"response": {
"output": [
{
"type": "function_call",
"call_id": "chatcmpl-tool-92096782361fe18b",
"name": "workplace_assistant__email_reply_email",
"arguments": "{\"email_id\": \"00000057\", \"body\": \"Thanks for the update - I will get back to you tomorrow.\"}"
},
{
"type": "function_call_output",
"call_id": "chatcmpl-tool-92096782361fe18b",
"output": "Email replied successfully."
}
]
},
"mcp_tool_call_provenance": {
"chatcmpl-tool-92096782361fe18b": {
"server_name": "workplace_assistant",
"tool_name": "email_reply_email"
}
},
"reward": 1.0
}The stored alias remained OpenClaw-facing, while the sidecar carried the canonical identity under the same Temporary rollout configworkplace_assistant:
resources_servers:
workplace_assistant:
entrypoint: app.py
domain: agent
verified: false
expose_tools_over_mcp: true
description: Temporary OpenClaw MCP handoff smoke test
workplace_assistant_openclaw_mcp:
responses_api_agents:
openclaw_agent:
entrypoint: app.py
resources_server:
type: resources_servers
name: workplace_assistant
model_server:
type: responses_api_models
name: policy_model
concurrency: 1
command: openclaw
model: ${policy_model_name}
workspace_root: outputs/issue-2670/workspaces
openclaw_agent_id: main
thinking: "off"
system_prompt: null
setup_timeout: 900
timeout: 900
extra_args: []
env: {}
openclaw_config: {}
context_window: null
max_output_tokens: null
openclaw_version: 2026.6.11
datasets:
- name: smoke
type: validation
jsonl_fpath: issue_2668_workplace_smoke.jsonl
license: Apache 2.0
|
Mark the intentional secret-redaction test values so detect-secrets does not treat them as credentials. Signed-off-by: Chris Wing <[email protected]>
|
/claude review |
|
SHIP — LGTM, no reliability concerns. Reviewed the full diff (README + What I verified against the correctness/async/API bars:
No BLOCKER/RISK/NOTE findings. |
Return provenance explicitly, remove the unused response side channel, and clarify OpenClaw-specific configuration translation without changing behavior. Signed-off-by: Chris Wing <[email protected]>
Adopt the centralized seed metadata contract and explicit execution result while preserving OpenClaw-native config and event parsing. Signed-off-by: Chris Wing <[email protected]>
|
/claude review |
|
SHIP — LGTM, no reliability concerns. Wires rollout-scoped Gym MCP into the OpenClaw agent following the same shared-infra pattern already merged for
|
## What does this PR do? README only. Tells OpenClaw users to set `context_window` to the model server's maximum context length, and explains how OpenClaw uses it and `max_output_tokens`. Follow-up to NVIDIA-NeMo#4476, which lets sandbox sessions use `max_output_tokens`; there is no issue. Why: when `context_window` is unset, OpenClaw assumes 200,000 tokens. On a server with a smaller limit, it keeps requesting its full output limit and does not compact in time, so long episodes can send requests the server rejects. Gym's `vllm_model` returns an empty reply, not an error, by default, and the run ends early. Example, worked out from the code and not measured in a run: released vLLM (up to 0.31) rejects a call when prompt + requested output > `max_model_len`. At 131,072 with no `context_window`, calls fail once the prompt passes 122,880 tokens (131,072 − 8,192 default), or 98,304 with `max_output_tokens: 32768` (131,072 − 32,768). With `context_window: 131072`, OpenClaw lowers each call's output to fit the room left by its estimate of the input; the estimate can undercount code or JSON. Unreleased vLLM main (vllm-project/vllm#57035) lowers the output instead of rejecting, but still rejects a prompt longer than `max_model_len`. The sandbox section now also says that the request field is rejected but the agent config field applies, and that a `max_output_tokens` above `context_window` is rejected (the check from NVIDIA-NeMo#4476). ## Validation - Read the OpenClaw npm package at 2026.6.11 (pinned in `configs/openclaw_agent.yaml`) and at 2026.6.35 (the pin in NVIDIA-NeMo#4082). Both match the README: - `contextWindow` defaults to 200,000 and `maxTokens` to min(8,192, `contextWindow`) (`dist/io-*.js`); - each call requests at most min(`maxTokens`, `contextWindow` − estimated input − 1), where the estimate is characters / 4 × 1.25. This applies to any base URL other than OpenAI's or Azure OpenAI's, which covers Gym's model server (`dist/openai-transport-stream-*.js`); - two in-run limits are computed from `contextWindow`. One is the context guard: once a run passes its limit, OpenClaw compacts and retries (`installToolResultContextGuard` in `dist/selection-*.js`). The other is the cap on each tool result's size (`resolveLiveToolResultMaxChars` in `dist/tool-result-truncation-*.js`). - Gym code on main: `_build_openclaw_config` writes `contextWindow` and `maxTokens` only when they are set, and `vllm_model` returns an empty `length` completion on a context-length error unless `propagate_context_overflow_errors` is true. - Open PRs touching OpenClaw: NVIDIA-NeMo#3902 and NVIDIA-NeMo#2733 edit this README, and NVIDIA-NeMo#4082 moves the pin to 2026.6.35. `git merge-tree` shows this PR adds no conflicts with any of them. - `pre-commit run --all-files`: passed. ## Rollouts N/A: README-only change, with no code or config changes. ## Compatibility and benchmark impact None from this PR. Following the advice can change rollouts with long episodes or long tool results, because `context_window` also sets when OpenClaw compacts and how much of a tool result it keeps. ## Checklist - [x] I have read the [contributing guidelines](https://github.com/NVIDIA-NeMo/Gym/blob/main/CONTRIBUTING.md). - [x] The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs. - [x] Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable). N/A: docs-only. - [x] Documentation added or updated, or N/A with justification. - [x] Pre-commit checks pass locally (`pre-commit run --all-files`) (so CI lint/format checks pass). - [x] New source files include the required Apache-2.0 SPDX header. N/A: no new files. - [x] All commits have DCO sign-off (`git commit -s`) (so the DCO check passes). Signed-off-by: Abhishree <[email protected]>
ffrujeri
left a comment
There was a problem hiding this comment.
Thanks for this, and sorry it sat so long. Main has moved on since August: OpenClaw now receives Gym MCP tools through agent-session MCPToolAccess grants (_granted_mcp_servers, #5551), and the direct /run path this PR changes is no longer the main OpenClaw path. This PR also builds on #2673, which hasn't merged, so nemo_gym.mcp and the provenance types don't exist on main. The piece still missing is per-call (server_name, tool_name) provenance; reverification still refuses MCP-exposed servers without it. Would it make sense to close this and re-land the mcpServer/mcpTool extraction on the session path once the provenance contract is settled (a rebased #2673 or a fresh PR)?
Summary
This PR lets OpenClaw discover and call rollout-scoped Gym resources-server tools while keeping each signed MCP token isolated to its own invocation.
Details
RolloutMCPServercontract from/seed_session, then translate it once into OpenClawmcp.serversconfigurationopenclaw.json, preserving unrelated static MCP servers and giving the rollout entry same-name precedenceAgentExecutionResult/AgentEpisodecontractCloses #2670
Test plan
pytest responses_api_agents/openclaw_agent/tests -q— 75 passed (including process-tree cleanup outside the sandbox)pre-commit run --files ...— passed2026.6.11andnvidia/nvidia/nemotron-3.5-lightningworkplace_assistant__email_reply_emailcall_id:chatcmpl-tool-b27ad536832c6461(workplace_assistant, email_reply_email)under that call IDStack
This PR is intentionally based on #2673 and now directly consumes its shared MCP handoff infrastructure. Retarget to
mainafter #2673 merges.