[GH-ISSUE #1169] [Bug] CLI --schema marks defaulted inputs as required #414

Closed
opened 2026-10-15 18:24:51 +00:00 by bsakaguchi · 0 comments
Owner

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

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

rea <command> --schema --json exports input schemas that list arguments and options with defaults under required, although the CLI accepts their omission and applies the default. inspect-keyed-archive requires archive, offset, and limit in its schema while its documented one-argument form works; inspect-artifact requires integrityPolicy while its default fail applies when omitted. A client that validates calls against the advertised schema rejects valid invocations. The keyed-archive help also shows its defaulted second argument as mandatory (<path> <archive>).

The keyed-archive schema contains "archive": {"default": ".", "type": "string"} with "required": ["path", "archive"] under args, and offset (default 0) and limit (default 20000) with "required": ["offset", "limit"] under options. Help prints Usage: rea inspect-keyed-archive <path> <archive> [options]. The one-argument call exits 0 and returns the archive (total_objects: 2, offset: 0, truncated: false), while jsonschema.validate rejects that same input with 'archive' is a required property. inspect-artifact --schema prints ['integrityPolicy'] although the thin-binary call without that option exits 0. Reproduced twice on the npm release and again on the main build.

Reproduction

cat > keyed.plist <<'XML'
<?xml version="1.0" encoding="UTF-8"?><plist version="1.0"><dict><key>$archiver</key><string>NSKeyedArchiver</string><key>$version</key><integer>100000</integer><key>$objects</key><array><string>$null</string><string>hello</string></array><key>$top</key><dict><key>root</key><dict><key>CF$UID</key><integer>1</integer></dict></dict></dict></plist>
XML
npx -y rea-agents@6.1.0 inspect-keyed-archive --schema --json > schema.json
npx -y rea-agents@6.1.0 inspect-keyed-archive --help | grep Usage
npx -y rea-agents@6.1.0 inspect-keyed-archive ./keyed.plist --json; echo "exit=$?"
python3 -c 'import json,jsonschema; s=json.load(open("schema.json")); jsonschema.validate({"path":"./keyed.plist"}, s["args"])'
npx -y rea-agents@6.1.0 inspect-artifact --schema --json | python3 -c 'import json,sys; print(json.load(sys.stdin)["options"]["required"])'

Expected behavior

Global help describes --schema as "Show JSON Schema for command". docs/native-investigation.md (Static inspection) documents rea inspect-keyed-archive <plist> as a standalone one-argument call, with the second argument only for a bundle. An input schema should accept every invocation the CLI accepts: properties with defaults that may be omitted should not be listed in required, and help should show the defaulted second argument as optional.

Impact and scope

Schema-driven agents and wrappers that validate before invoking reject documented valid calls; direct CLI use is unaffected.

Workaround: Supplying the defaulted arguments and options explicitly (for example inspect-keyed-archive ./keyed.plist keyed.plist --offset 0 --limit 20000) passes validation and was observed to succeed.

REA version

rea-agents@6.1.0 from npm, and main at 089bbf58f3 built locally with npm ci && npm run build:cached.

Runtime and platform

Node v24.21.0, macOS 27.0.1 (26A434), arm64; Python jsonschema used to validate.

Target and artifact context

Foundation keyed-archive XML plist; thin Mach-O

Interface

CLI

Earliest failure stage

Request parsing or validation

Relevant output or evidence

  • Expected source: global --help text for --schema, and docs/native-investigation.md Static inspection.
  • Failure source: the exported schemas, help line, and validation result quoted under Observed behavior.
  • Evidence provenance: observed
  • Local verification: reproduced
  • Reproduction completeness: complete

Typed outcome or recovery expected

Failing now: validating {"path":"./keyed.plist"} against the exported args schema fails, and inspect-artifact's options schema requires integrityPolicy. Restored: both inputs the CLI accepts validate against the exported schemas, the defaults still appear as default annotations, and help shows [archive] as optional. Control: path stays required for inspect-keyed-archive, and an out-of-range value such as --limit 0 must keep failing schema validation (the exported schema sets minimum: 1).

Analysis or suspected cause

Source-derived, not verified by a patch: src/cli/artifactCommands.ts declares archive, offset, and limit with Zod .default(...); the bundled Incur CLI exports --schema through z.toJSONSchema without selecting input mode, which lists defaulted properties as required. Only the two commands named here were checked.

Additional context

Found while exercising typical REA workflows on macOS with rea-agents@6.1.0; each case was reproduced on the npm release and on a local build of main, and re-checked on main at 6a1e558db3 just before filing.

Originally created by @coygeek on GitHub (Oct 9, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/1169 ### 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 `rea <command> --schema --json` exports input schemas that list arguments and options with defaults under `required`, although the CLI accepts their omission and applies the default. `inspect-keyed-archive` requires `archive`, `offset`, and `limit` in its schema while its documented one-argument form works; `inspect-artifact` requires `integrityPolicy` while its default `fail` applies when omitted. A client that validates calls against the advertised schema rejects valid invocations. The keyed-archive help also shows its defaulted second argument as mandatory (`<path> <archive>`). The keyed-archive schema contains `"archive": {"default": ".", "type": "string"}` with `"required": ["path", "archive"]` under `args`, and `offset` (default 0) and `limit` (default 20000) with `"required": ["offset", "limit"]` under `options`. Help prints `Usage: rea inspect-keyed-archive <path> <archive> [options]`. The one-argument call exits 0 and returns the archive (`total_objects: 2`, `offset: 0`, `truncated: false`), while `jsonschema.validate` rejects that same input with `'archive' is a required property`. `inspect-artifact --schema` prints `['integrityPolicy']` although the thin-binary call without that option exits 0. Reproduced twice on the npm release and again on the `main` build. ### Reproduction ```sh cat > keyed.plist <<'XML' <?xml version="1.0" encoding="UTF-8"?><plist version="1.0"><dict><key>$archiver</key><string>NSKeyedArchiver</string><key>$version</key><integer>100000</integer><key>$objects</key><array><string>$null</string><string>hello</string></array><key>$top</key><dict><key>root</key><dict><key>CF$UID</key><integer>1</integer></dict></dict></dict></plist> XML npx -y rea-agents@6.1.0 inspect-keyed-archive --schema --json > schema.json npx -y rea-agents@6.1.0 inspect-keyed-archive --help | grep Usage npx -y rea-agents@6.1.0 inspect-keyed-archive ./keyed.plist --json; echo "exit=$?" python3 -c 'import json,jsonschema; s=json.load(open("schema.json")); jsonschema.validate({"path":"./keyed.plist"}, s["args"])' npx -y rea-agents@6.1.0 inspect-artifact --schema --json | python3 -c 'import json,sys; print(json.load(sys.stdin)["options"]["required"])' ``` ### Expected behavior Global help describes `--schema` as "Show JSON Schema for command". `docs/native-investigation.md` (Static inspection) documents `rea inspect-keyed-archive <plist>` as a standalone one-argument call, with the second argument only for a bundle. An input schema should accept every invocation the CLI accepts: properties with defaults that may be omitted should not be listed in `required`, and help should show the defaulted second argument as optional. ### Impact and scope Schema-driven agents and wrappers that validate before invoking reject documented valid calls; direct CLI use is unaffected. Workaround: Supplying the defaulted arguments and options explicitly (for example `inspect-keyed-archive ./keyed.plist keyed.plist --offset 0 --limit 20000`) passes validation and was observed to succeed. ### REA version `rea-agents@6.1.0` from npm, and `main` at 089bbf58f3561e3f465c544bbcf8c307287b1256 built locally with `npm ci && npm run build:cached`. ### Runtime and platform Node v24.21.0, macOS 27.0.1 (26A434), arm64; Python `jsonschema` used to validate. ### Target and artifact context Foundation keyed-archive XML plist; thin Mach-O ### Interface CLI ### Earliest failure stage Request parsing or validation ### Relevant output or evidence - Expected source: global `--help` text for `--schema`, and `docs/native-investigation.md` Static inspection. - Failure source: the exported schemas, help line, and validation result quoted under Observed behavior. - Evidence provenance: observed - Local verification: reproduced - Reproduction completeness: complete ### Typed outcome or recovery expected Failing now: validating `{"path":"./keyed.plist"}` against the exported `args` schema fails, and `inspect-artifact`'s options schema requires `integrityPolicy`. Restored: both inputs the CLI accepts validate against the exported schemas, the defaults still appear as `default` annotations, and help shows `[archive]` as optional. Control: `path` stays required for `inspect-keyed-archive`, and an out-of-range value such as `--limit 0` must keep failing schema validation (the exported schema sets `minimum: 1`). ### Analysis or suspected cause Source-derived, not verified by a patch: `src/cli/artifactCommands.ts` declares `archive`, `offset`, and `limit` with Zod `.default(...)`; the bundled Incur CLI exports `--schema` through `z.toJSONSchema` without selecting input mode, which lists defaulted properties as required. Only the two commands named here were checked. ### Additional context Found while exercising typical REA workflows on macOS with `rea-agents@6.1.0`; each case was reproduced on the npm release and on a local build of `main`, and re-checked on `main` at 6a1e558db3ec2b69561e91ea817f1c2065dfc676 just before filing.
bsakaguchi 2026-10-15 18:24:51 +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#414
No description provided.