Skip to content

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

Open
hacktivistxt wants to merge 2 commits into
GreyDGL:mainfrom
hacktivistxt:fix/supervisor-basis-id-feedback
Open

hacktivistxt wants to merge 2 commits into
GreyDGL:mainfrom
hacktivistxt:fix/supervisor-basis-id-feedback

Conversation

@hacktivistxt

Copy link
Copy Markdown

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

hacktivistxt and others added 2 commits October 29, 2026 09:21
When the Supervisor cited a basis observation whose 32-char hex ID it had
mistyped, the deterministic validator rejected it with only the bad ID, so
the blind retry mis-copied again and the run died on supervisor_contract
after 2 attempts (observed: a near-miss ID differing in 6 of 44 characters).

compile_plan now appends the closest valid observation IDs (difflib) plus the
full available set to both the task-basis and finish-basis errors. These are
fed back to the retry as validation_feedback, so it can copy the correct ID
instead of being told only that its citation is unknown. Adds a focused test
asserting the error names the near-miss's real observation ID.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Completion reuse of a valid same-task observation succeeds when the lease
and grounding trace share an episode. This adds the mirror 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. The validator
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.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@hacktivistxt

Copy link
Copy Markdown
Author

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.

@hacktivistxt

Copy link
Copy Markdown
Author

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.

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