[PR #3503] [CLOSED] fix(mcp): scope automatic workflow unknowns to their derived Evidence #5786

Closed
opened 2026-10-31 01:09:26 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3503
Author: @Dragolone
Created: 10/14/2026
Status: ❌ Closed

Base: main ← Head: fix/workflow-unknowns-scoped-to-evidence


📝 Commits (1)

  • 28726f8 fix(mcp): scope automatic workflow unknowns to their derived Evidence

📊 Changes

4 files changed (+38 additions, -27 deletions)

View changed files

📝 src/server/registerInvestigationTools/helpers.ts (+3 -1)
📝 src/server/registerManagedWorkflowTools/compareManagedMembers.ts (+1 -2)
📝 src/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.ts (+1 -2)
📝 tests/boundary/mcp/investigationAnalysisMcp.test.ts (+33 -22)

📄 Description

Summary

Six workflow tools record an automatic unknown when their result stays unresolved:

  • find_changed_behavior
  • build_call_path
  • correlate_static_and_runtime
  • verify_reconstruction
  • compare_managed_members
  • verify_managed_native_boundaries

Each of them files that unknown under a fixed question with no subject, so every unresolved result from a tool maps to the same unknown identity.

A second, different unresolved query in the same session then collides with the first. The whole call fails atomically with revision_conflict ("Evidence state changed before the update completed. Refresh the current state and retry…"), and the new derived Evidence is lost. Retrying hits the same conflict, although the error presents it as retryable.

Fixes #3333, which reports the same build_call_path 0x3000/0x4000 collision and the verify_managed_native_boundaries case. No open PR addresses it.

Problem and expected behavior

Smallest trigger: in one session, call build_call_path for goal 0x3000, then for goal 0x4000, with a call graph that resolves neither. The second call fails with revision_conflict.

Expected: independent unresolved results each record their own unknown, and an exact repeat of the same query stays idempotent (same Evidence, no duplicate unknown).

Change and scope

The automatic question now names the derived Evidence: … (evidence <evidence_id>). This is the same approach process comparisons already use (… (comparison <id>) in registerProcessComparisonTool.ts).

The change is made in three places:

  • recordWorkflowEvidence in src/server/registerInvestigationTools/helpers.ts, which serves the four investigation tools;
  • compareManagedMembers.ts;
  • verifyManagedNativeBoundaries.ts.

Because the Evidence ID is content-derived, an exact repeat produces the same question and remains idempotent.

Not included: changes to how unknowns are keyed in the ledger.

Contribution scope: a correctness fix in existing MCP workflow tools; a maintainer scope decision is not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: the automatic-unknown question built by recordWorkflowEvidence and the two managed workflow tools.
  • Contribution scope fit and linked maintainer decision: in scope; not applicable.
  • CLI and MCP/tool-catalog contract: the text of automatically recorded unknown questions now ends with (evidence <id>); tool inputs and outputs are otherwise unchanged.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: independent unresolved results keep their derived Evidence instead of failing with revision_conflict.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: tests/boundary/mcp/investigationAnalysisMcp.test.ts.
    • The new test, "records independent unresolved call-path questions and keeps exact repeats idempotent", calls build_call_path for goals 0x3000, 0x4000 and 0x3000 again. It expects all three calls to succeed, the repeat to return the first Evidence ID, and exactly two call-path unknowns, one per Evidence ID.
    • Existing expectations for the other workflow questions were updated to the scoped text.
  • Base reproduction or other evidence: executed. With the three source files reverted to main, the new test fails: the second call returns {"error":{"code":"revision_conflict",…,"message":"Evidence state changed before the update completed. Refresh the current state and retry…"}}.
  • User-visible CLI/MCP output (if applicable): the unknown question text, as above.
  • Remaining proof gaps: the two managed workflow tools are covered by their updated expectations, not by a dedicated repeat-and-differ test.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npx vitest run tests/boundary/mcp/investigationAnalysisMcp.test.ts -t "independent unresolved call-path" with the three source files reverted to main eab789aed — 1 failed (revision_conflict on the second call).
  • npx vitest run tests/boundary/mcp/investigationAnalysisMcp.test.ts with the fix — 12 tests passed.
  • npx vitest run tests/boundary/mcp/managedMcp.test.ts tests/boundary/mcp/investigationAnalysisMcp.test.ts — 2 files, 14 tests passed.
  • npx tsc --noEmit — 0 errors.
  • npx oxlint on the changed files — 0 errors.
  • npx oxfmt --check on the changed files — clean.
  • npm run verify:module-boundaries — passed.
  • pre-push hook (deps check, typecheck, lint) — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Callers that matched automatic unknown questions by exact text see the (evidence <id>) suffix.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new inputs or side effects.

Author readiness

Human owner: @Dragolone

  • 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.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/3503 **Author:** [@Dragolone](https://github.com/Dragolone) **Created:** 10/14/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/workflow-unknowns-scoped-to-evidence` --- ### 📝 Commits (1) - [`28726f8`](https://github.com/morluto/rea/commit/28726f8af5e487a32c14225f2a2f9973b026246d) fix(mcp): scope automatic workflow unknowns to their derived Evidence ### 📊 Changes **4 files changed** (+38 additions, -27 deletions) <details> <summary>View changed files</summary> 📝 `src/server/registerInvestigationTools/helpers.ts` (+3 -1) 📝 `src/server/registerManagedWorkflowTools/compareManagedMembers.ts` (+1 -2) 📝 `src/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.ts` (+1 -2) 📝 `tests/boundary/mcp/investigationAnalysisMcp.test.ts` (+33 -22) </details> ### 📄 Description ## Summary Six workflow tools record an automatic unknown when their result stays unresolved: - `find_changed_behavior` - `build_call_path` - `correlate_static_and_runtime` - `verify_reconstruction` - `compare_managed_members` - `verify_managed_native_boundaries` Each of them files that unknown under a fixed question with no subject, so every unresolved result from a tool maps to the same unknown identity. A second, different unresolved query in the same session then collides with the first. The whole call fails atomically with `revision_conflict` ("Evidence state changed before the update completed. Refresh the current state and retry…"), and the new derived Evidence is lost. Retrying hits the same conflict, although the error presents it as retryable. Fixes #3333, which reports the same `build_call_path` `0x3000`/`0x4000` collision and the `verify_managed_native_boundaries` case. No open PR addresses it. ## Problem and expected behavior Smallest trigger: in one session, call `build_call_path` for goal `0x3000`, then for goal `0x4000`, with a call graph that resolves neither. The second call fails with `revision_conflict`. Expected: independent unresolved results each record their own unknown, and an exact repeat of the same query stays idempotent (same Evidence, no duplicate unknown). ## Change and scope The automatic question now names the derived Evidence: `… (evidence <evidence_id>)`. This is the same approach process comparisons already use (`… (comparison <id>)` in `registerProcessComparisonTool.ts`). The change is made in three places: - `recordWorkflowEvidence` in `src/server/registerInvestigationTools/helpers.ts`, which serves the four investigation tools; - `compareManagedMembers.ts`; - `verifyManagedNativeBoundaries.ts`. Because the Evidence ID is content-derived, an exact repeat produces the same question and remains idempotent. Not included: changes to how unknowns are keyed in the ledger. Contribution scope: a correctness fix in existing MCP workflow tools; a maintainer scope decision is not applicable. ## Contract and boundary impact - Semantic owner and earliest changed stage: the automatic-unknown question built by `recordWorkflowEvidence` and the two managed workflow tools. - Contribution scope fit and linked maintainer decision: in scope; not applicable. - CLI and MCP/tool-catalog contract: the text of automatically recorded unknown questions now ends with `(evidence <id>)`; tool inputs and outputs are otherwise unchanged. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: independent unresolved results keep their derived Evidence instead of failing with `revision_conflict`. - Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable. - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact: none. Expected effects (check known effects; use documentation-only on its own). Unchecked items do not establish absence; leave uncertainties visible. - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: `tests/boundary/mcp/investigationAnalysisMcp.test.ts`. - The new test, "records independent unresolved call-path questions and keeps exact repeats idempotent", calls `build_call_path` for goals `0x3000`, `0x4000` and `0x3000` again. It expects all three calls to succeed, the repeat to return the first Evidence ID, and exactly two call-path unknowns, one per Evidence ID. - Existing expectations for the other workflow questions were updated to the scoped text. - Base reproduction or other evidence: executed. With the three source files reverted to main, the new test fails: the second call returns `{"error":{"code":"revision_conflict",…,"message":"Evidence state changed before the update completed. Refresh the current state and retry…"}}`. - User-visible CLI/MCP output (if applicable): the unknown question text, as above. - Remaining proof gaps: the two managed workflow tools are covered by their updated expectations, not by a dedicated repeat-and-differ test. For evidence-bearing changes: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npx vitest run tests/boundary/mcp/investigationAnalysisMcp.test.ts -t "independent unresolved call-path"` with the three source files reverted to main eab789aed — 1 failed (`revision_conflict` on the second call). - `npx vitest run tests/boundary/mcp/investigationAnalysisMcp.test.ts` with the fix — 12 tests passed. - `npx vitest run tests/boundary/mcp/managedMcp.test.ts tests/boundary/mcp/investigationAnalysisMcp.test.ts` — 2 files, 14 tests passed. - `npx tsc --noEmit` — 0 errors. - `npx oxlint` on the changed files — 0 errors. - `npx oxfmt --check` on the changed files — clean. - `npm run verify:module-boundaries` — passed. - pre-push hook (deps check, typecheck, lint) — passed. ## Compatibility, safety, and release - Breaking changes or migration steps: none. Callers that matched automatic unknown questions by exact text see the `(evidence <id>)` suffix. - Real Hopper/Ghidra, browser, or OS coverage: not applicable. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no new inputs or side effects. ## Author readiness <!-- The human owner completes these declarations before requesting review. The PR author is the owner by default. A different owner must explicitly accept ownership on this PR. AI agents must leave these declarations to a human to dictate to them or there could be catastrophic consequences for many users of REA. Draft PRs may leave them unchecked. These declarations record initial readiness when opening the PR for review; later pushes do not require a new human sign-off. Keep the description and validation evidence current as the work changes. See CONTRIBUTING.md#pull-request-ownership-and-readiness. --> Human owner: @Dragolone - [x] 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. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:09:26 +00:00
bsakaguchi changed title from [PR #3503] [CLOSED] fix(mcp): scope automatic workflow unknowns to their derived Evidence to [PR #3503] fix(mcp): scope automatic workflow unknowns to their derived Evidence 2026-11-03 13:30:42 +00:00
bsakaguchi changed title from [PR #3503] fix(mcp): scope automatic workflow unknowns to their derived Evidence to [PR #3503] [CLOSED] fix(mcp): scope automatic workflow unknowns to their derived Evidence 2026-11-03 14:32:25 +00:00
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#5786
No description provided.