Repository navigation
Conversation
…alysisErrorWithCleanupDependencies The desktop capture CLI built a cleanup composite with analysisErrorWithCleanupFailure and then bound both parts as dependencies by hand. The close path collects at most two failures (SQLite close and the export worker retry), so binding `typed` is exactly binding the primary and cleanup parts, which is what analysisErrorWithCleanupDependencies owns. Removes src/cli/desktopCaptureCommands.ts from the cleanup-dependency-binding baseline (45 files / 76 sites). Refs morluto#11859 Co-Authored-By: Claude Opus 5.5 <[email protected]>
[Medium impact] The change is limited to cleanup composition in desktop CLI operations. Keep this PR unmerged until the export close path preserves all collected cleanup owners. Findings
Fix with agent prompt### Issue 1
src/cli/desktopCaptureCommands.ts:259-263
The export close callback can collect three failures: `resources.close()`, `sqlite.close()`, and `OwnedWorkerRuntime.retryPending()`. If staged-state cleanup and SQLite close fail while a previously retained worker also fails its retry, this call binds only the first two errors. The old `bindCleanupDependencies(typed)` kept all three.
Once the first two owners release, the combined error can report `cleanupIncomplete === false` while the worker remains unreleased. This violates the requirement to retain every unresolved cleanup owner. Compose all collected errors and add a three-failure regression.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryReplaces manual cleanup-error binding with
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Export closes readers] --> B[Close staged resources]
B --> C[Close SQLite]
C --> D[Retry retained workers]
D --> E{Three failures?}
E -->|Yes| F[Helper binds first two errors]
F --> G[First two owners release]
G --> H[Combined error reports cleanup complete]
H --> I[Worker may still need cleanup]
Reviews (5) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile |
Codex Review Summary: ✅ CompletedThis 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. |
Drives export-desktop-application in process with both the SQLite close and the export worker retry failing. Checks that both cleanup failures and their resources reach the projected error, and that the thrown composite stays incomplete until each part's owner confirms release, then completes. Passes on the base revision and on this change. Fails if the second failure is dropped or if the composite is not bound to its parts. Refs morluto#11859 Co-Authored-By: Claude Opus 5.5 <[email protected]>
… missing Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # scripts/verify/baselines/cleanup-dependency-binding.json
|
I merged current The only conflict was in Checked on the merged head:
CI is waiting for approval to run on the fork. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ba630e837c
ℹ️ 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".
| throw analysisErrorWithCleanupDependencies( | ||
| typed[0]!, | ||
| typed[1]!, |
There was a problem hiding this comment.
Bind every collected close failure
When export_desktop_application gets failures from all three cleanup stages above (resources.close(), sqlite.close(), and OwnedWorkerRuntime.retryPending()), this helper binds only typed[0] and typed[1]. The removed bindCleanupDependencies(typed) also tracked the worker failure, whereas the new composite can report completion after the first two owners release while that third owner remains unreleased; compose or bind every collected failure.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
| throw analysisErrorWithCleanupDependencies( | ||
| typed[0]!, | ||
| typed[1]!, | ||
| operation, | ||
| ); |
There was a problem hiding this comment.
Third cleanup failure gets dropped
The export close callback can collect three failures: resources.close(), sqlite.close(), and OwnedWorkerRuntime.retryPending(). If staged-state cleanup and SQLite close fail while a previously retained worker also fails its retry, this call binds only the first two errors. The old bindCleanupDependencies(typed) kept all three.
Once the first two owners release, the combined error can report cleanupIncomplete === false while the worker remains unreleased. This violates the requirement to retain every unresolved cleanup owner. Compose all collected errors and add a three-failure regression.
Context Used: AGENTS.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/cli/desktopCaptureCommands.ts
Line: 259-263
Comment:
**Third cleanup failure gets dropped**
The export close callback can collect three failures: `resources.close()`, `sqlite.close()`, and `OwnedWorkerRuntime.retryPending()`. If staged-state cleanup and SQLite close fail while a previously retained worker also fails its retry, this call binds only the first two errors. The old `bindCleanupDependencies(typed)` kept all three.
Once the first two owners release, the combined error can report `cleanupIncomplete === false` while the worker remains unreleased. This violates the requirement to retain every unresolved cleanup owner. Compose all collected errors and add a three-failure regression.
**Context Used:** AGENTS.md ([source](https://github.com/morluto/rea/blob/main/AGENTS.md))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.|
Thank you for this, and for the CLI-level test approach, which #13168 reuses. Since this PR was written, main added the artifact-scope close, so the state-reader close can now collect three failures. A two-argument |
Summary
Next batch for #11859 (Refs #11859; the issue stays open for the remaining custom-error / multi-dependency sites). The first step of the issue's plan (
HistoricalCaptureDecoder.ts,HopperFileOffset.ts, the directPcapProvider.tssite) already landed onmain; the baseline was 46 files / 77 sites at 6752875.Problem and expected behavior
src/cli/desktopCaptureCommands.tscomposed the state-reader close failures withanalysisErrorWithCleanupFailure(typed[0], typed[1], operation)and then calledcombined.bindCleanupDependencies(typed)by hand. That is the compositionanalysisErrorWithCleanupDependenciesinsrc/domain/analysisErrorCleanup.tsowns.Change and scope
analysisErrorWithCleanupDependencies(typed[0]!, typed[1]!, operation).OwnedWorkerRuntime.retryPending()for exports) and only takes this branch whenfailures.length > 1, sotypedis exactly[primary, cleanup]and the bound dependencies are unchanged.scripts/verify/baselines/cleanup-dependency-binding.json(now 45 files / 76 sites).Not included: the other
analysisErrorWithCleanupFailure(...).bindCleanupDependencies(...)sites are not equivalent to the helper.PcapProvider.ts:1007binds[commandFailure, snapshotFailure]rather than its composed parts,NativeMacOSProvider.ts:1897also bindsproducerwhen a descriptor cleanup is present, andSourceMapCommand.tspasses a resource owner. Those need their own small batches.Contribution scope: not applicable (internal refactor within existing boundaries).
Contract and boundary impact
Semantic owner and earliest changed stage:
analysisErrorWithCleanupDependenciesnow owns this composition; desktop capture CLI close path.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: same composite error, same cleanup dependencies.
Generated metadata, package, or installation impact: none.
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/boundary/application/desktopStateReaderCleanup.test.tsdrivesexport-desktop-applicationin process with both the SQLite close and the export-worker retry failing. It checks that both cleanup failures and their resources reach the projectedcleanup_incompleteerror, and that the thrown composite stays incomplete until each part's release claim reports release, then completes. It lives in the isolatedboundaryproject because it uses module mocks.analysisErrorWithCleanupFailure(no dependency binding) fails the test, and throwing only the first failure fails the test. The architecture guard enforces the lower baseline.Validation performed
node scripts/verify/architecture-guards.mjs— Architecture guards passed across 2871 source files.node scripts/run-typescript.mjs --noEmit— exit 0.npx vitest run tests/boundary/mcp/cleanupPrimaryProjection.test.ts tests/boundary/cli/projectCliAnalysisResult.test.ts tests/boundary/providers/desktopExportSeedPolicy.test.ts— 3 files, 10 tests passed.npx vitest run tests/boundary/application/desktopStateReaderCleanup.test.ts— 1 passed; on base 6752875 — 1 passed; with the binding removed — 1 failed; with the second failure dropped — 1 failed.npx vitest run tests/boundary/filesystem/ciTestProjects.test.ts tests/evaluation/noSharedModuleMockRule.test.ts— 35 passed.npm run typecheck— exit 0.npm run check— exit 0 (typecheck, lint,oxfmtformat check, knip, metadata, guards, typed lint).npm run check:fast— exit 0.npx oxfmt --checkon changed files — clean.npx oxlint src/cli/desktopCaptureCommands.ts tests/boundary/application/desktopStateReaderCleanup.test.ts— no errors; only the existing max-lines warnings in the CLI file.npm run verify:module-boundaries— passed.Compatibility, safety, and release
Author readiness
Human owner: @anant8140
Before merge
type(scope): outcome.🤖 Generated with Claude Code