Repository navigation
FEAT: program execution scorer (scorer phase 10b) - #3218
Open
WatchTree-19 wants to merge 6 commits into
Open
WatchTree-19 wants to merge 6 commits into
WatchTree-19 wants to merge 6 commits into
Conversation
Adds ProgramBehaves, ProgramExecutionScorable, ProgramExecutionSource, the SandboxClient protocol with a DockerSandboxClient, and ProgramExecutionScorer. The scorer sends the source only the runtime profile and invocations; expected results stay with the scorer. Program failure is observed evidence, a sandbox failure is undetermined, and a stored execution can be judged again without running the program.
- ProgramExecutionSource shares one in-flight run between concurrent callers of the same attempt and cancels it only when every caller has gone. - DockerSandboxClient reports an exit code only for an exited container; a client that exits while the container is still running is a sandbox error. - Docker management commands are killed and reaped on cancellation as well as on timeout. - A failed container removal is reported as a warning with the container name, kept in the observation metadata, and stops further cases. - The read-only program file is made writable before its directory is removed, so cleanup also works on Windows. - ContentEntryScorable is accepted as a program reference, so a saved score anchor can be scored again.
Contributor
Author
|
Thanks Roman, all six addressed in the latest commit, each with a regression test:
|
…ations - DockerSandboxClient uses one deadline for the whole invocation, including the attached client's exit. A client still running after its streams close is ended at the deadline, and the container's own state then decides the result, so a stalled client is neither unbounded nor mistaken for a program timeout. - ProgramExecutionSource waits for the sandbox's cleanup when the last caller of an attempt is cancelled, so cancellation still means the environment is gone. - Memory links a new observation whose ID is already stored when the stored row is identical, checked under the observation row locks; different evidence under the same ID is still rejected. ProgramExecutionScorer drops its separate pre-check, so concurrent scoring calls that share one acquisition both persist their scores.
Contributor
Author
|
Thanks Roman, all three are addressed in the latest commit.
|
…ork off the loop - DockerSandboxClient runs containers with --log-driver none, so the daemon keeps no copy of the output, and sets --entrypoint from the profile, so an image's own entrypoint never changes the command that runs. Building the run arguments and waiting on the attached client are now separate helpers. - Writing and removing the program directory runs in a worker thread; a cancelled caller waits for that work before its cancellation completes. - ProgramExecutionSource gives an attempt's reusable evidence an ID derived from the source and the attempt, and loads it from memory once the cache has let it go, so a stored attempt is never run again. Errors keep fresh IDs and are retried.
Contributor
Author
|
Thanks Rich, all five are in the latest commit.
|
Extract reusable execution clients from scoring and make shared execution data types private. Remove implicit execution reuse, obsolete helpers, and duplicate test scaffolding. Preserve exact source bytes, bounded output, and cancellation-safe cleanup. Validate Docker resource support, reject image-declared volumes, remove owned anonymous volumes, and protect submitted source with a private host workspace. Update scoring replay, scoped regressions, real Docker integration, and paired documentation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0bdf701a-5fa6-44c0-ba7e-82a5beb6722d
Richard Lundeen (richlundeen)
approved these changes
Oct 23, 2026
Keep the single-image Docker example as the only exception to caller-owned execution environments without expanding the framework section. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0bdf701a-5fa6-44c0-ba7e-82a5beb6722d
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds experimental program execution and behavior scoring, implementing phase 10b of the scorer design and roadmap. It checks what submitted code actually does for specified inputs, rather than judging a description of its behavior.
Reusable execution, separate from scoring
pyrit._code_executionprovides a small client contract for caller-configured execution backends. Targets, converters, dataset generators, and scorers can use it without importing scoring or memory. Its shared input and result types are private and experimental.Optional Docker adapter
Each invocation runs in a fresh container using a pre-pulled, digest-pinned image. The adapter disables networking and daemon logging, runs as a non-root user with capabilities dropped and privilege escalation disabled, mounts the program read-only, and applies memory, CPU, process, time, and output limits. It rejects backends that do not report the required resource support and images that declare volumes. Submitted source stays inside a private host workspace; cleanup handles cancellation and removes owned containers and anonymous volumes.
Stronger isolation can use the same client contract through a different caller-provided backend.
Scoring and replay
ProgramExecutionSourceresolves program references and captures evidence.ProgramExecutionScorerkeeps the expected results fromProgramBehavesseparate and compares them with that evidence. Every scoring call executes afresh; the saved observation identifies the run. Explicit replay evaluates saved output without another execution.All cases passing yields true; any proven case failure yields false. Infrastructure failures and insufficient evidence leave the verdict undetermined. Truncated output retains its uncertainty. Code is not extracted from surrounding prose, and existing scorer behavior is unchanged.