refactor(errors): remove stale workspace failures

This commit is contained in:
morluto
2026-09-29 19:23:08 +08:00
parent bb6a58c2a7
commit f570d40f50
13 changed files with 22 additions and 166 deletions
+13 -16
View File
@@ -350,25 +350,24 @@ REA handles the app analysis in steps 1–5. The agent performs step 6 with its
- Reconstruct an app's authentication, storage, update, or networking flow.
- Recover enough structure to document an undocumented format or interface.
- Trace a suspicious behavior from a string or symbol to the code that implements it.
- Run, checkpoint, resume, and reuse a content-addressed artifact investigation across two versions.
- Turn recovered behavior into product features, tests, migration notes, ports, or interoperable replacements.
- Analyze Swift and Objective-C metadata without manually untangling every mangled symbol.
- Leave names, comments, and bookmarks in Hopper so human and agent analysis reinforce each other.
## Tool catalog for investigation
| Tool family | Count | Examples |
| ------------------------- | ----: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Native inspection | 36 | procedures, pseudocode, assembly, strings, names, segments, callers, callees, xrefs, annotations, bounded byte reads, file-offset translation |
| Investigation workflows | 12 | `binary_overview`, `analyze_function`, `inspect_native_api`, `batch_decompile`, `trace_feature`, exact string-to-code lookup, Evidence-backed call paths, call graphs, Swift and Objective-C discovery |
| Native macOS utilities | 5 | Mach-O metadata, code signatures, plists, architectures, Swift demangling; Hopper-free and provenance-bearing |
| Artifact graph | 2 | complete inline inspection of directories and supported packages, plus explicitly selected extraction into an absent owned tree |
| Managed PE/CLI | 8 | PE/CLI identity, metadata members, CIL hashes, P/Invoke/native-boundary declarations and verification, application-graph projection, decompiler reconstruction import, token remapping, runtime-correlation plans, and version comparison |
| Browser observation | 9 | exact-origin passive CDP capture, bundle and source-map analysis, WebMCP discovery, session timelines, capture diff, visual evidence, and bounded Playwright scenarios |
| Electron analysis | 5 | passive root-confined observation, static application mapping, evidence-backed static/runtime reconciliation, and provider-owned click/wait scenarios |
| JavaScript runtime | 2 | approved attach-only Node/Electron Inspector target discovery plus bounded script and execution-context observation without evaluation or instrumentation |
| Application workflows | 10 | complete cross-layer traces, unique-only version matching, historical-source to bundle mapping, static export return-shape comparison, approved Linux-isolated extracted-module replay, managed-runtime characterization, reconstruction coverage closure, and deterministic obligation ledgers |
| Workspace and observation | 22 | target lifecycle, inline Evidence bundle retrieval, aggregate navigation/address context, direct finite replay-machine evaluation, process/artifact/function comparison, evidence-linked residual-unknown lifecycle |
| Tool family | Count | Examples |
| ----------------------- | ----: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Native inspection | 36 | procedures, pseudocode, assembly, strings, names, segments, callers, callees, xrefs, annotations, bounded byte reads, file-offset translation |
| Investigation workflows | 12 | `binary_overview`, `analyze_function`, `inspect_native_api`, `batch_decompile`, `trace_feature`, exact string-to-code lookup, Evidence-backed call paths, call graphs, Swift and Objective-C discovery |
| Native macOS utilities | 5 | Mach-O metadata, code signatures, plists, architectures, Swift demangling; Hopper-free and provenance-bearing |
| Artifact graph | 2 | complete inline inspection of directories and supported packages, plus explicitly selected extraction into an absent owned tree |
| Managed PE/CLI | 8 | PE/CLI identity, metadata members, CIL hashes, P/Invoke/native-boundary declarations and verification, application-graph projection, decompiler reconstruction import, token remapping, runtime-correlation plans, and version comparison |
| Browser observation | 9 | exact-origin passive CDP capture, bundle and source-map analysis, WebMCP discovery, session timelines, capture diff, visual evidence, and bounded Playwright scenarios |
| Electron analysis | 5 | passive root-confined observation, static application mapping, evidence-backed static/runtime reconciliation, and provider-owned click/wait scenarios |
| JavaScript runtime | 2 | approved attach-only Node/Electron Inspector target discovery plus bounded script and execution-context observation without evaluation or instrumentation |
| Application workflows | 10 | complete cross-layer traces, unique-only version matching, historical-source to bundle mapping, static export return-shape comparison, approved Linux-isolated extracted-module replay, managed-runtime characterization, reconstruction coverage closure, and deterministic obligation ledgers |
| Session and observation | 22 | target lifecycle, inline Evidence bundle retrieval, aggregate navigation/address context, direct finite replay-machine evaluation, process/artifact/function comparison, evidence-linked residual-unknown lifecycle |
The public interface describes what the agent is trying to learn. Providers decide how to answer. macOS utilities handle common semantic inspection without launching Hopper; Hopper handles deeper native analysis; the process harness implements controlled behavioral capture.
@@ -395,7 +394,6 @@ REA is already useful for native application, browser, and Electron investigatio
- Search and trace features across symbols, strings, metadata, references, and call paths.
- Record every successful result as deterministic Evidence with artifact and provider identity, confidence, authority, limitations, and locations.
- Export and import evidence bundles across sessions.
- Persist automatic cross-version artifact runs as canonical, lock-protected workspaces with tamper-evident revision commitments.
- Capture approved PTY scenarios as Process Capture Evidence, including committed run manifests, raw and rendered terminal frames, scripted interactions, descendant settlement, named filesystem checkpoints, deterministic command shims, and loopback HTTP/WebSocket exchanges.
- Validate finite replay machines without launching a target through `run_replay_machine` or `rea run-replay-machine`; ordered events return typed decisions, actions, captured aliases, transition journals, final state, and exact limit use without echoing request or captured values.
- Compare complete artifact inventories by stable path, content, metadata, and relations; incomplete evidence never implies equivalence.
@@ -539,7 +537,6 @@ current session for bounded `completion/complete` suggestions; see
flowchart LR
Agent["Agent"] --> REA["REA<br/>CLI + MCP"]
Terminal --> REA
REA --> Workspace["Investigation workspace<br/>evidence + artifacts + captures"]
REA --> Session["Target-bound session router"]
Session --> Registry["Deep-provider registry<br/>deterministic selection"]
Registry --> Hopper["Hopper provider"]
@@ -556,7 +553,7 @@ flowchart LR
Artifact --> Target
```
The CLI and MCP server use the same application workflows and evidence contracts. A provider declares which capabilities it supports and the side effects those capabilities may have. Terminal commands are short-lived; an MCP session can retain an active target and evidence ledger across an investigation. Approved persistent workspaces keep canonical Evidence and resumable run checkpoints across both process and session lifetimes.
The CLI and MCP server use the same application workflows and evidence contracts. A provider declares which capabilities it supports and the side effects those capabilities may have. Terminal commands are short-lived; an MCP session can retain an active target and evidence ledger for the session.
## CLI
-39
View File
@@ -661,45 +661,6 @@
"required": ["code", "category", "message", "retryable", "remediation"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"code": { "type": "string", "const": "outside_approved_root" },
"category": {
"type": "string",
"enum": [
"invalid_input",
"permission_required",
"unsupported_provider",
"integrity_mismatch",
"truncated",
"cancelled",
"timeout",
"unavailable",
"execution_failure"
]
},
"message": { "type": "string", "minLength": 1 },
"retryable": { "type": "boolean" },
"remediation": {
"type": "object",
"properties": {
"action": { "type": "string", "minLength": 1 },
"restart_required": { "type": "boolean" },
"elicitation_supported": { "type": "boolean" }
},
"required": ["action", "restart_required"],
"additionalProperties": false
},
"details": {
"type": "object",
"propertyNames": { "type": "string" },
"additionalProperties": { "$ref": "#/$defs/__schema0" }
}
},
"required": ["code", "category", "message", "retryable", "remediation"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
+2 -2
View File
@@ -160,8 +160,8 @@ all four `--left-module-path`, `--left-export-name`, `--right-module-path`, and
`--right-export-name` options to verify an explicit export pair.
Because source Evidence and derived Evidence are retained by the normal session
ledger, evidence bundles, analysis snapshots, and investigation workspaces can
carry these records without another persistence format.
ledger, evidence bundles and analysis snapshots can carry these records without
another persistence format.
## Controlled replay boundary
+1 -1
View File
@@ -45,7 +45,7 @@ REA accepts ordinary `tools/call` progress tokens. Updates are monotonic,
rate-bounded to at most one intermediate update per 100 ms, and always allow a
terminal update. Unknown totals are omitted; REA does not fabricate percentages.
Provider calls receive the request cancellation signal. Artifact traversal,
hashing, cross-version scanning/checkpoints, Hopper requests, and process capture
hashing, version comparisons, Hopper requests, and process capture
check the same signal. Cancellation is distinct from timeout. A cleanup failure
uses `cleanup_incomplete` and lists only the owned resource kinds that remain.
Derived comparisons and reconstruction verification yield before computation
+2 -2
View File
@@ -501,9 +501,9 @@
"mcp_prompts": 6
},
"digests": {
"tools_sha256": "37c7ca2a93d9c78dd5372b88db55626d7ee5474bbb1b82477d14363631d68ddf",
"tools_sha256": "8a5a864d18fa972a8fd9e1ce87e5b42fabca373f88f8e3c3e31991d18ad6d679",
"prompts_sha256": "fa889fc671185ac9c968c6dc8309cf609e709cdc837dbbf39b7cdfadb84ac2d7",
"combined_sha256": "64e291ccdfb45d454eb084b2944e94d5b46fbdec61802cff95ad6bd420125526",
"combined_sha256": "65a7b444b254db1d9122b635ee7d927f7bbf03b534436db1095c83386c438e55",
"providers_sha256": "7247eece8fad09c8023af8d5c682d223d7ed7ebd68eac79e9154962a7e03b66b"
}
}
@@ -1,5 +1,5 @@
{
"manifest_id": "ecm_a1bee6c3a55086b881e35c2b8ce35bf0852d493d356685db7e188dbbdc61ee37",
"manifest_id": "ecm_b0d44c0849214bfcdb88244976706b23a6afb703e937d763df2f37d1a9770dc0",
"verifier": {
"id": "rea-managed-conformance",
"version": "1"
@@ -13,7 +13,7 @@
"skill_digests": [
{
"skill_id": "reverse-engineer-anything",
"sha256": "c04163b8a565e95246f22f083f4923efbc4e4499c15b67858bc5649e2d1bc98b"
"sha256": "a877f1c73ff33976d3d7afb3ff62521f176462096614118cf8b9f2240f3b312c"
}
],
"claims": [
+1 -1
View File
@@ -4,7 +4,7 @@ description: Reverse engineer native, managed, Electron/JavaScript, packaged, an
metadata:
version: "23"
tool_count: 111
catalog_digest: "64e291ccdfb45d454eb084b2944e94d5b46fbdec61802cff95ad6bd420125526"
catalog_digest: "65a7b444b254db1d9122b635ee7d927f7bbf03b534436db1095c83386c438e55"
---
# REA
-1
View File
@@ -95,7 +95,6 @@ export const analysisErrorProjectionSchema = z.discriminatedUnion("code", [
generic("process_capture_failed"),
generic("cleanup_incomplete"),
generic("revision_conflict"),
generic("outside_approved_root"),
generic("configuration_invalid"),
generic("target_unavailable"),
generic("execution_failure"),
-41
View File
@@ -10,7 +10,6 @@ import {
HopperProcessError,
HopperStartError,
HopperTimeoutError,
WorkspaceStorageError,
NoBinaryOpenError,
PermissionRequiredError,
ProviderSelectionError,
@@ -78,8 +77,6 @@ export const analysisErrorCategory = (
return "unavailable";
if (error instanceof ArtifactOperationError)
return artifactErrorCategory(error.reason);
if (error instanceof WorkspaceStorageError)
return workspaceStorageCategory(error.reason);
return STATIC_ERROR_CATEGORIES[error._tag] ?? "execution_failure";
};
@@ -98,21 +95,6 @@ const browserErrorCategory = (
return "execution_failure";
};
const workspaceStorageCategory = (
reason: WorkspaceStorageError["reason"],
): AnalysisErrorProjection["category"] => {
if (
reason === "disabled" ||
reason === "outside-root" ||
reason === "not-file"
)
return "unavailable";
if (reason === "too-large") return "truncated";
if (reason === "invalid-json" || reason === "integrity")
return "integrity_mismatch";
return "execution_failure";
};
const artifactErrorCategory = (
reason: ArtifactOperationError["reason"],
): AnalysisErrorProjection["category"] => {
@@ -156,8 +138,6 @@ export const analysisErrorUserMessage = (error: AnalysisError): string => {
return "Evidence is invalid or has changed. Recreate or re-import it, then try again.";
if (error instanceof EvidenceFileError)
return evidenceFileMessage(error.reason);
if (error instanceof WorkspaceStorageError)
return workspaceStorageMessage(error.reason);
if (error instanceof UnknownRegistryError && error.reason === "not-found")
return "The requested residual unknown does not exist in this session. Check the unknown_id and try again.";
if (error instanceof UnknownRegistryError)
@@ -262,26 +242,6 @@ const evidenceFileMessage = (reason: EvidenceFileError["reason"]): string => {
return "Evidence file could not be accessed. Check file permissions and try again.";
};
const workspaceStorageMessage = (
reason: WorkspaceStorageError["reason"],
): string => {
if (reason === "disabled")
return "Investigation workspace access is disabled. Configure a workspace directory and try again.";
if (reason === "outside-root")
return "Investigation workspace is outside the allowed directory. Choose a configured workspace directory and try again.";
if (reason === "not-file")
return "Investigation workspace path is not a file. Choose a workspace file and try again.";
if (reason === "too-large")
return "Investigation workspace is too large. Reduce its size and try again.";
if (reason === "invalid-json" || reason === "integrity")
return "Investigation workspace is invalid or has changed. Recreate or repair it, then try again.";
if (reason === "locked")
return "Another investigation update is in progress. Try again when it finishes.";
if (reason === "revision-conflict" || reason === "name-conflict")
return "Investigation workspace state changed. Refresh the current state and try again.";
return "Investigation workspace could not be accessed. Check file permissions and try again.";
};
const KNOWN_ERROR_TAGS = {
AnalysisProtocolError: true,
AnalysisInputError: true,
@@ -296,7 +256,6 @@ const KNOWN_ERROR_TAGS = {
ProcessCaptureError: true,
EvidenceIntegrityError: true,
EvidenceFileError: true,
WorkspaceStorageError: true,
UnknownRegistryError: true,
HopperTimeoutError: true,
HopperCancelledError: true,
-20
View File
@@ -17,7 +17,6 @@ import {
HopperProcessError,
HopperRemoteError,
HopperTimeoutError,
WorkspaceStorageError,
PermissionRequiredError,
ProviderAdapterError,
ProviderSelectionError,
@@ -72,8 +71,6 @@ const errorCode = (error: AnalysisError): AnalysisErrorProjection["code"] => {
if (error instanceof ArtifactOperationError)
return artifactOperationCode(error);
if (error instanceof EvidenceFileError) return evidenceFileCode(error.reason);
if (error instanceof WorkspaceStorageError)
return workspaceStorageCode(error.reason);
if (error instanceof UnknownRegistryError)
return unknownRegistryCode(error.reason);
if (error._tag === "ProcessCaptureError") return processCaptureCode(error);
@@ -112,19 +109,6 @@ const evidenceFileCode = (
? "evidence_integrity_mismatch"
: "execution_failure";
const workspaceStorageCode = (
reason: WorkspaceStorageError["reason"],
): AnalysisErrorProjection["code"] => {
if (reason === "revision-conflict" || reason === "name-conflict")
return "revision_conflict";
if (reason === "too-large") return "truncated";
if (reason === "disabled") return "capability_unavailable";
if (reason === "outside-root") return "outside_approved_root";
if (reason === "integrity" || reason === "invalid-json")
return "evidence_integrity_mismatch";
return "execution_failure";
};
const unknownRegistryCode = (
reason: UnknownRegistryError["reason"],
): AnalysisErrorProjection["code"] => {
@@ -149,7 +133,6 @@ type SpecializedErrorTag =
| "ArtifactOperationError"
| "BrowserObservationError"
| "EvidenceFileError"
| "WorkspaceStorageError"
| "PermissionRequiredError"
| "ProcessCaptureError"
| "ProviderSelectionError"
@@ -188,7 +171,6 @@ const staticErrorCode = (
case "ArtifactOperationError":
case "BrowserObservationError":
case "EvidenceFileError":
case "WorkspaceStorageError":
case "PermissionRequiredError":
case "ProcessCaptureError":
case "ProviderSelectionError":
@@ -262,8 +244,6 @@ const artifactStateErrorDetails = (
reason: error.reason,
...(error.reason === "limit" ? { truncated: true } : {}),
};
if (error instanceof WorkspaceStorageError)
return { operation: error.operation, reason: error.reason };
if (error instanceof UnknownRegistryError) return { reason: error.reason };
if (error instanceof EvidenceFileError)
return { operation: error.operation, reason: error.reason };
-25
View File
@@ -39,7 +39,6 @@ const ANALYSIS_ERROR_TAGS = [
"ProcessCaptureError",
"EvidenceIntegrityError",
"EvidenceFileError",
"WorkspaceStorageError",
"UnknownRegistryError",
"HopperTimeoutError",
"HopperCancelledError",
@@ -331,29 +330,6 @@ export class EvidenceFileError extends AnalysisError {
}
}
/** A revisioned workspace could not be read or updated. */
export class WorkspaceStorageError extends AnalysisError {
readonly _tag = "WorkspaceStorageError";
constructor(
readonly operation: "read" | "update",
readonly reason:
| "disabled"
| "outside-root"
| "not-file"
| "too-large"
| "invalid-json"
| "integrity"
| "locked"
| "revision-conflict"
| "name-conflict"
| "io",
options?: ErrorOptions,
) {
super(`Workspace storage ${operation} failed: ${reason}`, options);
}
}
/** Residual-unknown mutation failed a lifecycle, reference, or CAS invariant. */
export class UnknownRegistryError extends AnalysisError {
readonly _tag = "UnknownRegistryError";
@@ -515,7 +491,6 @@ export interface AnalysisErrorProjection
| "process_capture_failed"
| "cleanup_incomplete"
| "revision_conflict"
| "outside_approved_root"
| "configuration_invalid"
| "target_unavailable"
| "execution_failure"
File diff suppressed because one or more lines are too long
@@ -6,7 +6,6 @@ import {
ArtifactOperationError,
EvidenceFileError,
HopperRemoteError,
WorkspaceStorageError,
UnknownRegistryError,
projectAnalysisError,
type AnalysisError,
@@ -32,20 +31,6 @@ describe("analysis error projection contract", () => {
...(["not-file", "exists", "invalid-json", "io"] as const).map(
(reason) => new EvidenceFileError("read", reason),
),
...(
[
"disabled",
"outside-root",
"not-file",
"too-large",
"invalid-json",
"integrity",
"locked",
"revision-conflict",
"name-conflict",
"io",
] as const
).map((reason) => new WorkspaceStorageError("update", reason)),
...(
[
"not-found",