[GH-ISSUE #5526] [Bug] Bash completion omits documented global options #3363

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/5526

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

The Bash hook emitted by rea completions bash omits documented global options for rea instructions. Completing --he, --for, or --tok returns no candidates, while command-specific options and enum values complete successfully. The full global flags remain usable.

Reproduction

The independent verifier ran this from the built source checkout in Bash 5.3.20 (the hook requires Bash 4.4 or newer), with disposable HOME/XDG directories:

rea() { node scripts/rea.mjs "$@"; }
source <(rea completions bash)
for prefix in -- --he --for --tok --proc; do
  COMP_WORDS=(rea instructions "$prefix")
  COMP_CWORD=2
  _incur_complete_rea
  printf '%s: count=%s' "$prefix" "${#COMPREPLY[@]}"
  printf ' %s' "${COMPREPLY[@]}"
  printf '\n'
done
COMP_WORDS=(rea instructions --target-format "")
COMP_CWORD=3
_incur_complete_rea
printf 'target-format: %s\n' "${COMPREPLY[*]}"
rea instructions --help
rea instructions --schema --format json

The callback omission reproduced using both a wrapper and the shell function above. No analysis target, database, or provider was needed.

Expected behavior

Offer the active command's documented global options alongside its command-specific options. rea completions --help advertises shell completion; rea instructions --help lists these Global Options: --filter-output, --format, --full-output, --help, --llms, --llms-full, --schema, --token-count, --token-limit, and --token-offset. Thus --he should suggest --help, --for should suggest --format, and --tok should suggest the documented token flags.

Impact and scope

Bash users cannot discover or complete valid global flags in the demonstrated instructions workflow. This is a bounded functional failure with a practical workaround: read command help and type the flags in full. Command-specific flag and enum completion still work. Other shells and command pages were not independently tested; no analysis-data damage was observed.

REA version

rea-agents 6.7.0; source commit 074768901f3cdc8205b61773fb1faf6f6c7b3ca8; locked Incur 0.6.1.

Runtime and platform

Node.js v26.12.0, macOS arm64, Bash 5.3.20. Hopper/Ghidra are not involved.

Target and artifact context

Not applicable: static CLI help, schema, and Bash completion only.

Interface

CLI

Earliest failure stage

Transport or result projection

Relevant output or evidence

The executed completion callback returned:

--: count=6 --procedure --snapshot --target-format --architecture --entry-point --provider
--he: count=0
--for: count=0
--tok: count=0
--proc: count=1 --procedure
target-format: dos-com raw-binary

The callbacks exited 0 without stderr. rea instructions --help exited 0 and listed all ten global flags above. rea instructions --schema --format json exited 0 and returned a valid JSON object, confirming that the global flags are accepted.

Typed outcome or recovery expected

Include the documented global flags in completion candidates while preserving command-option and enum candidates. Until then, typing the full flags is the verified workaround.

Analysis or suspected cause

Source-derived reasoning: REA constructs its Incur CLI in src/cli.ts:92–111 without a custom globals schema. In bundled Incur 0.6.1, node_modules/incur/dist/Cli.js:408–424 dispatches completion to Completions.complete, passing configured custom globals. node_modules/incur/dist/Completions.js:19–95 adds command options and optional custom globals, but omits the standard globals printed by node_modules/incur/dist/Help.js:294–318. This matches the observed candidate omission. Whether to address this in REA or through an Incur update is left to maintainers.

Additional context

Prepared with AI assistance and independently reproduced by a separate verifier. The submitter checked upstream changes after the tested revision: no relevant completion or dependency fix was found. Related feature request #5481 proposes shell completion generally; this report concerns the existing generated hook's missing global-option candidates.

NOT_ENOUGH_INFO: no last-known-good version was established, so this is not claimed as a regression. A proposed acceptance check is to rerun the reproduction, obtain the documented globals for --, --he, --for, and --tok, and preserve the passing --proc, enum, and schema controls. No repair was implemented or tested.

Originally created by @coygeek on GitHub (Oct 20, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/5526 ### 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 The Bash hook emitted by `rea completions bash` omits documented global options for `rea instructions`. Completing `--he`, `--for`, or `--tok` returns no candidates, while command-specific options and enum values complete successfully. The full global flags remain usable. ### Reproduction The independent verifier ran this from the built source checkout in Bash 5.3.20 (the hook requires Bash 4.4 or newer), with disposable HOME/XDG directories: ```bash rea() { node scripts/rea.mjs "$@"; } source <(rea completions bash) for prefix in -- --he --for --tok --proc; do COMP_WORDS=(rea instructions "$prefix") COMP_CWORD=2 _incur_complete_rea printf '%s: count=%s' "$prefix" "${#COMPREPLY[@]}" printf ' %s' "${COMPREPLY[@]}" printf '\n' done COMP_WORDS=(rea instructions --target-format "") COMP_CWORD=3 _incur_complete_rea printf 'target-format: %s\n' "${COMPREPLY[*]}" rea instructions --help rea instructions --schema --format json ``` The callback omission reproduced using both a wrapper and the shell function above. No analysis target, database, or provider was needed. ### Expected behavior Offer the active command's documented global options alongside its command-specific options. `rea completions --help` advertises shell completion; `rea instructions --help` lists these Global Options: `--filter-output`, `--format`, `--full-output`, `--help`, `--llms`, `--llms-full`, `--schema`, `--token-count`, `--token-limit`, and `--token-offset`. Thus `--he` should suggest `--help`, `--for` should suggest `--format`, and `--tok` should suggest the documented token flags. ### Impact and scope Bash users cannot discover or complete valid global flags in the demonstrated `instructions` workflow. This is a bounded functional failure with a practical workaround: read command help and type the flags in full. Command-specific flag and enum completion still work. Other shells and command pages were not independently tested; no analysis-data damage was observed. ### REA version rea-agents 6.7.0; source commit `074768901f3cdc8205b61773fb1faf6f6c7b3ca8`; locked Incur 0.6.1. ### Runtime and platform Node.js v26.12.0, macOS arm64, Bash 5.3.20. Hopper/Ghidra are not involved. ### Target and artifact context Not applicable: static CLI help, schema, and Bash completion only. ### Interface CLI ### Earliest failure stage Transport or result projection ### Relevant output or evidence The executed completion callback returned: ```text --: count=6 --procedure --snapshot --target-format --architecture --entry-point --provider --he: count=0 --for: count=0 --tok: count=0 --proc: count=1 --procedure target-format: dos-com raw-binary ``` The callbacks exited 0 without stderr. `rea instructions --help` exited 0 and listed all ten global flags above. `rea instructions --schema --format json` exited 0 and returned a valid JSON object, confirming that the global flags are accepted. ### Typed outcome or recovery expected Include the documented global flags in completion candidates while preserving command-option and enum candidates. Until then, typing the full flags is the verified workaround. ### Analysis or suspected cause Source-derived reasoning: REA constructs its Incur CLI in `src/cli.ts:92–111` without a custom globals schema. In bundled Incur 0.6.1, `node_modules/incur/dist/Cli.js:408–424` dispatches completion to `Completions.complete`, passing configured custom globals. `node_modules/incur/dist/Completions.js:19–95` adds command options and optional custom globals, but omits the standard globals printed by `node_modules/incur/dist/Help.js:294–318`. This matches the observed candidate omission. Whether to address this in REA or through an Incur update is left to maintainers. ### Additional context Prepared with AI assistance and independently reproduced by a separate verifier. The submitter checked upstream changes after the tested revision: no relevant completion or dependency fix was found. Related feature request #5481 proposes shell completion generally; this report concerns the existing generated hook's missing global-option candidates. NOT_ENOUGH_INFO: no last-known-good version was established, so this is not claimed as a regression. A proposed acceptance check is to rerun the reproduction, obtain the documented globals for `--`, `--he`, `--for`, and `--tok`, and preserve the passing `--proc`, enum, and schema controls. No repair was implemented or tested.
Author
Owner

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

Cross-referencing with canonical issue #5481 ([Feature] Add shell completion for the REA CLI) and siblings #5527 and #5528. Reports omission of documented global flags in generated Bash shell completions. Cataloged under Cluster AW in consolidation tracker #4330.

<!-- gh-comment-id:6293043441 --> @matbrgz commented on GitHub (Oct 20, 2026): Cross-referencing with canonical issue #5481 (`[Feature] Add shell completion for the REA CLI`) and siblings #5527 and #5528. Reports omission of documented global flags in generated Bash shell completions. Cataloged under Cluster AW in consolidation tracker #4330.
Author
Owner

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

Checked the reported fix on main at d87e73f2db.

REA now owns completion globals from canonical builtin/output flag metadata and passes them to Incur Completions.complete. The regression asserts --he -> --help, --for -> --format, token flags, a command-specific procedure flag, target-format enum choices and output format values; it also excludes internal/root-only flags from command scope. A separate public-launcher Bash test covers actual generated registration.

Implementation: completions.ts, completions.ts.

The relevant regression checks in completions.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:6380777321 --> @coygeek commented on GitHub (Oct 24, 2026): Checked the reported fix on `main` at d87e73f2db50be72d33a4b3c7199af35518b441c. REA now owns completion globals from canonical builtin/output flag metadata and passes them to Incur Completions.complete. The regression asserts --he -> --help, --for -> --format, token flags, a command-specific procedure flag, target-format enum choices and output format values; it also excludes internal/root-only flags from command scope. A separate public-launcher Bash test covers actual generated registration. Implementation: [completions.ts](https://github.com/morluto/rea/blob/d87e73f2db50be72d33a4b3c7199af35518b441c/src/cli/completions.ts#L20), [completions.ts](https://github.com/morluto/rea/blob/d87e73f2db50be72d33a4b3c7199af35518b441c/src/cli/completions.ts#L114). The relevant regression checks in [completions.test.ts](https://github.com/morluto/rea/blob/d87e73f2db50be72d33a4b3c7199af35518b441c/tests/boundary/cli/completions.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#3363
No description provided.