#571

test: pin that a different-episode trace cannot complete a task

Openhacktivistxtwants to merge intofrom

Adds the missing execution-validator test for the episode-identity guard.

Completion by reusing a valid same-task observation already succeeds when the lease and the grounding trace share an episode (see test_executor_can_complete_by_exactly_reusing_same_task_evidence). This adds the mirror negative case: the same exact-quote DONE delta and reusable ObservationRecord, but with the lease bound to a different trace_episode_id than the trace carries. compile_execution refuses it with evidence trace belongs to a different episode before any grounding is credited — so evidence captured in another episode cannot float a completion.

Covers the execution.py:301-305 guard in the DONE-would-otherwise-succeed path, which test_evidence_trace_must_match_the_persisted_episode_identity (PROGRESS, empty events) did not exercise.

Verification:

  • uv run python -m pytest -q → 120 passed, 1 skipped
  • uv run ruff check src tests / ruff format --check clean
  • uv run mypy src clean

🤖 Generated with Claude Code

Activity

4
hacktivistxt9d ago

CI should pass on this branch. Locally against pentestgpt_agent: uv run python -m pytest -q → 120 passed, 1 skipped; uv run ruff check src tests and uv run ruff format --check src tests clean; uv run mypy src clean. The change is test-only (adds one execution-validator case), so no runtime behavior is touched.

hacktivistxt9d ago

Confirmed green: ran the same CI workflow on my fork for this exact SHA (ed1d6dd) — success: https://github.com/hacktivistxt/PentestGPT/actions/runs/41072974821 (pytest 120 passed/1 skipped, ruff check + format, mypy, all clean). This PR's run is just awaiting maintainer approval of the fork-PR workflow gate.