Repository navigation
fix(lifecycle): preserve ownership, cancellation, and cleanup outcomes - #4238
Conversation
Keep cleanup remediation through combined errors and direct or managed one-shot analysis while retaining primary diagnostics. Refs: #4227
Authenticate initial and cleanup handshakes through the same identity owner. Expose startup and cleanup activity, retain health after target retirement, and expire abandoned unauthenticated listeners without timing out authenticated work. Refs: #4227
Preserve observed child health with incomplete peer coverage, retry only unresolved clients, and retain all child cleanup recovery actions. Refs: #4233
Check the request signal after cleanup and before final publication, retaining completed observations under typed cancellation. Refs: #4005
Publish failed-launch process identity and observed exit separately from object validity. Retire only the exact owned process and retain uncertainty when exit cannot be established. Refs: #4232
Check cancellation after runtime-root cleanup and retain collected trace observations as partial cancellation evidence. Refs: #4009
Reuse the existing one-shot finalizer across thirteen command families to retain completed Evidence and primary diagnostics on close failure. Cover success, denied cleanup, and combined primary/cleanup failure through the public CLI. Refs: #3935
Document distinct ownership/readiness/exit facts, late cancellation and atomic publication boundaries, partial child cleanup, and diagnostic retention. Link representative regressions and route contributor guidance through AGENTS.md. Refs: #4227
|
Follow-up probing of this PR head confirmed separate remaining cases: Android late-cancellation classification (#3927), firmware late-cancellation classification (#3923), concurrent Ghidra startup cancellation ownership (#3983), and loss of original cleanup-resource diagnostics in direct CLI error composition (new #4240). The fresh results and controls are recorded in the lifecycle audit #4227. These probes used compiled production services/clients with controlled provider boundaries; they do not establish real-engine frequency. No source changes were added to this PR during the follow-up pass, and these cases are not claimed fixed here. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6e64a09a3f
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
[High impact] The PR appears safe to merge; both previous findings are addressed and no new blocking issue was found. SummaryThe PR preserves ownership and collected facts across startup, cancellation and cleanup.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
Run["Provider run"] --> Retire["Retire target"]
Retire --> Close{"Cleanup succeeds?"}
Close -->|No| Retain["Keep client, route and run ID"]
Retain --> Close
Close -->|Yes| Clear["Clear retained run"]
Reviews (3) · Last reviewed commit: "fix(providers): report retained cleanup ..." · Reviewed by Greptile |
Summary
Preserve lifecycle facts from provider startup through cancellation and cleanup. A late handshake, cancelled finalization, failed launch, or partially successful close now retains the observations and ownership needed to explain the outcome and recover.
Fixes #4232, #4233, #4005, #4009, #3935, #4240. Related audit: #4227.
Problem and expected behavior
cleanup_incompleteChange and scope
The initial eight semantic commits repair the producing boundaries and their consumers. Four review follow-ups keep client, route and run ID together through retirement, failed startup and restoration; preserve original cleanup-resource diagnostics alongside the later close assessment; reuse the canonical native result projection to retain completed facts on finalization failure; and emit typed Flutter/web cleanup errors at their resource owners, preserving paths, causes and recovery actions through service composition. Thirteen CLI command families reuse the existing
finishAnalysisCommand; shared error composition preserves cleanup recovery actions. Design/testing docs define the lifecycle invariants, synchronized failure scenarios and atomic-publication exception, with anAGENTS.mdpointer.The initial eight-commit series was replayed on main
e2db76801;git range-diffconfirms patch equivalence to the audited series. Static checks and focused regressions are revalidated on that base below.Ordinary fixes within existing provider authorities. A new-provider/protection-recovery scope decision is not applicable. The cross-provider audit remains open for unavailable platforms and engines.
Contract and boundary impact
binary_session.cleanup_pending; retained client health/activity/lineage remains visible under its originalanalysis_run.run_idafter target retirement. Confirmed cleanup clears that run; replacements receive a fresh ID. Cancelled finalization returns typed failure; cleanup failure preserves partial observations. Existing named tools and inputs remain unchanged.Effects below describe the existing workflows touched, not expanded authority.
Evidence and regression coverage
Executed reproductions at
bde139c5d:cancelled, with observed target exit 0 retained as partial data and root removal confirmed. Non-aborted control succeeds.UNKNOWN, losing its completed result. The repaired fault/control regression retains valid completed observations or combined primary/cleanup diagnostics. This is not real WABT verification.eStateExitedprocess. The native-call verifier failed before repair and passes afterward.Detailed executed audit evidence and limits: audit record.
Validation performed
Host: macOS 26.3 arm64, Node 24.18.0; matching local toolchain used throughout.
npm run test:focusedwith 25 exact lifecycle/schema/CLI/acceptance paths: 169 passed, one existing skip on the PR branch. Includes whole-catalog SDK-converted schema validation, process CLI/MCP cancellation, Hopper recovery, composite ownership, LLDB failures, SQLite parity and controlled public CLI cleanup denial.3bd6c99ce: 89 focused tests passed across seven files, including public MCP close/retry/status, failed startup/restoration ownership, direct cleanup-diagnostic controls, public CLI cleanup denial and schema validation.npm run check,npm run docs:check(five README tests) andnpm run check:fastpassed. The new assertions first failed on the old implementation. Provider outcomes are controlled seams; no additional real-engine run is claimed.b3f328f9d: 158 focused tests passed across 15 files, covering native finalization, Flutter/web retained cleanup and final CLI projection, mixed-owner resources/recovery actions, CLI/MCP workflows and the whole-catalog schema gate. Full static checks, docs checks (five README tests) and final pre-push checks passed. Native finalization uses the completed result schema's optional facts; journal-only failures continue to omit unreported facts.node scripts/verify-native-calls.mjspassed on Apple LLDB 2100.0.17.108 through CLI and stdio MCP (six events; exited/event-limit/duration-elapsed; hardened-runtime denial and get-task-allow success). Late-cancellation and cleanup fault timing remain controlled regressions, distinct from this real-engine control lane.python3 -m unittest discover -s bridge/native -p test_rea_lldb_tracer.py: 13 passed, including failed termination without inferred exit.npm run check: passed;npm run check:fast: passed again before each push.npm run docs:check: passed, including five README tests;npm run docs:build: passed after the documentation update;git diff --check: passed.Real-provider results below were executed during the audit of the patch-equivalent series; they were not rerun after replay onto main:
npm run verify:native-calls: passed, Apple LLDB 2100.0.17.108, real CLI/stdio MCP, exit/event/duration limits and hardened-runtime denial/get-task-allow controls.verify:ghidrapassed on Ghidra 12.1.4/JDK21 (373 successful, 52 rejected calls);verify:browserpassed on Chrome 155/Playwright 1.58.2;verify:inspectorpassed on disposable Node targets.verify:native-uiinitially had a window-geometry mismatch, then passed on rerun.Compatibility, safety, and release
/procrequirement on Darwin. Frida CLI binding was missing and disposable MCP spawn denied attach. Windows/Linux real-provider coverage remains unknown.Author readiness
Human owner: @morluto (PR author; declarations left for human completion).
Before merge
type(scope): outcome.