mirror of
https://github.com/morluto/rea.git
synced 2026-11-05 06:45:22 +00:00
[GH-ISSUE #5756] [Bug] observe-web-execution loses the target-termination reason when cleanup fails #3500
Closed
opened 2026-10-31 00:41:12 +00:00 by bsakaguchi
·
4 comments
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#3500
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 @coygeek on GitHub (Oct 21, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/5756
Before submitting
Area
Process capture or runtime observation
Observed behavior
Closing the selected Chrome page after
observe-web-executionreports its observation window armed returnscleanup_incomplete, but the failure omits the target-termination reason. Its main diagnostic instead names a failedProfiler.stopPreciseCoveragecommand. The selected target ID and failed cleanup commands survive; the fact that target termination ended the window does not.The independent verifier reproduced this in four closed-page trials at the baseline. The submitter replayed the exact reproduction below after rebuilding fetched main: both closed-page trials reproduced it, while the open-page control succeeded. Unconfirmed cleanup is correctly a failure; this report concerns the missing termination fact.
Reproduction
Run from the built source checkout with its locked dependencies installed. Set
REA_BROWSER_EXECUTABLEto a Chrome executable. This executed script creates a loopback page, separate headless Chrome and disposable profile. A native-WebSocket CDP client closes each selected page only after actual CLI armed progress. The script stops only its recorded Chrome and HTTP-server PIDs; it never attaches to an existing browser. REA runs throughenv -iwith isolated HOME/XDG/temporary directories.Complete reproduction, including an open-page control and two closed-page trials
Inspect
closed-1.json,closed-2.jsonandobservations.jsonin the generated work directory. Each closed trial requests 30000 ms but ends promptly after closure; the control requests 1000 ms and keeps the page open.Expected behavior
When the selected target detaches and its dead session cannot acknowledge instrumentation cleanup, retain the original producer reason alongside the selected target and failed cleanup commands. The caller must be able to tell that target termination ended the observation. Keep unconfirmed cleanup as a failure; no particular outer error code or nested representation is required.
The closed-target contract explicitly promises those facts. The window outcome schema includes
target_terminated.Impact and scope
P2: bounded diagnostic loss makes a page closure indistinguishable from an unrelated stop-coverage command failure without separate browser evidence. All four baseline and both rebuilt-main closed-page trials reproduced the omission; the two baseline open controls and rebuilt-main open control succeeded. A caller with an independent CDP event recorder can establish closure, as this reproduction does. Re-listing a missing target afterward cannot by itself recover the original window-ending event.
No target damage, captured-data corruption, or security boundary crossing was observed. Runtime coverage is CLI with native Chrome on macOS; MCP, browser crashes, whole-browser disconnects and other engines/platforms were not executed.
REA version
rea-agents6.7.0, independently verified source baseline9d8e7803326a382cbbb3ffdb900f5e93e5442d68. Rebuilt withnpm run build:cachedand replayed on fetched maind0067ba34a39ea47dd7e11bb2e6169bc0938cc3f(also 6.7.0): still reproduces. The lockfile is unchanged between these revisions. These are source-checkout reproductions.Runtime and platform
Node.js v26.12.0; macOS 27.0.1 arm64. Baseline: Google Chrome 156.0.8078.47. Rebuilt-main replay: separate official Google Chrome 156.0.8078.48, headless with a throwaway profile. Python 3 serves the loopback fixture.
Target and artifact context
Self-authored HTTP page on
127.0.0.1with a button and timer; one selected page per trial, browser-scoped loopback CDP endpoint, native V8 precise coverage. No user profile, private artifact or external API is involved in the reproduction.Interface
CLI
Earliest failure stage
Cleanup, cancellation, or lifecycle
Relevant output or evidence
Executed public command inside the isolated child:
Each rebuilt-main closed trial exits 1. Selected JSON fields:
The complete envelope also retains the exact selected target ID, seven failed cleanup commands, and
previous_errorrepeating the stop-coverage command failure. It contains neithertarget_terminatednor another explicit termination explanation. Independent CDP returnedsuccess: truefor bothTarget.closeTargetcalls, emittedTarget.detachedFromTargetandTarget.targetDestroyedfor each exact selected target, showed it absent fromTarget.getTargets, and still answeredBrowser.getVersionon the root connection. Both calls completed promptly after closure.The open control exits 0 with
window.end_reason: window_elapsed,coverage.state: captured,instrumentation.cleanup: confirmed, and the target still present. Evidence provenance: observed public CLI and independent CDP; baseline independently verified, main replay executed by the submitter.Typed outcome or recovery expected
Keep a non-success failure with unconfirmed cleanup and failed-command diagnostics, while explicitly retaining target termination as the observation-ending reason. The open control must continue to succeed. Do not label unrelated protocol or cleanup failures on still-open pages as termination. This is a proposed restoration check; no fix was tested.
Analysis or suspected cause
Source-derived explanation: CdpExecutionCapture.ts:53-68 receives the window reason, then sends
Profiler.stopPreciseCoveragebefore constructing a result retaining that reason. Its rejection becomes the capture failure. CdpRuntimeSession.ts:269-276 retains that command failure asprevious_error; CdpWebRuntimeProvider.ts:95-125 composes it with cleanup failure. The window reason was lost earlier. No bundled dependency was identified as the cause.The existing synthetic termination test acknowledges cleanup and expects
target_terminatedin a successful unavailable-coverage observation. The native termination check requires a failure, target ID and failed cleanup command, but does not assert preservation of the original reason.Additional context
Related #5440 concerns retained partial Evidence incorrectly claiming confirmed cleanup after successful capture. This case fails before constructing that observation and concerns the missing termination fact; correcting partial-record cleanup state alone does not restore it. Closed #5089 preserved caller abort causes, a different terminal path. #5724 and #5725 concern reload outcomes in page inspection rather than selected-target closure during execution observation. Merged #917 introduced this operation and documented reason preservation, but current main still omits the reason in the real closed-session case above.
Prepared with AI assistance and independent verification. NOT_ENOUGH_INFO: no last-known-good version or regression range was established.
@aron-intframe commented on GitHub (Oct 21, 2026):
Reproduced on
main335c042d(6.7.0) with real Chrome 153 on Linux x64 / Node 24.21.0, and the dropped fact is recoverable without changing the failure contract.Cause
On a closed page the first thing that fails is not cleanup, it is
Profiler.stopPreciseCoverageinside the capture itself, atsrc/browser/execution/CdpExecutionCapture.ts:67. By then the window has already resolved withtarget_terminated(set inCdpExecutionWindow.ts:32), but the detached flat session rejects that command, socaptureWebExecutionthrows a protocol error and never builds the envelope that would carrywindow.end_reason.CdpWebRuntimeProvider.runthen composes the throw as the primary error together with the cleanup failure (CdpWebRuntimeProvider.ts:125toanalysisErrorWithCleanupFailure), which is why the top-levelmessage,diagnostics.primary_errorandcleanup_error.diagnostics.previous_errorall name the stop-coverage command. The termination reason lives only inCdpExecutionWindow.reasonand is never read again, so the "original producer reason" promised bydocs/web-runtime.mdis gone while the target ID and failed cleanup commands survive, exactly as reported.There is an asymmetry in the same function: a termination before arming is reported with its reason (
CdpExecutionCapture.ts:39-42throwstarget_changedwith "ended with ${window.reason} before execution observation could be armed"), while a termination after arming is not.Evidence
Your script, unmodified except that Chrome runs through a one-line wrapper adding
--no-sandbox(this host disables unprivileged user namespaces). Both closed trials reproduce, the open control passes:closed-1.jsonin detail:The same failure also reproduces without a browser, at the provider boundary, by making the fixture's detached session reject commands the way Chrome does (
commandErrorreturning-32001onceTarget.detachedFromTargetis emitted):That seam is also why no current test fails:
tests/fixtures/webRuntime.ts:29-30answersProfiler.stopPreciseCoveragewith{}whatever the session state, socdpWebRuntimeTermination.test.ts"ends immediately on its root detachment" takes a success path that a real closed page cannot take.Fix that worked here
Convert the dead-session rejection into the termination fact only when the window actually ended that way, leaving every other stop-coverage failure untouched:
Same script, same box, after rebuilding:
Unconfirmed cleanup stays a failure: the outer code is still
cleanup_incomplete, the selected target and all 7 failed cleanup commands are still listed, and the open-page control is untouched (window_elapsed, coveragecaptured).npx turbo run typecheckis clean,src/browseris 723 passed, and the four lifecycle tests intests/boundary/browser/cdpWebRuntimeTermination.test.tsstill pass, including the one that must keep returning a successful observation withend_reason: "target_terminated"when cleanup does confirm.If you would rather not special-case the command, the other shape that works is to carry
window.reasoninto the cleanup composition soprevious_erroris the producer reason rather than the last failed command.We hit this class of thing a lot, where a late cleanup error claims the error field and masks the event that actually ended the work; the note we keep on it is in our own repo (ours): https://github.com/aron-intframe/agent-guards#8-read-the-raw-session-not-the-first-line-of-the-log
@XinwangTao commented on GitHub (Oct 21, 2026):
Agreed with aron-intframe's analysis — the dead-session rejection (-32001) claims the error field and masks the event that actually ended the window, so a page closure becomes indistinguishable from a stop-coverage failure. Both suggested shapes look sound; I'd lean toward keeping the original producer reason as the primary error while still carrying the failed cleanup commands as secondary detail, so the caller gets both facts at once: the window ended because the target terminated, and which cleanup commands could not be acknowledged. That matches the closed-target contract without weakening "unconfirmed cleanup is a failure". The fixture seam (webRuntime.ts answering stopPreciseCoverage with {} regardless of session state) is a particularly good catch — it explains why no current test fails on this path.
@XinwangTao commented on GitHub (Oct 21, 2026):
5891bfbcovers the core ask: the primary error now names target_changed instead of the misleading protocol_error/unreadable_output, while the outer cleanup_incomplete and the failed cleanup commands stay intact for callers that need them. That classification change alone makes page closure distinguishable from a real stop-coverage failure, which was the whole point. One follow-up worth pinning down: aron-intframe's seam observation (tests/fixtures/webRuntime.ts always answering stopPreciseCoverage with {}) is still the reason this class of bug can escape the suite — a test where the detached session rejects with -32001 would lock in the new behavior.@XinwangTao commented on GitHub (Oct 21, 2026):
The fix in
5891bfbresolves exactly the asymmetry you pointed out in CdpExecutionCapture: termination before arming already surfacedwindow.reasonin the target_changed error, while termination after arming silently fell through to the unrelated stop-coverage failure. Converting the dead-session rejection into target_changed only when the window truly ended with target_terminated keeps the diagnostic honest without masking genuine stop-coverage errors in other scenarios. Also nice that the no-browser provider-boundary repro proved the seam — that makes the regression fixture cheap to maintain.