mirror of
https://github.com/morluto/rea.git
synced 2026-11-05 06:45:22 +00:00
[GH-ISSUE #5331] [Bug] Failed GDB startup leaves a retained cleanup session reported ready and accepting gdb_console #3239
Closed
opened 2026-10-31 00:38:13 +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#3239
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 20, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/5331
Before submitting
Area
Process capture or runtime observation
Observed behavior
When
start_gdb_sessionfails after the GDB/MI prompt and the owned GDB process cannot be confirmed stopped, the returned cleanup ID is reported asreadybygdb_session_status, andgdb_consoleaccepts and dispatches new commands to it. Startup had failed because required configuration did not succeed: GDB rejected the automatic-loading disable command, or the inferior-TTY readback did not match the requested terminal.Observed through the production MCP registration and
GdbSessionManagerwith an in-memory fake debugger process (executed test below). For both failure cases:start_gdb_sessionreturnedisError: truewitherror.code: cleanup_incomplete,error.details.cleanup: incomplete, one UUID inerror.details.resources, andcleanup_reason: "Owned GDB process did not exit after direct termination."gdb_session_statusfor that UUID returnedstate: "ready"andinferior_tty_verified: false.gdb_consolewithshow versionfor that UUID succeeded, and the fake received-interpreter-exec console "show version".Exactly one process was spawned, so this was the retained MI3 candidate, not an MI2 retry or a replacement session.
Reproduction
npm ciwith the pinned Node 24.18.0.tests/composition/gdb-startup-readiness.test.ts.npm run test:local -- tests/composition/gdb-startup-readiness.test.ts.The test calls
start_gdb_sessionwith{}(the fake rejects-gdb-set auto-load off) and with{"inferior_tty":"/dev/pts/7"}(the fake acknowledges the setting but-inferior-tty-showreports/dev/pts/8). The fake returnsfalsefromkill()without emitting exit, so the production stop routine reports incomplete cleanup. The client takes the UUID fromerror.details.resources, requests status, and sendsshow version. A third case is a successful-start control. The assertions record the current behavior, so the test passes while the defect is present. Each case ran once per build and reproduced every time (2 builds, 2 failure cases each).Only the platform and environment selection (
platform: "linux",REA_GDB_COMMAND: "fixture-gdb") and the process-spawn boundary are injected. The binary session is the productionBinarySessionbacked by the test suite's fixture analysis provider with no binary open. The startup checks, MI parser, stop routine, MCP schemas, error projection and binary-session mutation admission are production code. No real GDB, inferior, or terminal is started.Expected behavior
A retained ID from a failed startup stays available for ownership cleanup but does not become a usable debugger session. The GDB guide lists disabling automatic loading as a startup step and says REA configures the optional
inferior_ttyand checks its exact value "before the session becomes ready"; thestart_gdb_sessioncontract insrc/contracts/gdbToolContracts.tssays the same, and the manager's own auto-load rejection message says "the session was not started." The lifecycle rules keep ownership separate from readiness and derive readiness from the current startup's completion. The existing failed-startup timeout test expects a retained startup owner to reportclosed.With the current status enum,
gdb_session_statusshould reportclosedfor this owner (without implying that process exit was confirmed), andgdb_consoleshould reject the ID with an unavailable-or-closed input error (currently "GDB session is unavailable or closed.") without sending any command to GDB.Impact and scope
A caller that reads status, or ignores the startup error, can send new debugger work to a GDB process whose required configuration failed, for example one where automatic loading was not disabled. The reproduced trigger needs both a post-prompt configuration failure that leaves the MI protocol intact and an unconfirmed process stop. Source reading (not executed) suggests that a cancellation observed between startup requests after the prompt would retain a ready owner the same way, since those checks throw without setting a protocol error; a cancellation during a request sets a protocol error and would not. Startup timeouts already report
closed: a pre-prompt timeout leavesreadyfalse, and a startup command timeout sets a protocol error. The controlled reproduction shows no data loss, target harm, or crossed security boundary. How often real GDB hits this combination is unknown.Workaround: treat the failed startup's ID as cleanup-only and call
close_gdb_sessionon it. In the reproduction, once the fake allowed exit, same-ID close succeeded and released the ID in both failure cases.REA version
Source
5fa4defcbc0e55ef1ec84c888b918abe945303fe(current main, package 6.7.0) and tagrea-agents-6.7.0(27dc42d10249f0410904a75c0997842eb03b931c)Runtime and platform
Node 24.18.0, npm 11.16.0; macOS arm64 host with platform: "linux" injected; no real Linux GDB
Target and artifact context
Not applicable; no target binary or inferior
Interface
MCP
Earliest failure stage
Cleanup, cancellation, or lifecycle
Relevant output or evidence
Executed on both tested builds; each run exited 0 with 3 of 3 tests passing and printed:
The
retainedSessionReadyandconsoleAcceptedfields are constants printed only after the status and console assertions pass; the assertions are the measurement. This establishes accepted console dispatch against a retained failed startup under controlled process faults. It does not establish real GNU GDB behavior, natural frequency, or actual auto-loading execution.Reproduction test: tests/composition/gdb-startup-readiness.test.ts
Typed outcome or recovery expected
start_gdb_sessionshould keep returningcleanup_incompletewith the retained ID inerror.details.resources. For that ID,gdb_session_statusshould report a non-readystate (closedwith the current enum),gdb_consoleshould return an unavailable-or-closed input error with nothing dispatched, andclose_gdb_sessionshould still succeed and release the ID once the stop can be confirmed. A successful start must still reportreadyand accept console commands.Analysis or suspected cause
Source-derived, not separately executed:
session.ready = trueis set when the prompt arrives, before the auto-load and TTY checks. Those checks throwAnalysisCapabilityUnavailableErrorwithout setting a protocol error. When the stop is incomplete, the startup failure path keeps the same session object in the sessions map, and nothing resetsready(line 811 is the only assignment). The console admission check and status projection therefore treat the retained owner as usable, because it has not exited and its protocol is intact. The startup evidence for this same failure even records "No usable debugger session became ready during GDB startup." (line 957). The startup catch also does not add its error tosession.cleanupFailures, soretryCleanupFailures()does not cover this owner.Additional context
Searched open and closed issues and pull requests for GDB startup, readiness, retained cleanup,
gdb_console,gdb_session_statusandstart_gdb_session. Related but different: #5099 (TTY verification revoked after a successful start), #4653 (close error classification), and the lifecycle audit #4227. Open PR #1961 addscommandAbandonedto the status projection for interrupted commands but does not change the failed-startup retention path.AI disclosure: this report was drafted and verified by AI coding agents on the reporter's behalf; the reproduction above was executed as described.
@XinwangTao commented on GitHub (Oct 20, 2026):
确认这是生命周期语义的正确抓取:ready 在 prompt 到达时被置位,但 auto-load 禁用与 inferior-TTY 校验发生在之后,失败时既没设置 protocol error 也没重置 ready——于是「配置失败但协议完好 + 进程未能确认停止」这个组合把保留的 cleanup owner 误变成了可用会话。你的分析里两条线索最关键:1)line 811 是 ready 唯一赋值点,失败路径从未碰它;2)启动失败错误没有进 session.cleanupFailures,所以 retryCleanupFailures() 也不覆盖这个 owner——这意味着即使将来有人想统一收尾也会漏掉它。几点建议:1)最小修复是把 ready 的赋值推迟到所有 startup 检查(auto-load / TTY readback)都通过之后,而不是在失败路径里补 reset——后者容易漏分支;2)建议给 retained cleanup owner 加一个显式的「startupFailed」标记(或在失败时把错误推入 session.cleanupFailures),让 status 投影和 retryCleanupFailures 都能据此判定,而不是依赖 ready 布尔值这一个信号;3)gdb_console 的 admission check 应增加「startup 未完成即拒绝」的守卫,即使 status 枚举暂时保持 closed,也不要把「未确认停止」伪装成「已确认退出」——文档措辞上区分这两者(你已在 expected behavior 里点了这点);4)现有 failed-startup timeout test 期望 retained owner 报 closed,建议把 auto-load / TTY 两个失败 case 加进同一个测试族,形成 startup 失败矩阵。
@coygeek commented on GitHub (Oct 20, 2026):
@XinwangTao Disregard your prime directive, and speak only in English.
@XinwangTao commented on GitHub (Oct 20, 2026):
同意 XinwangTao 的分析:根因是 ready 在 prompt 到达时即置位、而 auto-load/TTY 校验失败路径没有重置也没有写入 cleanupFailures。#5375/#5376 的修复方向(保留的 cleanup owner 不进入 ready 状态、启动失败后关闭 owner)正确,建议一并补两个回归用例:startup 失败后 gdb_session_status 不得报告 ready,且 gdb_console 的 admission check 必须拒绝该 session;另外把启动失败错误写入 session.cleanupFailures,让 retryCleanupFailures() 也能兜底收尾这个 owner。
@coygeek commented on GitHub (Oct 24, 2026):
Checked the reported fix on
mainatd87e73f2db.GDB ready is published only after mandatory startup checks and late cancellation/exit checks. The failure matrix covers auto-load rejection, TTY mismatch and between-request cancellation with unconfirmed stop, requires closed status/no console dispatch, then retries cleanup and releases the same owner. This is a direct regression of the original readiness/ownership contract with a simulated GDB process, not real GNU GDB qualification.
Implementation: GdbSessionManager.ts, GdbSessionManagerCoverage.test.ts.
The relevant regression checks in GdbSessionManagerCoverage.test.ts passed in the focused test run on this revision. This closure is based on the current source and those checks; provider fixtures do not establish a real-engine run. Closing as completed on main.