Skip to content

Fix/repo run task json link escape - #1611

Open
sazid63 wants to merge 24 commits into
intel:mainfrom
sazid63:fix/repo-run-task-json-link-escape
Open

sazid63 wants to merge 24 commits into
intel:mainfrom
sazid63:fix/repo-run-task-json-link-escape

Conversation

@sazid63

@sazid63 sazid63 commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Prevent repo run from reading task JSON through symlinks that escape the source repository or the relocated eval directory.

Changes

  • Check task paths through ordinary task entries and internal directory aliases before export.
  • Recheck task JSON targets in the exported eval tree before loading them.
  • Add regression tests, contract documentation, and a Security changelog fragment.

Risk

Only escaping or unresolvable task paths are newly refused. No artifact schema or persisted format changes.

Testing

  • Focused tests: 170 passed, 5 skipped.
  • Ruff, mypy, schema validation, and local static checks passed.
  • Mutation check: 17 killed, 1 equivalent mutant waived, 0 survivors.
  • The full local suite stopped at test_blob_less_clone_reads_manifests_in_few_requests: its local filtered clone had no HEAD (2022 passed, 19 skipped before failure).
  • Local schema-compatibility check reports five schema changes outside this PR; this PR does not modify schemas.

Open questions

None.

Revert

Revert the PR commits; no stored data or schema migration needs undoing.

Checklist

  • Focused tests added and passing
  • Ruff and mypy pass
  • Docs updated
  • Self-reviewed
  • New error paths and tests trace to contract §3
  • No ad-hoc artifacts committed
  • New files have SPDX headers
  • DCO sign-offs are resolved on all PR commits

@sazid63
sazid63 requested a review from a team as a code owner December 4, 2026 14:49
Copilot AI balanced review requested due to automatic review settings December 4, 2026 14:49

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@exai-bot

exai-bot commented Dec 4, 2026 •

Copy link
Copy Markdown

OpenCodeReview: Commit 0fbb7d2 was not reviewed. This PR has reached its review limit (6 reviews).

CI at 0fbb7d2: 2 passing.

To review this commit: re-request review from exai-bot in the Reviewers list.

Last review (420d2e2): no findings

Open threads from the bot: 0

Comment thread dokimi/dokimi/commands/repo_run.py Outdated
Comment on lines +144 to +145
if rel != tasks and not rel.startswith(f"{tasks}/"):
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

security · should fix
Validate task files reachable through internal directory aliases.

Trigger: .agent-eval/tasks/t1 -> ../shared, with .agent-eval/shared/task.json linking to an external host JSON file.

Evidence: WorkTree.files() and GitTree.files() list tasks/t1 without its descendants. Resolving that entry with dirs=True succeeds, while this filter skips shared/task.json. Export preserves both links, and load_tasks() discovers tasks/t1/task.json through the directory alias and reads its external target.

Impact: external JSON bypasses the new refusal and can enter cell artifacts when it has valid task keys.

Workaround: replace directory aliases with ordinary task directories.

Should fix: A run shows it, and the code before this change fails the same way.

Shown by running: exit 1 (at the head) · exit 1 (at the merge base) · exit 0 (at the head with the fix)

python -m pytest -q -p no:randomly -p no:cacheprovider tests/test_proof_c2.py

What the proof does: Runs repo run on a repo where tasks/t1 links to ../shared, whose task.json links outside the repo, and asserts exit 2 with path escapes the repository.

The problem shows as the output DIR_ALIAS_NOT_REFUSED.

Script: dokimi/tests/test_proof_c2.py (46 lines).

        out = run.stdout + run.stderr
>       assert 'path escapes the repository' in out and run.returncode == 2, 'DIR_ALIAS_NOT_REFUSED ' + out
E       AssertionError: DIR_ALIAS_NOT_REFUSED ✗ .agent-eval/tasks/t1/task.json: missing or empty required key 'family'; missing or empty required key 'prompt'
E         
E       assert ('path escapes the repository' in "✗ .agent-eval/tasks/t1/task.json: missing or empty required key 'family'; missing or empty required key 'prompt'\n")

tests/test_proof_c2.py:46: AssertionError
=========================== short test summary info ============================
FAILED tests/test_proof_c2.py::test_dir_alias_to_external_task_is_refused - A...
1 failed in 1.18s

Comment thread dokimi/dokimi/commands/repo_run.py Outdated
if rel != tasks and not rel.startswith(f"{tasks}/"):
continue
try:
tree.resolve(rel, dirs=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.

security · should fix
Validate containment after relocation, not only in the source tree.

Trigger: use eval_dir: a/b/c/d, tasks: a/b/c/d/tasks, and tasks/t1/task.json -> ../../../../../../outside.json, with a tracked outside.json at the repository root.

Evidence: both WorkTree and GitTree resolve this inside the repository, so this check accepts it; _export() preserves the link and moves the eval directory. With --out-dir /tmp/demo/b --name run, the exported link instead targets /tmp/demo/outside.json. _require_grade() immediately calls load_tasks(), whose read_text() follows that link without containment validation.

Impact: host-local JSON is read and, if it has valid task keys, can be persisted through runner.py's task.raw writer.

Workaround: use regular task files or links contained within the exported eval directory.

Should fix: A run shows it, and the code before this change fails the same way.

Shown by running: exit 1 (at the head) · exit 1 (at the merge base) · exit 0 (at the head with the fix)

python -m pytest -q -p no:randomly -p no:cacheprovider tests/test_proof_c1.py

What the proof does: Runs repo run on a repo with a relative task.json link that stays inside the repo but leaves the relocated eval_dir, and asserts exit 2 with path escapes the repository.

The problem shows as the output RELOCATED_LINK_NOT_REFUSED.

Script: dokimi/tests/test_proof_c1.py (44 lines).

        out = run.stdout + run.stderr
>       assert 'path escapes the repository' in out and run.returncode == 2, 'RELOCATED_LINK_NOT_REFUSED ' + out
E       AssertionError: RELOCATED_LINK_NOT_REFUSED ✗ [Errno 2] No such file or directory: '/tmp/pytest-of-root/pytest-0/test_relocated_relative_link_i0/b/run/_eval/content/tasks/t1/task.json'
E         
E       assert ('path escapes the repository' in "✗ [Errno 2] No such file or directory: '/tmp/pytest-of-root/pytest-0/test_relocated_relative_link_i0/b/run/_eval/content/tasks/t1/task.json'\n")

tests/test_proof_c1.py:44: AssertionError
=========================== short test summary info ============================
FAILED tests/test_proof_c1.py::test_relocated_relative_link_is_refused - Asse...
1 failed in 1.18s

Comment thread dokimi/dokimi/commands/repo_run.py Outdated
Comment on lines +176 to +177
if not task_json.is_file():
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

security · should fix
Validate containment before filtering by file type.

Trigger: use the relocation fixture's relative link, keep repo/outside.json a tracked regular file, but make tmp_path/outside.json a FIFO.

Evidence: source resolution accepts the repository file; after export, task_json.is_file() returns false for the FIFO, so this check skips it, while load_tasks() discovers the symlink with glob("*/task.json") and _read_task_json() opens it without a regular-file check.

Impact: _require_grade() blocks reading the host FIFO instead of refusing the escaped path; the relocation fix therefore still has a containment bypass. Resolve and check containment for every task.json entry the consumer discovers before applying any file-type filter.

Workaround: avoid task symlinks in untrusted eval trees.

Should fix: A run shows it; it was not judged to be met in ordinary use.

Shown by running: exit 1 (at the head) · exit 1 (at the merge base, which cannot run it) · exit 0 (at the head with the fix)

python review_fifo_proof_runner.py

What the proof does: Creates a tracked relative task link and a real external FIFO, calls the source validation and export code, and checks that exported-path validation refuses the escaped entry discovered by the task loader's glob.

The problem shows as the output AssertionError: escaped FIFO task.json must be rejected before task loading.

Script: dokimi/tests/test_review_fifo_containment.py (53 lines), dokimi/review_fifo_proof_runner.py (8 lines).

        except InputError as exc:
            assert 'path escapes the repository:' in str(exc)
        else:
>           raise AssertionError('escaped FIFO task.json must be rejected before task loading')
E           AssertionError: escaped FIFO task.json must be rejected before task loading

tests/test_review_fifo_containment.py:53: AssertionError
=========================== short test summary info ============================
FAILED tests/test_review_fifo_containment.py::test_exported_fifo_link_must_be_refused
1 failed in 0.64s

out = run.stdout + run.stderr
assert "path escapes the repository" in out, out
assert run.returncode == 2, out
\n No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

test · should fix
Remove the literal trailing \n characters.

Trigger: pytest collects this module.

Impact: Python raises a SyntaxError before any regression tests execute, interrupting test collection.

Evidence: line 129 contains a backslash followed by n outside a string; the local Ruff check confirms Expected a newline after line continuation character at this line.

Workaround: delete these characters or replace them with an actual newline.

Should fix: A run shows the tests do not catch this.

Shown by running: exit 1 (at the head) · exit 1 (at the merge base, which cannot run it) · exit 0 (at the head with the fix)

python tests/_parse_check.py

What the proof does: Parses the new test module with ast.parse and exits 1 on SyntaxError.

The problem shows as the output PARSE FAILED.

dokimi/tests/_parse_check.py

import ast, sys
src = open('tests/test_repo_run_task_link_escape.py', encoding='utf-8').read()
try:
    ast.parse(src)
except SyntaxError as e:
    print('PARSE FAILED: ' + str(e))
    sys.exit(1)
print('ok')
PARSE FAILED: unexpected character after line continuation character (<unknown>, line 129)


repo_run._context(args, tmp_path, SimpleNamespace())

assert calls == [("source", tree, manifest), ("exported", content, manifest)] No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

test · should fix
The ordering assertion does not observe the security boundaries.

Trigger: move _check_exported_task_json_links() below _require_grade() (or source validation below export), keeping the two validators in their current relative order.

Evidence: export and _require_grade are unrecorded stubs, so calls and this assertion remain unchanged.

Impact: this regression test passes even when task JSON is read before containment validation. Record export and _require_grade in the same event list and assert source check → export → exported check → grade.

Workaround: retain the current production ordering and inspect it manually.

Should fix: A run shows the tests do not catch this.

Shown by running: exit 0 (tests, code unchanged) · exit 0 (tests, code broken on purpose) · exit 0 (suggested test, code unchanged) · exit 1 (suggested test, code broken on purpose)

python -m pytest -q -p no:randomly -p no:cacheprovider tests/test_repo_run_task_link_escape.py::test_context_checks_task_links_before_and_after_export

.                                                                        [100%]
1 passed in 0.75s

@sazid63

sazid63 commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in 6f57313 and covered with direct regression tests in d85511d. The source-tree check now derives task IDs from directory-link entries and resolves each task.json through the alias.

@sazid63

sazid63 commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in 8604ba5 and covered with direct regression tests in d85511d. repo run checks task JSON targets in the staged eval directory before loading them, so relocation cannot make an escaping link readable.

sazid63 and others added 9 commits December 4, 2026 18:29
Signed-off-by: sazid63 <322897530+sazid63@users.noreply.github.com>
Signed-off-by: sazid63 <322897530+sazid63@users.noreply.github.com>
Signed-off-by: sazid63 <322897530+sazid63@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Signed-off-by: sazid63 <322897530+sazid63@users.noreply.github.com>
Signed-off-by: sazid63 <322897530+sazid63@users.noreply.github.com>
Signed-off-by: sazid63 <322897530+sazid63@users.noreply.github.com>
Signed-off-by: sazid63 <322897530+sazid63@users.noreply.github.com>
Cover task-directory aliases and links that escape after eval-directory relocation; document the refusal contract and changelog entry.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Signed-off-by: sazid63 <322897530+sazid63@users.noreply.github.com>
Exercise source and exported-tree validation directly, including unresolved paths and checks around eval export.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Signed-off-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@sazid63
sazid63 force-pushed the fix/repo-run-task-json-link-escape branch from d85511d to 420d2e2 Compare December 4, 2026 18:29
Refuse escaped FIFO targets and dangling task symlinks, and assert task loading follows both containment checks.

Signed-off-by: Sajid Hossain <322897530+sazid63@users.noreply.github.com>
@codecov-commenter

codecov-commenter commented Dec 4, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 97.14286% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 96.49%. Comparing base (0eeae5f) to head (8d6ae2d).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
dokimi/dokimi/repos/task_source.py 96.87% 0 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1611      +/-   ##
==========================================
+ Coverage   96.45%   96.49%   +0.03%     
==========================================
  Files         565      570       +5     
  Lines       74867    75284     +417     
  Branches    12930    12985      +55     
==========================================
+ Hits        72216    72643     +427     
+ Misses       1628     1614      -14     
- Partials     1023     1027       +4     
Files with missing lines Coverage Δ
dokimi/dokimi/commands/repo_run.py 97.51% <100.00%> (+0.20%) ⬆️
dokimi/dokimi/repos/task_source.py 96.87% <96.87%> (ø)

... and 38 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.



@pytest.mark.parametrize(("create_tasks", "create_task_file"), [(False, False), (True, False), (True, True)])
def test_exported_task_link_check_skips_missing_tasks(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CI check Tests (py3.14) fails: The added helpers push repo_run.py from 793 to 843 measured lines, exceeding the 800-line cap without a baseline entry; extract the helpers into a separate module. The new missing-tasks test also has no assertion; its deliberate must-not-raise behavior can use the audit's documented exemption with a reason. Proposed fix, not run by the bot.

Suggested change
def test_exported_task_link_check_skips_missing_tasks(
def test_exported_task_link_check_skips_missing_tasks( # test-quality: ok must-not-raise smoke test for missing tasks and ordinary task files

@napetrov napetrov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Change class: CONTRACT (head 4661cd9)

  • Contract: candidate. errors dokimi/dokimi/commands/repo_run.py:159; errors dokimi/dokimi/commands/repo_run.py:181
  • Responsibility: none
  • Dependency: none
  • Review depth: check the changed surface: callers, docs, tests pin new behaviour
  • Coverage gaps: none

Open issues to resolve on 4661cd9d.

  • The growth check passes at the merge base and fails on head because repo_run.py has 843 measured lines against the 800-line cap. CI also rejects the new test with no assertion. Earlier finding

Both task-path fixes touch the same preparation flow and conflict in their shared test file. Reconcile this PR with #1610 before merging either.

Reviewed the diff, edge cases and prior threads. Path containment was reviewed statically. The full local suite was outside coverage.

@sazid63

sazid63 commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor Author

@napetrov I've updated this PR to address the remaining security review findings and reconciled its scope with #1610.

The latest changes:

  • Validate task JSON paths reachable through internal task-directory aliases.
  • Check containment again after exporting the evaluation directory, catching relative links that become external after relocation.
  • Validate discovered task paths before applying file-type assumptions, including cases involving external FIFOs.
  • Preserve selection-aware loader behavior by deferring unresolved in-tree links and loops rather than blocking unrelated valid tasks.
  • Added regression coverage for directory aliases in both working-tree and pinned Git-tree sources.
  • Moved the source/export regression tests into a dedicated test module to avoid overlapping test ownership with Fix/repo run task symlink escape #1610.

The intended division is:

Both changes are intended to form complementary layers of the same security boundary.

Please review the latest commits and let me know if you see any remaining concerns before these are considered ready for merge.

Comment thread dokimi/dokimi/repos/task_source.py Outdated
Comment on lines +45 to +47
# strict=False still resolves dangling symlinks, so an external missing target
# is rejected. In-tree dangling links and loops are left to load_tasks(),
# which knows whether the task was selected.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CI check Static checks (ruff, schema, zizmor, licenses, pre-commit, bandit, secrets, changelog, schema com... fails: The new comment at task_source.py:45–47 has three consecutive full-line comments. The comment-block checker rejects changed blocks longer than two lines, matching the failed step's diagnostic. Proposed fix, not run by the bot.

Suggested change
# strict=False still resolves dangling symlinks, so an external missing target
# is rejected. In-tree dangling links and loops are left to load_tasks(),
# which knows whether the task was selected.
# Resolve dangling targets to reject escapes; defer in-tree broken links
# and loops to selection-aware load_tasks().

Signed-off-by: Sajid Hossain <322897530+sazid63@users.noreply.github.com>
Signed-off-by: Sajid Hossain <322897530+sazid63@users.noreply.github.com>
Signed-off-by: Sajid Hossain <322897530+sazid63@users.noreply.github.com>
Signed-off-by: Sajid Hossain <322897530+sazid63@users.noreply.github.com>
sazid63 and others added 6 commits December 5, 2026 00:59
Signed-off-by: Sajid Hossain <322897530+sazid63@users.noreply.github.com>
Signed-off-by: Sajid Hossain <322897530+sazid63@users.noreply.github.com>
Signed-off-by: Sajid Hossain <322897530+sazid63@users.noreply.github.com>
Signed-off-by: Sajid Hossain <322897530+sazid63@users.noreply.github.com>
Signed-off-by: Sajid Hossain <322897530+sazid63@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Signed-off-by: Sajid Hossain <322897530+sazid63@users.noreply.github.com>
@sazid63
sazid63 force-pushed the fix/repo-run-task-json-link-escape branch from bdc16b4 to d472aab Compare December 5, 2026 01:00
@sazid63

sazid63 commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor Author

@napetrov Follow-up on the latest head (d472aab):

The outstanding findings have been addressed in the updated implementation and regression tests:

  • Task JSON files reachable through internal directory aliases are checked.
  • Containment is revalidated after export, accounting for relocation.
  • Validation occurs before file-type filtering, including external FIFO cases.
  • The regression tests now verify the required security-check ordering.
  • The source/export tests have been separated into their own test module.
  • The repo_run.py line-count issue has been addressed, and the intentional must-not-raise test has an explicit quality exemption.
  • The excessive consecutive comment block has been shortened.

The latest changes are pushed. The remaining GitHub workflow runs are awaiting maintainer approval.

Please review the current head and let me know if anything remains before merge.

@github-actions

github-actions Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Mutation of changed lines

⚠️ No break was missed, but only 21 of 23 were caught; the rest were waived, timed out or errored

At 8d6ae2d: 21 caught · 0 missed · 2 waived

Not checked:

  • 2 changed lines were not mutated

Marked harmless with mutation-ok:

Where Operator Change Reason
dokimi/dokimi/repos/task_source.py:43 delete-statement continue → pass resolving an absent in-tree path is still contained
dokimi/dokimi/repos/task_source.py:52 delete-statement continue → pass end-of-loop naturally defers this path

Warning only: a missed break does not fail the job. Updated on every push; the full report is in the ci run summary.

Signed-off-by: Sajid Hossain <322897530+sazid63@users.noreply.github.com>
@sazid63
sazid63 force-pushed the fix/repo-run-task-json-link-escape branch from b9f1049 to b7043b7 Compare December 5, 2026 03:47
…ations

Signed-off-by: Sajid Hossain <322897530+sazid63@users.noreply.github.com>
@sazid63
sazid63 force-pushed the fix/repo-run-task-json-link-escape branch from 6c6c786 to 8d6ae2d Compare December 5, 2026 04:27

@vchamarthi vchamarthi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sazid63, could you fix the 2 small things I've marked fix before merge (in the line comments) and answer my question below? I'll approve once that's done.
I'll approve once that's done.

My question before I approve:

  • A task directory that links outside the eval directory after relocation, with no task.json in it, is skipped without a refusal, and the run says no task under when it is the only task. Decide which is meant: refuse this link and add a test for it, or keep skipping it and change that comment and the contract sentence to say so.
Optional, non-blocking (1)
  • dokimi/dokimi/repos/task_source.py:37: An eval directory that is itself a link to a directory outside the repository is still read (main has it too).

What I checked on 8d6ae2d:

  • When I changed the code on purpose, the tests still passed for 2 of 9 changes, and no test pins this one down yet (non-blocking): dokimi/dokimi/repos/task_source.py:28 (the handled error is raised again).
  • The 18 changed tests pass, and fail on main as expected.
  • The full test suite passes with main merged in (36,280 tests), apart from failures main has too.
  • It merges cleanly onto main.

Comment thread dokimi/dokimi/commands/repo_run.py Outdated
Comment on lines +40 to +41
"""Exit 2 for what the user typed and for task-file links that leave the tree.
Other paths supplied by the tree are checked by the operation that reads them."""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fix before merge (blocking): The refuse_typed docstring says it refuses task-file links, but that check is in _context.

I tested this suggestion: it fixes the problem, and the tests still pass.

Suggested change
"""Exit 2 for what the user typed and for task-file links that leave the tree.
Other paths supplied by the tree are checked by the operation that reads them."""
"""Exit 2 for what the user typed, and for a ``--manifest`` or ``--suite`` leaving the tree.
Task links are checked in ``_context``; other tree paths fail later, with exit 1."""
Details

The first line of the docstring says refuse_typed exits 2 for task-file links that leave the tree. Its body checks only the typed source, the manifest and the suite paths. The task links are checked in _context, at repo_run.py:91 and :100, so this sentence describes the wrong function.

Comment thread dokimi/dokimi/repos/task_source.py Outdated
target = task_json.resolve(strict=False)
target.relative_to(root)
except ValueError as exc:
raise InputError(f"path escapes the repository: {tasks}/{task_dir.name}/task.json") from exc

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fix before merge (blocking): A task link to a file inside the repository but outside the eval directory fails as path escapes the repository.

Suggestion: Give this refusal its own message that names the eval directory, and update the relocation test in dokimi/tests/test_repo_run_source_task_link_escape.py that asserts the current text.

Details

I made .agent-eval/tasks/t1/task.json a symlink to docs/shared.json, a tracked file outside .agent-eval. On the latest commit repo run exits 2 with path escapes the repository: .agent-eval/tasks/t1/task.json, but the target is in the repository. On the base commit 0eeae5f it exits 1 with a missing-file error. I'd expect a message that says the link leaves the exported eval directory, since that is what this check tests.

Signed-off-by: Sajid Hossain <322897530+sazid63@users.noreply.github.com>
Signed-off-by: Sajid Hossain <322897530+sazid63@users.noreply.github.com>
@sazid63

sazid63 commented Dec 5, 2026

Copy link
Copy Markdown
Contributor Author

@vchamarthi I've pushed the requested updates:

  1. Corrected the refuse_typed docstring using the suggested wording.
  2. Updated the post-export error message to identify the evaluation-directory boundary and revised the relocation regression test.
  3. Chose explicit refusal for task directories that resolve outside the evaluation tree, rather than silently skipping them.
  4. Added regression coverage for empty external task directories, directory symlinks, tasks-root escapes, and resolution errors that do not involve path escapes.

I've left the evaluation-directory symlink behaviour unchanged to keep the scope of this PR focused.

The updated CI workflows are currently awaiting approval, so the full test results are not available yet. I'll follow up once they have run.

I'll also coordinate the integration with #1610 before either PR is merged.

@napetrov napetrov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Change class: CONTRACT (head 0fbb7d2)

  • Contract: candidate. defaults dokimi/dokimi/repos/task_source.py:14; errors dokimi/dokimi/repos/task_source.py:20
  • Responsibility: none
  • Dependency: none
  • Review depth: check the changed surface: callers, docs, tests pin new behaviour
  • Coverage gaps: none

No new actionable findings.

This PR adds source and post-export containment checks before repo run uses tasks. It overlaps #1610, which checks containment in the shared exported-task loader.

Review alongside #1610 so the source/export checks and the shared task loader agree on scope. Nine focused task-selection and check-order tests passed on the combined tree.

CI on head 0fbb7d2: 0 failing Actions jobs; merge base 0eeae5f is behind base tip 5225c2a.

Compared the change and input edges against the merge base and checked existing threads and GitHub Actions. Runtime checks used local fixtures. Live credentials and external path access were outside the review. Focused tests on the head: extra 6 passed, 20 deselected in 0.60s.

This branch has not been deployed

No deployments
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.

7 participants