Skip to content

fix(snapshot): report binding mismatches - #8432

Merged
morluto merged 6 commits into
mainfrom
codex/snapshot-binding-diagnostics
Nov 1, 2026
Merged

morluto merged 6 commits into
mainfrom
codex/snapshot-binding-diagnostics

Conversation

@morluto

@morluto morluto commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes #8430. Snapshot binding failures previously reported the same profile_mismatch message for a changed target, provider or profile. Return the confirmed differing identities and profile digests so an agent can select the intended inputs or explicitly start without the snapshot.

Change and scope

One shared binding comparison now owns both admission and the structured mismatch facts. Explicit opens, staged and active imports, and CLI target preflight use that result; an unexamined profile remains not_compared, and incompatible profileless workflow contents remain separate. The older duplicate boolean binding and profileless checks are removed. The existing fail-closed error code, validation-before-retirement order, snapshot format and provider authority remain unchanged.

The error reports both sides for confirmed target/provider/profile differences and includes a concrete recovery. A changed raw entry point is part of target identity even when bytes match. CLI target preflight does not claim to have compared a provider profile. Diagnostic wording changes; use the error code and structured details rather than matching prose.

Validation

  • At 5d1346091, seven focused domain, filesystem, composition and MCP suites passed: 239 tests passed, 2 Windows-only skipped. They cover target, provider, profile and combined mismatch, profileless scope, staged imports, CLI preflight and active-session preservation. check:fast, changed-file formatting and git diff --check passed.
  • At the same source tree, real Ghidra 12.1.4/JDK 21 and Kuna 1.986 controls tested target plus provider changes in both directions. The previous active session remained usable, a fresh open without the snapshot succeeded, and actual CLI output reported target mismatch with profile comparison not_compared. Both tests passed.
  • A real Ghidra x86-64 raw-binary control passed at that tree: identical bytes selected at 0x1000 versus 0x2000 reported the differing entry points, preserved an active rename after refusal, and recovered without the snapshot. Actual CLI and MCP errors were exercised. Test-owned targets and snapshots were unchanged and not executed.
  • At 5d1346091, a real Ghidra selected-project control exercised a matching target/provider and project path after a synthetic history edit to a disposable copy. MCP and actual CLI reported the profile-digest mismatch, the existing MCP session remained usable, and restoring the test-owned project allowed snapshot replay. The target, snapshot and project were unchanged by REA; no target was executed. This is one selected project and host; the synthetic history edit does not establish an actual analyzer configuration.
  • The original new structured-mismatch assertion failed on the base. Earlier docs:check and schema-validation controls passed; this follow-up did not change documentation or error schemas. Windows, Hopper, actual analyzer-setting edits and autonomous-agent behavior remain unverified.

Compatibility and safety

No snapshot migration, target mutation, provider integration, or new authority. The error payload and wording provide more detail; the persisted format and stable error code do not change. Real-provider controls used owned fixtures and disposable project copies.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@greptile-apps

greptile-apps Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: apex

[Medium impact] The reviewed changes appear safe to merge; no new actionable issues were found.

Summary

The PR reports saved and selected binding differences through details.binding_mismatch. The latest changes make the same comparison result control both rejection and diagnostics.

  • Snapshot errors show which saved and selected bindings differ.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["Read and validate snapshot"] --> B["Compare selected target"]
  B --> C{"Target differs?"}
  C -->|Yes| D["CLI reports target difference and profile not compared"]
  C -->|No| E["Resolve selected provider and profile"]
  E --> F["Compare complete binding"]
  F --> G{"Binding differs or profile unavailable?"}
  G -->|Yes| H["Return error before retiring current session"]
  G -->|No| I{"Profileless route?"}
  I -->|Yes| J["Check permitted workflow contents"]
  J -->|Incompatible| H
  J -->|Compatible| K["Continue open or replay"]
  I -->|No| K
Loading

Reviews (4) · Last reviewed commit: "refactor(snapshot): derive admission fro..." · Reviewed by Greptile

@morluto
morluto marked this pull request as ready for review November 1, 2026 03:55
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T04:29:49.942755Z 5d13460 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@morluto
morluto merged commit 1c1c8f6 into main Nov 1, 2026
54 of 58 checks passed
@morluto
morluto deleted the codex/snapshot-binding-diagnostics branch November 1, 2026 09:23
Entrpi added a commit to Entrpi/rea that referenced this pull request Nov 1, 2026
Take main 7c755f2 (morluto#8432, morluto#8417). There were no text conflicts, but
morluto#8432 replaced snapshotMatchesBinding with snapshotBindingMismatch,
which returns undefined when a snapshot matches and otherwise names
what differs. rawLoadCompatibility.test.ts now asserts the mismatch: a
pre-morluto#7823 Ghidra snapshot differs only in its profile digest, and a
snapshot of a different target names the target.
coyoteXujie pushed a commit to coyoteXujie/rea that referenced this pull request Nov 2, 2026
* fix(snapshot): report binding mismatches

* test(snapshot): assert structured mismatch recovery

* docs(snapshot): explain profile comparison recovery

* fix(snapshot): include profile in recovery advice

* docs(snapshot): explain fresh-session profile discovery

* refactor(snapshot): derive admission from binding comparison
@morluto morluto added area: evidence Evidence, artifacts, and reconstruction bug Something isn't working labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: evidence Evidence, artifacts, and reconstruction bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Snapshot refusal does not identify which binding differs

1 participant