[GH-ISSUE #3205] [Bug] Setup and doctor report readiness for an invalid MCP output schema profile #1142

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

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

Before submitting

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

Area

Setup, packaging, or upgrade

Observed behavior

A Pi registration containing REA_MCP_OUTPUT_SCHEMA_PROFILE: "bogus" passes setup and doctor even though production MCP initialization fails with that value. Setup exits 0, rewrites the stale launcher, retains the invalid setting, and reports ready. Doctor exits 0, reports healthy: true and environment_healthy: true, and marks the Pi registration aligned with remediation: null.

The production mcp doctor diagnostic started with the same invalid value exits 1, reports healthy: false, fails the transport check with Internal server error, and obtains no server identity or catalog. The diagnostic receives the setting explicitly; it does not automatically read the Pi configuration. An actual Pi session was not launched.

Changing the persisted setting to off, then full, made setup and doctor accept each value. Each matching production MCP diagnostic exited 0, discovered 207 tools and 6 prompts, and completed the target-free binary_session request. As a comparison, an invalid REA_MCP_INPUT_SCHEMA_PROFILE: "bogus" caused setup to exit 1 with needs_human, preserved the configuration bytes, and made doctor report an invalid registration with remediation naming the input-profile setting.

Reproduction

  1. Prepare a clean checkout at the verified revision with a supported Node.js runtime:

    git clone https://github.com/morluto/rea.git rea-output-profile-repro
    cd rea-output-profile-repro
    git checkout 58300885207133422af235e0f2b10658cf958b03
    npm ci
    npm run build:cached
    
  2. Create an isolated Pi configuration and a minimal child environment. Run these commands from the checkout root in the same shell:

    REPRO_ROOT="$(mktemp -d)"
    mkdir -p "$REPRO_ROOT/home/.pi/agent"
    
    run_isolated() {
      env -i \
        PATH="$PATH" \
        HOME="$REPRO_ROOT/home" \
        XDG_CONFIG_HOME="$REPRO_ROOT/home/.config" \
        XDG_CACHE_HOME="$REPRO_ROOT/home/.cache" \
        XDG_DATA_HOME="$REPRO_ROOT/home/.local/share" \
        "$@"
    }
    
    cat > "$REPRO_ROOT/home/.pi/agent/mcp.json" <<'JSON'
    {
      "mcpServers": {
        "rea": {
          "command": "old",
          "args": [],
          "env": { "REA_MCP_OUTPUT_SCHEMA_PROFILE": "bogus" }
        }
      }
    }
    JSON
    
  3. Run setup and doctor, then read back the rewritten registration:

    run_isolated node scripts/rea.mjs setup --client pi --skill=false --yes --json
    run_isolated node scripts/rea.mjs doctor --client pi --json
    cat "$REPRO_ROOT/home/.pi/agent/mcp.json"
    

    Both commands return success. Setup reports ready, doctor reports aligned without remediation, and the registration retains the invalid output-profile value.

  4. Start the production MCP diagnostic with the same value:

    run_isolated REA_MCP_OUTPUT_SCHEMA_PROFILE=bogus \
      node scripts/rea.mjs mcp doctor --json
    

    This exits 1 and fails initialization/catalog discovery. No analysis target, installed analysis provider, skill installation, or live Pi session is required. The independent verifier used an already prepared compiled runtime; the dependency and build commands in step 1 are prerequisites for a future clean-checkout reproduction.

Expected behavior

docs/installation.md:66-73 explicitly names retained output-schema overrides and requires setup and doctor to report invalid runtime settings before setup writes files. The diagnostics must name the setting the caller needs to repair and preserve the rest of the environment map.

For this invalid literal, setup should fail before rewriting the registration, and doctor should report an invalid registration with remediation naming REA_MCP_OUTPUT_SCHEMA_PROFILE. docs/mcp-contracts.md:735-742 documents off and the default full; src/config/mcpOutputSchemaProfile.ts:7-33 rejects other strings with a named configuration error.

Impact and scope

This blocks production MCP initialization for a registration containing an invalid literal output-profile value while setup and doctor report readiness. The independently executed reproduction covers a Pi registration under an isolated minimal environment. It does not establish a live Pi session failure or results for other client formats.

Impact is P2, supported. The failure is bounded and reversible, with no demonstrated data loss or security boundary violation. The verified workaround is to change the single setting to full or off and restart REA. Both values passed setup, doctor, catalog discovery and the target-free request without a source change or loss of the remaining registration settings.

REA version

6.4.0 (main at 5830088520)

Runtime and platform

Node.js 26.10.0; macOS 27.0.1. The verifier report did not record the architecture.

Target and artifact context

Synthetic Pi MCP registration in .pi/agent/mcp.json. No analysis target or live client session was required. Configuration and environment changes stayed inside disposable fixture directories.

Interface

CLI

Earliest failure stage

Setup or provider admission

Relevant output or evidence

Selected fields from the independently executed commands:

setup --client pi --skill=false --yes --json
  exit 0; status="ready"
  persisted REA_MCP_OUTPUT_SCHEMA_PROFILE="bogus"
doctor --client pi --json
  exit 0; healthy=true; environment_healthy=true
  Pi registration: state="aligned"; remediation=null
REA_MCP_OUTPUT_SCHEMA_PROFILE=bogus mcp doctor --json
  exit 1; healthy=false
  transport: ok=false; detail="Internal server error"
  server=null; inventory=null; identity=null
  request_flow: tool="binary_session"; ok=false

Typed outcome or recovery expected

With the same stale registration and invalid value, setup must return failure and remediation naming REA_MCP_OUTPUT_SCHEMA_PROFILE before any configuration write. Doctor must report an invalid registration with the same named remediation. Repeated setup must preserve the original bytes until the caller repairs the setting.

After changing only that setting to full or off, setup and doctor must accept and retain the valid value, and production MCP initialization, catalog discovery and the target-free request must succeed. Preserve the existing invalid-input-profile control, which already rejects its named setting before writes. Discarding the output override or rejecting all profiles would not restore the documented contract.

Analysis or suspected cause

Source-derived at the verified baseline. src/application/ClientRegistrationEnvironment.ts:50-63 validates known settings through parseEnvironmentValues or parseEnvironment, then retains the original string map. src/config/environment.ts:22-77 omits REA_MCP_OUTPUT_SCHEMA_PROFILE, so that validation does not reject bogus. src/application/ClientConfigurationFiles.ts:88-118 applies the validation to registration files.

Public setup inspection and writing reach those readers through src/application/SetupClientConfiguration.ts:91, :423, :661, and :680. Production server composition calls the output-profile parser in src/server/createServer.ts:285-292 and :598-606; that parser rejects the value in src/config/mcpOutputSchemaProfile.ts:7-33. This explains the observed disagreement between registration readiness and production MCP initialization.

Additional context

Related reports are #2665, #1606, #1183 and #2512. They concern loader/compiler validation, preservation of valid overrides, Ghidra path admission, and catalog size respectively; this report requires rejecting an unsupported output-profile literal before registration writes while retaining valid full and off settings.

The P2 assessment follows the bounded MCP initialization failure and the independently demonstrated workaround of correcting one setting.

Originally created by @coygeek on GitHub (Oct 14, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/3205 ### 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 Setup, packaging, or upgrade ### Observed behavior A Pi registration containing `REA_MCP_OUTPUT_SCHEMA_PROFILE: "bogus"` passes setup and doctor even though production MCP initialization fails with that value. Setup exits 0, rewrites the stale launcher, retains the invalid setting, and reports `ready`. Doctor exits 0, reports `healthy: true` and `environment_healthy: true`, and marks the Pi registration `aligned` with `remediation: null`. The production `mcp doctor` diagnostic started with the same invalid value exits 1, reports `healthy: false`, fails the transport check with `Internal server error`, and obtains no server identity or catalog. The diagnostic receives the setting explicitly; it does not automatically read the Pi configuration. An actual Pi session was not launched. Changing the persisted setting to `off`, then `full`, made setup and doctor accept each value. Each matching production MCP diagnostic exited 0, discovered 207 tools and 6 prompts, and completed the target-free `binary_session` request. As a comparison, an invalid `REA_MCP_INPUT_SCHEMA_PROFILE: "bogus"` caused setup to exit 1 with `needs_human`, preserved the configuration bytes, and made doctor report an invalid registration with remediation naming the input-profile setting. ### Reproduction 1. Prepare a clean checkout at the verified revision with a supported Node.js runtime: ```sh git clone https://github.com/morluto/rea.git rea-output-profile-repro cd rea-output-profile-repro git checkout 58300885207133422af235e0f2b10658cf958b03 npm ci npm run build:cached ``` 2. Create an isolated Pi configuration and a minimal child environment. Run these commands from the checkout root in the same shell: ```sh REPRO_ROOT="$(mktemp -d)" mkdir -p "$REPRO_ROOT/home/.pi/agent" run_isolated() { env -i \ PATH="$PATH" \ HOME="$REPRO_ROOT/home" \ XDG_CONFIG_HOME="$REPRO_ROOT/home/.config" \ XDG_CACHE_HOME="$REPRO_ROOT/home/.cache" \ XDG_DATA_HOME="$REPRO_ROOT/home/.local/share" \ "$@" } cat > "$REPRO_ROOT/home/.pi/agent/mcp.json" <<'JSON' { "mcpServers": { "rea": { "command": "old", "args": [], "env": { "REA_MCP_OUTPUT_SCHEMA_PROFILE": "bogus" } } } } JSON ``` 3. Run setup and doctor, then read back the rewritten registration: ```sh run_isolated node scripts/rea.mjs setup --client pi --skill=false --yes --json run_isolated node scripts/rea.mjs doctor --client pi --json cat "$REPRO_ROOT/home/.pi/agent/mcp.json" ``` Both commands return success. Setup reports `ready`, doctor reports `aligned` without remediation, and the registration retains the invalid output-profile value. 4. Start the production MCP diagnostic with the same value: ```sh run_isolated REA_MCP_OUTPUT_SCHEMA_PROFILE=bogus \ node scripts/rea.mjs mcp doctor --json ``` This exits 1 and fails initialization/catalog discovery. No analysis target, installed analysis provider, skill installation, or live Pi session is required. The independent verifier used an already prepared compiled runtime; the dependency and build commands in step 1 are prerequisites for a future clean-checkout reproduction. ### Expected behavior `docs/installation.md:66-73` explicitly names retained output-schema overrides and requires setup and doctor to report invalid runtime settings before setup writes files. The diagnostics must name the setting the caller needs to repair and preserve the rest of the environment map. For this invalid literal, setup should fail before rewriting the registration, and doctor should report an invalid registration with remediation naming `REA_MCP_OUTPUT_SCHEMA_PROFILE`. `docs/mcp-contracts.md:735-742` documents `off` and the default `full`; `src/config/mcpOutputSchemaProfile.ts:7-33` rejects other strings with a named configuration error. ### Impact and scope This blocks production MCP initialization for a registration containing an invalid literal output-profile value while setup and doctor report readiness. The independently executed reproduction covers a Pi registration under an isolated minimal environment. It does not establish a live Pi session failure or results for other client formats. Impact is P2, supported. The failure is bounded and reversible, with no demonstrated data loss or security boundary violation. The verified workaround is to change the single setting to `full` or `off` and restart REA. Both values passed setup, doctor, catalog discovery and the target-free request without a source change or loss of the remaining registration settings. ### REA version 6.4.0 (main at 58300885207133422af235e0f2b10658cf958b03) ### Runtime and platform Node.js 26.10.0; macOS 27.0.1. The verifier report did not record the architecture. ### Target and artifact context Synthetic Pi MCP registration in `.pi/agent/mcp.json`. No analysis target or live client session was required. Configuration and environment changes stayed inside disposable fixture directories. ### Interface CLI ### Earliest failure stage Setup or provider admission ### Relevant output or evidence Selected fields from the independently executed commands: ```text setup --client pi --skill=false --yes --json exit 0; status="ready" persisted REA_MCP_OUTPUT_SCHEMA_PROFILE="bogus" doctor --client pi --json exit 0; healthy=true; environment_healthy=true Pi registration: state="aligned"; remediation=null REA_MCP_OUTPUT_SCHEMA_PROFILE=bogus mcp doctor --json exit 1; healthy=false transport: ok=false; detail="Internal server error" server=null; inventory=null; identity=null request_flow: tool="binary_session"; ok=false ``` ### Typed outcome or recovery expected With the same stale registration and invalid value, setup must return failure and remediation naming `REA_MCP_OUTPUT_SCHEMA_PROFILE` before any configuration write. Doctor must report an invalid registration with the same named remediation. Repeated setup must preserve the original bytes until the caller repairs the setting. After changing only that setting to `full` or `off`, setup and doctor must accept and retain the valid value, and production MCP initialization, catalog discovery and the target-free request must succeed. Preserve the existing invalid-input-profile control, which already rejects its named setting before writes. Discarding the output override or rejecting all profiles would not restore the documented contract. ### Analysis or suspected cause Source-derived at the verified baseline. `src/application/ClientRegistrationEnvironment.ts:50-63` validates known settings through `parseEnvironmentValues` or `parseEnvironment`, then retains the original string map. `src/config/environment.ts:22-77` omits `REA_MCP_OUTPUT_SCHEMA_PROFILE`, so that validation does not reject `bogus`. `src/application/ClientConfigurationFiles.ts:88-118` applies the validation to registration files. Public setup inspection and writing reach those readers through `src/application/SetupClientConfiguration.ts:91`, `:423`, `:661`, and `:680`. Production server composition calls the output-profile parser in `src/server/createServer.ts:285-292` and `:598-606`; that parser rejects the value in `src/config/mcpOutputSchemaProfile.ts:7-33`. This explains the observed disagreement between registration readiness and production MCP initialization. ### Additional context Related reports are #2665, #1606, #1183 and #2512. They concern loader/compiler validation, preservation of valid overrides, Ghidra path admission, and catalog size respectively; this report requires rejecting an unsupported output-profile literal before registration writes while retaining valid `full` and `off` settings. The P2 assessment follows the bounded MCP initialization failure and the independently demonstrated workaround of correcting one setting.
bsakaguchi 2026-10-15 18:31:27 +00:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

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

Resolved on main by 0930e94e0.

Registration validation now uses the runtime output-profile parser; invalid overrides are rejected before writes, and valid profiles are preserved.

Rechecked on main b8510ee00 in the current focused run: 20 test files passed, 225 tests passed and one platform-dependent test skipped. Relevant regression coverage: tests/acceptance/setup/piClientSetup.test.ts and tests/boundary/filesystem/clientConfigurationEnvironment.test.ts.

<!-- gh-comment-id:6174977646 --> @morluto commented on GitHub (Oct 14, 2026): Resolved on main by 0930e94e0. Registration validation now uses the runtime output-profile parser; invalid overrides are rejected before writes, and valid profiles are preserved. Rechecked on main b8510ee00 in the current focused run: 20 test files passed, 225 tests passed and one platform-dependent test skipped. Relevant regression coverage: tests/acceptance/setup/piClientSetup.test.ts and tests/boundary/filesystem/clientConfigurationEnvironment.test.ts.
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#1142
No description provided.