[PR #3073] [CLOSED] fix(adb): observe daemon startup notices emitted on stderr #5592

Closed
opened 2026-10-31 01:07:50 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3073
Author: @viniciusdsandrade
Created: 10/14/2026
Status: ❌ Closed

Base: main ← Head: fix/adb-cold-daemon-startup


📝 Commits (7)

  • 2008dfa fix(adb): accept daemon startup notices from stderr in adb devices parser
  • 61a5c39 fix(adb): forward stderr to device parser on adb devices query
  • 3229dd0 test(adb): verify daemon startup observation when notices are on stderr
  • 3aaa97c style(adb): wrap stderr daemon notice checks within print width
  • 549f870 test(adb): verify stderr does not inject device lines or unparsed errors
  • 740b0c7 fix(verification): populate synthetic procfs entry for Linux demo helper fixture
  • bfa281f Merge remote-tracking branch 'origin/main' into HEAD

📊 Changes

4 files changed (+84 additions, -0 deletions)

View changed files

📝 src/adb/AdbDeviceOutput.test.ts (+41 -0)
📝 src/adb/AdbDeviceOutput.ts (+12 -0)
📝 src/adb/AdbProvider.test.ts (+30 -0)
📝 src/adb/AdbProvider.ts (+1 -0)

📄 Description

Summary

list_adb_devices / list-adb-devices reports may_have_started_adb_server: false on the first query against a cold ADB server because daemon startup notices printed by ADB to stderr were not inspected by parseAdbDevicesOutput.

Fixes #3051

Problem and expected behavior

When ADB runs devices -l against a cold or stopped ADB server, modern adb binaries (including platform-tools r34 and r37) emit daemon startup notices to stderr:

* daemon not running; starting now at tcp:5037
* daemon started successfully

while stdout receives the standard device table banner:

List of devices attached

In src/adb/AdbProvider.ts, runAdb captures both stdout and stderr, but list_adb_devices passed only ran.value.stdout to parseAdbDevicesOutput. In src/adb/AdbDeviceOutput.ts, parseAdbDevicesOutput only accepted a stdout parameter. As a result, when ADB started a background server process during the device query, daemonStarted was not detected, and the structured response reported may_have_started_adb_server: false.

Expected behavior per docs/adb-device-analysis.md: the ADB client starting its local server on first query is recorded in the tool result when observed (may_have_started_adb_server: true), while subsequent queries or runs against an already running server report false. Unrecognized line reporting and device parsing continue to apply strictly to stdout.

Change and scope

  • In src/adb/AdbDeviceOutput.ts: update parseAdbDevicesOutput to accept an optional stderr parameter. When daemonStarted was not found in stdout and stderr is non-empty, scan stderr lines for * daemon ... started successfully notices. Device lines and unparsed line tracking continue to evaluate stdout only.
  • In src/adb/AdbProvider.ts: forward ran.value.stderr alongside ran.value.stdout into parseAdbDevicesOutput.
  • In src/adb/AdbDeviceOutput.test.ts: add a unit test asserting daemonStarted: true when daemon notices are emitted on stderr.
  • In src/adb/AdbProvider.test.ts: add a regression test asserting may_have_started_adb_server: true when the stub prints daemon notices to stderr.

Contract and boundary impact

  • Semantic owner and earliest changed stage: ADB device output parsing in src/adb/AdbDeviceOutput.ts and provider delegation in src/adb/AdbProvider.ts.
  • Contribution scope fit and linked maintainer decision: not applicable; routine bug fix within existing ADB provider boundaries.
  • CLI and MCP/tool-catalog contract: unchanged schemas. Retains existing may_have_started_adb_server boolean field.
  • Provider, bridge, target-format, or platform compatibility: Android SDK platform-tools adb.
  • Evidence, artifact, provenance, or reconstruction contract: device entries, unparsed line handling, and limitations remain unmodified.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): preserves caller-selected adb execution boundaries; does not launch or kill background processes.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated:
    • src/adb/AdbDeviceOutput.test.ts: verifies parseAdbDevicesOutput detects daemon startup notices from stderr while parsing stdout devices.
    • src/adb/AdbProvider.test.ts: verifies list_adb_devices returns may_have_started_adb_server: true when adb prints daemon startup notices to stderr.
  • Base reproduction or other evidence: on the base revision, list_adb_devices passes only stdout to parseAdbDevicesOutput, so daemon startup notices on stderr leave may_have_started_adb_server: false.
  • User-visible CLI/MCP output (if applicable): may_have_started_adb_server: true when the first query against a cold adb server starts a background server.
  • Remaining proof gaps: tests were verified by source inspection; CI executes the deterministic suite.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • No local commands were run: verification is source-derived; CI executes the deterministic suite.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: none run.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no added execution authority; preserves existing input validation and honest reporting of unparsed stdout lines.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/3073 **Author:** [@viniciusdsandrade](https://github.com/viniciusdsandrade) **Created:** 10/14/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/adb-cold-daemon-startup` --- ### 📝 Commits (7) - [`2008dfa`](https://github.com/morluto/rea/commit/2008dfac5566b7f501c2e069cf7b91318c204cfb) fix(adb): accept daemon startup notices from stderr in adb devices parser - [`61a5c39`](https://github.com/morluto/rea/commit/61a5c3971d56507c641922cdd8ebf14795a76c0d) fix(adb): forward stderr to device parser on adb devices query - [`3229dd0`](https://github.com/morluto/rea/commit/3229dd0346fad3ac21dadc57cd5dc1923a777ef0) test(adb): verify daemon startup observation when notices are on stderr - [`3aaa97c`](https://github.com/morluto/rea/commit/3aaa97ca824444e2f76329888c2b752387b611a5) style(adb): wrap stderr daemon notice checks within print width - [`549f870`](https://github.com/morluto/rea/commit/549f870b07e6e916098d3f2eab32e85ed3a82a24) test(adb): verify stderr does not inject device lines or unparsed errors - [`740b0c7`](https://github.com/morluto/rea/commit/740b0c7b70b72b453d4d72633a9b53d25199b3ea) fix(verification): populate synthetic procfs entry for Linux demo helper fixture - [`bfa281f`](https://github.com/morluto/rea/commit/bfa281fc4117422acfa91c90cd7863773f5d336c) Merge remote-tracking branch 'origin/main' into HEAD ### 📊 Changes **4 files changed** (+84 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/adb/AdbDeviceOutput.test.ts` (+41 -0) 📝 `src/adb/AdbDeviceOutput.ts` (+12 -0) 📝 `src/adb/AdbProvider.test.ts` (+30 -0) 📝 `src/adb/AdbProvider.ts` (+1 -0) </details> ### 📄 Description ## Summary `list_adb_devices` / `list-adb-devices` reports `may_have_started_adb_server: false` on the first query against a cold ADB server because daemon startup notices printed by ADB to stderr were not inspected by `parseAdbDevicesOutput`. Fixes #3051 ## Problem and expected behavior When ADB runs `devices -l` against a cold or stopped ADB server, modern `adb` binaries (including platform-tools r34 and r37) emit daemon startup notices to stderr: ``` * daemon not running; starting now at tcp:5037 * daemon started successfully ``` while stdout receives the standard device table banner: ``` List of devices attached ``` In `src/adb/AdbProvider.ts`, `runAdb` captures both stdout and stderr, but `list_adb_devices` passed only `ran.value.stdout` to `parseAdbDevicesOutput`. In `src/adb/AdbDeviceOutput.ts`, `parseAdbDevicesOutput` only accepted a `stdout` parameter. As a result, when ADB started a background server process during the device query, `daemonStarted` was not detected, and the structured response reported `may_have_started_adb_server: false`. Expected behavior per `docs/adb-device-analysis.md`: the ADB client starting its local server on first query is recorded in the tool result when observed (`may_have_started_adb_server: true`), while subsequent queries or runs against an already running server report `false`. Unrecognized line reporting and device parsing continue to apply strictly to stdout. ## Change and scope - In `src/adb/AdbDeviceOutput.ts`: update `parseAdbDevicesOutput` to accept an optional `stderr` parameter. When `daemonStarted` was not found in stdout and stderr is non-empty, scan stderr lines for `* daemon ... started successfully` notices. Device lines and unparsed line tracking continue to evaluate stdout only. - In `src/adb/AdbProvider.ts`: forward `ran.value.stderr` alongside `ran.value.stdout` into `parseAdbDevicesOutput`. - In `src/adb/AdbDeviceOutput.test.ts`: add a unit test asserting `daemonStarted: true` when daemon notices are emitted on stderr. - In `src/adb/AdbProvider.test.ts`: add a regression test asserting `may_have_started_adb_server: true` when the stub prints daemon notices to stderr. ## Contract and boundary impact - Semantic owner and earliest changed stage: ADB device output parsing in `src/adb/AdbDeviceOutput.ts` and provider delegation in `src/adb/AdbProvider.ts`. - Contribution scope fit and linked maintainer decision: not applicable; routine bug fix within existing ADB provider boundaries. - CLI and MCP/tool-catalog contract: unchanged schemas. Retains existing `may_have_started_adb_server` boolean field. - Provider, bridge, target-format, or platform compatibility: Android SDK platform-tools adb. - Evidence, artifact, provenance, or reconstruction contract: device entries, unparsed line handling, and limitations remain unmodified. - Target selection, authority, upstream behavior, and cleanup details (if applicable): preserves caller-selected adb execution boundaries; does not launch or kill background processes. - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact: none. Expected effects: - [ ] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: - `src/adb/AdbDeviceOutput.test.ts`: verifies `parseAdbDevicesOutput` detects daemon startup notices from stderr while parsing stdout devices. - `src/adb/AdbProvider.test.ts`: verifies `list_adb_devices` returns `may_have_started_adb_server: true` when adb prints daemon startup notices to stderr. - Base reproduction or other evidence: on the base revision, `list_adb_devices` passes only stdout to `parseAdbDevicesOutput`, so daemon startup notices on stderr leave `may_have_started_adb_server: false`. - User-visible CLI/MCP output (if applicable): `may_have_started_adb_server: true` when the first query against a cold adb server starts a background server. - Remaining proof gaps: tests were verified by source inspection; CI executes the deterministic suite. For evidence-bearing changes: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - No local commands were run: verification is source-derived; CI executes the deterministic suite. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: none run. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no added execution authority; preserves existing input validation and honest reporting of unparsed stdout lines. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:07:50 +00:00
Sign in to join this conversation.
No milestone
No project
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#5592
No description provided.