Skip to content

refactor(ghidra): let Ghidra cleanup errors read the client's and checkpoint's release - #10802

Merged
morluto merged 1 commit into
refactor/darwin-helper-release-claimsfrom
refactor/ghidra-release-claims
Nov 15, 2026
Merged

morluto merged 1 commit into
refactor/darwin-helper-release-claimsfrom
refactor/ghidra-release-claims

Conversation

@morluto

@morluto morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Summary

Moves Ghidra's client and checkpoint cleanup completion onto the read-side model from #10744: each cleanup failure is bound to an AnalysisCleanupRelease that the owner confirms when a later close or retry releases everything, instead of the owner keeping a set of failures and pushing resolveCleanup() to each. Fourth owner-family slice of #10763's baseline.

Problem and expected behavior

GhidraClient collected every cleanup failure in #cleanupFailures and called resolveCleanup() on each after a successful close; GhidraCheckpoint.retryCleanup() did the same for checkpoint file removal failures. Expected behaviour is unchanged: those errors report incomplete cleanup until the owner releases everything, then complete; failures from a later cycle report against a fresh release.

Change and scope

Stacked on #10801 (Darwin helper slice, which adds AnalysisCleanupRelease), on #10789, on #10744.

Contribution scope: not applicable (internal refactor within existing boundaries).

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: the Ghidra client and checkpoint own release; AnalysisError.cleanupIncomplete reads it.
  • Contribution scope fit and linked maintainer decision: not applicable.
  • 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): close and retry order unchanged; Ghidra databases stay ephemeral and executable bytes untouched.
  • Generated metadata, package, or installation impact: none.
  • 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: none; tests/boundary/providers/ghidra/ghidraClient.test.ts already requires retained cleanup failures to become complete after a later close or retry (for example lines 408-820 assert cleanupIncomplete false after release).
  • Base reproduction or other evidence: refactor; no behaviour change intended.
  • User-visible CLI/MCP output (if applicable): not applicable.
  • Remaining proof gaps: no real Ghidra run.
  • Tests added or updated:
  • Base reproduction or other evidence:
  • User-visible CLI/MCP output (if applicable):
  • Remaining proof gaps:

For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant 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

  • npm run check:fast — passed.
  • node scripts/verify/architecture-guards.mjs --shrink-baselines — passed (baseline lowered).
  • npm run test:local -- src/ghidra/GhidraCheckpoint.test.ts src/ghidra/GhidraProvider.behavior.test.ts src/ghidra/GhidraSessionError.test.ts src/ghidra/GhidraRequestQueue.test.ts — 353 passed.
  • npm run test:focused -- tests/boundary/providers/ghidra/ghidraClient.test.ts tests/boundary/providers/ghidra/ghidraFileFailure.test.ts tests/boundary/providers/ghidra/ghidraLaunchOutcome.test.ts — 123 passed.
  • Pre-push hook passed. macOS arm64.
  • command — result

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: simulated Ghidra bridge only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new effects.
  • 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.

…ckpoint's release

GhidraClient and GhidraCheckpoint bind each cleanup failure to an AnalysisCleanupRelease and confirm it when a later close or retry releases everything, instead of keeping a set of failures and pushing resolveCleanup() to each. Removes two resolveCleanup() calls; the counted baseline shrinks.
@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T06:18:13.053577Z 793fba6 PR opened
ℹ️ 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

[Low impact] The PR appears safe to merge; no actionable failures were found.

Summary

Replaces Ghidra cleanup-failure sets with shared release objects. Existing errors read completion from their owner instead of receiving a completion update.

  • Ghidra client cleanup errors read whether the client has finished cleanup.
  • Checkpoint removal errors read whether the checkpoint has finished cleanup.

Reviews (1) · Last reviewed commit: "refactor(ghidra): let Ghidra cleanup err..." · Reviewed by Greptile

@morluto
morluto merged commit c820d43 into refactor/darwin-helper-release-claims Nov 15, 2026
1 check passed
@morluto
morluto deleted the refactor/ghidra-release-claims branch November 15, 2026 08:17
morluto added a commit that referenced this pull request Nov 15, 2026
…s release (#10801)

* refactor(errors): read cleanup completion from dependencies instead of pushing it to dependents

AnalysisError.cleanupIncomplete becomes a getter over the error's own unresolved state and its bound dependencies. The WeakRef dependents graph and resolveCleanup's push propagation are removed, and subclasses mark their initial state through markCleanupIncomplete instead of overriding a public mutable field.

* fix(errors): settle bound dependencies before binding more

A composite whose dependencies had released but whose status was never read
stayed incomplete when a later dependency was bound.

* refactor(errors): let errors read a lease group's release instead of resolving them (#10759)

AnalysisCleanupLeaseGroup no longer calls resolveCleanup() on its error.
The error holds the group as a release claim and reads cleanupReleased when
asked, so completion follows the lease owner without a push.

* chore(verify): count resolveCleanup and bindCleanupDependencies calls so they only shrink (#10763)

* refactor(errors): let errors read a lease group's release instead of resolving them

AnalysisCleanupLeaseGroup no longer calls resolveCleanup() on its error.
The error holds the group as a release claim and reads cleanupReleased when
asked, so completion follows the lease owner without a push.

* chore(verify): count resolveCleanup and bindCleanupDependencies calls so they only shrink

* refactor(process): let worker cleanup errors read their root epoch's release

OwnedWorkerRuntime's root epoch is now an AnalysisCleanupReleaseClaim. Errors bound to it read its release when asked instead of the epoch pushing resolveCleanup() through weak references, and a runtime without a retained root binds an already-released owner. Removes the OwnedWorkerCleanupFailure structural type and four resolveCleanup() pushes; the counted baseline shrinks accordingly.

* refactor(pcap): let pcap cleanup errors read command and snapshot release (#10792)

Retained pcap commands, retained snapshot failures and snapshot completion descriptors now own their release and errors read it: commands and snapshot failures implement AnalysisCleanupReleaseClaim, and a failed completion-descriptor close is retried through an AnalysisCleanupLease bound to its error. Removes four resolveCleanup() pushes; the counted baseline shrinks accordingly.

* refactor(process): let Darwin helper cleanup errors read their owner's release

Darwin helper cache and run-token reader root cleanup now record an AnalysisCleanupRelease that every failure reports; a successful retry confirms it. Replaces the first-failure anchor that later failures depended on and the resolveCleanup() push. Removes two resolveCleanup() and two bindCleanupDependencies() calls; both counted baselines shrink.

* refactor(ghidra): let Ghidra cleanup errors read the client's and checkpoint's release (#10802)

GhidraClient and GhidraCheckpoint bind each cleanup failure to an AnalysisCleanupRelease and confirm it when a later close or retry releases everything, instead of keeping a set of failures and pushing resolveCleanup() to each. Removes two resolveCleanup() calls; the counted baseline shrinks.
@morluto morluto added area: domain Domain logic, errors, and pure functions provider: ghidra Analysis provider / engine: ghidra labels Nov 22, 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 provider: ghidra Analysis provider / engine: ghidra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant