mirror of
https://github.com/morluto/rea.git
synced 2026-11-05 06:45:22 +00:00
Closed
opened 2026-10-31 01:14:34 +00:00 by bsakaguchi
·
0 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#6455
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?
📋 Pull Request Information
Original PR: https://github.com/morluto/rea/pull/4884
Author: @Adolanium
Created: 10/17/2026
Status: ❌ Closed
Base:
main← Head:fix/startup-signal-cleanup📝 Commits (10+)
c84d11efix(mcp): close the session when a signal interrupts startupf6fa42afix(mcp): keep startup failures and failed shutdown owners when a request races startup16ea307Merge remote-tracking branch 'upstream/main' into fix/startup-signal-cleanup5f1c9ffMerge remote-tracking branch 'upstream/main' into fix/startup-signal-cleanup4b7b302fix(mcp): keep provider documents when a shutdown signal cancels the initial open8075ad4fix(mcp): start no transport after a shutdown request during provider loading10c87a6fix(mcp): keep a reported shutdown failure as the startup outcomef91dffeMerge remote-tracking branch 'upstream/main' into fix/startup-signal-cleanupcf5a537fix(mcp): recognize a cancelled startup open that reports its own cleanup28cb1d3fix(mcp): retain startup cleanup retry ownership📊 Changes
12 files changed (+1084 additions, -140 deletions)
View changed files
📝
src/application/binary/BinarySession.ts(+32 -19)📝
src/application/binary/BinarySessionOpen.ts(+6 -0)📝
src/domain/analysisErrorProjection.ts(+11 -0)📝
src/main/eagerRuntime.ts(+52 -28)📝
src/main/shutdown.ts(+205 -54)📝
src/main/startup.ts(+29 -5)📝
src/main/transport.ts(+11 -0)📝
src/main/types.ts(+1 -0)📝
src/server/shutdownRegistration.test.ts(+22 -17)📝
tests/boundary/mcp/mainErrors.test.ts(+6 -1)📝
tests/boundary/mcp/shutdown.test.ts(+19 -16)➕
tests/boundary/mcp/startupShutdown.test.ts(+690 -0)📄 Description
Summary
Refs #4885 (startup signal handling only; startup EOF remains open).
REA installed its SIGINT, SIGTERM, and stdin EOF handlers only after the initial target opened and the MCP transport started. A signal during a slow
HOPPER_TARGET_PATHopen used Node's default handler and ended REA withoutsession.close(). REA now handles SIGINT and SIGTERM from session creation, aborts the initial open, and closes the session even when the transport never started. Stdin EOF during startup is still not observed (see Not included).Problem and expected behavior
run()insrc/main.tsdocuments that EOF and process signals close bridge resources. It calledopenInitialTarget(session.open(HOPPER_TARGET_PATH)with no signal) andstartMcpTransportbeforecreateShutdown, which registers the handlers throughregisterProcessShutdown. Provider children are spawned withdetached: platform !== "win32"insrc/process/ProviderProcess.ts, so a default signal exit can leave them running after REA is gone.Change and scope
createShutdowninsrc/main/shutdown.tsnow takes only the session and registers the handlers at once. A shutdown request aborts itssignaland closes the owners attached so far.attachTransportadds the stdio handle, Android, and optional-provider owners after the transport starts.finishwaits for an in-flight attempt and closes any owner attached after the request.releaseunregisters the handlers when startup fails and has already closed its own resources, unless a shutdown attempt that raced the failure failed; then the handlers stay registered so a repeated request retries the retained owners.finishcloses a late-attached transport joins that cleanup instead of reaching Node's default signal handling.finishdoes not retry an attempt that already failed and was reported when no owner was attached after it. It returns 1 and keeps the handlers registered, so a repeated signal retries the retained owners, as after transport start.openInitialTargetinsrc/main/startup.tspasses the shutdown signal tosession.open. When the open fails because shutdown aborted it, it returnscancelledand leaves cleanup and reporting to the shutdown. It decides withisCancelledAnalysisErrorfromsrc/domain/analysisErrorProjection.ts, which compares the primary error's own code, so a cancellation that also reports incomplete cleanup still counts, not fromsignal.abortedalone, so a failure that preceded the request is still reported as the startup failure. Its logger, stderr writer, and signal are now one options object.runEager(insrc/main/eagerRuntime.tssince #4424;run()before that) creates the shutdown owner right after the session. It returns the shutdown outcome (0, or 1 when cleanup failed and was reported) when a request arrives during the open or the transport start. If startup throws unexpectedly,run()closes the session throughfinishbefore it rethrows, so the handlers do not outlive a failed startup.RuntimeDependencies.createSessionlets tests supply the session. It defaults tocreateBinarySession.BinarySessionOpenOptions.retainProviderDocumentsOnCancelmakes#failedOpenretire the new client withretainDocument: truewhen the open's signal aborted and the open failed because it was cancelled, the same testopenInitialTargetuses to classify a cancelled open. A provider failure that races the signal still closes what it launched.openInitialTargetsets it. Without it, an external Hopper application would getshutdown_documentand close its GUI document, which normal MCP shutdown deliberately retains. A cancelledopen_binarytool call and non-cancellation open failures keep their existing cleanup.28cb1d31a), startup finishes throughfinishFailedOpen. It retries with the failed open's own non-retaining close, passed explicitly on every attempt so a policy saved by a raced shutdown request cannot persist, so an externally launched Hopper document still closes, and keeps the handlers registered for later retries under the same policy. A shutdown request during the initial open aborts it but does not close the session yet:whileOpeningleaves the session owner out of shutdown attempts until the open settles, since a close queued behind the open could otherwise replace a failed open's non-retaining policy and succeed before startup sees the failure. Startup then closes the session throughfinish,finishFailedOpen, orrelease. Each shutdown attempt first callssession.beginShutdown()(from #6411), so a request the server admitted before shutdown cannot reopen the session after its close: the late open fails as cancelled and starts no provider.finishstill returns 1, so the entrypoint does not overwrite the failure with 0.startMcpTransporttakes the shutdown signal. If shutdown was requested while optional providers loaded, it does not callserve(). It returns the loaded providers' close as a shutdown owner, andfinishcloses them.McpTransportOwners.handleis optional for this case. A request duringserve()itself still closes the transport that starts.McpServerHandle, and itsprepareShutdownbarrier runs before any owner closes. A failed barrier closes nothing, and the next request retries it. Forrea mcp --http, the startup signal latch is released when the shutdown owner registers at session creation, so a signal during the initial open aborts it there too.session.openalready accepted a signal and checks it between lifecycle steps and passes it to the providerhealthcall; the only change belowBinarySessionis the retention choice above.Not included: stdin EOF during startup. Nothing reads
process.stdinuntil the MCP transport starts, so theendandcloselisteners registered early do not fire for a client that disconnects during the initial open. Observing it would mean reading stdin before the transport exists and handing the buffered messages to the SDK, which changes stdin ownership and is left for a separate change. The optional-provider loaders take no signal, so a request during loading waits for that load to finish. Whether each real provider stops its startup promptly on abort was not checked.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.
Contribution scope: not applicable. This is a fix within the existing lifecycle boundary.
Contract and boundary impact
createShutdown, now from session creation instead of after transport start.open_binary.retainProviderDocuments: true. Stdin EOF is handled only after the transport starts, as before. A cancelled initial open no longer prints an "Initial target failed to open" error. REA exits 0 after a clean interrupted startup and 1 when cleanup fails.docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs andskills/; edit authored instructions in.agents/skills/reverse-engineer-anything/and never commit build outputs): none.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
tests/boundary/mcp/startupShutdown.test.tsdrivesrun(). The first test blocks the providerhealthcall of the initial open, sends a shutdown request, and checks that the open's signal is aborted. It sends a second request while client cleanup is blocked, then checks one client close, no transport start, one unregistration, no stderr output, exit code 0, and a closed session. The second test sends a request while optional providers load and blocks the close of the transport handle that starts afterwards. It checks that the handlers are still registered during that close, sends a second request there, and then checks one handle close, one unregistration, and that a later request does not close the handle again. The third test makes client cleanup fail during an interrupted open. It checks one reported failure, exit code 1, two client close attempts (the aborted open and the shutdown), and retained handlers; a repeated request then closes the client and unregisters. A parameterized test makes the providerhealthcall fail with a timeout and sends a request while the failed open's client close is blocked. It checks exit code 1 and that the timeout message is reported. When the shutdown cleanup succeeds, the handlers unregister. When it fails, they stay registered, and a repeated request closes the client and unregisters. Reverting the cause check fails both cases; reverting thereleaseretention fails the second. Two tests cover a failed open that races the shutdown request: in one the provider reports a timeout after the signal aborted, and in the other the failed open's first close fails and the shutdown close would then succeed. Both check exit code 1, no pending cleanup, and that no close usedretainDocument: true. Reverting the cancellation check in#failedOpenfails the first; letting shutdown close the session during the open fails the second. Another test opens the session from insideserveafter a raced request, and checks that the open is refused as cancelled, no client is created or closed, and the handle closes once; without the seal it fails. Main's two #6411 tests intests/boundary/mcp/shutdown.test.tsnow attach their handle throughattachTransportand also fail without the seal. The last test makessession.openthrow and checks thatrun()rethrows, closes the session once, and unregisters.tests/boundary/mcp/mainErrors.test.tsnow also checks that a transport start failure unregisters the handlers.tests/boundary/mcp/shutdown.test.tsandsrc/server/shutdownRegistration.test.tsnow attach the transport throughattachTransport, with their retry and idempotence assertions unchanged.startupShutdowntests failed: three timed out because no handler was registered during startup (on that basecreateSessiondoes not exist, so the real session was used), and the throw test saw no unregistration. ThemainErrorstransport start failure test also failed, because no handler was registered before the transport started. The default-signal exit and the orphaned provider children were not reproduced at runtime; that part is source-derived.REA could not close cleanly. End the REA process before starting it again.as before.startMcpTransportis not cancellable.For evidence-bearing changes:
Validation performed
At
e49b50bb8(upstream/main4c547008cmerged, integrating #6411's shutdown seal) on Linux (WSL Ubuntu, Node 24.18.0), afternpm run build:cached:npx tsc -p . --noEmitpassed andoxfmt --checkwas clean;oxlintreported the same count as atc04f289c6. The lifecycle, deferred-runtime, session and BinarySession tests plusbrowserCli.test.tspassed 34 files and 372 tests in two runs. With thesession.beginShutdown()call removed, the converted startup test and main's two seal tests failed.At
c04f289c6(upstream/mained069bb9dmerged) on Linux (WSL Ubuntu, Node 24.18.0), afternpm run build:cached:npx tsc -p . --noEmitpassed andoxfmt --checkwas clean.oxlintreported the same warnings as main on the shared changed files, and none instartupShutdown.test.ts. The lifecycle, deferred-runtime, session and BinarySession tests, plustests/boundary/cli/browserCli.test.ts(which failed in CI onfe1275626against older main), passed 34 files and 370 tests in two runs.At
fe1275626on Linux (WSL Ubuntu, Node 24.18.0):npx tsc -p . --noEmitpassed,oxfmt --checkwas clean, andoxlintreported the same 11 warnings as83586cade. The same test set passed 33 files and 356 tests in two runs. The negative check above failed the new test.At
83586cadeon Linux (WSL Ubuntu, Node 24.18.0):npx tsc -p . --noEmitpassed,oxfmt --checkwas clean, andoxlintreported the same 11 warnings asa95b470b7. The same test set passed 33 files and 355 tests in two runs. Removing the re-arm inattachTransportfailed the new reopened-session test (0 client closes instead of 1).At
a95b470b7on Linux (WSL Ubuntu, Node 24.18.0), afternpm run build:cached:npx tsc -p . --noEmitpassed.oxfmt --checkwas clean.oxlinton the four touched files reported the same 11 warnings asd929ac01e(theBinarySession.tsfile-length warning is now 1327 lines). The lifecycle, deferred-runtime, session, and BinarySession tests passed 33 files and 354 tests in two runs. Each of the two reversions above failed its regression test.At
9249971b1on Linux (WSL Ubuntu, Node 24.18.0):npx tsc -p . --noEmitpassed, andoxfmtandoxlintwere clean. The lifecycle, deferred-runtime, session, and BinarySession tests passed 30 files and 322 tests in two runs. With the session close option omitted again for the non-retaining policy, the raced-shutdown failed-open test failed.After merging main again (
316180b4e; #4424 moved startup intosrc/main/eagerRuntime.ts, which now holds this PR's lifecycle and handslifecycle.shutdowntocaptureShutdown) on Linux (WSL Ubuntu, Node 24.18.0):npx tsc -p . --noEmitpassed,oxfmtwas clean, andoxlintreported the same single warning as main.tests/boundary/mcp,src/main,src/server/http,src/server/shutdownRegistration.test.ts,tests/composition/analysis-sessions, andsrc/application/binarypassed 1420 tests in two runs. Afternpm run mcp-catalog:generate, the catalog-dependentcontractPresentation,deferredRuntime, andtoolSchemaValidity, together withmcpStartupPolicy,startupShutdown, andshutdown, passed 68 tests in two runs.At
e09a158eeon Linux (WSL Ubuntu, Node 24.18.0):npx tsc -p . --noEmitpassed.oxfmtandoxlintwere clean on the changed files. The lifecycle tests,tests/composition/analysis-sessions, andsrc/application/binarypassed 28 files and 279 tests in two runs. Withrun()callingfinish()instead offinishFailedOpen(), the failed-open retry test failed on its no-retainDocumentassertion.At
cf5a53729on Linux (WSL Ubuntu, Node 24.18.0):npx tsc -p . --noEmitpassed.oxfmtwas clean.oxlintreported the same 4 warnings as the parent commit. The lifecycle tests,src/domain,src/application/binary, andtests/composition/analysis-sessionspassed 297 files and 5677 tests in two runs. With the cancellation check reverted to the projected code, the new test for a cancellation that carries its own cleanup observation failed.After merging main again (
f91dffede; the#failedOpenconflict is described in the PR comments) on Linux (WSL Ubuntu, Node 24.18.0), afternpm ciandnpm run build:cached:npx tsc -p . --noEmitpassed andoxfmtwas clean.oxlinton the five touched files reported the same 12 warnings as main. The lifecycle tests,tests/composition/analysis-sessions,src/application/binary, the HoppercleanupRetryandexternalExitclient tests, and the HTTP serve tests passed 32 files and 361 tests in two runs.At
10c87a6d7on Linux (WSL Ubuntu, Node 24.18.0):npx tsc -p . --noEmitpassed, andoxfmtandoxlintwere clean on the changed files. The same 9 lifecycle and HTTP test files passed 112 tests in two runs. With the sticky failure flag removed, the new late-owner retry test failed.At
8075ad4fcon Linux (WSL Ubuntu, Node 24.18.0):npx tsc -p . --noEmitpassed.oxfmt --checkwas clean.oxlintreported only the existingmax-lines-per-functionwarning onstartMcpTransport.shutdownRegistration,mainErrors,shutdown,startupShutdown,serverLifecycleMcp,optionalProviderShutdown,mcpHttpOptions,serveStreamableHttp, andstreamableHttpMcppassed 9 files and 111 tests in two runs. With the post-load signal check removed fromstartMcpTransport, the provider-loading startup test failed.At
4b7b30284on Linux (WSL Ubuntu, Node 24.18.0), afternpm run build:cached:npx tsc -p . --noEmitpassed.oxfmt --checkwas clean.oxlinton the four touched files reported only the 4 warnings already present on the parent commit.npx vitest runonshutdownRegistration,mainErrors,shutdown,startupShutdown,serverLifecycleMcp,tests/composition/analysis-sessions, the HoppercleanupRetryandexternalExitclient tests, andsrc/application/binarypassed 27 files and 269 tests. WithretainProviderDocumentsOnCancelremoved fromopenInitialTarget, the startup signal test failed: close options[{}]instead of[{ retainDocument: true }].After merging upstream/main
60bd64647(streamable HTTP transport, #4955) into the branch (5f1c9ffd9), on Linux (WSL Ubuntu, Node 24.18.0):npm run build:cached,npx tsc -p . --noEmitpassed, andnpx vitest runonshutdownRegistration,mainErrors,shutdown,startupShutdown,streamableHttpMcp,mcpHttpOptions,optionalProviderShutdown,serverLifecycleMcp, andserveStreamableHttppassed 110 of 110 tests in two runs. In the same loaded run on60bd64647alone, thestreamableHttpMcpround-trip test failed twice out of two, so that failure predates this branch. It passes when run alone.npx vitest run tests/boundary/mcp/startupShutdown.test.ts tests/boundary/mcp/shutdown.test.ts src/server/shutdownRegistration.test.ts tests/boundary/mcp/mainErrors.test.ts— 21 passed atf6fa42a83(withdist/built bynpx tsc -p tsconfig.build.json). The newstartupShutdowncases were also run with each fix reverted, failing as described above.The same
startupShutdownandmainErrorstest files with the upstream/main source — 5 failed (4startupShutdowntests and themainErrorstransport start failure test), as expected. A sixth failure, the compiled-runtime import test, was only becausedist/was not built at that point.npx vitest run tests/boundary/mcp/serverLifecycleMcp.test.ts tests/boundary/mcp/optionalProviderIsolation.test.ts tests/process-global/mcpDeliveryEnvironment.test.ts tests/boundary/process/browserScenarioProbeLifecycle.test.ts— 13 passed, 4 failed, 2 skipped. The 2 SQLite stdio shutdown tests failed with missing packaged Windows native artifacts (native/windows/build/manifest.json). The 2 Electron isolation tests failed with ananalyze_javascript_applicationerror. The same 4 tests fail the same way on upstream/main on this host.npm run check:fast(typecheck and lint) — passed.npx tsc --noEmit --pretty false— no errors (before the review fixes).npx oxlinton the changed source and test files — 0 warnings, 0 errors.npx oxfmt --checkon the changed source and test files — all formatted.Compatibility, safety, and release
createShutdownandopenInitialTargetare internal and their call sites are updated.Author readiness
Human owner: @Adolanium
Before merge
type(scope): outcome.Maintainer blocker verification
A failed initial open that retains cleanup ownership now calls
finishFailedOpen(), which switches the session owner to non-retaining cleanup before both the current retry and later signal retries. Failed cleanup keeps the exact owner and registered signal handlers until retry succeeds. Direct review ofe09a158confirmed this call is wired inmain.ts; the current regression records underlying close options and asserts that no failed-open retry usesretainDocument: true.The focused startup-shutdown boundary suite passed all 10 tests and
npm run check:fastpassed on Node 24.18.0/npm 11.16.0. These are lifecycle fixtures, not a real-provider run.Startup stdin EOF remains unimplemented: a failed initial open returns before MCP transport begins reading stdin. This PR therefore covers startup signals and their cleanup, and does not fully close #4885's EOF criterion.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.