Skip to content

feat(cline): run Cline in task sandboxes through agent sessions - #5546

Merged
yaoyu-33 merged 22 commits into
mainfrom
claude/gymint-633-cline-sessions-0f4869
Nov 12, 2026
Merged

yaoyu-33 merged 22 commits into
mainfrom
claude/gymint-633-cline-sessions-0f4869

Conversation

@yaoyu-33

@yaoyu-33 yaoyu-33 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Cline now runs inside a borrowed or agent-owned task sandbox through Gym's seed → activation → close lifecycle. The adapter pins Cline 3.0.55, routes model calls through Gym's Model Server, and returns responses and observations for verification. No separate issue is needed for this focused adapter integration.

  • Seed installs or reuses the checksum-verified native binary; no Node installation is needed. Publication uses a bounded lock, with safe refusal when replacing a stale runtime without flock.
  • One supervised activation owns its model attempts through the rollout URL and x-session-id. Identical retries join it; conflicting requests are refused. Deadlines and rollout stops preserve partial work and cleanup evidence. Close releases a borrowed connection or stops an owned sandbox.
  • Session state is private while tools retain the task's environment. Observations include the invocation, tool timing, sandbox identity/outcome and available usage; malformed or missing usage remains unknown.
  • network_access: inherit preserves the provider policy. Opt-in model_only applies only to agent-owned OpenSandbox sandboxes: it allows the Model Server host and denies other egress. Unsupported providers, borrowed-policy changes, conflicting policies and unreachable model addresses are refused. Restricted installation verifies the pinned archive on the Agent Server and uploads the binary, so it needs no registry access inside the sandbox. The image must already provide Bash, glibc and coreutils.

Compatibility and limits

configs/cline_agent.yaml selects sessions; existing host callers use configs/cline_local_agent.yaml. Host /run and sessionless Responses remain available with lazy CLI installation. All entry paths reject non-null request max_output_tokens with HTTP 422 before starting work or binding an activation; remove it from task rows and configure a per-call limit on the Model Server. Session sampling fields remain unsupported.

This is Evaluation-level support, without token IDs/logprobs or external tool grants. Network policy is host-wide, including every port and co-hosted service. Actual OpenSandbox enforcement and a restricted end-to-end model rollout have not been tested. Host usage retains its documented cache-counting limitation. No benchmark support declaration or full benchmark score is added.

Validation

  • Final source: c472ac854; all 9 changed-file hashes match the workstation sources, and the commit has DCO sign-off.
  • Linux component suite: python -m pytest responses_api_agents/cline_agent/tests -q -o addopts= — 195 passed. Includes policy admission, offline integrity/publication/reuse, cancellation, setup cleanup, and host/session budget refusal.
  • pre-commit run --files <changed paths> — passed on the Linux workstation; no full-repository pre-commit claim.
  • Real-model rollout: one unchanged Reasoning Gym example, NIM nvidia/nemotron-3.5-super-vl-120b-a12b, agent-owned Docker debian:bookworm-slim, temperature 0, top_p 1, Model Server max_tokens 4096, thinking disabled, 180-second activation budget. Response completed, reward 0.0, unmasked, no failure outcome. Verifier output was inspected; all task process groups and containers were removed. This one-row smoke checks runtime and verification behavior, not benchmark qualification.
  • Cold install/reuse in Docker with network=none: passed: real Cline 3.0.55 installed in a cold debian:bookworm-slim container with networking disabled, then reused without another download; no container remained. This checks offline bootstrap, not OpenSandbox policy enforcement.

Targeted regression controls: 9 tests fail against the pre-fix production sources and pass in the full fixed-source suite above.

CI repair — November 10

The URL-resolution test checked its output before the service necessarily wrote it. Gate its healthcheck on nonempty output and poll within a bounded startup window.

Validated on the Linux workstation at 458278844e445b007679cdc18d45cb5ba8389850: 151 Compose tests passed; delayed-start control fails on the previous test and passes on the fix. Full pre-commit run --all-files passed using Python 3.13 hook environments. Model rollout: N/A, test-only change; production behavior is unchanged.

Follow-up merge of main preserves the Cline migration parameter cases in the new split migration test files. All original test bodies and parameters were compared before/after the move. Workstation validation of the exact merged tree: 183 migration and scheduling tests passed; full pre-commit run --all-files passed using Python 3.13 hook environments. Model rollout: N/A for this test-layout conflict resolution.

Merge-queue conflict repair — November 10

At 29f5db01be4289a1259f3f2186ad1a8378601ae2, merge main at d4c8702a6d6e4c32d4438ce5c1f670eb7d660e07 and keep both the Cline and merged Copilot harness catalog rows. The Cline adapter source is unchanged by the resolution.

Validation on the Linux workstation against the exact merged tree: 195 Cline component tests passed; all 4 Cline migration cases passed; full pre-commit run --all-files passed with Python 3.13 hook environments; Fern validation reported 0 errors and 1 warning. Model rollout: N/A for this merge/catalog conflict resolution. No separate issue is needed.

Main integration validation (2026-11-10)

Merged main a5cc1105564f38d7c7be5c86da5892f740d596e2, preserving sandbox sessions and lazy host installation while adopting main's worker-entrypoint guard. Lazy host installs now use the shared cross-process installation lock and record, and waiting workers recover the locally provisioned Node path as well as Cline's npm-prefix path.

Validation on workstation ws:

  • gym env test +entrypoint=responses_api_agents/cline_agent: 197 passed.
  • pytest tests/unit_tests/utils/test_install_lock.py tests/unit_tests/utils/test_server_process.py -q: 8 passed.
  • pytest tests/unit_tests/tooling/test_agent_environment_default_configs.py tests/unit_tests/tooling/test_agent_environment_session_templates.py -k cline -q: 4 passed.
  • Real cold-install probe: two simultaneous workers, no system Node/npm, separate task-owned local Node and npm-global directories. Both launched Cline 3.0.55, with exactly one npm install. Before the Node-path fix, this same probe required two installs.
  • pre-commit run --all-files: passed.

The new two-process regression covers both system npm and locally provisioned Node with a separate global npm directory. No new model rollout was needed for installer coordination and worker startup; earlier sandbox-session model smoke remains historical evidence, and the host installation path was exercised directly above.

Completed CI for the previous repair

Source 0d6ea6cf3e512d519d19b73f8aeed5f35d6ecda1: CICD NeMo Gym and release rehearsal passed. Lint and DCO also passed.

Documentation integration repair — November 11

Source 6856057744fc346f9f139b98b0e18ccf8b7148ca integrates main 65aca7b6b7383d5070a26e45ec54d3c3a7411269. Retain the Cline row alongside main's corrected OpenClaw token-capture wording, all other corrected capture notes, and Goose. Cline runtime, installer, tests, and dependency lock are unchanged from the preceding PR head. No separate issue is needed for this focused conflict repair.

Exact-tree Linux workstation validation:

  • python -m pytest responses_api_agents/cline_agent/tests -q -o addopts= — 197 passed.
  • python -m pytest tests/unit_tests/utils/test_install_lock.py tests/unit_tests/utils/test_server_process.py -q -o addopts= — 8 passed.
  • python -m pytest tests/unit_tests/config/test_global_config.py::TestComposeUnboundAgent::test_agent_session_agent_types_match_the_agent_apps -q -o addopts= — 1 passed.
  • python -m pytest tests/unit_tests/tooling/test_agent_environment_default_configs.py tests/unit_tests/tooling/test_agent_environment_session_templates.py -k 'cline or goose' -q -o addopts= — 6 passed.
  • python tests/unit_tests/test_fern_docs_links.py — 29 passed.
  • pre-commit run --all-files — passed.
  • cd fern && npm run check — zero errors; authenticated missing-redirect check skipped because no Fern credential was available. No redirects changed.

Independent source review found no blockers. New model rollout: N/A for this documentation conflict resolution; prior installer/model evidence above remains pinned to its original revisions. Fresh CI was requested for the exact new source; see current checks.

Completed CI at 6856057744fc346f9f139b98b0e18ccf8b7148ca: CICD NeMo Gym and release rehearsal passed. Lint and DCO passed.

Main integration validation (2026-11-12)

Source ed6d11407e481675c4fd8e3ca859d188dac62d97 merges main 5d22439f4b4d84eaf7ef3d08e9dff1527f775d92. The only manual conflict was the release workflow, which now matches main’s #6066 previous-tag lookup, explicit override, job dependency, and template pin. Prior feature changes remain intact; no lockfile regeneration was needed.

Workstation validation on the reviewed tree:

  • pre-commit run --all-files: passed; no tracked files changed.
  • Parsed the workflow and checked previous-tag/output/dependency/template wiring; bash -n passed for both embedded shell blocks.

Independent source review passed. New model smoke: N/A for this workflow-only conflict resolution; prior feature and model evidence remains pinned to the revisions recorded above.

CI requested for this exact source: Build, validate, and release NeMo-Gym, CICD NeMo Gym. Current CI status is available in the linked runs.

Conflict repair — November 12, 2026

Source f1a7756f5e93a5baa3e13d7607a6d7f3ee23d72b merges main b2a27913e248fe4c7e9a975e7df6b2fbe18aa3fb. Preserve both Cline and OpenHands rows in the harness tables and include main's secrets-baseline repair from #6083. The Cline adapter files are unchanged from the preceding PR head; all current main catalog rows are retained. No separate issue is needed for this focused conflict resolution.

Exact-tree validation on Linux workstation ws:

  • python -m pytest responses_api_agents/cline_agent/tests -q -o addopts= -o log_cli=false: 197 passed.
  • python -m pytest tests/unit_tests/config/test_global_config.py tests/unit_tests/tooling/test_agent_environment_default_configs.py tests/unit_tests/tooling/test_agent_environment_session_templates.py tests/unit_tests/test_fern_docs_links.py -q -o addopts= -o log_cli=false: 326 passed, 24 subtests passed.
  • pre-commit run --all-files: passed with Python 3.13 hook environments; no tracked changes.
  • detect-secrets-hook --baseline .github/workflows/config/.secrets.baseline <all PR-changed files>: passed with detect-secrets 1.5.0.
  • uv lock --check --project responses_api_agents/cline_agent: passed with uv 0.13.4.
  • cd fern && npm run check: zero errors; the missing-redirect check was skipped because no Fern credential was available. No redirects changed.

Model rollout: N/A for this documentation conflict resolution and inherited baseline fix. Fresh CI requested for the exact new source.

yaoyu-33 and others added 2 commits November 3, 2026 13:41
Give cline_agent the agent-session lifecycle the merged sandboxed peers have.
Seed connects to the borrowed task sandbox (or starts an agent-owned one when
sandbox_provider is set) and installs the pinned Cline 3.0.55 there: its
self-contained glibc binary from @cline/cli-linux-{x64,arm64}, checked against
a SHA-512 the adapter pins, so the sandbox needs no Node. Activation writes
Cline's provider settings (rollout-prefixed Model Server URL, x-session-id
header) and runs it under the shared process supervisor; close stops it
before verification and returns an observation bundle.

The host /run and sessionless /v1/responses path is unchanged, except that it
now installs Cline on first use instead of at server startup.
configs/cline_agent.yaml becomes the session config; the host config moves to
configs/cline_local_agent.yaml with the same agent key.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33 yaoyu-33 added feature New capabilities, enhancements, or enablement work area:agent Agent harnesses and Responses API agent behavior labels Nov 3, 2026
@copy-pr-bot

copy-pr-bot Bot commented Nov 3, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@yaoyu-33

yaoyu-33 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test c7b36e2

The secrets detector reads the SHA-512 digests of the pinned npm tarballs as
high-entropy strings. They are public npm integrity values, not credentials.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33

yaoyu-33 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test d533de1

…ne-sessions-0f4869

Signed-off-by: yaoyu-33 <[email protected]>

# Conflicts:
#	responses_api_agents/cline_agent/requirements.txt
@yaoyu-33

yaoyu-33 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 98ed914

yaoyu-33 and others added 2 commits November 4, 2026 21:06
Review follow-ups for the Cline agent-session adapter:

- A rollout stop that lands before launch, or before the runner opens
  Cline's output, now yields an empty transcript graded as a stop instead
  of failing the activation.
- An agent-owned sandbox gets a TTL (installation + run + 10 minutes,
  unless sandbox_config sets one) and the provider's default metadata plus
  gym-agent, gym-session and gym-rollout labels.
- The activation status comes from Cline's final run_result only; a done
  event without one is a crash, not a completed run.
- "Model returned empty response" is classified as agent_invalid_output.
- A developer message counts as the system message, metadata={} is
  accepted, and the argv limit applies to the padded prompt.
- cline_agent.yaml sets concurrency: 32; cline_local_agent.yaml gets the
  SPDX header.
- README: the Terminal-Bench 2.1 recipe is the unsupported development
  pairing the smoke runs used; document Cline's checkpoint refs, what
  stays in the sandbox after close, the host path's prompt, concurrency,
  timed-out usage and the 300 s request limit. List Cline in the harness
  docs' Tools and Sandboxed harnesses tables.
- Tests: real staging, runner and capture with a detached stdout holder,
  rollout stops before and after launch, a closing session's 409, the
  owned-sandbox spec, and more seed refusals.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Cline 3.0.55 does not bound a --json run with --timeout; the subprocess
deadline ends the host run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33

yaoyu-33 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 0fb78fd

@yaoyu-33 yaoyu-33 added needs-review PR is ready for code review and waiting on a reviewer and removed ready-to-merge PR is approved, current, and waiting for final CI or merge labels Nov 10, 2026
adil-a
adil-a previously approved these changes Nov 10, 2026
@yaoyu-33
yaoyu-33 added this pull request to the merge queue Nov 10, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 10, 2026
@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test 29f5db0

@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test 2fc42d6

@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test 0d6ea6c

Keep main's corrected OpenClaw token_id_capture note alongside the Cline
harness row. Preserve the existing Cline runtime, process-shared installer,
recorded installation, and local Node PATH restoration unchanged.

Linux workstation validation passed: 197 Cline tests, eight installer and
worker tests, one registry contract, six migration cases, 29 documentation
link tests, and full pre-commit. Fern check reported zero errors and one
warning because its authenticated redirect check was unavailable.

Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test 6856057

@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test ed6d114

@giuliolovisotto giuliolovisotto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at ed6d11407e481675c4fd8e3ca859d188dac62d97. The earlier fixes remain intact. The added host-install coordination holds the shared lock across version checking and installation, and waiting workers recover both the Cline and locally provisioned Node paths. The worker-entrypoint change follows the shared startup guard. No blocking findings.

Fresh validation: 185 Cline tests passed, 12 Linux-only installer tests skipped on macOS; all 8 shared install-lock and worker-entrypoint tests passed. No new native model rollout or CI run.

— @codex

@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test f1a7756

@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/43320348558

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Agent harnesses and Responses API agent behavior feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants