[PR #6187] fix(setup): keep Pi registration settings and write its recommended timeout #7193

Open
opened 2026-11-01 21:46:02 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/6187
Author: @camilopiedra92
Created: 10/21/2026
Status: 🔄 Open

Base: main ← Head: fix/pi-registration-caller-settings


📝 Commits (2)

  • 391bf35 fix(setup): preserve Pi caller-owned server settings
  • e054692 fix(setup): write Pi's recommended request timeout

📊 Changes

3 files changed (+167 additions, -0 deletions)

View changed files

📝 docs/client-configuration.md (+8 -0)
📝 src/application/SetupClientConfiguration.ts (+31 -0)
📝 tests/boundary/filesystem/piClientConfiguration.test.ts (+128 -0)

📄 Description

Summary

rea setup --client pi rebuilt mcpServers.rea from type, command, args, and env, so every run discarded the settings Pi keeps in the same entry and left Pi's 60 second request default in place. This keeps the caller's settings across rewrites and writes REA's provider-budget deadline, so a Pi registration stays correct without hand-maintained values.

Found while repairing a local Pi registration; no issue is linked because the trigger is a configuration write, not a reported defect.

Problem and expected behavior

Trigger, observed with the published rea-agents 6.7.0 and a Pi configuration seeded with caller settings:

$ cat /tmp/pi-config/mcp.json
{"mcpServers":{"rea":{"type":"stdio","command":"/previous/rea","args":["mcp"],"env":{"A":"1"},"timeout":600,"description":"keep me","enabled":false}}}

$ PI_CODING_AGENT_DIR=/tmp/pi-config rea setup --client pi --skill=false --yes

$ cat /tmp/pi-config/mcp.json
{"mcpServers":{"rea":{"type":"stdio","command":"<rea>","args":["mcp"],"env":{"A":"1", …}}}}

timeout, description, and enabled disappeared: a server the caller had disabled came back enabled, and the request deadline reverted to Pi's 60 second default.

Separately, no Pi entry ever received a deadline recommendation, although src/mcpStartupPolicy.ts computes one and setup writes it for Codex and Kimi. That matters for Pi because a cold Ghidra analysis carries a 330 second startup budget (DEFAULT_GHIDRA_STARTUP_TIMEOUT_MS), and GhidraClient.callTool forwards progress only to start(), so a long Ghidra request emits no progress notifications that would reset a client-side deadline.

Expected: setup owns the launcher, its arguments, its environment, and the recommended deadline; the caller's settings in the same entry survive; a caller-selected deadline wins.

Change and scope

  • src/application/SetupClientConfiguration.ts: setup carries the caller-owned Pi keys (enabled, exposure, toolExposure, cwd, description) from the existing entry through an explicit allowlist, so keys Pi does not define are dropped rather than copied, and a foreign transport (url) is replaced instead of producing a mixed entry.
  • The same function writes timeout from recommendedMcpToolTimeoutSeconds, with the caller's positive value winning, matching the existing Codex tool_timeout_sec and Kimi toolTimeoutMs behavior.
  • docs/client-configuration.md: the Pi section states which settings setup owns and which stay caller-owned.

Intentionally not included: provider inspections for bring-your-own tools (their paths remain caller environment), and any change to Ghidra's progress emission.

Contribution scope: not applicable. This is an ordinary fix inside the existing setup boundary and changes no target execution, injection, mutation, or protection-recovery authority.

Contract and boundary impact

  • Semantic owner and earliest changed stage: application/SetupClientConfiguration, at the client configuration write.
  • Contribution scope fit and linked maintainer decision: existing boundary; not applicable.
  • CLI and MCP/tool-catalog contract: unchanged tool surface and schemas; only the client registration setup writes.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details: none.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration. (writes one client mcp.json)
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: tests/boundary/filesystem/piClientConfiguration.test.ts gains caller-settings preservation with idempotency, foreign-transport replacement, and recommended-timeout/override cases; two existing Pi goldens now include the setup-owned deadline.

  • Base reproduction: the rea-agents 6.7.0 run above, which drops all three caller keys.

  • User-visible CLI/MCP output: a production-boundary run of the built CLI against temporary Pi configurations wrote timeout: 450 for a fresh entry, kept timeout: 45 for a caller entry, and kept timeout: 600, description, enabled, and env unchanged for a real configuration.

  • Remaining proof gaps: no live Ghidra or Hopper session was run to observe a deadline expiring; the 450 second recommendation is derived from the documented provider budgets, not measured against a live analysis.

  • Observed, derived, and inferred claims remain distinguishable.

  • Artifact identity, source provenance, and failed attempts remain preserved.

  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:focused -- tests/boundary/filesystem/piClientConfiguration.test.ts — 47 passed.
  • npm run check:fast — typecheck and lint succeeded (2 tasks).
  • npm run docs:check — 5 passed.
  • npm run build:cached, then the built CLI with PI_CODING_AGENT_DIR pointed at temporary configurations — fresh entry received 450 seconds, a caller timeout: 45 was kept, and a real configuration kept its 600 second override, description, and environment.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Existing entries keep their caller-selected timeout; entries without one gain a computed value.
  • Real Hopper/Ghidra, browser, or OS coverage: configuration paths only, exercised on the macOS host that holds the affected Pi configuration. No provider session was executed.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: writes one client configuration file, preserves unrelated keys and servers, and keeps the existing backup behavior.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/6187 **Author:** [@camilopiedra92](https://github.com/camilopiedra92) **Created:** 10/21/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/pi-registration-caller-settings` --- ### 📝 Commits (2) - [`391bf35`](https://github.com/morluto/rea/commit/391bf3525a3e03938633972c974ac203ad6c3599) fix(setup): preserve Pi caller-owned server settings - [`e054692`](https://github.com/morluto/rea/commit/e0546921e07811932b54f33dc17e148932aafde7) fix(setup): write Pi's recommended request timeout ### 📊 Changes **3 files changed** (+167 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/client-configuration.md` (+8 -0) 📝 `src/application/SetupClientConfiguration.ts` (+31 -0) 📝 `tests/boundary/filesystem/piClientConfiguration.test.ts` (+128 -0) </details> ### 📄 Description ## Summary `rea setup --client pi` rebuilt `mcpServers.rea` from `type`, `command`, `args`, and `env`, so every run discarded the settings Pi keeps in the same entry and left Pi's 60 second request default in place. This keeps the caller's settings across rewrites and writes REA's provider-budget deadline, so a Pi registration stays correct without hand-maintained values. Found while repairing a local Pi registration; no issue is linked because the trigger is a configuration write, not a reported defect. ## Problem and expected behavior Trigger, observed with the published `rea-agents` 6.7.0 and a Pi configuration seeded with caller settings: ```console $ cat /tmp/pi-config/mcp.json {"mcpServers":{"rea":{"type":"stdio","command":"/previous/rea","args":["mcp"],"env":{"A":"1"},"timeout":600,"description":"keep me","enabled":false}}} $ PI_CODING_AGENT_DIR=/tmp/pi-config rea setup --client pi --skill=false --yes $ cat /tmp/pi-config/mcp.json {"mcpServers":{"rea":{"type":"stdio","command":"<rea>","args":["mcp"],"env":{"A":"1", …}}}} ``` `timeout`, `description`, and `enabled` disappeared: a server the caller had disabled came back enabled, and the request deadline reverted to Pi's 60 second default. Separately, no Pi entry ever received a deadline recommendation, although `src/mcpStartupPolicy.ts` computes one and setup writes it for Codex and Kimi. That matters for Pi because a cold Ghidra analysis carries a 330 second startup budget (`DEFAULT_GHIDRA_STARTUP_TIMEOUT_MS`), and `GhidraClient.callTool` forwards progress only to `start()`, so a long Ghidra request emits no progress notifications that would reset a client-side deadline. Expected: setup owns the launcher, its arguments, its environment, and the recommended deadline; the caller's settings in the same entry survive; a caller-selected deadline wins. ## Change and scope - `src/application/SetupClientConfiguration.ts`: setup carries the caller-owned Pi keys (`enabled`, `exposure`, `toolExposure`, `cwd`, `description`) from the existing entry through an explicit allowlist, so keys Pi does not define are dropped rather than copied, and a foreign transport (`url`) is replaced instead of producing a mixed entry. - The same function writes `timeout` from `recommendedMcpToolTimeoutSeconds`, with the caller's positive value winning, matching the existing Codex `tool_timeout_sec` and Kimi `toolTimeoutMs` behavior. - `docs/client-configuration.md`: the Pi section states which settings setup owns and which stay caller-owned. Intentionally not included: provider inspections for bring-your-own tools (their paths remain caller environment), and any change to Ghidra's progress emission. Contribution scope: not applicable. This is an ordinary fix inside the existing setup boundary and changes no target execution, injection, mutation, or protection-recovery authority. ## Contract and boundary impact - Semantic owner and earliest changed stage: `application/SetupClientConfiguration`, at the client configuration write. - Contribution scope fit and linked maintainer decision: existing boundary; not applicable. - CLI and MCP/tool-catalog contract: unchanged tool surface and schemas; only the client registration setup writes. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: none. - Target selection, authority, upstream behavior, and cleanup details: none. - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact: none. Expected effects: - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [x] Change process memory, registers, files, or configuration. (writes one client `mcp.json`) - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: `tests/boundary/filesystem/piClientConfiguration.test.ts` gains caller-settings preservation with idempotency, foreign-transport replacement, and recommended-timeout/override cases; two existing Pi goldens now include the setup-owned deadline. - Base reproduction: the `rea-agents` 6.7.0 run above, which drops all three caller keys. - User-visible CLI/MCP output: a production-boundary run of the built CLI against temporary Pi configurations wrote `timeout: 450` for a fresh entry, kept `timeout: 45` for a caller entry, and kept `timeout: 600`, `description`, `enabled`, and `env` unchanged for a real configuration. - Remaining proof gaps: no live Ghidra or Hopper session was run to observe a deadline expiring; the 450 second recommendation is derived from the documented provider budgets, not measured against a live analysis. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npm run test:focused -- tests/boundary/filesystem/piClientConfiguration.test.ts` — 47 passed. - `npm run check:fast` — typecheck and lint succeeded (2 tasks). - `npm run docs:check` — 5 passed. - `npm run build:cached`, then the built CLI with `PI_CODING_AGENT_DIR` pointed at temporary configurations — fresh entry received 450 seconds, a caller `timeout: 45` was kept, and a real configuration kept its 600 second override, description, and environment. ## Compatibility, safety, and release - Breaking changes or migration steps: none. Existing entries keep their caller-selected `timeout`; entries without one gain a computed value. - Real Hopper/Ghidra, browser, or OS coverage: configuration paths only, exercised on the macOS host that holds the affected Pi configuration. No provider session was executed. - Package or release metadata impact: none. - Security, privacy, process, or containment review: writes one client configuration file, preserves unrelated keys and servers, and keeps the existing backup behavior. ## Author readiness Human owner: <!-- to be completed by the human owner --> - [ ] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [ ] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [ ] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [ ] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#7193
No description provided.