Skip to content

Revalidate decisions that cite files: flag them, don't hide them #123

Closed

Description

@gosha70

Why

#57's replay (#121; results in eval/decisions-57/results-k5.json and results-k3.json, discussion in the research note, sections 4–5) found two things:

  • Decisions are never revalidated. revalidate checks code memories only. A probe retained a decision and a code memory citing the same file, then rewrote and deleted the file: the code memory was flagged both times, the decision neither time (file_probe in the results).
  • A file-hash check would catch real stale decisions, and also valid ones. In code-copilot-team's history at 00d49c0, the first cited file of both stale decisions changed after the decision date. So did the cited file of 3 of the 10 decisions still in force, two of them safety rules (cited_file_history in the results). recall hides flagged memories by default, so hiding flagged decisions would lose those rules.

Proposed (needs a spec first)

  • Record a hash at retain. A decision whose source names a file under the project root stores that file's hash, as code memories do. Only source is tracked for now, not the other paths in evidence.
  • Flag on change or loss. revalidate flags such a decision when the file is missing or its hash changed, and clears the flag when the hash matches again or the decision is superseded.
  • Flagged code stays hidden; flagged decisions are returned. recall keeps hiding flagged code memories, as today, but returns flagged decisions, so the agent re-checks the evidence instead of losing the decision.
  • The mark is an additive field. Each recall result gains needs_review and review_reason (false and empty when not flagged). The preview is unchanged, and existing fields keep their meaning.
  • Older decisions (no stored hash) are flagged only when the cited file is missing.
  • No new record type or MCP tool; reuse the code revalidation path.

Acceptance (sketch)

  • The Preserve and retrieve implementation alternatives for reuse-first coding #57 file probe: the decision is flagged on rewrite and on delete, and recall still returns it with needs_review: true and a review_reason.
  • The replay: every seed record is still found; decisions whose cited files changed come back flagged, not hidden.
  • recall still hides flagged code memories.
  • Stores from 0.1.x to 0.9.x load unchanged (the new key loads with a default).

To decide in the spec

  • Whether flagged decisions also appear in the session-start "Needs review" list (lifecycle.py, today fed by revalidation's flagged items, at most 10 lines).

Related: #57, #121 (replay), #118 (decision records in the template).

Activity

  1. added 3 commits that reference this issue on Nov 14, 2026
  2. gosha70 commented on Nov 15, 2026

    @gosha70
    OwnerAuthor

    Closing: shipped on main (spec #126, build #127, merged as baff4dd; not yet in a release).

    Revalidation:

    • A new decision whose source is a readable file under the project root records that file's hash as source_hash. A retain that matches an existing decision returns it unchanged, with its own source and hash.
    • revalidate() flags such a decision changed when the file differs and missing when it is gone.
    • A decision from before this change has no hash. It is flagged only when its file is missing, and a present file clears only that flag.
    • Only source is tracked, not other paths in evidence.

    Flagged, not hidden:

    • recall returns flagged decisions on both its relevance and its order="newest" paths.
    • Every result carries the additive needs_review and review_reason fields.
    • Flagged code memories stay hidden as before.
    • The lifecycle's choice of the latest checkpoint is unchanged.

    Session start:

    • The ### Needs review list names each item's type, with a hint for decisions and for code, and shows every memory still flagged.
    • Context lines in the hook blocks mark a flagged memory, e.g. [decision, needs review: changed].

    Acceptance:

    The tests are in tests/unit/test_decision_revalidation.py.

  3. gosha70 commented on Nov 16, 2026

    @gosha70
    OwnerAuthor

    A finding from #128's calibration, for the conflict rule this issue's parent (#57) put in the template.

    #128 ran the #57 corpus's crowded store (code-copilot-team 00d49c0, embedding pinned at 1110a243) through the hook paths that call recall(): compact recovery and on_post_compact(), ten candidates each, five shown.

    The finding. For the conflict case "Destructive git commands require confirmation", the partner record "Balanced profile denies destructive git commands" was among the ten candidates on both paths, but ranked 10th of 10. So it never made the five shown. A session that resumes after compaction would see one side of the conflict, and the template's "show both and ask" rule could not fire. This happens with or without a relevance floor.

    It matches #57's MCP replay, where top_k=3 also lost this partner and top_k=5 brought it back. The hook blocks show 5 too, but they rank over a whole checkpoint rather than a short task line, which pushes the partner lower.

    Where the evidence is: eval/anti-rot-128/calibration.json on the #128 build branch: per-case windows with similarities, and the displayed memories per path.

    Not addressed by #128. #128 dropped its floor, which had no effect on this corpus (amendment A5). Showing both sides of a conflict in a hook block would need its own change, for example pulling in a displayed decision's conflict partners. No issue is filed for that yet.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions