[GH-ISSUE #6433] [Bug] Directory-selected tshark is reported as unreadable analysis output #3849

Closed
opened 2026-10-31 00:44:36 +00:00 by bsakaguchi · 2 comments
Owner

Originally created by @coygeek on GitHub (Oct 23, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/6433

Before submitting

  • I searched the open and closed issues for a related report.
  • I removed credentials, tokens, private paths, and sensitive target data.

Area

Provider or capability discovery

Observed behavior

node scripts/rea.mjs inspect-pcap-client --json returns unreadable_output and generic rea doctor guidance when REA_TSHARK_COMMAND selects a directory. The error omits details, the tool name and selected path. Missing-path and non-executable-file controls instead return capability_unavailable with the path and Wireshark supply guidance. All three cases correctly refuse the unusable tool; the defect is the machine-readable classification and recovery information.

Reproduction

Run from the repository root with its required Node version, locked dependencies and compiled runtime prepared. Python 3 is required. This exact program was executed on the host below; it isolates writable state, inherits only PATH, creates all necessary fixtures and cleans them up. No Wireshark, saved capture or traffic is needed. The capinfos fixture is never launched because tshark fails first.

python3 - <<'PYTHON'
import json, os, pathlib, shutil, subprocess, tempfile
node = shutil.which('node')
assert node, 'Install the Node version required by the checkout first'
with tempfile.TemporaryDirectory(prefix='pcap-tool-selection-') as work:
    root = pathlib.Path(work).resolve()
    env = {'PATH': os.environ['PATH']}
    for key, name in [('HOME', 'home'), ('XDG_CONFIG_HOME', 'config'),
                      ('XDG_DATA_HOME', 'data'), ('XDG_STATE_HOME', 'state'),
                      ('XDG_CACHE_HOME', 'cache'), ('TMPDIR', 'tmp')]:
        path = root / name
        path.mkdir()
        env[key] = str(path)
    directory = root / 'selected-directory'
    directory.mkdir()
    regular = root / 'selected-file'
    regular.write_text('#!/bin/sh\nexit 0\n')
    regular.chmod(0o644)
    env['REA_CAPINFOS_COMMAND'] = str(regular)
    for name, selection in [('directory', directory),
                            ('missing', root / 'missing-tool'),
                            ('non-executable', regular)]:
        env['REA_TSHARK_COMMAND'] = str(selection)
        result = subprocess.run(
            [node, 'scripts/rea.mjs', 'inspect-pcap-client', '--json'],
            env=env, capture_output=True, text=True, timeout=60)
        error = json.loads(result.stdout)
        print(json.dumps({'case': name, 'exit': result.returncode,
                          'code': error.get('code'),
                          'category': error.get('category'),
                          'details_present': 'details' in error,
                          'message': error.get('message'),
                          'stderr': result.stderr}))
PYTHON

Expected behavior

Refuse the directory as an unusable caller-selected host tool using the existing capability_unavailable family, identify tshark and the configured path, and retain the Wireshark supply remediation. Keep the missing and non-executable controls' actionable refusals. This is a tool-configuration diagnostic contract, not a request to admit a directory as an executable.

Impact and scope

P2: the changed public error code/category and discarded selection identity impair typed caller recovery, beyond a message wording difference. Observed scope is CLI client inspection with a directory-selected tshark. The unusable selection still fails; no false success, capture loss or security-boundary crossing was observed. Workaround: inspect and correct the configured tool path. Natural occurrence frequency, other-host behavior and successful real-Wireshark recovery are NOT_ENOUGH_INFO. MCP, capture-runtime and unreadable-file variants were not tested by this verifier.

REA version

Tested main source revision 9eb829aca3, reporting package/CLI version 6.7.0. The published release tag lacks this pre-probe identity-read loop; its runtime was not executed, so this is not a claim of published-package reproduction.

Runtime and platform

Node.js v24.18.0; npm 11.16.0; macOS Darwin 27.0.0 arm64.

Target and artifact context

Disposable directory and non-executable text-file tool selections. No capture file or target is opened; directory rejection precedes all version probes.

Interface

CLI

Earliest failure stage

Setup or provider admission

Relevant output or evidence

Observed result summary from the inline program, with dynamic paths omitted:

{"case":"directory","exit":1,"code":"unreadable_output","category":"execution_failure","details_present":false}
{"case":"missing","exit":1,"code":"capability_unavailable","category":"unsupported_provider","details_present":true}
{"case":"non-executable","exit":1,"code":"capability_unavailable","category":"unsupported_provider","details_present":true}

Directory message: Analysis returned an unreadable result. Run `rea doctor` and review the reported details; repeating the unchanged request is not expected to succeed. The details property is absent rather than empty. Both controls identify the selected path and supply-tools remedy; the non-executable control reports spawn EACCES without a cleanup failure. The existing five CLI pcap boundary tests passed with node node_modules/vitest/vitest.mjs run tests/boundary/cli/pcapCli.test.ts --maxWorkers=1 --reporter=verbose.

Contract breadcrumbs: src/pcap/PcapConfiguration.ts:46-61 explicitly gives host-tool refusals their own AnalysisCapabilityUnavailableError and Wireshark guidance; tests/boundary/cli/cliServeHarness.ts:35-51 checks that shape for tool configuration. docs/pcap-analysis.md, Supply tools, documents absolute selection and capture-free client inspection.

Typed outcome or recovery expected

A non-retryable host-tool capability refusal with the selected tshark path and Wireshark correction, preserving the distinction from unreadable producer output.

Analysis or suspected cause

Source-derived trace: src/pcap/PcapProvider.ts:342-377 canonicalizes the selection and reads executable identity before probing. src/artifacts/readStableArtifact.ts:55-64 rejects a directory as ArtifactReaderFailure reason path. src/pcap/PcapProvider.ts:646-682 wraps that read failure in AnalysisProtocolError, which src/domain/analysisErrorProjection.ts:253 and src/domain/analysisErrorPresentation.ts:399 project as unreadable output with doctor advice. The public results were executed; this call-path explanation is source-derived.

Additional context

Related reports checked: #6123 concerns workspace allocation after capture admission, #5711 concerns unsupported-host discovery, #5940 concerns cleanup after a failed version probe, and #3403 concerns shared selection ownership. None describes this pre-probe directory read refusal. Open and closed searches found no same-closure report. NOT_ENOUGH_INFO: last known good runtime.

Proposed restoration check: rerun the inline program; the directory must still fail, but with a host-tool capability refusal naming tshark and its selected path, Wireshark correction, and no unreadable_output or generic doctor advice. Keep missing and non-executable controls' classifications and diagnostics. No source fix or restored runtime was tested.

Originally created by @coygeek on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/6433 ## Before submitting - [x] I searched the open and closed issues for a related report. - [x] I removed credentials, tokens, private paths, and sensitive target data. ## Area Provider or capability discovery ## Observed behavior `node scripts/rea.mjs inspect-pcap-client --json` returns `unreadable_output` and generic `rea doctor` guidance when `REA_TSHARK_COMMAND` selects a directory. The error omits `details`, the tool name and selected path. Missing-path and non-executable-file controls instead return `capability_unavailable` with the path and Wireshark supply guidance. All three cases correctly refuse the unusable tool; the defect is the machine-readable classification and recovery information. ## Reproduction Run from the repository root with its required Node version, locked dependencies and compiled runtime prepared. Python 3 is required. This exact program was executed on the host below; it isolates writable state, inherits only PATH, creates all necessary fixtures and cleans them up. No Wireshark, saved capture or traffic is needed. The capinfos fixture is never launched because tshark fails first. ```sh python3 - <<'PYTHON' import json, os, pathlib, shutil, subprocess, tempfile node = shutil.which('node') assert node, 'Install the Node version required by the checkout first' with tempfile.TemporaryDirectory(prefix='pcap-tool-selection-') as work: root = pathlib.Path(work).resolve() env = {'PATH': os.environ['PATH']} for key, name in [('HOME', 'home'), ('XDG_CONFIG_HOME', 'config'), ('XDG_DATA_HOME', 'data'), ('XDG_STATE_HOME', 'state'), ('XDG_CACHE_HOME', 'cache'), ('TMPDIR', 'tmp')]: path = root / name path.mkdir() env[key] = str(path) directory = root / 'selected-directory' directory.mkdir() regular = root / 'selected-file' regular.write_text('#!/bin/sh\nexit 0\n') regular.chmod(0o644) env['REA_CAPINFOS_COMMAND'] = str(regular) for name, selection in [('directory', directory), ('missing', root / 'missing-tool'), ('non-executable', regular)]: env['REA_TSHARK_COMMAND'] = str(selection) result = subprocess.run( [node, 'scripts/rea.mjs', 'inspect-pcap-client', '--json'], env=env, capture_output=True, text=True, timeout=60) error = json.loads(result.stdout) print(json.dumps({'case': name, 'exit': result.returncode, 'code': error.get('code'), 'category': error.get('category'), 'details_present': 'details' in error, 'message': error.get('message'), 'stderr': result.stderr})) PYTHON ``` ## Expected behavior Refuse the directory as an unusable caller-selected host tool using the existing `capability_unavailable` family, identify tshark and the configured path, and retain the Wireshark supply remediation. Keep the missing and non-executable controls' actionable refusals. This is a tool-configuration diagnostic contract, not a request to admit a directory as an executable. ## Impact and scope P2: the changed public error code/category and discarded selection identity impair typed caller recovery, beyond a message wording difference. Observed scope is CLI client inspection with a directory-selected tshark. The unusable selection still fails; no false success, capture loss or security-boundary crossing was observed. Workaround: inspect and correct the configured tool path. Natural occurrence frequency, other-host behavior and successful real-Wireshark recovery are NOT_ENOUGH_INFO. MCP, capture-runtime and unreadable-file variants were not tested by this verifier. ## REA version Tested main source revision 9eb829aca34be36ff112826337996f6139f82eff, reporting package/CLI version 6.7.0. The published release tag lacks this pre-probe identity-read loop; its runtime was not executed, so this is not a claim of published-package reproduction. ## Runtime and platform Node.js v24.18.0; npm 11.16.0; macOS Darwin 27.0.0 arm64. ## Target and artifact context Disposable directory and non-executable text-file tool selections. No capture file or target is opened; directory rejection precedes all version probes. ## Interface CLI ## Earliest failure stage Setup or provider admission ## Relevant output or evidence Observed result summary from the inline program, with dynamic paths omitted: ```json {"case":"directory","exit":1,"code":"unreadable_output","category":"execution_failure","details_present":false} {"case":"missing","exit":1,"code":"capability_unavailable","category":"unsupported_provider","details_present":true} {"case":"non-executable","exit":1,"code":"capability_unavailable","category":"unsupported_provider","details_present":true} ``` Directory message: ``Analysis returned an unreadable result. Run `rea doctor` and review the reported details; repeating the unchanged request is not expected to succeed.`` The `details` property is absent rather than empty. Both controls identify the selected path and supply-tools remedy; the non-executable control reports spawn EACCES without a cleanup failure. The existing five CLI pcap boundary tests passed with `node node_modules/vitest/vitest.mjs run tests/boundary/cli/pcapCli.test.ts --maxWorkers=1 --reporter=verbose`. Contract breadcrumbs: `src/pcap/PcapConfiguration.ts:46-61` explicitly gives host-tool refusals their own `AnalysisCapabilityUnavailableError` and Wireshark guidance; `tests/boundary/cli/cliServeHarness.ts:35-51` checks that shape for tool configuration. `docs/pcap-analysis.md`, Supply tools, documents absolute selection and capture-free client inspection. ## Typed outcome or recovery expected A non-retryable host-tool capability refusal with the selected tshark path and Wireshark correction, preserving the distinction from unreadable producer output. ## Analysis or suspected cause Source-derived trace: `src/pcap/PcapProvider.ts:342-377` canonicalizes the selection and reads executable identity before probing. `src/artifacts/readStableArtifact.ts:55-64` rejects a directory as `ArtifactReaderFailure` reason `path`. `src/pcap/PcapProvider.ts:646-682` wraps that read failure in `AnalysisProtocolError`, which `src/domain/analysisErrorProjection.ts:253` and `src/domain/analysisErrorPresentation.ts:399` project as unreadable output with doctor advice. The public results were executed; this call-path explanation is source-derived. ## Additional context Related reports checked: [#6123](https://github.com/morluto/rea/issues/6123) concerns workspace allocation after capture admission, [#5711](https://github.com/morluto/rea/issues/5711) concerns unsupported-host discovery, [#5940](https://github.com/morluto/rea/issues/5940) concerns cleanup after a failed version probe, and [#3403](https://github.com/morluto/rea/issues/3403) concerns shared selection ownership. None describes this pre-probe directory read refusal. Open and closed searches found no same-closure report. NOT_ENOUGH_INFO: last known good runtime. Proposed restoration check: rerun the inline program; the directory must still fail, but with a host-tool capability refusal naming tshark and its selected path, Wireshark correction, and no `unreadable_output` or generic doctor advice. Keep missing and non-executable controls' classifications and diagnostics. No source fix or restored runtime was tested.
Author
Owner

@CassieFox23 commented on GitHub (Oct 23, 2026):

I'd like to take this one. When tshark or capinfos points at a directory, REA fails while it reads the tool file. So it reports the unreadable-output error. The fix turns that failed read into the same host-tool refusal as the missing-path case. The refusal then names the tool and the path, with the Wireshark advice. I have a small fix and a test, checked on Linux.

Thanks, coygeek, for the exact reproduction and the source trace.

🤖 Written with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

<!-- gh-comment-id:6367761252 --> @CassieFox23 commented on GitHub (Oct 23, 2026): I'd like to take this one. When tshark or capinfos points at a directory, REA fails while it reads the tool file. So it reports the unreadable-output error. The fix turns that failed read into the same host-tool refusal as the missing-path case. The refusal then names the tool and the path, with the Wireshark advice. I have a small fix and a test, checked on Linux. Thanks, coygeek, for the exact reproduction and the source trace. 🤖 Written with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊
Author
Owner

@coygeek commented on GitHub (Oct 24, 2026):

Checked the reported fix on main at d87e73f2db.

Selected executable reads have a dedicated configuration-admission boundary: a directory ArtifactReaderFailure is mapped through pcapToolUnavailable, preserving path, capability_unavailable classification and Wireshark supply guidance. Cancellation and cleanup ownership remain distinct. The regression exercises both tshark and capinfos directory selections and asserts classification, selected path and Wireshark guidance.

Implementation: PcapProvider.ts, PcapConfiguration.ts.

The relevant regression checks in pcapProviderCrossPlatform.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.

<!-- gh-comment-id:6380749664 --> @coygeek commented on GitHub (Oct 24, 2026): Checked the reported fix on `main` at d87e73f2db50be72d33a4b3c7199af35518b441c. Selected executable reads have a dedicated configuration-admission boundary: a directory ArtifactReaderFailure is mapped through pcapToolUnavailable, preserving path, capability_unavailable classification and Wireshark supply guidance. Cancellation and cleanup ownership remain distinct. The regression exercises both tshark and capinfos directory selections and asserts classification, selected path and Wireshark guidance. Implementation: [PcapProvider.ts](https://github.com/morluto/rea/blob/d87e73f2db50be72d33a4b3c7199af35518b441c/src/pcap/PcapProvider.ts#L241), [PcapConfiguration.ts](https://github.com/morluto/rea/blob/d87e73f2db50be72d33a4b3c7199af35518b441c/src/pcap/PcapConfiguration.ts#L53). The relevant regression checks in [pcapProviderCrossPlatform.test.ts](https://github.com/morluto/rea/blob/d87e73f2db50be72d33a4b3c7199af35518b441c/tests/boundary/pcap/pcapProviderCrossPlatform.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.
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#3849
No description provided.