Skip to content

(MOT-4363) fix(harness): accept absolute workspace paths - #716

Merged
ytallo merged 1 commit into
mainfrom
fix/harness-shell-coder-path-evaluator
Aug 5, 2026
Merged

(MOT-4363) fix(harness): accept absolute workspace paths#716
ytallo merged 1 commit into
mainfrom
fix/harness-shell-coder-path-evaluator

Conversation

@ytallo

@ytallo ytallo commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • treat relative and absolute paths inside the scenario workspace as equivalent for exact Coder and host execution gates
  • reject parent traversal and paths outside the run-owned workspace
  • correlate matched Coder and host calls with their own results through function_call_id
  • add regression coverage for absolute paths, traversal, outside targets, and mismatched results

Why

The shell_coder_sandbox evaluator compared raw path strings with relative filenames. The DeepSeek V4 Flash daily execution completed the required file workflow with absolute in-workspace paths, but the evaluator reported a hard-gate failure despite the exact final file and successful outputs.

Impact

Valid workflows no longer fail solely because they use an absolute workspace path. A successful result from an unrelated invocation can no longer satisfy the affected Coder or host gate. The scenario prompt, score weights, threshold, and hard-gate policy remain unchanged.

Validation

  • cargo fmt --manifest-path harness/Cargo.toml --all -- --check
  • cargo test --locked --manifest-path harness/Cargo.toml -p harness-e2e (91 passed)
  • cargo clippy --locked --manifest-path harness/Cargo.toml -p harness-e2e -- -D warnings
  • confirmed all six affected calls in each retained failing run have a result with the same call ID and function ID

Fixes MOT-4363
Refs MOT-4279

Summary by CodeRabbit

  • Bug Fixes

    • Improved function-call result matching for more reliable operation tracking.
    • Added validation for relative and absolute workspace paths while rejecting unsafe traversal and unrelated targets.
    • Strengthened checks for successful batch operations, exact file reads, and non-timeout command output.
  • Tests

    • Expanded end-to-end coverage for path normalization, result correlation, and transcript handling.

@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
workers Ready Ready Preview Aug 5, 2026 5:18pm
workers-tech-spec Ready Ready Preview Aug 5, 2026 5:18pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The E2E harness now preserves transcript call IDs, matches results to individual invocations, normalizes workspace paths, and validates operation-specific outputs for coder and host execution scenarios.

Changes

Sandbox invocation validation

Layer / File(s) Summary
Invocation and result correlation
harness/tests/e2e/src/scenarios/common.rs
Adds invocation records with optional call IDs. Result lookup now matches call ID, function ID, and successful status.
Workspace-aware operation matching
harness/tests/e2e/src/scenarios/shell_coder_sandbox.rs
Operation checks accept equivalent relative and absolute workspace paths and reject traversal or unrelated paths.
Per-invocation result validation
harness/tests/e2e/src/scenarios/shell_coder_sandbox.rs
Coder and host checks validate each matching invocation result. Tests cover path handling, result correlation, batch success, exact reads, and command output.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Transcript
  participant function_invocations
  participant shell_coder_sandbox
  participant function_result
  Transcript->>function_invocations: Parse calls and call IDs
  function_invocations-->>shell_coder_sandbox: Return observed invocations
  shell_coder_sandbox->>shell_coder_sandbox: Normalize workspace paths
  shell_coder_sandbox->>function_result: Find result for matching invocation
  function_result->>Transcript: Match call ID and function ID
  Transcript-->>function_result: Return successful result
  function_result-->>shell_coder_sandbox: Return correlated result
  shell_coder_sandbox->>shell_coder_sandbox: Validate operation output
Loading

Possibly related PRs

  • iii-hq/workers#625: Adds related transcript call-ID tracking and correlated result validation.
  • iii-hq/workers#635: Introduces the shell_coder_sandbox scenario refined by this change.
  • iii-hq/workers#644: Modifies related sandbox transcript and result-correlation logic.

Suggested reviewers: andersonleal

Poem

A rabbit checks each call by name,
Then finds its matching result frame.
Paths stay within the workspace gate,
Reads and commands validate their state.
With IDs aligned, the tests now run—
Hop, hop, review work done!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the harness fix for accepting absolute workspace paths, which is the primary change in the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/harness-shell-coder-path-evaluator

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

skill-check — worker

0 verified, 54 skipped (no docs/).

Layer Result
structure
vale
ai
render

Four for four. Nicely done.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@harness/tests/e2e/src/scenarios/shell_coder_sandbox.rs`:
- Around line 426-429: Update the argument validation around
workspace_path_matches so FINAL_NAME must be the Python command’s actual script
argument, not merely any argument. Accept only the supported Python invocation
with exactly one script argument, and reject earlier script arguments and
python3 -c forms; add negative tests covering both cases.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5c81ee92-871c-45bc-94f6-2b7aa1a553ea

📥 Commits

Reviewing files that changed from the base of the PR and between 692ffda and b4364ed.

📒 Files selected for processing (2)
  • harness/tests/e2e/src/scenarios/common.rs
  • harness/tests/e2e/src/scenarios/shell_coder_sandbox.rs

Comment on lines +426 to +429
.is_some_and(|args| {
args.iter()
.any(|arg| workspace_path_matches(arg.as_str(), root, FINAL_NAME))
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Require the final file to be Python's script argument.

Line 426 accepts any argument that names FINAL_NAME. Therefore, python3 other.py /workspace/final_check.py or python3 -c "..." /workspace/final_check.py can pass this gate while Python does not execute the final file. Require exactly one script argument, or validate the exact supported Python command form.

Proposed fix
-        .is_some_and(|args| {
-            args.iter()
-                .any(|arg| workspace_path_matches(arg.as_str(), root, FINAL_NAME))
-        });
+        .is_some_and(|args| {
+            args.len() == 1 && workspace_path_matches(args[0].as_str(), root, FINAL_NAME)
+        });

Add negative tests for an earlier script argument and for python3 -c. This conflicts with the PR objective for an exact host execution gate.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.is_some_and(|args| {
args.iter()
.any(|arg| workspace_path_matches(arg.as_str(), root, FINAL_NAME))
});
.is_some_and(|args| {
args.len() == 1 && workspace_path_matches(args[0].as_str(), root, FINAL_NAME)
});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@harness/tests/e2e/src/scenarios/shell_coder_sandbox.rs` around lines 426 -
429, Update the argument validation around workspace_path_matches so FINAL_NAME
must be the Python command’s actual script argument, not merely any argument.
Accept only the supported Python invocation with exactly one script argument,
and reject earlier script arguments and python3 -c forms; add negative tests
covering both cases.

@ytallo
ytallo merged commit 96763b9 into main Aug 5, 2026
18 checks passed
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