Skip to content

fix(application): surface web resource cleanup errors via tagged error algebra - #3492

Closed
mohsinkhandevs wants to merge 1 commit into
morluto:mainfrom
mohsinkhandevs:fix/web-resource-cleanup-error-algebra
Closed

mohsinkhandevs wants to merge 1 commit into
morluto:mainfrom
mohsinkhandevs:fix/web-resource-cleanup-error-algebra

Conversation

@mohsinkhandevs

Copy link
Copy Markdown

Summary

Problem and expected behavior

Change and scope

Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.

Contract and boundary impact

  • Semantic owner and earliest changed stage:
  • Contribution scope fit and linked maintainer decision:
  • CLI and MCP/tool-catalog contract:
  • Provider, bridge, target-format, or platform compatibility:
  • Evidence, artifact, provenance, or reconstruction contract:
  • Target selection, authority, upstream behavior, and cleanup details (if applicable):
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs):

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:
  • Base reproduction or other evidence:
  • User-visible CLI/MCP output (if applicable):
  • Remaining proof gaps:

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

  • command — result

Compatibility, safety, and release

  • Breaking changes or migration steps:
  • Real Hopper/Ghidra, browser, or OS coverage:
  • Package or release metadata impact:
  • Security, privacy, process, or containment review:

Author readiness

Human owner:

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

Copilot AI balanced review requested due to automatic review settings October 14, 2026 13:03
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@greptile-apps

greptile-apps Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with the existing non-blocking loss of cleanup details still outstanding.

Findings

  1. P2 Cleanup reasons disappear ▶
Fix with agent prompt
### Issue 1
src/application/closeOwnedWebResources.ts:13-16
`SourceMapCleanupFailure` stores failed stop/delete reasons in `diagnostics.cleanup_failures`, not `cleanup.reason`. This branch substitutes the generic adapter message, and the new wrapper drops the original diagnostics. `projectAnalysisError` does not recover them from `cause`.

When the final cleanup retry fails differently, CLI users lose the latest reason and process details needed to diagnose leftover resources. Preserve each owner's caller-safe diagnostics in the combined error and use its reported cleanup reasons.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Web cleanup failures now use ProviderCleanupError, and both web CLI commands use finishAnalysisCommand.

  • Web cleanup failures now carry provider and resource details.
  • Web trace commands keep results visible when cleanup fails.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Web CLI command] --> B[Run trace]
  B --> C[Close all cleanup owners]
  C --> D{Cleanup failed?}
  D -->|No| E[Return evidence or primary error]
  D -->|Yes| F[Create ProviderCleanupError]
  F --> G[Keep evidence or primary error]
  G --> H[Return cleanup failure details]
Loading

Reviews (2) · Last reviewed commit: "fix(application): surface web resource c..." · Reviewed by Greptile

Comment on lines +13 to +16
if (cause instanceof AnalysisError) {
return {
reason: cause.cleanup?.reason ?? cause.message,
resources: cause.cleanupResources,

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.

P2 Cleanup reasons disappear

SourceMapCleanupFailure stores failed stop/delete reasons in diagnostics.cleanup_failures, not cleanup.reason. This branch substitutes the generic adapter message, and the new wrapper drops the original diagnostics. projectAnalysisError does not recover them from cause.

When the final cleanup retry fails differently, CLI users lose the latest reason and process details needed to diagnose leftover resources. Preserve each owner's caller-safe diagnostics in the combined error and use its reported cleanup reasons.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/application/closeOwnedWebResources.ts
Line: 13-16

Comment:
**Cleanup reasons disappear**

`SourceMapCleanupFailure` stores failed stop/delete reasons in `diagnostics.cleanup_failures`, not `cleanup.reason`. This branch substitutes the generic adapter message, and the new wrapper drops the original diagnostics. `projectAnalysisError` does not recover them from `cause`.

When the final cleanup retry fails differently, CLI users lose the latest reason and process details needed to diagnose leftover resources. Preserve each owner's caller-safe diagnostics in the combined error and use its reported cleanup reasons.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@morluto

morluto commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Source-derived audit against pinned main 4ed33efb0cc993895cf4b4c74049f939f08888c2: da357c038 implements tagged web-workflow cleanup errors and updates both web workflow services/CLI paths. The shared cleanup owner and MCP cleanup coverage are present on pinned main. Closing as superseded; this audit did not run tests or claim runtime verification.

@morluto morluto closed this Oct 25, 2026
@morluto morluto reopened this Oct 25, 2026
@morluto

morluto commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Correction to my earlier closure: pinned main does implement shared tagged cleanup aggregation and caller finalization, but this PR also carries meaningful web-specific provider/operation attribution and cleanup-detail extraction that I did not verify in main. I reopened the PR because that portion remains unrepresented. Source comparison: https://github.com/morluto/rea/blob/4ed33efb0cc993895cf4b4c74049f939f08888c2/src/application/closeOwnedWebResources.ts and https://github.com/morluto/rea/blob/4ed33efb0cc993895cf4b4c74049f939f08888c2/src/domain/providerCleanupError.ts.

@morluto morluto added area: domain Domain logic, errors, and pure functions bug Something isn't working labels Nov 23, 2026
@morluto

morluto commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Thank you for this fix! Surfacing web resource cleanup failures via ProviderCleanupError and the tagged error algebra has already landed on main in src/application/closeOwnedWebResources.ts (via f65a98f9ad and b2bb427553 / #12589), which wraps non-AnalysisError cleanup rejections in ProviderCleanupError and aggregates multi-owner failures via providerCleanupErrorFromCloseRejections for both WebModuleTraceService and WebSourceLocationService. Closing as already landed.

@morluto morluto closed this Nov 24, 2026
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