agora.plan.run_check

run_check postcondition predicate — execute a command, gate on its result.

Integration run 1 (docs/design/project-phases.md) needs one mechanism that covers phases 5/6/7: run a command in the task workspace and assert its exit code (and optionally that its stdout contains a string). This is the test- and acceptance-execution gate the axis-1 probe never had.

Design constraints:
  • argv only, no shell — shell=False, cmd is a literal argv list. That is the network guarantee for run 1: no shell means no $(...) / pipes / redirects, and we assert no resolver use by simply never handing the command to a shell. OS-level network isolation is out of scope here.

  • cwd pinned under the workspace — cwd is workspace-relative and may not escape work_dir.

  • bounded capture — stdout and stderr are each truncated to 4 KB and the truncation is flagged, then appended to ctx["run_check_sink"] so the (watchlisted, length-prone) pytest output reaches the task record.

Registered via the standard @register_predicate decorator; imported by the registry at its module bottom, exactly like probe_predicates.

Findings: the bounded capture keeps the informative tail of a failure so the repair oracle isn’t starved (F11 — head+tail, not head-only). This same predicate is the round-trip target of a handoff Verification record: F20 serializes each gate as a COMPLETE run_check spec (cmd + stdin + expectation) precisely so a future phase-0 re-validation can feed it straight back into build_predicate("run_check", spec) and re-execute it verbatim.

Functions

postcond_run_check(cmd[, cwd, timeout_s, ...])

Run cmd (argv, no shell) under work_dir/cwd and gate on its result.

agora.plan.run_check.postcond_run_check(cmd, cwd='.', timeout_s=30.0, expect_exit=0, expect_stdout_contains='', stdin='')[source]

Run cmd (argv, no shell) under work_dir/cwd and gate on its result.

Passes iff the process exits within timeout_s with code expect_exit and — when expect_stdout_contains is non-empty — its stdout contains that substring. stdin (when non-empty) is fed to the process’s standard input, so a headless acceptance check (!ping → pong) needs no shell pipe. Fails closed on a missing/invalid cwd, a non-list cmd, a timeout, an exit-code mismatch, or a stdout miss. Every invocation records a capture dict into ctx["run_check_sink"] when present.