Skip to content

refactor(process): compose supervision and provider-client cleanup failures through the shared owner - #10905

Merged
morluto merged 10 commits into
mainfrom
refactor/process-cleanup-composition
Nov 15, 2026
Merged

morluto merged 10 commits into
mainfrom
refactor/process-cleanup-composition

Conversation

@morluto

@morluto morluto commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Moves 10 process-supervision and provider-client sites in 6 files onto the shared composition from #10900, analysisErrorWithCleanupDependencies(primary, cleanup, operation). Each site composed a failure with its cleanup failure and bound exactly those two parts by hand; the shared owner now does both. None of the 6 files has a direct bindCleanupDependencies() call left.

Problem and expected behavior

103 production sites write analysisErrorWithCleanupFailure(p, c, op).bindCleanupDependencies([p, c]): the composition and the rule that it completes from its parts live at every caller. The counted cleanup-dependency-binding guard can only shrink once a shared owner exists for that rule.

Expected: one owner composes the error and binds its parts; callers state only which failures they compose. Behavior is unchanged: the same dependencies are bound in the same order.

Change and scope

  • src/process/capture/FilesystemSnapshot.ts, ProcessCaptureLifecycle.ts, ProcessHarness.ts (2), src/process/DarwinProcessRunTokenReader.ts (2), src/providers/AnalysisClientCreation.ts (3), src/providers/OwnedCommandCleanup.ts: mechanical rewrite of analysisErrorWithCleanupFailure(p, c, op).bindCleanupDependencies([p, c]) to analysisErrorWithCleanupDependencies(p, c, op); imports updated.
  • Counted cleanup-dependency-binding baseline: the 6 entries are removed.

Not included: ArtifactAnalysisResources.ts and runOwned.ts (open in #10653 and the capture-classifier stack), other families.

Stacked on #10902.

Contract and boundary impact

  • Semantic owner and earliest changed stage: analysisErrorCleanup.ts owns the composition; process supervision and provider clients consume it.
  • Contribution scope fit and linked maintainer decision: not applicable (internal refactor; coordinator decision for plan W4 item 4).
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): unchanged; same parts bound, same order.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

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: none; behavior-preserving (the same two parts are bound in the same order).
  • Base reproduction or other evidence: node scripts/verify/architecture-guards.mjs --shrink-baselines lowered the counted baseline as listed; the guard passes.
  • User-visible CLI/MCP output (if applicable): none.
  • Remaining proof gaps: no real-provider run.

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

  • npm run check:fast — passed.
  • node scripts/verify/architecture-guards.mjs — passed.
  • npm run test:focused -- src/process/capture/FilesystemSnapshot.test.ts src/process/capture/ProcessCaptureLifecycle.test.ts src/process/capture/ProcessHarness.test.ts src/process/DarwinProcessRunTokenReader.finalization.test.ts src/process/DarwinProcessRunTokenReader.timeout.test.ts src/providers/OwnedCommandCleanup.test.ts tests/boundary/mcp/processCaptureCleanupSchema.test.ts tests/boundary/process/darwinProcessRunTokenReader.test.ts tests/boundary/process/processCaptureLifecycle.test.ts tests/boundary/providers/ownedCommandCleanup.test.ts tests/process-global/darwinCompilerCleanup.test.ts — 11 files, 163 passed, 4 skipped.
  • npm run test:focused -- src/application/binary/DeferredAnalysisClient.test.ts (the only consumer of AnalysisClientCreation) — 18 passed.

Rebased onto main after #11316 (0e7a2b8). The earlier stack commits are already on main through #10744 and #10855. This branch now holds only this PR's commit. AnalysisClientCreation.ts keeps main's cancelledBy/closedAnalysisClientError imports and imports analysisErrorWithCleanupDependencies. The baseline removals moved into scripts/verify/baselines/cleanup-dependency-binding.json.

  • node scripts/verify/architecture-guards.mjs --shrink-baselines passed. It removed the same 6 entries this PR removed before.
  • npm run check:fast passed.
  • npm run test:local -- src/providers/OwnedCommandCleanup.test.ts src/application/process/ProcessScenarioPreparation.test.ts src/native/NativeCommandAnalysisError.test.ts passed 23 tests.

Compatibility, safety, and release

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

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-15T21:49:34.831754Z
We couldn’t complete this review. Comment @codex review to try again.
aaf3142 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 Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] This PR appears safe to merge; no actionable new issues were found.

Summary

Centralizes cleanup-error composition across process, provider, application, and server code. It also gives Hopper session and launcher cleanup separate retry releases.

  • Callers share one helper for composing a failure with the cleanup that followed it.
  • Close failures keep unknown cleanup status visible until their owners confirm release.
  • Hopper close retries confirm session and launcher cleanup separately.
  • Resource imports are grouped together without changing what the code does.

These changes remain absent from the target branch, so the PR is not fully superseded there. No actionable new issues were found.

Validation: source review and git diff --check passed. Tests were not run during this review.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Caller failures] --> B{Close completion known?}
  B -->|Live cleanup records| C[Follow both failures]
  B -->|Unknown close outcome| D[Keep cleanup pending]
  E[Hopper session cleanup succeeds] --> F[Confirm session release]
  G[Hopper launcher cleanup succeeds] --> H[Confirm launcher release]
  F --> C
  H --> C
  C --> I[Complete only when both parts release]
Loading

Reviews (12) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

Base automatically changed from refactor/application-cleanup-composition to refactor/android-cleanup-composition November 15, 2026 11:11
Base automatically changed from refactor/android-cleanup-composition to refactor/desktop-release-claims November 15, 2026 11:11
@morluto
morluto changed the base branch from refactor/desktop-release-claims to main November 15, 2026 12:06
@morluto
morluto force-pushed the refactor/process-cleanup-composition branch from ed08e74 to 0e7a2b8 Compare November 15, 2026 16:25
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

@greptileai please review the latest commit (0e7a2b8). The last review covered ed08e74; since then the stack was rebased onto main and #10917/#10920 are folded in through #10908.

…res through the shared owner (#10908)

* refactor(native): compose LLDB, native UI and signature cleanup failures through the shared owner

* refactor(server): compose close, reset and session-status cleanup failures through the shared owner (#10915)

* refactor(dotnet): compose managed snapshot cleanup failures through the shared owner (#10917)

* refactor(dotnet): compose managed snapshot cleanup failures through the shared owner

* refactor(flutter): compose build cleanup failures through the shared owner (#10918)

* refactor(flutter): compose build cleanup failures through the shared owner

* refactor(apple): compose asset catalog and keyed archive cleanup failures through the shared owner (#10919)

* refactor(ghidra): join session cleanup failures through the shared owner (#10920)

* refactor(ghidra): join session cleanup failures through the shared owner

* refactor(desktop): compose build-setup cleanup failures through the shared owner (#10921)

* refactor(desktop): compose build-setup cleanup failures through the shared owner

* refactor(cutter): compose bridge service cleanup failures through the shared owner (#10922)

* refactor(cutter): compose bridge service cleanup failures through the shared owner

* refactor(electron): compose fuse and file-scope cleanup failures through the shared owner (#10923)

* refactor(electron): compose fuse and file-scope cleanup failures through the shared owner

* refactor(browser): compose scenario, web-bundle and capture cleanup failures through the shared owner (#10924)

* refactor(application): compose uninstall, session retirement and decompile-all cleanup failures through the shared owner (#10933)

* refactor(application): compose uninstall, session retirement and decompile-all cleanup failures through the shared owner

* refactor(ghidra): compose Java probe, NativeAOT snapshot and provider-client cleanup failures through the shared owner (#10927)

* refactor(ghidra): compose Java probe, NativeAOT snapshot and provider-client cleanup failures through the shared owner

* refactor(hopper): compose provider close cleanup failures through the shared owner (#10928)

* refactor(hopper): compose provider close cleanup failures through the shared owner

* refactor(javascript): compose analysis worker runtime and inspection failures through the shared owner (#10929)

* refactor(javascript): compose analysis worker runtime and inspection failures through the shared owner

* refactor(kuna): compose project-cache and target-command cleanup failures through the shared owner (#10930)

* refactor(kuna): compose project-cache and target-command cleanup failures through the shared owner

* refactor(native): compose macOS provider, pwndbg and pwntools cleanup failures through the shared owner (#10931)

* refactor(native): compose macOS provider, pwndbg and pwntools cleanup failures through the shared owner

* refactor(wasm): compose WABT artifact cleanup failures through the shared owner (#10932)

* refactor(wasm): compose WABT artifact cleanup failures through the shared owner

* refactor(application): compose analysis-view cancellation and retained-content cleanup failures through the shared owner (#10941)

* refactor(application): compose analysis-view cancellation and retained-content cleanup failures through the shared owner

* refactor(kuna): compose span-close cancellation cleanup through the shared owner (#10942)

* refactor(decompile): bind the initialization failure with its cleanup through the shared owner (#10965)

* refactor(decompile): bind the initialization failure with its cleanup through the shared owner

* refactor(cli): bind environment serve listener and close failures through the shared owner (#10966)

* refactor(cli): bind environment serve listener and close failures through the shared owner

* refactor(kuna): bind project export and span-read failures with their cleanup through the shared owner (#10967)

* refactor(kuna): bind project export and span-read failures with their cleanup through the shared owner

* refactor(cutter): bind descriptor read failures with their cleanup through the shared owner (#10968)

* refactor(cutter): bind descriptor read failures with their cleanup through the shared owner

* refactor(ida): bind workspace file failures with their cleanup through the shared owner (#10969)

* refactor(ida): bind workspace file failures with their cleanup through the shared owner

* refactor(rizin): bind debug finalization failures with their cleanup through the shared owner (#10970)

* refactor(rizin): bind debug finalization failures with their cleanup through the shared owner

* refactor(application): compose close rejections with unknown completion through one owner (#10971)

* refactor(application): compose close rejections with unknown completion through one owner

* refactor(hopper): compose startup and launcher close rejections through the shared owner (#10972)

* refactor(hopper): compose startup and launcher close rejections through the shared owner

* refactor(desktop): compose task-file close rejections through the shared owner (#10973)

* fix(hopper): confirm reported close failures when a later close of the client succeeds

* fix(hopper): keep owned close failures reading their own owner on retry

HopperClient bound every failed close part to its client retry, so a launcher
aggregate that already follows its child failures stayed pending after the
launcher released them. AnalysisCleanupRelease.bindUnowned now owns the rule
that a retry claims only ownerless failures; BinarySession's local copy of it
is removed.

* fix(hopper): release each close part's earlier failures when that part succeeds

One shared retry release made the session part's earlier failures wait for
the launcher part too, so a later close whose session cleanup succeeded kept
reporting the session's released resources. HopperClient keeps one release per
part (session, launcher), and each part confirms its own failures when it
succeeds.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

@greptileai please review the latest commit: the branch was rebased on main after #11316 split the guard baselines into per-guard files, and the latest score predates that push.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

# Conflicts:
#	src/application/binary/BinarySession.ts
#	src/browser/history/CaptureFailures.ts
#	src/dotnet/ManagedSnapshot.ts
#	src/flutter/FlutterBuildProvider.ts
#	src/ghidra/GhidraProviderClient.ts
#	src/javascript/analysis/JavaScriptAnalysisWorker.ts
#	src/kuna/KunaProjectCache.ts
#	src/kuna/KunaProjectExport.ts
#	src/native/LldbCallTracer.ts
#	src/providers/OwnedCommandCleanup.ts
#	src/server/registerResetInvestigationTool.ts
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

# Conflicts:
#	src/artifacts/MachOSliceArtifactReader.ts
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

# Conflicts:
#	src/cutter/CutterBridgeClient.ts
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

…nup-composition

# Conflicts:
#	scripts/verify/baselines/cleanup-dependency-binding.json
@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

@greptileai review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

…nup-composition

# Conflicts:
#	src/artifacts/NodeSeaArtifactReader.ts
@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

@greptileai review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

…nup-composition

# Conflicts:
#	src/artifacts/ArtifactHash.ts
#	src/artifacts/DotnetBundleArtifactReader.ts
#	src/artifacts/PyInstallerArtifactReader.ts
#	src/artifacts/deno/DenoVirtualFs.ts
#	src/artifacts/extraction/ArtifactExtraction.ts
#	src/artifacts/pyinstaller/PyInstallerPyzStore.ts
#	src/resources/StableRootArtifact.ts
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

…nup-composition

# Conflicts:
#	src/artifacts/InesArtifactReader.ts
@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

@greptileai review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto
morluto merged commit cd1b35b into main Nov 15, 2026
7 checks passed
@morluto
morluto deleted the refactor/process-cleanup-composition branch November 15, 2026 21:54
@morluto morluto added the area: runtime Process capture and runtime observation label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant