[GH-ISSUE #5527] [Bug] Bash completion fails to register in macOS system Bash #3362

Closed
opened 2026-10-31 00:39:33 +00:00 by bsakaguchi · 2 comments
Owner

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

Before submitting

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

Area

CLI

Observed behavior

node scripts/rea.mjs completions bash generates a script that fails when sourced in macOS system Bash 3.2.57(1)-release: complete: nosort: invalid option name. Sourcing returns 2 and leaves rea without a completion registration. Generation and the shell syntax check succeed. The identical generated script registers successfully in Bash 5.3.20(1)-release.

This report was prepared with AI assistance and independently reproduced by a verifier through REA's supplied compiled CLI. Results below describe that verification.

Reproduction

From the source checkout at the revision below, the verifier ran this reproduction with disposable home/configuration/data/cache/state roots and no analysis database:

verify_dir=$(mktemp -d)
export HOME="$verify_dir/home"
export XDG_CONFIG_HOME="$verify_dir/config"
export XDG_DATA_HOME="$verify_dir/data"
export XDG_CACHE_HOME="$verify_dir/cache"
export XDG_STATE_HOME="$verify_dir/state"
export TMPDIR="$verify_dir/temp"
export CI=1 NO_UPDATE_NOTIFIER=1
mkdir -p "$HOME" "$XDG_CONFIG_HOME" "$XDG_DATA_HOME" "$XDG_CACHE_HOME" "$XDG_STATE_HOME" "$TMPDIR"
node scripts/rea.mjs completions --help
node scripts/rea.mjs completions bash > "$verify_dir/rea.bash"
system_bash=$(command -p -v bash)
"$system_bash" --version
"$system_bash" --noprofile --norc -n "$verify_dir/rea.bash"
"$system_bash" --noprofile --norc -c 'source "$1"; source_status=$?; printf "source_status=%s\n" "$source_status"; complete -p rea' verify "$verify_dir/rea.bash"

The final command prints source_status=2, reports no registration, and exits 1. Separate source-only and combined registration checks both reproduced the source failure; no statistical failure rate was measured.

With the verifier's installed modern Bash on PATH, this control succeeds with the same generated bytes:

bash --noprofile --norc -c 'source "$1"; source_status=$?; printf "source_status=%s\n" "$source_status"; complete -p rea' verify "$verify_dir/rea.bash"

Expected behavior

Following the advertised Bash setup should source the script without error and register completion for rea, observable with complete -p rea. The observed completions --help Setup section advertises eval "$(rea completions bash)" without a minimum Bash version; docs/installation.md:532-539 documents macOS support. Applicability to the tested system Bash is an inference from that unqualified help and host support, not an explicit documented promise naming Bash 3.2.

Impact and scope

Bash completion is entirely unregistered on the tested macOS system Bash. Ordinary REA commands remain available. Using the verifier's already installed Bash 5.3.20 is a demonstrated workaround: it registers the identical script and its callback returns analyze, analyze-web-bundle, and analyze-javascript-application for the prefix ana. No other Bash versions were tested, and the callback sample does not establish every completion case.

REA version

rea-agents 6.7.0; source commit 074768901f3cdc8205b61773fb1faf6f6c7b3ca8.

Runtime and platform

macOS 27.0.1 arm64; Node v26.12.0; system Bash 3.2.57(1)-release; modern control Bash 5.3.20(1)-release. The repository pins Node 24.18.0; generation used the available Node version and supplied compiled runtime. The failure occurs in the generated shell script after Node exits.

Target and artifact context

Generated 28-line Bash completion script for rea; no analysis target or provider is involved.

Interface

CLI

Earliest failure stage

Setup or provider admission

Relevant output or evidence

Generation and system_bash --noprofile --norc -n both exit 0. Sourcing the generated script reports this diagnostic at line 28:

complete: nosort: invalid option name
source_status=2
complete: rea: no completion specification

The combined source/registration command exits 1 because the final registration query fails. The modern Bash control prints source_status=0, successfully prints the completion registration including -o nosort, and emits no stderr.

Typed outcome or recovery expected

No typed REA result is involved. Shell setup should return 0 without stderr and leave a working completion registration.

Analysis or suspected cause

Source-derived explanation: REA constructs its Incur CLI in src/cli.ts:92. The locked dependency is Incur 0.6.1 (package.json:346). In that dependency, node_modules/incur/src/Cli.ts:1056-1088 dispatches completions bash, and node_modules/incur/src/Completions.ts:303 unconditionally emits -o nosort in the Bash registration. That option is rejected by the tested system Bash.

A diagnostic scratch copy with only -o nosort removed registered in system Bash and returned the same three sampled candidates. This is a mechanism check, not a product fix or proof of complete Bash 3.2 compatibility. Whether to address this in REA or through an Incur update is left to the maintainers.

Additional context

Related feature request: #5481 asks for shell completion generally; it does not report this generated-script registration failure.

NOT_ENOUGH_INFO: no last known good REA version or first bad release was established. Proposed restoration checks are to regenerate, source, query registration, and sample the callback in both tested shells; no product fix was implemented during verification.

Originally created by @coygeek on GitHub (Oct 20, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/5527 ### 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 CLI ### Observed behavior `node scripts/rea.mjs completions bash` generates a script that fails when sourced in macOS system Bash 3.2.57(1)-release: `complete: nosort: invalid option name`. Sourcing returns 2 and leaves `rea` without a completion registration. Generation and the shell syntax check succeed. The identical generated script registers successfully in Bash 5.3.20(1)-release. This report was prepared with AI assistance and independently reproduced by a verifier through REA's supplied compiled CLI. Results below describe that verification. ### Reproduction From the source checkout at the revision below, the verifier ran this reproduction with disposable home/configuration/data/cache/state roots and no analysis database: ```sh verify_dir=$(mktemp -d) export HOME="$verify_dir/home" export XDG_CONFIG_HOME="$verify_dir/config" export XDG_DATA_HOME="$verify_dir/data" export XDG_CACHE_HOME="$verify_dir/cache" export XDG_STATE_HOME="$verify_dir/state" export TMPDIR="$verify_dir/temp" export CI=1 NO_UPDATE_NOTIFIER=1 mkdir -p "$HOME" "$XDG_CONFIG_HOME" "$XDG_DATA_HOME" "$XDG_CACHE_HOME" "$XDG_STATE_HOME" "$TMPDIR" node scripts/rea.mjs completions --help node scripts/rea.mjs completions bash > "$verify_dir/rea.bash" system_bash=$(command -p -v bash) "$system_bash" --version "$system_bash" --noprofile --norc -n "$verify_dir/rea.bash" "$system_bash" --noprofile --norc -c 'source "$1"; source_status=$?; printf "source_status=%s\n" "$source_status"; complete -p rea' verify "$verify_dir/rea.bash" ``` The final command prints `source_status=2`, reports no registration, and exits 1. Separate source-only and combined registration checks both reproduced the source failure; no statistical failure rate was measured. With the verifier's installed modern Bash on PATH, this control succeeds with the same generated bytes: ```sh bash --noprofile --norc -c 'source "$1"; source_status=$?; printf "source_status=%s\n" "$source_status"; complete -p rea' verify "$verify_dir/rea.bash" ``` ### Expected behavior Following the advertised Bash setup should source the script without error and register completion for `rea`, observable with `complete -p rea`. The observed `completions --help` Setup section advertises `eval "$(rea completions bash)"` without a minimum Bash version; `docs/installation.md:532-539` documents macOS support. Applicability to the tested system Bash is an inference from that unqualified help and host support, not an explicit documented promise naming Bash 3.2. ### Impact and scope Bash completion is entirely unregistered on the tested macOS system Bash. Ordinary REA commands remain available. Using the verifier's already installed Bash 5.3.20 is a demonstrated workaround: it registers the identical script and its callback returns `analyze`, `analyze-web-bundle`, and `analyze-javascript-application` for the prefix `ana`. No other Bash versions were tested, and the callback sample does not establish every completion case. ### REA version `rea-agents` 6.7.0; source commit `074768901f3cdc8205b61773fb1faf6f6c7b3ca8`. ### Runtime and platform macOS 27.0.1 arm64; Node v26.12.0; system Bash 3.2.57(1)-release; modern control Bash 5.3.20(1)-release. The repository pins Node 24.18.0; generation used the available Node version and supplied compiled runtime. The failure occurs in the generated shell script after Node exits. ### Target and artifact context Generated 28-line Bash completion script for `rea`; no analysis target or provider is involved. ### Interface CLI ### Earliest failure stage Setup or provider admission ### Relevant output or evidence Generation and `system_bash --noprofile --norc -n` both exit 0. Sourcing the generated script reports this diagnostic at line 28: ```text complete: nosort: invalid option name source_status=2 complete: rea: no completion specification ``` The combined source/registration command exits 1 because the final registration query fails. The modern Bash control prints `source_status=0`, successfully prints the completion registration including `-o nosort`, and emits no stderr. ### Typed outcome or recovery expected No typed REA result is involved. Shell setup should return 0 without stderr and leave a working completion registration. ### Analysis or suspected cause Source-derived explanation: REA constructs its Incur CLI in `src/cli.ts:92`. The locked dependency is Incur 0.6.1 (`package.json:346`). In that dependency, `node_modules/incur/src/Cli.ts:1056-1088` dispatches `completions bash`, and `node_modules/incur/src/Completions.ts:303` unconditionally emits `-o nosort` in the Bash registration. That option is rejected by the tested system Bash. A diagnostic scratch copy with only ` -o nosort` removed registered in system Bash and returned the same three sampled candidates. This is a mechanism check, not a product fix or proof of complete Bash 3.2 compatibility. Whether to address this in REA or through an Incur update is left to the maintainers. ### Additional context Related feature request: #5481 asks for shell completion generally; it does not report this generated-script registration failure. NOT_ENOUGH_INFO: no last known good REA version or first bad release was established. Proposed restoration checks are to regenerate, source, query registration, and sample the callback in both tested shells; no product fix was implemented during verification.
Author
Owner

@matbrgz commented on GitHub (Oct 20, 2026):

Cross-referencing with canonical issue #5481 and siblings #5526 and #5528. Relates to Bash completion script compatibility across older system Bash environments (macOS 3.2). Cataloged under Cluster AW in consolidation tracker #4330.

<!-- gh-comment-id:6293044297 --> @matbrgz commented on GitHub (Oct 20, 2026): Cross-referencing with canonical issue #5481 and siblings #5526 and #5528. Relates to Bash completion script compatibility across older system Bash environments (macOS 3.2). Cataloged under Cluster AW in consolidation tracker #4330.
Author
Owner

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

Verified resolved on main at d87e73f2db.

I regenerated the Bash completion script from the rebuilt public CLI and sourced those exact bytes under both macOS system Bash 3.2.57 and Bash 5.3.20, using an isolated home. Both source/registration checks now exit 0 with empty stderr, and both completion callbacks return analyze, analyze-web-bundle, and analyze-javascript-application for ana. System Bash registers without nosort; modern Bash retains it.

The registration now falls back when nosort is unsupported and guards compopt. The focused dispatcher/completion run also passed all 17 tests across its two files, including the generated Bash launcher regression. Closing as completed on main.

<!-- gh-comment-id:6380612162 --> @coygeek commented on GitHub (Oct 24, 2026): Verified resolved on `main` at d87e73f2db50be72d33a4b3c7199af35518b441c. I regenerated the Bash completion script from the rebuilt public CLI and sourced those exact bytes under both macOS system Bash 3.2.57 and Bash 5.3.20, using an isolated home. Both source/registration checks now exit 0 with empty stderr, and both completion callbacks return `analyze`, `analyze-web-bundle`, and `analyze-javascript-application` for `ana`. System Bash registers without `nosort`; modern Bash retains it. The [registration now falls back when `nosort` is unsupported and guards `compopt`](https://github.com/morluto/rea/blob/d87e73f2db50be72d33a4b3c7199af35518b441c/src/cli/bashCompletionRegistration.ts#L30-L36). The focused dispatcher/completion run also passed all 17 tests across its two files, including [the generated Bash launcher regression](https://github.com/morluto/rea/blob/d87e73f2db50be72d33a4b3c7199af35518b441c/tests/boundary/cli/completions.test.ts#L108-L145). 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#3362
No description provided.