mirror of
https://github.com/morluto/rea.git
synced 2026-11-05 06:45:22 +00:00
[GH-ISSUE #4512] [Bug] Process capture can attempt PTY launch after cancellation during executable sampling #1794
Closed
opened 2026-10-16 21:10:18 +00:00 by bsakaguchi
·
1 comment
No Branch/Tag specified
main
codex/procedure-reference-stacked
release-please--branches--main--components--rea-agents
release-please--branches--main--components--rea-agents--release-notes
codex/kuna-independent-retry
codex/byte-search-overlay-coverage
codex/open-failure-target-receipt
codex/kuna-xref-evidence
codex/ghidra-ambiguous-procedure-recovery
codex/function-source-bundle
codex/trace-function-integration-prototype
codex/snapshot-source-closure
codex/recorded-evidence-array-pages
codex/evidence-recovery-redesign
codex/trace-feature-address-scope
codex/call-discovery-scope
codex/ghidra-literal-candidate-evidence
codex/decompile-directory-independent-retry
codex/retry-provenance-base
codex/value-flow-capability-experiment
codex/ghidra-containing-instruction
cursor/readme-discord-button-ef9f
dependabot/github_actions/actions/setup-node-7.1.0
dependabot/github_actions/actions/upload-artifact-7.0.2
dependabot/npm_and_yarn/npm-minor-and-patch-d8d97ce6df
codex/kuna-1989
fix/8559-native-ui-fixture-ownership
fix/8555-go-verifier-mcp-ownership
codex/provider-capability-recovery
fix/8642-rizin-target-stdin
codex/ghidra-memory-effect-scope
codex/ghidra-annotation-entry-selector
codex/ghidra-readonly-recovery
codex/ghidra-regex-verifier-recovery
codex/evidence-discovery-view-guidance
fix/8545-bulk-append-overflow
fix/8428-navigation-refusal-alternatives
codex/address-context-recovery
codex/matching-member-limitations
codex/unknown-scope-contract
codex/evidence-view-guidance
feat/8373-native-trace-views
codex/ghidra-snapshot-verifier-binding
codex/elf-export-visibility
codex/evidence-view-recovery
codex/native-reference-cli-help
codex/provider-candidate-observation-scope
codex/kuna-session-verification
codex/ghidra-switch-lifetime-guidance
codex/pseudocode-paging-discovery
codex/clarify-evidence-view-support
codex/kuna-xrefs-selector-recovery
codex/context-capacity-recovery
codex/evidence-closure-large-links
codex/same-function-evidence-identity
codex/ghidra-verifier-inspected-jdk
codex/audit-guided-workflows
codex/crash-prompt-retained-dossiers
codex/analysis-view-error-recovery
codex/kuna-verifier-target-selection
codex/ghidra-selected-project-call-coverage
codex/docs-native-analysis-scope
codex/ghidra-java-socket-boundary
codex/ghidra-retained-snapshot-verifier
codex/ghidra-search-inventory-facts
fix/8284-zero-argument-parameter-bindings
fix/8198-ui-action-handler-offset
fix/8257-elf-entry-label-identity
fix/8304-deferred-output-schema-projection
fix/8277-call-path-computed-target-uncertainty
fix/pr-8089-conflicts
fix/ci-static-duplicate-export
dependabot/npm_and_yarn/lint-staged-17.6.0
dependabot/github_actions/actions/download-artifact-8.0.2
dependabot/npm_and_yarn/write-file-atomic-8.0.0
dependabot/npm_and_yarn/canonicalize-5.1.0
dependabot/github_actions/actions/cache/restore-6.1.0
dependabot/npm_and_yarn/toon-format/toon-4.4.0
dependabot/github_actions/actions/deploy-pages-5.0.1
codex/review-fixes-pr-2403
codex/review-fixes-pr-2400
codex/process-terminal-width
codex/test-brittleness-cleanup
verify/7167-browser-connect-macos
fix/7167-browser-connect
feat/native-matching-allowance-setting
feat/browser-scenario-dry-run
test/managed-caller-parameters-20261024
codex/parser-fortythird-boundaries
fix/6926-pinvoke-platform-decorations-20261023
fix/6889-har-body-encoding-20261023
fix/6888-sqlite-schema-budget-20261023
fix/dependency-security-gates-6708
cursor/evidence-overwrite-rebase-b4ac
feat/4057-verify-native-exports
fix/windows-acl-observer-overhead-20261022
cursor/erlang-beam-restack-4476
cursor/pe-certificate-review-bf32
fix/6116-javascript-application-fs-errors
fix/6061-unmapped-runtime-script-unknown
feat/browser-scenario-summary
fix/pe-certificates
codex/verify-3407
cursor/rebase-5699
cursor/rebase-5352
cursor/rebase-5600
cursor/fix-cli-schema-omission-10a8
codex/audit-hopper-shutdown-reasons-20261021
fix/demangle-swift-omitted-record
fix/nib-boolean-value-types
cursor/cancellation-partial-observation-a5ac
fix/ib-object-limit-reasons
fix/electron-fuse-limit-advice
fix/kuna-doctor-dangling-cache
fix/fixed-budget-refusal-advice
fix/js-ipc-listener-dedup
fix/js-return-member-provenance
fix/dmg-integrity-retry-advice
fix/ida-doctor-readiness
fix/kuna-version-probe-output-drain
fix/legacy-swift-runtime-name-matching
fix/dylib-lazy-load-commands
fix/browser-scenario-startup-cancel
fix/swift-nested-punycode-classification
fix/compare-unselected-scopes
fix/objc-method-budget-coverage
fix/dmg-mounted-root-observations
audit/ci-tests-20261019-round2
release/6.7.0
fix/wabt-cleanup-retry-resolution
fix/electron-fuse-elf-pe-architecture
fix/native-plist-descriptor-ownership
fix/kuna-caller-cleanup-ownership
experiment/atomic-codemode-20261016
review/first-contributor-3776
fix/call-resolution-full-read-cycles
fix/member-mutation-selection-repeat
experiment/atomic-re-tools-20261015
perf/member-mutation-lazy-origins
perf/static-network-mutation-index
fix/hopper-startup-lifecycle
audit/3050-windows-proof-20261015
feat/windows-window-capture-2183
audit/3049-windows-proof-20261015
audit/3735-macos-fixtures-20261015
fix/batch-decompile-null-pseudocode
fix/kuna-inventory-honors-jobs
experiment/browser-codemode-tool-design-20261015
fix/hopper-clean-runtime-argv
codex/review-2049-27f1b367
review-fixes/pr-2787-routing
fix/3360-scoped-this-emitters
fix/3367-replaced-global-effects
fix/3838-compact-any-value-items
test/hopper-download-probe-20261015
codex/windows-runtime-creation-red-green-20261015
codex/windows-readonly-root-red-green-20261015
codex/windows-root-share-red-green-20261015
codex/exp-1685-win-mcp-startup
codex/bug-sweep-20261015
investigate/2190-windows-package-phases
investigate/3543-macos-cli-deadline
perf/3281-reverse-tools-feedback-quality
fix/3406-hopper-doctor-fixture
fix/3341-wrapper-require-test-context
fix/3301-owned-uninstall-fixtures
fix/3164-compiler-input-ownership
fix/pcap-cleanup-stdout-newline-20261014
perf/interface-builder-summary
codex/review-fixes-pr-1977
fix/ghidra-effective-jvm-platform
fix/docs-turkish-rust-link-20261013
fix/main-maintenance-ci-20261010
fix/recover-binary-session-process-effects
codex/review-fixes-pr-2457
codex/ci-required-cancellation-gate
fix/main-format-baseline-20261013
fix/setup-preserve-entry-fields
cursor/restore-main-checks-1ffc
fix/ghidra-bridge-hashmap-import
codex/shared-ci-jadx-json-default-20261013
codex/shared-ci-ghidra-test-groups-20261013
codex/shared-ci-java-fixture-format-20261013
codex/fix-intrinsic-invocation-boundaries
test/release-preflight-reusable-jobs
test/js-parameter-provenance-expectation
fix/linux-hopper-verification-current
test/2419-ghidra-elf-probe-size
followup/pr-1544-native-ida
codex/fold-pr-2230-contribution
docs/readme-responsible-use
fix/issue-2064
fix/issue-2050
fix/issue-2053
fix/issue-1968
fix/issue-1945
experiment/codemode-bridge-20261011
fix/tool-effects-negative-wording-1904-20261012
fix/1842-electron-interop-provenance
feat/recover-javascript-multi-input
refactor/website-i18n-prep
fix/nativeaot-pe-virtual-extent
fix/browser-verifier-ci-hang
fix/pe-resources-input-selection
docs/beginner-friendly-guides
docs/beginner-setup-guide
fix/javascript-analysis-worker-1563
fix/1649-ghidra-duplicate-names
fix/javascript-export-keys-integration-1369
test/maintenance-boundary-contracts-20261011
review/javascript-export-keys-1369
review/process-live-progress-1483
test/javascript-1495-growth-ratio
fix/ci-escape-timing
docs/normalized-terminal-geometry-1450
release/6.3.0
archive/release-6.3.0-pr1381
release/6.2.0
fix/electron-preload-dynamic-override
fix/javascript-self-referential-bundler-edges
release/6.1.0
cursor/grok-client-cherry-pick-0b56
feat/signature-posture
feat/dyld-shared-cache
feat/artifact-integrity-policy
feat/pkg-inventory
release/6.0.0
chore/sync-release-5.0.0
release/5.0.0
cursor/cloud-agent-node-787e
fix/javascript-xhr-open-endpoints
review/pr-711-realpath-fallback-wording
cleanup/replay-confinement
codex/test-suite-performance
codex/issue-foundations
codex/address-open-issues-2026-07-20
agent/javascript-vite-rollup-esbuild-adapters
agent/process-cleanup
agent/triage-integration
agent/unknown-commands-registry
feat/mcp-identity-metadata
morlvps/issue_cleanup
codex/installer-redesign
morl/roadmap-investigation-core
morl/roadmap-investigation-docs
release-please--branches--main--components--rea
rea-agents-6.8.0
rea-agents-6.7.0
rea-agents-6.6.0
experiment/atomic-codemode-wait-runtime-20261016
rea-agents-6.5.0
rea-agents-6.4.0
rea-agents-6.3.0
rea-agents-6.2.0
rea-agents-6.1.0
rea-agents-6.0.0
rea-agents-5.0.0
rea-agents-4.1.0
rea-agents-4.0.1
rea-agents-4.0.0
rea-agents-3.2.1
rea-agents-3.2.0
rea-agents-3.1.0
rea-agents-3.0.0
rea-agents-2.7.0
rea-agents-2.6.0
rea-agents-2.5.1
rea-agents-2.5.0
rea-agents-2.4.0
rea-agents-2.3.0
rea-agents-2.2.0
rea-agents-2.1.0
rea-agents-2.0.0
rea-agents-1.7.0
rea-agents-1.6.0
rea-agents-1.5.0
rea-agents-1.4.0
rea-agents-1.3.0
rea-agents-1.2.0
rea-agents-1.1.0
rea-agents-1.0.0
rea-agents-0.5.0
rea-agents-0.4.0
rea-agents-0.3.0
rea-0.2.1
rea-0.2.0
Labels
Clear labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
Mirrored from GitHub Pull Request
question
roadmap
triage
No labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
question
roadmap
triage
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
morluto/rea#1794
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dakjdakd on GitHub (Oct 16, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/4512
Before submitting
Area
Process capture or runtime observation
Observed behavior
The focused fix and regression test are implemented on
fix/process-pre-spawn-cancellation, commit1fd8a884e. I am working on the corresponding pull request alongside this report.Process capture can reach its PTY launch call after the caller has cancelled during the final executable metadata read or descriptor close. The cancellation arrives before any target has been started, but
startCaptureRuntimecontinues fromawait observeSelectedExecutable(...)intospawn(...)without checking the signal again.I reproduced the launch attempt through the exported production
captureProcessScenarioboundary. The executable was opened, read, inspected, and closed using real filesystem operations. The native PTY entry point was replaced with a throwing sentinel, so no target process was created. On the affected source, both late-cancellation cases called that sentinel once. Earlier cancellation controls did not call it.This report concerns the decision to initiate execution. It does not claim that the sampler's completed digest is invalid, that cleanup leaked a real process, or that a real target caused damage. A native Linux/macOS capture and public CLI/MCP cancellation were not executed for this reproduction.
Reproduction
The regression is
tests/process-global/processPrelaunchCancellation.test.tsin the proposed fix. It exercises the actual capture harness rather than reproducing its launch logic in a separate helper.process.execPath, with arguments["--eval", "process.exit(0)"]and the checkout as its working directory. Supply anAbortController.signaland an empty host environment.node:fs/promises.open, executable reads, descriptorstat, and descriptorclose. Wrap the returned real handle only to synchronize an abort with a chosen completion boundary.statresolves. This is the second descriptor metadata inspection in the sampler, after the executable bytes have been read.closeresolves. The descriptor has already been released when cancellation is raised.captureProcessScenariowith the existing platform and cleanup seams. Native ownership preparation/baseline discovery are replaced with controlled host responses; PTYspawnis intercepted and throws before creating a process. The fixture checks that interception is installed before entering the harness.Run the new regression together with the existing early-metadata cancellation control:
The deterministic observations on the affected base were:
The uninterrupted case deliberately ends at the throwing sentinel; it establishes reachability, not a successful native capture. The two affected boundaries reproduced under their explicit fault-injection schedules. Their frequency under normal filesystem timing is
NOT_ENOUGH_INFO; no timing-based incidence estimate is available.Expected behavior
Recheck the caller's signal after the awaited executable sampling has fully settled and before launching the selected program. If the signal is already aborted, take the existing typed cancellation/startup-cleanup path and make zero PTY launch attempts.
The lifecycle guidance separates target admission, active execution, and resource release, and requires cancellation to remain authoritative through awaited finalization. An executable sample establishes file facts; it should not independently authorize a later launch after the requesting operation has been cancelled.
Completed file observations should remain available. In particular, obtaining a complete SHA-256 before cancellation does not make that digest unknown. Preventing the subsequent launch should not require changing the sampler's return value or discarding the bytes it already observed.
Impact and scope
The observed scope is the shared process-capture startup path. Both CLI and MCP consumers use this harness, so the source path is shared; adapter-specific cancellation delivery was not tested here.
The practical concern is that a request cancelled during its last awaited prerequisite can still cross the execution boundary. Once started, a selected program may begin work before later cancellation monitoring and cleanup run. That consequence follows from the call order; the fixture intentionally prevents execution and therefore does not demonstrate a particular target action, a process leak, or an isolation failure.
The window is narrow but deterministic to exercise. Earlier checks cannot close it because they run before an awaited final metadata read and descriptor release. No additional permission, target format, provider, or transport option is involved.
REA version
Source revision
180ba03bfddd5916251e81e97a500b1ede7a9eea(rea-agents6.5.0).Runtime and platform
Node.js v24.18.0, Windows x64, Vitest v5.0.3. The test uses the harness's controlled Linux platform/ownership seams to exercise portable startup logic; it does not establish native Windows PTY support or a real Linux execution result.
Target and artifact context
The local Node executable supplies real executable bytes and metadata. No extracted application, private target, external service, or credential is required.
Interface
Other: exported production
captureProcessScenarioboundary. CLI/MCP impact is source-derived.Earliest failure stage
Cleanup, cancellation, or lifecycle: executable sampling has completed, immediately before PTY launch.
Relevant output or evidence
The affected caller awaits
observeSelectedExecutableand proceeds tospawn. In the sampler, the last ordinary cancellation check precedes the final awaited descriptorstat; thefinallyblock then awaits descriptor close.Separate direct-sampler controls confirm that both late schedules retain the correct complete SHA-256 with
signal.aborted === trueand a closed descriptor. The caller must therefore make its own execution decision after consuming that completed sample.Typed outcome or recovery expected
The existing
ProcessCaptureErrorcancellation outcome, with cleanup completed and no target PID acquired. Retain existing startup resource cleanup; do not start a target solely to discover cancellation in a later monitoring phase.Analysis or suspected cause
The final metadata and close awaits introduce cancellation opportunities after the sampler's last check. There is no intervening signal check at the consuming launch boundary. A single
assertNotCancelled(options.signal)after the sampling await closes these schedules without changing descriptor ownership or completed-digest semantics.Additional context
RegularFileRead/OwnedRegularFileowner and preserve completed file facts. This sampler is independent; this report targets its downstream launch decision.ProviderProcess.ts; #4005 concerns cancellation after target exit during capture cleanup. Neither covers this prelaunch boundary.These related fixes establish useful controls, but I found no focused report or pending change for this final sampling-to-launch window.
@morluto commented on GitHub (Oct 19, 2026):
Fixed on main in
d6ca7b3f20.The shared launch consumer now checks cancellation immediately before PTY spawn, after executable sampling and descriptor cleanup have settled. The sampler keeps its completed file facts. The shared typed cancellation constructor now retains the exact caller reason, and admission, normalization, active-exit and finalization consumers pass that fact through directly.
Five controlled capture-API schedules cover uninterrupted launch reachability, pre-admission abort, post-open abort, final metadata completion and post-close abort. Executable reads/stats/closes are real; PTY is a throwing sentinel, so these tests create no target. A separate real Node capture cancels at terminal cleanup reporting and retains the completed exit, cleanup facts and exact object reason. Unchanged d3627 baseline:5 failures/1 pass across the two new files; final focused gate:114 passed across11 files, including real CLI signals, MCP cancellation, process cleanup/finalization and progress. Full npm run check, docs:check (5), and discovery (1608 files) passed.
Six paired compiled SDK workflows (actual controlled Node capture, whole207-tool catalog, stable filesystem and retained unknown) preserved catalog and semantic observation hashes. Warm repeated medians: elapsed3.537→3.411s, CPU4.261→4.180s, sampled process-family RSS889.9→889.5MB. Request estimate108 cl100k tokens; full SDK reply estimate814174→814103 reflects retained ambient capture variation. Small sample, no speedup/model-context/true-cold claim; fault and other-host costs unmeasured.
Adapted #4836 at014afa38929d46d58067b617c707759cd753cf8d after reviewing its full diff; contributor credited in the commit, PR not merged. Native Windows qualification was not performed. The separately verified snapshot/sampler failed-close ownership problem remains open as #5140; execution admission and reason provenance do not repair that lifecycle ownership.