Skip to content

fix(verifiers): run_container_unit_tests_verifier reads its result files in the container, refusing a link - #932

Merged
earakely-scale merged 12 commits into
mainfrom
edgararakelyan/stop-agent-step
Nov 27, 2026
Merged

earakely-scale merged 12 commits into
mainfrom
edgararakelyan/stop-agent-step

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

What

run_container_unit_tests_verifier reads its result files inside the container, as root, and refuses a link or anything that isn't a regular file. A refused file is recorded as unread (None), as an unreadable one already was.

Before, it copied each result file to the sandbox's host with docker cp and read the copy there with cat. docker cp copies a link as a link, so a link the agent planted at a result path was followed on the host. A host file could end up in the run's record.

A stale reward file the agent wrote is a different case, already handled: the verifier clears reward_path before the tests, so a test command that exits without writing a reward scores 0.

Verified

  • New integration test: tst/integration/task_step/test_run_container_result_files_local.py runs the verifier against a real Debian container on a local sandbox.
    • A regular result file is read as it is.
    • A link at a result path, pointing at a file on the sandbox's host that holds a secret, comes back None.
    • With the old verifier swapped in, the same test fails: the link came back holding the host file's secret.
  • Unit tests: the verifier's fake sandboxes now answer the in-container read instead of docker cp. A local-sandbox test checks that the read runs in the sandbox's own container.

Also: a flaky page-driver test

test_a_start_that_never_listens_is_stopped_and_the_next_call_starts_afresh failed once on this PR's CodeBuild run, unrelated to it.

  • Cause: its stand-in for Playwright MCP imports mcp before writing the marker the test reads. On a busy runner, that import outlasted the test's 2 s start window, so the driver stopped the stand-in before the marker existed.
  • Fix: the silent-once and wedged-once stand-ins now write their marker before the import.
  • Check: the driver tests pass three times in a row under parallel load.

History

This PR first added a stop_agent step, which ended what an agent left running before a verifier read its container, and a lint warning for verifiers without one. Both are left out for now.

From outside the agent, the step could pick out the agent's processes only with a shell script and guesses: the server by its port, its user, its start time. The agent protocol has no call for ending them yet, and its existing calls can't do it: a run learns a turn's A2A task id only once the turn has ended. Ending leftovers waits for such a call.

🤖 Generated with Claude Code

Confidence Score: 5/5 · The PR appears safe to merge; no actionable issues were found.RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable issues were found.

Summary

run_container_unit_tests_verifier now reads result files inside the container as root instead of copying them onto the host.

  • The container verifier reads result files inside the container and refuses links.
  • The page-driver test stand-in writes its startup marker before importing mcp.

No new actionable issues were found. The earlier threads concern the removed stop_agent step and lint warning. earakely-scale deferred those features until the agent protocol supports stopping leftover processes.

Reviews (15) · Last reviewed commit: "refactor: leave stop_agent and its lint ..." · Reviewed by Greptile

earakely-scale and others added 2 commits November 25, 2026 14:52
…e steps that read its container, and lint warns of a verifier without one

stop_agent cancels the A2A tasks of an agent's turns, ends the processes it started where it works (those of its
server's user that started after the server, found by its A2A port, and descend from it or were orphaned), and
removes clear_paths, recording each in metadata["stop_agent"]. Its server, and whatever ran before it, keep running.
task lint warns of a run_container_unit_tests_verifier on a container an agent was installed into, or a
verify_sandbox on an agent's own, with no stop_agent for that agent before it.

run_container_unit_tests_verifier reads its result files in the container, refusing a link or anything but a regular
file, in place of a docker cp read on the sandbox's host, which followed a link the agent planted there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…et's user, and runs its scripts on the system's PATH

Root in a container without CAP_SYS_PTRACE reads only its own user's descriptors, so the Claude Code image's server,
which runs as agent under root's supervisord, was not found.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale requested a review from a team as a code owner November 25, 2026 22:59
Comment thread src/agent_env/task/lint.py Resolved
earakely-scale and others added 2 commits November 25, 2026 15:08
…ntainer, lint checks each installed agent, and its limits are named

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…in its container

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
earakely-scale and others added 3 commits November 25, 2026 15:13
…he other agents' it looks up

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…marker before importing mcp

The import outlasted a test's 2 s start window on a busy runner, so the start was stopped before the marker existed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
earakely-scale and others added 5 commits November 25, 2026 20:07
…ails when a scan of the processes fails

A process name may hold a newline, which split the record, ended the scan's subshell, and read as no process left.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ver by its arguments

A command line is what the shell expanded, so it can hold a secret such as the agent's model key, and the report goes
into the run's context.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, with no clear_paths or cancel

The verifier already clears its reward_path before the tests, and a cancel almost always found a finished turn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ontainer result read and the page-driver test fix

stop_agent would end an agent's leftover processes only with a shell script's guesses from outside the agent, and the
protocol has no call for it yet. Ending leftovers waits for one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale earakely-scale changed the title feat(task_step): stop_agent ends what an agent left running before a verifier reads its container, and lint warns of one without it fix(verifiers): run_container_unit_tests_verifier reads its result files in the container, refusing a link Nov 27, 2026
@earakely-scale
earakely-scale merged commit 505637b into main Nov 27, 2026
37 checks passed
@earakely-scale
earakely-scale deleted the edgararakelyan/stop-agent-step branch November 27, 2026 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant