Skip to content

fix(review): a review records its prompt digest when it starts, and a benchmark arm refuses runs whose prompts or code changed #1050

Description

@dan-petty

Refreshed plan (2026-10-17, unblocking review)

This section supersedes any text below that conflicts with it.

Decisions

Scope

Delivery

Acceptance criteria

  • ReviewProfiler.__init__ computes review_prompt_digest() once, next to tools_lock_digest() (profile.py:188), and build() records that start value as prompt_digest. A test makes the digest change between start and build() and asserts that the recorded digest is the start's.
  • build() computes the digest again and sets code_changed_during_run: true when it differs from the start's, so the existing warning prints. With own_source_state stubbed as unchanged, tests cover an edited prompt and an added untracked prompt .md.
  • score_corpus_runs raises ValidationError naming each session whose profile records code_changed_during_run: true. devops review corpus score then exits 1 with that message and scores nothing. A new test sits next to test_an_arm_refuses_sessions_that_ran_different_prompts.
  • Five places state that the digest is the start's, that code_changed_during_run also covers a changed prompt digest, and that runs whose code or prompts changed are refused as arms: the field comments at profile.py:118 and :126-127, the warning text at src/devops_cli/lang/en/messages.py:44-48, and docs/SELF_IMPROVEMENT.md:594-595 and :722-726.
  • uv run devops ci passes.

Current references (verified at 3dd7fa6)

  • src/devops_cli/ai/review/profile.py:185-189: __init__ reads the tools lock digest and the source state when the run starts. :345 is where the prompt digest is still computed at build(). :348 records the source-state comparison.
  • src/devops_cli/ai/personas/__init__.py:73-90: review_prompt_digest globs every .md file under ai/tasks/ and ai/personas/, untracked files included.
  • src/devops_cli/core/repo.py:241-264: own_source_state hashes git diff HEAD and ignores untracked files.
  • src/devops_cli/ai/review/defects.py:1623-1640: _shared_prompt_digest already refuses mixed digests. score_corpus_runs is at :1643-1680 and calls it at :1657.
  • src/devops_cli/commands/review.py:2050-2055: corpus score exits 1 on ValidationError.
  • tests/test_review_profile.py:138-140: the fixed_prompt_digest fixture stubs the digest that the new start-time call reads.
  • tests/test_review_defects.py:414-423: the existing test that refuses mixed digests.
  • docs/SELF_IMPROVEMENT.md:594-595: the profile docs say when code_changed_during_run is true.
  • src/devops_cli/review/analysis.py:795: the explanation stage loads its prompt from ai/tasks, so the digest still matters after refactor(review): the persona review stage, the legacy segment engine and review-time RAG are deleted, and devops review builds a model client only for the explanation stages #1151.

Dependencies and order


Problem

profile.json records the prompt digest when the run ends (ai/review/profile.py:286, at da50329). Review session 20261003-021501 (S9) ran at da50329 with digest fe6678c8b4bc291f, but its profile records 48254f0be30580d1, the digest of 0ce4736, because the main checkout moved to 0ce4736 at 02:39:03 while the run was going (.data/review-evaluation-20261003-s9.md). devops-cli runs as an editable install and imports some modules lazily (for example devops_cli.sandbox.host inside execute_criterion_command), so the same move made every verification after 02:39 run new code against old modules: 7 findings ended verification-unavailable: AttributeError ('HostSandboxResult' object has no attribute 'timed_out'). Nothing in the session records that the code changed.

Acceptance criteria

  • The profile's prompt digest (and the persona and verifier system hashes) are computed when the run starts and stored then. A test changes a prompt file between the start and the end of a profiled run and asserts the recorded digest is the start's.
  • A review records the commit and dirty state of its own source tree at start, checks them again at the end, and when they differ prints a warning and records code_changed_during_run: true in profile.json. A test simulates the change with a stub.
  • uv run devops ci passes.

Key questions

  • Import everything at start instead? (proposed) No. Lazy imports keep the CLI fast; recording and warning is enough, and the measurement docs already say to run reviews from a worktree that stays put.

Depends on: none.
Order: any time.
Related: #1047 (a branch review reads the commit it reviews), #607 (run identity).

Activity

  1. added
    type/bug
    scope/review
    priority/p3-low
    on Oct 3, 2026
  2. dan-petty commented on Oct 3, 2026

    @dan-petty
    OwnerAuthor

    Frozen by the evidence-first review redesign (#1137, owner direction of 2026-10-03): patches to the model generator and verifier stop, and tool-layer fixes continue. Its "the review's own code changed mid-run" warning moves into #1142 (the tools lock records every input, and a review warns when devops-cli's own source tree changes during the run). The prompt-digest part goes with #1151. This item stays open, labelled status/blocked, until #1142 lands, then closes as superseded.

  3. added
    status/blocked
    on Oct 3, 2026
  4. changed the title [-]fix(review): a review records its prompt digest when it starts and warns when its own code changes during the run[/-] [+]fix(review): a review records its prompt digest when it starts, and a benchmark arm refuses runs whose prompts or code changed[/+] on Oct 18, 2026
  5. removed
    status/blocked
    on Oct 18, 2026
  6. added a commit that references this issue on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p3-lowscope/reviewtype/bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions