[GH-ISSUE #2180] fix(cli): rejected browser and Inspector inputs lose correction details #726

Closed
opened 2026-10-15 18:27:43 +00:00 by bsakaguchi · 1 comment
Owner

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

Summary

Six public CLI commands reject supplied arguments through their named input contracts, then return a generic invalid_request error without the contract's field issues. The output tells callers to "Correct the listed arguments and retry", but lists no arguments or constraints. This affects post-admission validation in list-browser-targets, inspect-web-page, analyze-web-bundle, observe-web-session, list-javascript-runtime-targets and observe-javascript-runtime. The rejection code and nonzero exit status are correct; the failure is missing correction guidance.

Affected area

Area: CLI. Interface: CLI JSON output. Earliest failing stage: request validation, when a handler discards the named contract's issue metadata. Target context: malformed endpoint strings or empty target identifiers, with no browser, Inspector process or native provider required.

Runtime or environment

Independently reproduced on a source-built checkout at c22111eca2 and a separately installed published rea-agents 6.4.0 package. Both ran on measured Node.js 24.21.0, macOS arm64. The runtime satisfies the package's supported Node range; it is not the checkout's exact contributor pin. The source runtime had already been built with npm run build:cached; the released package used its shipped runtime. The behavior matched in both builds.

Steps to reproduce

Use the installed package's rea command, or run node scripts/rea.mjs in the built checkout in place of rea. Each command below was executed against both builds, exited 1 and returned an error without details:

rea list-browser-targets 'not a url' --json
rea inspect-web-page 'http://127.0.0.1:9222' '' --json
rea analyze-web-bundle 'not a url' TARGET --json
rea observe-web-session 'http://127.0.0.1:9222' '' --json
rea list-javascript-runtime-targets '' --json
rea observe-javascript-runtime 'http://127.0.0.1:9229' '' --json

The malformed endpoints and empty identifiers fail input validation before target access. No endpoint needs to be listening. Use an isolated working directory and home if repeating the commands.

Execute the sibling CLI controls:

rea compare-web-screenshots '{}' '{}' --json
rea capture-browser-scenario '{}' --json

Both controls exit 1 and return populated details.issues, with eight and three entries respectively. For the parser-admission control, run rea list-browser-targets --json without its endpoint. It returns the framework's VALIDATION_ERROR and names endpoint in fieldErrors. That initial parser failure is a different path from this defect.

For a public MCP control, start the same package with rea --mcp and call list_browser_targets with {"cdp_endpoint":"not a url"}. The observed text is Input validation error: Invalid arguments for tool list_browser_targets: cdp_endpoint: Invalid CDP endpoint URL. Call list_javascript_runtime_targets with {"inspector_endpoint":""} to observe inspector_endpoint: Too small: expected string to have >=1 characters. These stdio controls ran against both builds without target access.

Expected behavior

When a supplied CLI value passes positional parsing but fails the named input contract, the typed invalid-input result should retain the safe correction metadata that the contract and shared projector already provide. Its details.issues should identify the rejected field and reason, with an authored message or numeric bound where applicable. Preserve the existing failure classification, retryability and nonzero exit status. Correction metadata must not echo raw rejected values.

For the malformed endpoint cases, the canonical safe projection produces {"path":["cdp_endpoint"],"reason":"invalid_value","message":"Invalid CDP endpoint URL"}. For the empty target identifiers it produces {"path":["target_id"],"reason":"out_of_range","minimum":1}. The empty Inspector endpoint produces the same range issue at inspector_endpoint. These facts were independently observed from each build's named contract and shared projection, rather than inferred from a proposed fix.

Actual behavior

The four browser commands return this body, without any details key:

{
  "error": "Browser observation failed",
  "code": "invalid_request",
  "category": "invalid_input",
  "message": "Analysis input is invalid. Check the arguments and try again.",
  "retryable": true,
  "remediation": {
    "action": "Correct the listed arguments and retry."
  }
}

The two Inspector commands return the same fields with "error":"JavaScript runtime observation failed". All six exit 1. The response gives neither the field that failed nor its constraint, although those issues exist at the handler's validation boundary.

Public MCP named the field in five of the six corresponding test cases. For inspect_web_page with an empty target_id, it returned only Input validation error: Invalid arguments for tool inspect_web_page: Invalid input. That MCP case is not evidence of field-specific parity; the canonical projection and sibling CLI controls establish the correction metadata for it.

Evidence

  • Expected source: AGENTS.md, Architecture and Cleanup, requires preservation of meaningful failure reasons and named contract binding; src/domain/inputIssueProjection.ts:7 and :23 define the standard retained, safe correction metadata; src/domain/analysisErrorProjection.ts:268 projects nonempty issues; src/domain/analysisErrorPresentation.ts:104 supplies the authored remediation. src/contracts/browserToolContracts.ts:132, :149, :167 and :190, and src/contracts/javascript/javascriptRuntimeObservationToolContracts.ts, bind the applicable named schemas. tests/boundary/cli/scenarioCliInputDiagnostics.test.ts:15 and :47 assert issue coordinates on sibling CLI failures.
  • Failure source: Independently executed public CLI commands above on both builds. src/cli/browserCommands.ts:55, :93, :131 and :162 discard the parse issues when constructing the error; src/cliJavaScriptRuntimeCommands.ts:53 and :82 call the no-issues helper at :97. src/domain/analysisErrorCore.ts:53 defaults the issue list to empty. The corresponding shipped dist implementations have the same constructions, and the released dispatcher's output reproduces the failure.
  • Evidence provenance: observed
  • Local verification: reproduced
  • Reproduction completeness: complete

Execution establishes the returned CLI/MCP diagnostics, canonical correction metadata and process exit statuses. Source inspection establishes the adapter's loss of issues and the validation-before-target-access call path. Only invalid-input workflows were exercised; no valid provider observation is claimed. The malformed rejected endpoint value did not appear in CLI, canonical projection or MCP output in the tested cases.

Related issue 1421 concerns a repaired unmatched-union issue in the shared projector. It is reference-only: here the canonical projection already retains the issues, while the six CLI handlers never supply them to the typed error.

Restoration check

Repeat all six commands. Each should still reject the same input with invalid_request, invalid_input, retryability and exit 1, while returning a nonempty safe issue list with the corresponding field, reason and authored message or minimum described above. Accept a correctly mapped CLI argument name or canonical field name that lets the caller identify the argument. Do not require every issue to contain an expected field; the nonempty constraints use minimum.

The screenshot and scenario controls should retain their existing issue metadata, and omitted positional input should retain the framework's parser diagnostic. Check that the malformed rejected value remains absent from correction output. Advertised-schema constraints and valid provider execution are separate properties; restoring this diagnostic contract must not depend on changing input admission or on acquiring a target. The implementation remains open.

Triage assessment

  • Impact level: P3
  • Assessment status: supported
  • Impact basis: The observed defect removes diagnostic content and leaves the instruction to correct listed arguments misleading. All tested inputs still fail with the correct typed classification and nonzero exit status. No incorrect successful analysis, persistent-state defect or core workflow failure was observed, so the supported impact is correction clarity for these rejected inputs.
  • Workaround status: available
  • Workaround basis: Public MCP reports the malformed endpoint or nonempty-value requirement in five tested cases. For the page-inspection case, the packaged named contract identifies the nonempty target_id requirement, even though its MCP admission message is generic. These routes provide correction guidance without changing code or accessing a target, but require another interface call or contract inspection and leave the CLI defect present.
Originally created by @coygeek on GitHub (Oct 12, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/2180 ## Summary Six public CLI commands reject supplied arguments through their named input contracts, then return a generic `invalid_request` error without the contract's field issues. The output tells callers to "Correct the listed arguments and retry", but lists no arguments or constraints. This affects post-admission validation in `list-browser-targets`, `inspect-web-page`, `analyze-web-bundle`, `observe-web-session`, `list-javascript-runtime-targets` and `observe-javascript-runtime`. The rejection code and nonzero exit status are correct; the failure is missing correction guidance. ## Affected area Area: CLI. Interface: CLI JSON output. Earliest failing stage: request validation, when a handler discards the named contract's issue metadata. Target context: malformed endpoint strings or empty target identifiers, with no browser, Inspector process or native provider required. ## Runtime or environment Independently reproduced on a source-built checkout at c22111eca2c4bc84a084f12711f405b3e7422a40 and a separately installed published `rea-agents` 6.4.0 package. Both ran on measured Node.js 24.21.0, macOS arm64. The runtime satisfies the package's supported Node range; it is not the checkout's exact contributor pin. The source runtime had already been built with `npm run build:cached`; the released package used its shipped runtime. The behavior matched in both builds. ## Steps to reproduce Use the installed package's `rea` command, or run `node scripts/rea.mjs` in the built checkout in place of `rea`. Each command below was executed against both builds, exited 1 and returned an error without `details`: ```bash rea list-browser-targets 'not a url' --json rea inspect-web-page 'http://127.0.0.1:9222' '' --json rea analyze-web-bundle 'not a url' TARGET --json rea observe-web-session 'http://127.0.0.1:9222' '' --json rea list-javascript-runtime-targets '' --json rea observe-javascript-runtime 'http://127.0.0.1:9229' '' --json ``` The malformed endpoints and empty identifiers fail input validation before target access. No endpoint needs to be listening. Use an isolated working directory and home if repeating the commands. Execute the sibling CLI controls: ```bash rea compare-web-screenshots '{}' '{}' --json rea capture-browser-scenario '{}' --json ``` Both controls exit 1 and return populated `details.issues`, with eight and three entries respectively. For the parser-admission control, run `rea list-browser-targets --json` without its endpoint. It returns the framework's `VALIDATION_ERROR` and names `endpoint` in `fieldErrors`. That initial parser failure is a different path from this defect. For a public MCP control, start the same package with `rea --mcp` and call `list_browser_targets` with `{"cdp_endpoint":"not a url"}`. The observed text is `Input validation error: Invalid arguments for tool list_browser_targets: cdp_endpoint: Invalid CDP endpoint URL`. Call `list_javascript_runtime_targets` with `{"inspector_endpoint":""}` to observe `inspector_endpoint: Too small: expected string to have >=1 characters`. These stdio controls ran against both builds without target access. ## Expected behavior When a supplied CLI value passes positional parsing but fails the named input contract, the typed invalid-input result should retain the safe correction metadata that the contract and shared projector already provide. Its `details.issues` should identify the rejected field and reason, with an authored message or numeric bound where applicable. Preserve the existing failure classification, retryability and nonzero exit status. Correction metadata must not echo raw rejected values. For the malformed endpoint cases, the canonical safe projection produces `{"path":["cdp_endpoint"],"reason":"invalid_value","message":"Invalid CDP endpoint URL"}`. For the empty target identifiers it produces `{"path":["target_id"],"reason":"out_of_range","minimum":1}`. The empty Inspector endpoint produces the same range issue at `inspector_endpoint`. These facts were independently observed from each build's named contract and shared projection, rather than inferred from a proposed fix. ## Actual behavior The four browser commands return this body, without any `details` key: ```json { "error": "Browser observation failed", "code": "invalid_request", "category": "invalid_input", "message": "Analysis input is invalid. Check the arguments and try again.", "retryable": true, "remediation": { "action": "Correct the listed arguments and retry." } } ``` The two Inspector commands return the same fields with `"error":"JavaScript runtime observation failed"`. All six exit 1. The response gives neither the field that failed nor its constraint, although those issues exist at the handler's validation boundary. Public MCP named the field in five of the six corresponding test cases. For `inspect_web_page` with an empty `target_id`, it returned only `Input validation error: Invalid arguments for tool inspect_web_page: Invalid input`. That MCP case is not evidence of field-specific parity; the canonical projection and sibling CLI controls establish the correction metadata for it. ## Evidence - Expected source: `AGENTS.md`, Architecture and Cleanup, requires preservation of meaningful failure reasons and named contract binding; `src/domain/inputIssueProjection.ts:7` and `:23` define the standard retained, safe correction metadata; `src/domain/analysisErrorProjection.ts:268` projects nonempty issues; `src/domain/analysisErrorPresentation.ts:104` supplies the authored remediation. `src/contracts/browserToolContracts.ts:132`, `:149`, `:167` and `:190`, and `src/contracts/javascript/javascriptRuntimeObservationToolContracts.ts`, bind the applicable named schemas. `tests/boundary/cli/scenarioCliInputDiagnostics.test.ts:15` and `:47` assert issue coordinates on sibling CLI failures. - Failure source: Independently executed public CLI commands above on both builds. `src/cli/browserCommands.ts:55`, `:93`, `:131` and `:162` discard the parse issues when constructing the error; `src/cliJavaScriptRuntimeCommands.ts:53` and `:82` call the no-issues helper at `:97`. `src/domain/analysisErrorCore.ts:53` defaults the issue list to empty. The corresponding shipped `dist` implementations have the same constructions, and the released dispatcher's output reproduces the failure. - Evidence provenance: observed - Local verification: reproduced - Reproduction completeness: complete Execution establishes the returned CLI/MCP diagnostics, canonical correction metadata and process exit statuses. Source inspection establishes the adapter's loss of issues and the validation-before-target-access call path. Only invalid-input workflows were exercised; no valid provider observation is claimed. The malformed rejected endpoint value did not appear in CLI, canonical projection or MCP output in the tested cases. Related [issue 1421](https://github.com/morluto/rea/issues/1421) concerns a repaired unmatched-union issue in the shared projector. It is reference-only: here the canonical projection already retains the issues, while the six CLI handlers never supply them to the typed error. ## Restoration check Repeat all six commands. Each should still reject the same input with `invalid_request`, `invalid_input`, retryability and exit 1, while returning a nonempty safe issue list with the corresponding field, reason and authored message or minimum described above. Accept a correctly mapped CLI argument name or canonical field name that lets the caller identify the argument. Do not require every issue to contain an `expected` field; the nonempty constraints use `minimum`. The screenshot and scenario controls should retain their existing issue metadata, and omitted positional input should retain the framework's parser diagnostic. Check that the malformed rejected value remains absent from correction output. Advertised-schema constraints and valid provider execution are separate properties; restoring this diagnostic contract must not depend on changing input admission or on acquiring a target. The implementation remains open. ## Triage assessment - Impact level: P3 - Assessment status: supported - Impact basis: The observed defect removes diagnostic content and leaves the instruction to correct listed arguments misleading. All tested inputs still fail with the correct typed classification and nonzero exit status. No incorrect successful analysis, persistent-state defect or core workflow failure was observed, so the supported impact is correction clarity for these rejected inputs. - Workaround status: available - Workaround basis: Public MCP reports the malformed endpoint or nonempty-value requirement in five tested cases. For the page-inspection case, the packaged named contract identifies the nonempty target_id requirement, even though its MCP admission message is generic. These routes provide correction guidance without changing code or accessing a target, but require another interface call or contract inspection and leave the CLI defect present.
bsakaguchi 2026-10-15 18:27:43 +00:00
Author
Owner

@morluto commented on GitHub (Oct 12, 2026):

Consolidation update: #2230 remains the canonical earlier contribution. Its six requested CLI diagnostics paths passed review, and the adjacent browser fixes from #2247 are offered in https://github.com/369Apps/rea/pull/1 against the original author branch because maintainer edits are disabled. The exact contribution head passes 16 public CLI tests and full source checks. #2247 remains open until integration. Keeping this issue open for the canonical PR's merge.

<!-- gh-comment-id:6129996008 --> @morluto commented on GitHub (Oct 12, 2026): Consolidation update: #2230 remains the canonical earlier contribution. Its six requested CLI diagnostics paths passed review, and the adjacent browser fixes from #2247 are offered in https://github.com/369Apps/rea/pull/1 against the original author branch because maintainer edits are disabled. The exact contribution head passes 16 public CLI tests and full source checks. #2247 remains open until integration. Keeping this issue open for the canonical PR's merge.
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#726
No description provided.