[GH-ISSUE #202] fix(application): avoid rescanning for complete investigation replay runs #150

Closed
opened 2026-10-15 18:21:40 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @morluto on GitHub (Jul 14, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/202

Problem

runCrossVersionInvestigation always scans both version inputs and then proceeds through full continuation logic before checking for an already-complete run, so investigate-versions/find_changed_behavior cannot cheaply replay cached results.

In the MCP/CLI path this also means unresolved input paths can fail even when a completed workspace could be reused: runInvestigation and registerChangedBehavior perform investigation_input authorization before calling runCrossVersionInvestigation, and runCrossVersionInvestigation does not short-circuit until after scanVersions has already been attempted.

Evidence

  • In src/application/CrossVersionInvestigation.ts, scanVersions(...) is called before continueInvestigation(...) (:93-:99), and the complete-run check is only inside continueInvestigation (:156-:157).
  • In src/server/registerInvestigationTools.ts, MCP always authorizes investigation_input before invoking runCrossVersionInvestigation for investigation_run inputs (:98-:139).
  • In src/cliInvestigationCommands.ts, CLI does the same investigation_input authorization order for investigate-versions.

Impact

  • Re-running a cached complete changed-behavior investigation still requires both left/right input paths to exist and be permission-authorized.
  • Reuse can fail with missing/degraded inputs even though the workspace already contains a complete, verifiable result.
  • Increases latency and resource usage for every replay-only invocation.

Suggested behavior

  • Detect complete workspace runs by identity before scanning inputs.
  • Skip investigation_input enforcement for replay-only complete runs (or reduce it to workspace-only checks).
  • Preserve full authorization path only when a new run or refresh is required.

Reproduction idea

  1. Run find_changed_behavior once to create a complete workspace run.
  2. Remove or revoke access to one of left_path / right_path.
  3. Re-run with same investigation_run payload.
  4. Current flow still attempts input access/scan and can fail before returning cached evidence.
Originally created by @morluto on GitHub (Jul 14, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/202 ## Problem `runCrossVersionInvestigation` always scans both version inputs and then proceeds through full continuation logic before checking for an already-complete run, so `investigate-versions`/`find_changed_behavior` cannot cheaply replay cached results. In the MCP/CLI path this also means unresolved input paths can fail even when a completed workspace could be reused: `runInvestigation` and `registerChangedBehavior` perform `investigation_input` authorization before calling `runCrossVersionInvestigation`, and `runCrossVersionInvestigation` does not short-circuit until after `scanVersions` has already been attempted. ## Evidence - In `src/application/CrossVersionInvestigation.ts`, `scanVersions(...)` is called before `continueInvestigation(...)` (`:93`-`:99`), and the complete-run check is only inside `continueInvestigation` (`:156`-`:157`). - In `src/server/registerInvestigationTools.ts`, MCP always authorizes `investigation_input` before invoking `runCrossVersionInvestigation` for `investigation_run` inputs (`:98`-`:139`). - In `src/cliInvestigationCommands.ts`, CLI does the same `investigation_input` authorization order for `investigate-versions`. ## Impact - Re-running a cached complete changed-behavior investigation still requires both left/right input paths to exist and be permission-authorized. - Reuse can fail with missing/degraded inputs even though the workspace already contains a complete, verifiable result. - Increases latency and resource usage for every replay-only invocation. ## Suggested behavior - Detect complete workspace runs by identity before scanning inputs. - Skip `investigation_input` enforcement for replay-only complete runs (or reduce it to workspace-only checks). - Preserve full authorization path only when a new run or refresh is required. ## Reproduction idea 1. Run `find_changed_behavior` once to create a complete workspace run. 2. Remove or revoke access to one of `left_path` / `right_path`. 3. Re-run with same `investigation_run` payload. 4. Current flow still attempts input access/scan and can fail before returning cached evidence.
bsakaguchi 2026-10-15 18:21:40 +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#150
No description provided.