[GH-ISSUE #7671] [Bug] record_unknown citing Evidence from a closed session reports "Evidence state changed" instead of naming the missing reference #4594

Closed
opened 2026-10-31 00:51:07 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @shockstricken on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/7671

Before submitting

  • I searched the open and closed issues for a related report. Closest is #6106 (closed), which fixed the invalid-transition reason. This report is about the integrity reason.
  • I removed credentials, tokens, private paths, and sensitive target data.

Area

MCP or agent integration

REA version

rea-agents 6.8.0 (Ghidra provider, Linux x86_64, MCP over HTTP)

Observed behavior

After close_binary, a record_unknown call whose supporting_evidence_ids names an Evidence ID produced before the close fails with:

code: evidence_integrity_mismatch
message: Evidence state changed before the update completed. Refresh the current state and try again.

Nothing changed concurrently. The record is gone because close_binary clears retained records. The message does not say that a referenced Evidence ID is not in the current session, does not name the ID, and suggests a retry that cannot succeed.

Reproduction

  1. Build a synthetic target: printf 'int main(void){return 0;}\n' > t.c && cc -O0 -o t t.c
  2. open_binary {"path": "<abs path>/t"}
  3. analyze_function on main. Note the returned evidence_id (call it E).
  4. close_binary {}
  5. record_unknown:
    {"question": "Does main do anything?", "domain": "repro", "severity": "low",
     "supporting_evidence_ids": ["E"], "contradicting_evidence_ids": [],
     "required_authority": "analyst-inference", "required_confidence": "observed",
     "required_environment": {"id": null, "platform": null, "architecture": null, "isolation": null},
     "recommended_probes": [], "relationships": []}
    
  6. Result: the evidence_integrity_mismatch error above.

Observed in two separate sessions on 6.8.0 with a raw-binary target opened through the Ghidra provider. The steps above are the minimal equivalent and were not run verbatim. Not tried: a well-formed ID that never existed (for example ev_ followed by 64 f), which I expect takes the same path.

Expected behavior

An invalid_request style diagnostic that names the unresolved Evidence ID(s), says they are not retained in the current session (for example, because the session was closed), and points to the recovery: record the unknown before close_binary, or import_evidence_bundle first. A real integrity failure and a dangling reference should be told apart.

Where it seems to come from (source reading on main, not a run)

  • src/application/investigation/EvidenceLedger.ts: when validateResidualUnknownAddition throws InvalidResidualUnknownGraphError, the ledger returns new UnknownRegistryError("integrity", { cause }).
  • src/domain/analysisErrorProjection.ts: reason integrity maps to evidence_integrity_mismatch, and the details keep only { reason }, so the cause is dropped.
  • src/domain/analysisErrorPresentation.ts: every other UnknownRegistryError gets the generic "Evidence state changed before the update completed" text.

Impact

Low. The caller is pointed at a retry that cannot succeed. A missing reference is presented as tampering or a race.

Originally created by @shockstricken on GitHub (Oct 28, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/7671 ### Before submitting - [x] I searched the open and closed issues for a related report. Closest is #6106 (closed), which fixed the `invalid-transition` reason. This report is about the `integrity` reason. - [x] I removed credentials, tokens, private paths, and sensitive target data. ### Area MCP or agent integration ### REA version rea-agents 6.8.0 (Ghidra provider, Linux x86_64, MCP over HTTP) ### Observed behavior After `close_binary`, a `record_unknown` call whose `supporting_evidence_ids` names an Evidence ID produced before the close fails with: ``` code: evidence_integrity_mismatch message: Evidence state changed before the update completed. Refresh the current state and try again. ``` Nothing changed concurrently. The record is gone because `close_binary` clears retained records. The message does not say that a referenced Evidence ID is not in the current session, does not name the ID, and suggests a retry that cannot succeed. ### Reproduction 1. Build a synthetic target: `printf 'int main(void){return 0;}\n' > t.c && cc -O0 -o t t.c` 2. `open_binary` `{"path": "<abs path>/t"}` 3. `analyze_function` on `main`. Note the returned `evidence_id` (call it `E`). 4. `close_binary` `{}` 5. `record_unknown`: ```json {"question": "Does main do anything?", "domain": "repro", "severity": "low", "supporting_evidence_ids": ["E"], "contradicting_evidence_ids": [], "required_authority": "analyst-inference", "required_confidence": "observed", "required_environment": {"id": null, "platform": null, "architecture": null, "isolation": null}, "recommended_probes": [], "relationships": []} ``` 6. Result: the `evidence_integrity_mismatch` error above. Observed in two separate sessions on 6.8.0 with a raw-binary target opened through the Ghidra provider. The steps above are the minimal equivalent and were not run verbatim. Not tried: a well-formed ID that never existed (for example `ev_` followed by 64 `f`), which I expect takes the same path. ### Expected behavior An `invalid_request` style diagnostic that names the unresolved Evidence ID(s), says they are not retained in the current session (for example, because the session was closed), and points to the recovery: record the unknown before `close_binary`, or `import_evidence_bundle` first. A real integrity failure and a dangling reference should be told apart. ### Where it seems to come from (source reading on `main`, not a run) - `src/application/investigation/EvidenceLedger.ts`: when `validateResidualUnknownAddition` throws `InvalidResidualUnknownGraphError`, the ledger returns `new UnknownRegistryError("integrity", { cause })`. - `src/domain/analysisErrorProjection.ts`: reason `integrity` maps to `evidence_integrity_mismatch`, and the details keep only `{ reason }`, so the cause is dropped. - `src/domain/analysisErrorPresentation.ts`: every other `UnknownRegistryError` gets the generic "Evidence state changed before the update completed" text. ### Impact Low. The caller is pointed at a retry that cannot succeed. A missing reference is presented as tampering or a race.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#4594
No description provided.