Skip to content

feat(dispatch): add owned sandbox runner adapter - #44

Merged
JustinJLeopard merged 1 commit into
demo-buildfrom
desktop-codex/justai-owned-sandbox-runner-20260810
Aug 10, 2026
Merged

feat(dispatch): add owned sandbox runner adapter#44
JustinJLeopard merged 1 commit into
demo-buildfrom
desktop-codex/justai-owned-sandbox-runner-20260810

Conversation

@JustinJLeopard

Copy link
Copy Markdown
Owner

Summary

  • adds a concrete JustAi-owned runner over the existing Bubblewrap local executor
  • preserves action and verification evidence, including explicit bounded tail truncation
  • keeps local task completion honest: only executed-and-verified work is done

Verification

  • PYTHONDONTWRITEBYTECODE=1 pytest -q -p no:cacheprovider
    • 573 passed, 14 subtests passed
  • independent read-only review: PASS after targeted evidence-tail regressions

Boundary

Source-only candidate. No runtime installation, listener, model service, deployment, or readiness claim is included; productive execution remains separately gated.

Copilot AI lite review requested due to automatic review settings August 10, 2026 07:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a concrete, JustAi-owned AgentRunner implementation over the existing Bubblewrap local executor, producing structured run evidence (actions/results/transcript) with explicit bounded observation truncation, while keeping “task done” dependent on both execution and verification.

Changes:

  • Introduces JustAiSandboxRunner plus Chunk-based local execution plumbing (_chunk_for_task, _perform_chunk_action, _verify_chunk, transcript writer).
  • Preserves “honest completion” semantics in _execute_single_local by mapping runner evidence to Task status without inferring completion.
  • Expands/adjusts tests to validate policy gating, evidence/action recording, and bounded tail preservation.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
justai/agent_dispatch.py Adds owned sandbox runner adapter, structured evidence recording, and Chunk-based execution/verification helpers.
tests/test_local_execution.py Adds owned-runner behavior tests (policy gating, evidence budgets, transcript/tail behavior) and transcript cleanup.
tests/test_executor_routing.py Updates routing tests to the new action/verification result shapes (_run_local_command_result, _verify_chunk).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread justai/agent_dispatch.py
Comment on lines +969 to +987
run = _LocalRunResult(
chunk=chunk,
success=success,
steps_used=1 if execution.action is not None else 0,
final_diff="",
transcript_path="",
failure_class=failure_class,
latency_seconds=time.monotonic() - started_at,
actions=actions,
results=results,
execution_outcome=execution.outcome,
execution_detail=_bounded_observation_value(
execution.detail, observation_limit, tail=True
),
verification_passed=verification.passed,
verification_detail=_bounded_observation_value(
verification.detail, observation_limit, tail=True
),
)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 770824dc13

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread justai/agent_dispatch.py
Comment on lines 758 to +762
if _is_catastrophic(command):
return "blocked", f"refused catastrophic command: {command[:120]}"
return _ActionExecution(
"blocked", f"refused catastrophic command: {command[:120]}"
)
action_record = ActionRecord.create("bash", {"command": command})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Record blocked commands in action evidence

When the model emits a catastrophic command such as rm -rf /, this early return occurs before the ActionRecord is created. The resulting safety-violation run therefore omits the blocked attempt from actions and results—and may show only the subsequently executed verifier—so typed audit evidence cannot identify or correlate the action that caused the violation. Create the action record before applying the guard and attach a failed result for blocked commands.

Useful? React with 👍 / 👎.

Comment thread justai/agent_dispatch.py Outdated
# Retain the failed verifier's raw tail until the runner renders the
# Chunk-bounded observation. A head slice here would hide the terminal
# diagnostic and make the later tail policy misleading.
return _Verification(False, f"exit {result.returncode}: {result.stderr}", "fail", True)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep verifier exit codes in the bounded tail

When a failed verifier emits more stderr than the observation budget, the later tail truncation removes the exit <code>: prefix, leaving only the stderr suffix and a generic fail status. Consequently, the returned result and transcript lose the verifier's numeric exit code precisely for noisy failures; append the exit code after stderr, as the action executor does, so structured-tail truncation preserves it.

Useful? React with 👍 / 👎.

@JustinJLeopard
JustinJLeopard force-pushed the desktop-codex/justai-owned-sandbox-runner-20260810 branch from 770824d to 07b58d3 Compare August 10, 2026 07:16
@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
justai-demo Ready Ready Preview Aug 10, 2026 1:11pm

Request Review

@JustinJLeopard

Copy link
Copy Markdown
Owner Author

Independent review from Cowork — PASS on design, CHANGES-NEEDED before merge (rebase + one conflict to reconcile).

The adapter itself reads well: it builds on the current boundary work, keeps _task_workdir() inside the try in _verify_chunk (so SandboxUnavailable still becomes a verification failure rather than escaping), preserves fail-closed on an unavailable sandbox, and keeps the honest three-state. Retaining the raw tail until the Chunk policy renders it is the right call — pre-slicing would hide the terminal diagnostic.

Blocking: the branch is 7 commits behind demo-build (base d768a74, now 9cd7d02), and merging as-is silently reverts two fixes. Verified first-hand by running the current regression file against your head 07b58d3:

FAILED test_verify_failure_outside_the_workdir_names_the_boundary
FAILED test_readonly_system_paths_are_not_reported_as_unreachable
2 failed, 590 passed
  1. fix(dispatch): explain verification failures caused by the sandbox boundary #46 boundary legibility, dropped. _verify_chunk returns f"exit {rc}: {result.stderr}"; _outside_workdir_paths is called only on the execution side (line ~773), not in verification. A criterion naming a path the sandbox cannot reach can never pass, and it goes back to a bare exit 1: with empty stderr — the operator debugs a phantom missing file. fix(dispatch): explain verification failures caused by the sandbox boundary #46 also falls back to stdout when stderr is empty (that exit 1: carried nothing) and leads with the note, because callers truncate the detail to ~150 chars and a trailing note is the first thing dropped.

  2. fix(dispatch): explain verification failures caused by the sandbox boundary #46's follow-up, also dropped. Your _outside_workdir_paths predates the fix that excludes the read-only system roots the sandbox actually binds, so it reports /usr/bin/python3 as "not visible" and blames the boundary for ordinary command failures. That one bites your execution-side hint too.

Suggested reconciliation (the conflict is only in _verify_task's old return path): rebase onto 9cd7d02 and keep #46's semantics inside your bounded-tail rendering — compute the note from _outside_workdir_paths(criteria, workdir), put it in front of exit {rc}: …, and take the current _outside_workdir_paths/_verify_task bodies from demo-build wholesale rather than merging line-by-line.

Then re-run: current demo-build is at 612 passed + 14 subtests (your run of 573 predates #46/#47/#48/#49/#50/#51). Your lane, so I have not touched the branch.

@JustinJLeopard
JustinJLeopard force-pushed the desktop-codex/justai-owned-sandbox-runner-20260810 branch from 07b58d3 to caefe5f Compare August 10, 2026 13:11
@JustinJLeopard
JustinJLeopard merged commit 9c4621c into demo-build Aug 10, 2026
2 checks passed
@JustinJLeopard
JustinJLeopard deleted the desktop-codex/justai-owned-sandbox-runner-20260810 branch August 10, 2026 13:12
@JustinJLeopard

Copy link
Copy Markdown
Owner Author

Re-review of the rebased head — PASS. Clean, green, and mergeable; merge when you're ready.

Head caefe5f · merge-base is now 9cd7d02 (0 behind) · merges into demo-build with 0 conflicts.

Both regressions I proved against the old head are gone, and you reconciled the semantics rather than silencing the tests:

  • tests/test_task_workdir_regression.py 15/15 pass (was 2 failed).
  • Verification names the boundary again, and the note leads the detail so caller truncation can't drop it. Live check: [sandbox: verification only sees /tmp/…; not visible: /tmp/not-visible-xyz.txt] exit 1:
  • The stdout fallback for empty stderr is preserved.
  • _outside_workdir_paths keeps the read-only-roots exclusion (_RO_SYSTEM_PATHS imported and used). Live check: /usr/bin/python3 -m pytest[], so no false boundary blame.

Full suite at your head: 621 passed + 14 subtests (demo-build is 612 + 14; your 9 new tests account for the delta).

Design points I'd keep as-is: _task_workdir() stays inside the try in _verify_chunk, so an unavailable sandbox becomes a verification failure rather than an exception escaping to a (bool, str) caller; retaining the raw tail until the Chunk policy renders it is right.

Your source atom, so I'm not merging it. No further review needed from me unless the head moves again.

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.

2 participants