-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Tech-Debt]: Use of generic Error for process exit simulation causes swallowed control-flow exceptions #97796
Copy link
Copy link
Closed
Labels
P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.Low-priority cleanup, docs, polish, ergonomics, or speculative work.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.no-staleExclude from stale automationExclude from stale automation
Description
Metadata
Metadata
Assignees
Labels
P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.Low-priority cleanup, docs, polish, ergonomics, or speculative work.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.no-staleExclude from stale automationExclude from stale automation
Type
Fields
Priority
None yet
What Problem This Solves
In the CLI runtime environment,
createNonExitingRuntime()simulates a process exit by throwing a genericnew Error("exit ${code}"). This is a dangerous anti-pattern because upstreamtry-catchblocks designed to catch real runtime crashes will accidentally catch this control-flow signal, logging it as a bug rather than terminating the CLI command.Expected vs Actual Behavior
Expected: The runtime should throw a specific subclass (e.g.,
class ExitError extends Error) so upstream callers can explicitly checkif (err instanceof ExitError)and respect the simulated exit.Actual: It throws a generic
Error.Code Link
https://github.com/openclaw/openclaw/blob/main/src/runtime.ts#L98-L105
Proposed Solution
Introduce a strongly-typed
ExitErrorclass inruntime.tsand updatecreateNonExitingRuntimeto throw it.