Skip to content

fix(errors): separate recovery actions from failure messages - #4829

Open
prabhuramkarki wants to merge 3 commits into
morluto:mainfrom
prabhuramkarki:fix/actionable-error-remediation
Open

prabhuramkarki wants to merge 3 commits into
morluto:mainfrom
prabhuramkarki:fix/actionable-error-remediation

Conversation

@prabhuramkarki

@prabhuramkarki prabhuramkarki commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Addresses the default error-remediation portion of #4815, item 8. Protocol/output failures, adapter failures, cancellations, and timeouts now return an imperative default recovery action instead of repeating their failure message. Producer-authored messages and explicit remediation retain their existing precedence.

Problem and expected behavior

A plain AnalysisOutputError previously repeated “Analysis returned an unreadable result…” in remediation.action. Its default action now starts “Run rea doctor…”. Custom Ghidra and Kuna messages still direct callers to reopen the target when the current provider or executable identity is lost.

Change and scope

Reuse the error-tag groups in the shared domain presentation owner. Apply generic defaults only after explicit remediation, specialized handlers, and custom producer messages. This preserves existing producer guidance without provider-specific repairs or text parsing. Update the MCP batch-decompile expectation and add projection and Kuna boundary regressions.

Synced the branch with upstream main 39275420e, which includes the existing French README formatting and composed Electron cleanup assertion fixes from #4824.

Contract and boundary impact

  • Semantic owner: analysisErrorRemediationAction; shared CLI/MCP and doctor consumers receive the same defaults.
  • Contribution scope: ordinary usability/correctness fix within existing boundaries; new-capability maintainer decision not applicable.
  • Changes recovery wording for seven default error classes. Schemas, codes, messages, retryability, diagnostic details, authority, and target side effects are unchanged.
  • Provider-specific messages and explicit remediation remain verbatim.

Expected effects:

  • Documentation or usability only; no target interaction.

Evidence and regression coverage

  • Original default-action controls failed before the default change.
  • The earlier PR head reproduced two Ghidra recovery regressions. Review also identified Kuna identity-change recovery supplied only through a custom message.
  • Before the preservation guard, new adapter/output/timeout custom-message controls and a Kuna executable-replacement boundary assertion failed. Existing Ghidra lost-provider assertions also failed.
  • With the shared guard, all 258 focused tests passed across Ghidra behavior, domain projections, projection conformance, MCP batches, Electron launch rejections, and Kuna provider boundaries.
  • Cleanup review follow-up: ProviderCleanupError inherits the adapter tag but supplies its own cleanup-specific message. The same shared guard preserves that message before the generic adapter default. A regression verifies cleanup_incomplete, non-retryability, retained resource ownership, and unchanged cleanup advice; it failed when the guard was removed and passed when restored. No additional producer repair or cleanup remains for this finding.
  • Independent final source review found no remaining findings.

Validation performed

Node 24.18.0 / npm 11.16.0 through npm exec:

  • npm run test:focused -- src/ghidra/GhidraProvider.behavior.test.ts src/domain/analysisErrorProjection.test.ts tests/boundary/mcp/enhancedTools.callPathsAndBatches.test.ts tests/conformance/contracts/analysisErrorProjection.test.ts tests/boundary/process/electronLaunchRejections.test.ts tests/boundary/providers/kuna/kunaProvider.test.ts — 258 passed; runtime artifacts prepared.
  • npm run check — passed, including typecheck, compilation, lint/module boundaries, repository formatting, knip, metadata, and architecture guards.
  • npm run test:local -- src/domain/analysisErrorCleanup.test.ts src/domain/analysisErrorProjection.test.ts — 82 passed after adding the cleanup review regression.
  • git diff --check — passed.
  • npm run test:fast — all 643 source test files passed at production-fix head 61fe76b46: 10,532 tests passed and 8 skipped.

Compatibility, safety, and release

No schema migration, new dependencies, target side effects, or release metadata changes. Ghidra and Kuna provider boundaries used simulated providers; no native Ghidra/Kuna target session or Windows qualification was performed. The complete built/portable repository suite and performance profiling were not run.

GitHub validation status

Upstream CI and readiness are checked separately from these local results. This contributor account cannot approve fork workflow runs or rerun upstream readiness workflows (HTTP 403: repository admin rights required). Upstream CI is action_required with no jobs executed. Readiness remains pending because GitHub reports no upstream commit-to-PR association for the fork head. These statuses must pass before merge; local validation does not replace them.

Author readiness

Human owner: @prabhuramkarki

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

Keep this AI-assisted PR in draft until the human owner completes these declarations.

@prabhuramkarki
prabhuramkarki marked this pull request as ready for review October 19, 2026 08:26
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T08:44:17.348583Z 61fe76b New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge.

Summary

The PR gives default failures separate recovery actions while preserving explicit guidance and producer messages.

  • Analysis errors get recovery actions separate from their failure messages.

Reviews (3) · Last reviewed commit: "test(errors): preserve retained cleanup ..." · Reviewed by Greptile

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8f8242f48f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/domain/analysisErrorPresentation.ts Resolved

@CassieFox23 CassieFox23 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TL;DR: This is a code read. I ran nothing. The change is still needed on main for six of the seven error types, and it applies without conflicts. It needs a rebase first: main has moved on, and two of its new test rows plus one existing test on main would fail.

I read the PR head 373c3b7 against main ad518cf and the merge base 3927542. Main is 2,795 commits past that base.

Should fix

  1. The timeout default can never run on main. Main returns its own timeout recovery for every timeout error. See analysisErrorPresentation.ts line 135 and lines 142 to 147 on main. Both exits come before the spot where the PR adds its checks (lines 264 to 266). So the new "Narrow the request" branch is dead code there. Two new test rows then expect text that main never returns:

    • analysisErrorProjection.test.ts line 586 expects an action that starts with Run, Start or Narrow. Main gives "Inspect any partial Evidence...".
    • Line 603 expects the custom userMessage as the action. Main gives the timeout recovery.

    Main already keeps the timeout action apart from its message. Dropping the timeout branch and those two rows at rebase would fit.

  2. An existing test on main breaks. In WakaruReport.test.ts on main, lines 74 to 76 expect the action to equal the message for a ProviderAdapterError. That test sets no userMessage and no remediationAction. So its message is the standard text, and today its action is the same text. With this PR, the action becomes the new adapter default, so the check fails. The test came in with a0214e0 (#6022) on 22 Oct, after this branch was synced. So you could not have seen it.

Nit

  • The body says seven error classes change. On main it is six, because of finding 1.
  • The body's test counts were taken on 3927542. They say nothing yet about main.
  • Only three checks ran on this head: Greptile, PR readiness and the author declaration. All pass. No build or test job is listed. The body says upstream CI is waiting for approval.
  • The new line if (error.userMessage !== undefined) return error.userMessage; (head line 141) returns the message alone. The old fallback adds a sentence for a caller that keeps going (main lines 382 to 390). Is that drop on purpose? I did not look for a producer that sets that sentence without a remediationAction.

Looks good

  • It is still needed. Line 266 on main still falls back to analysisErrorUserMessage. Main's batch decompile test shows the message and the action as the same text for AnalysisOutputError (lines 620 to 624 of enhancedTools.callPathsAndBatches.test.ts).
  • The order matches the body. A set remediation wins first, then the special cases. Then comes the producer's userMessage, and last the defaults.
  • ProviderCleanupError sets its own userMessage (lines 11 and 12 of providerCleanupError.ts). So the guard keeps its cleanup text. A new test pins that (analysisErrorCleanup.test.ts, line 19).
  • Kuna sets a "reopen the target" userMessage (KunaCommand.ts line 217 on main), and the guard keeps it. The new Kuna check pins that. By my read it also passed before this change. So it guards against a regression rather than proving a fix.
  • I applied the PR diff to main's five files with patch --dry-run. There were no rejects. Some hunks landed with offsets and fuzz.

Not run

  • No tests, no typecheck, no build. Only a run of test:fast on the rebased branch settles whether it passes. My two test findings come from reading the code paths.
  • I did not search for other tests on main that compare an action to a message for the changed tags. I found the Wakaru one by grep, so there could be more.
Where I looked
Tree File Lines
Head 373c3b7 src/domain/analysisErrorPresentation.ts 85, 141–151
Head 373c3b7 src/domain/analysisErrorProjection.test.ts 579–640
Head 373c3b7 src/domain/analysisErrorCleanup.test.ts 19
Main ad518cf src/domain/analysisErrorPresentation.ts 130–147, 264–266, 382–390, 579–619
Main ad518cf src/javascript/recovery/WakaruReport.ts 108–125, 156–170
Main ad518cf src/javascript/recovery/WakaruReport.test.ts 74–76
Main ad518cf src/kuna/KunaCommand.ts 217
Main ad518cf tests/boundary/mcp/enhancedTools.callPathsAndBatches.test.ts 620–624

Main has changed analysisErrorPresentation.ts in 30 commits since 3927542. The function now takes a caller lifetime. The PR branch does not have it.

🤖 Written with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants