Skip to content

docs(setup): acquire packages outside a REA source checkout - #9695

Open
2SinceJuly wants to merge 5 commits into
morluto:mainfrom
2SinceJuly:fix/9685-npx-checkout-guidance
Open

2SinceJuly wants to merge 5 commits into
morluto:mainfrom
2SinceJuly:fix/9685-npx-checkout-guidance

Conversation

@2SinceJuly

Copy link
Copy Markdown
Contributor

Summary

Fixes #9685.

npx rea-agents@X run inside a REA source checkout selects the checkout's own rea-agents workspace package instead of the published one, because npm resolves package requests against the local project. Nothing is built into that checkout's node_modules/.bin, so the launcher fails with 'rea' is not recognized before REA starts. A client registration the agent runs from that directory then reports a closed connection, and nothing in the recovery path points at the working directory.

The onboarding docs and the bundled skill already said to acquire from a trusted directory outside the target project. A target project and a REA source checkout are different exclusions: contributors hit this while working inside the checkout itself, which the existing wording does not cover.

Problem and expected behavior

Observed on Windows 11 with a Claude Code user-scope registration cmd.exe /d /c npx -y rea-agents@6.8.0 mcp, started with cwd in a REA source checkout: CONNECTION_CLOSED. npx -y rea-agents@6.8.0 --version from that checkout prints 'rea' is not recognized as an internal or external command; from %TEMP% the same command prints 6.8.0. npx -y -p rea-agents@6.8.0 -c "echo %PATH%" shows the child PATH with <checkout>\node_modules\.bin and no _npx\<hash>\node_modules\.bin entry.

Expected: the acquisition guidance names the source checkout as an environment to avoid, so a contributor can recognize the closed connection as a launcher-resolution failure rather than a REA transport failure.

Change and scope

Documentation and skill guidance only:

  • README.md — the setup section's acquisition sentence.
  • docs/getting-started/installation.md — the package-runner sentence in the rea mcp add paragraph.
  • .agents/skills/reverse-engineer-anything/SKILL.md and references/connection-and-recovery.md — the same exclusion plus what the failure looks like.

Not included, and deliberately so:

  • No change to registrationAligned in src/application/ClientRegistrationStatus.ts. The 6.8.0 behavior the report describes ("an exact npx/bunx reference is aligned with no further checks") is already gone on current main: legacy package runners remain owned, but setup migrates them (src/application/ClientRegistrationStatus.ts:493) makes any package-runner registration stale. Changing that classification on a source-derived claim would need a runtime reproduction of the 6.8.0 dist, which this environment cannot run.
  • No code change to setup or doctor. npm_config_local_prefix-style detection would be a new behavioral rule, and the issue does not establish what setup should do when it detects a checkout cwd.

Contract and boundary impact

  • Semantic owner and earliest changed stage: documentation only; the owning behavior for registration status is unchanged.
  • Contribution scope fit and linked maintainer decision: not applicable (documentation-only change inside an existing setup path).
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details: not applicable.
  • Generated metadata, package, or installation impact: skills/reverse-engineer-anything/SKILL.md is generated from .agents/skills/; regenerated locally with node scripts/generate-skill-metadata.mjs and verified with --check. Nothing generated is committed.

Expected effects:

  • Documentation or usability only; no target interaction.

Evidence and regression coverage

  • Tests added or updated: none. Existing coverage applies unchanged.
  • Base reproduction or other evidence: the reporter's Windows transcript above; the npm resolution rule is the same on every platform (a local project named rea-agents is selected over the registry). Not reproduced on this machine, which has no checkout-level rea-agents package to select.
  • User-visible CLI/MCP output (if applicable): none.
  • Remaining proof gaps: the macOS/Linux and bunx cases are untested, as the report itself notes.

Validation performed

  • npm run test:focused -- tests/conformance/readmeConsistency.test.ts — 9/9 passed, including the translated-README shell-example equality check.
  • node scripts/generate-skill-metadata.mjs --check — passed.
  • node scripts/check-doc-facts.mjs — passed.
  • npx oxfmt --check README.md docs/getting-started/installation.md .agents/skills/reverse-engineer-anything/SKILL.md .agents/skills/reverse-engineer-anything/references/connection-and-recovery.md — all files formatted.

npm run check:fast / npm run typecheck were not run: current main (e9b6c87c1) does not compile — src/cli/adbCommands.ts:48 redeclares packageName (TS2451) — and open PRs #9677 and #9678 already fix it. To run check-doc-facts.mjs and the skill generator, the duplicate was removed locally, the docs and skill checks were run, and the file was restored; this PR's diff does not include that file.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

Author readiness

Human owner: @2SinceJuly

  • 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.

npm exec resolves a package request against a local project of the same name, so `npx rea-agents@X` run inside a REA source checkout selects the unbuilt workspace package instead of the published one. The launcher then fails with "'rea' is not recognized" before REA starts, and a client registration that runs it reports a closed connection with no REA diagnostic.

The onboarding docs and the bundled skill already said to acquire from a trusted directory outside the target project. Name the source checkout as a second exclusion so the guidance covers the failure DerekMaki reported (morluto#9685), and say what the failure looks like.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T08:53:26.142933Z 4b53aa2 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@2SinceJuly

Copy link
Copy Markdown
Contributor Author

CI status on this head:

The checks this change is responsible for pass locally on the same head: docs-facts, generate-skill-metadata --check, tests/conformance/readmeConsistency.test.ts (9/9), and oxfmt --check on all four files.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1443610af8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +74 to +75
with absolute target paths. Inside a checkout npm resolves `rea-agents` to the
local unbuilt package, so the launcher fails and the client reports a closed

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Scope checkout shadowing to matching package requests

When this authored skill is used directly, the fallback immediately above is npx -y rea-agents@latest, and npm does not shadow that tag with the checkout: with npm 11.4 an offline run from this repository queried npmjs.org and returned ENOTCACHED, whereas the matching exact @6.8.0 request selected the checkout and failed with rea: not found. npm's exec documentation likewise says that a package with a specifier is considered a local match only for the exact same name and version. The package-skill generator may pin @latest, but the repository/source skill retains the tag, so this explanation sends agents diagnosing a valid @latest launch down the wrong recovery path; scope it to unversioned or matching exact-version requests.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6a60523: the paragraph now says npm treats rea-agents as a local match only for an unversioned request or one naming the checkout's exact version, and that an @latest request keeps resolving the registry entry, so the shadowing does not explain a failure of the documented @latest fallback.

Not run: no test covers this prose; node scripts/verify/architecture-guards.mjs still reports the pre-existing DesktopBuildSecrets.ts violation that main carries, untouched here.

@2SinceJuly

Copy link
Copy Markdown
Contributor Author

Full run finished; adding the two jobs that landed after my last comment. Both trace to the same two base defects:

  • Source tests — cliBundleResource, nativeDeadlineFlags and config/captureDecoderHeap fail at transform with Identifier packageName has already been declared at src/cli/adbCommands.ts:46/48 (the fix(cli): align ADB package-name schemas #9675 duplicate). src/domain/desktop/appTaskReaders.test.ts > renders byte for byte as the selector parent before readers compares 5de3e07… to f23f2f3… — a golden snapshot of the desktop selector that feat(desktop): isolate declared secrets during app builds #9225 changed alongside DesktopBuildSecrets.ts.
  • Portable tests / CI required — gated by the jobs above.

This PR changes four Markdown files and nothing else (git diff --name-only origin/main...HEAD | grep -v '\.md$' is empty), so none of these can come from this diff.

The guidance says a checkout makes the `npx -y rea-agents@latest` fallback
fail, but npm treats a specifier as a local match only for the same name and
exact version: `@latest` keeps resolving the registry entry (npm 11.4
returned its own `ENOTCACHED`, not a checkout hit). Saying otherwise sends
agents diagnosing a valid `@latest` launch down the wrong recovery path.
@2SinceJuly

Copy link
Copy Markdown
Contributor Author

Re-checked on head 6a6052341. Nothing has changed upstream yet, and the Documentation job failing is a new data point worth recording: npm run compile stops on src/cli/adbCommands.ts(46,9) and (48,9), error TS2451: Cannot redeclare block-scoped variable 'packageName'. That is the #9675 duplicate still on main (e9b6c87c1), and compile is a prerequisite of Documentation, Source tests, Portable tests and Build, so one redeclaration accounts for every red job except the digest pin.

The appTaskReaders digest is also upstream and, on closer inspection, mispinned rather than stale: the expected f23f2f37… has never been produced by any commit on main — fe2985a0b^ renders 5de3e075…, same as now. Reported in more detail on #9696.

This PR changes four Markdown files and nothing else, so it cannot affect any of these.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ef9bc15005

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread docs/getting-started/installation.md Outdated
Comment on lines +1244 to +1245
child launcher. Run that acquisition from a trusted directory outside any REA
source checkout; prefer managed

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Put the checkout warning beside the setup command

When a contributor opens this installation guide directly from a REA checkout, the first Start setup command at line 19 is still the unversioned npx rea-agents setup and is shown without this exclusion; npm 11's exec documentation says that a package name without a specifier is matched to whatever version exists in the local project. The only warning added to this guide is over 1,200 lines later in the Ghidra/rea mcp add aside, so the primary onboarding path can hit the checkout shadowing before seeing the advice; put the exclusion beside Start setup or in the linked package-runner section.

AGENTS.md reference: AGENTS.md:L31-L33

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair — the only warning was 1,200 lines below the command it protects. Fixed in 32b99523a: the Start setup section now says to run it from a trusted directory outside any REA source checkout and gives the unversioned-match reason, and the mcp add aside at line 1245 points back to it instead of restating the rule.

Comment on lines +164 to +166
Inside a checkout, npm resolves `rea-agents` to the local unbuilt package, so the
launcher fails before REA starts and a registration that runs from there reports a
closed connection rather than a REA diagnostic.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Carry the version qualifier into the recovery reference

When a registration uses @latest or an exact version different from the checkout, this sentence still falsely attributes the launch to the local package: npm 11's exec documentation says a package with a specifier is a local match only for the exact same name and version, and the corrected SKILL.md lines 74–79 now records that qualifier. Fresh evidence after the earlier fix is that this linked sibling reference retained the unconditional wording, so an agent consulting it can still misdiagnose the same closed connection; apply the same unversioned/matching-version qualification here.

AGENTS.md reference: AGENTS.md:L35-L35

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 32b99523a. The reference now scopes the shadowing the same way SKILL.md does: an unversioned rea-agents request, or one naming the checkout's exact version, matches the local unbuilt package; @latest or another version still resolves the registry entry and is unaffected.

The warning was placed only beside the mcp add aside, over 1,200 lines below
the first setup command, so the primary onboarding path could hit the
shadowing before ever seeing it. State the exclusion next to the Start setup
command as well.

The recovery reference still described the checkout as unconditionally
shadowing the launch. npm only treats a package as a local match for an
unversioned request or one naming the checkout's exact version; an @latest
request resolves the registry entry, which is the form SKILL.md recommends.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 32b99523a7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread README.md
Comment on lines 90 to +93
available. Run package acquisition from a trusted directory outside the target
project. Installation and recovery details are in the setup guide below.
project and outside a REA source checkout: inside that checkout npm resolves
`rea-agents` to the local (unbuilt) package instead of the published one, so the
launcher fails before REA starts. Installation and recovery details are in the setup guide below.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Cover the remaining public setup entry points

When a contributor starts from the prominent README command at line 27 or the website command at docs/index.md:31, they can run npx rea-agents setup from a checkout before ever seeing this warning; the guide's linked package-runner section at docs/getting-started/installation.md:1957-1960 also retains only the older “outside the target project” advice. npm 11's exec documentation says an unversioned package name is matched to whatever version exists in the local project, so all of these public entry paths still reproduce the launcher failure this patch is meant to prevent. Put the exclusion beside those commands or use the unaffected @latest form there.

AGENTS.md reference: AGENTS.md:L31-L33

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 4b53aa25: README.md:27 and docs/index.md:31 now run npx rea-agents@latest setup, which resolves the registry entry even when the cwd sits inside a checkout. The README hero also states the exclusion next to the command, and docs/getting-started/installation.md "Package runners and global installation" now names the source checkout alongside the target project.

Leaving the in-checkout shadowing pinned by request version (not an unconditional failure) is intentional — it is what 32b99523 established and npm 11 matches a local package only for an unversioned or exact-version request.

Verified locally: tests/boundary/filesystem/documentationFacts.test.ts and tests/conformance/readmeConsistency.test.ts pass (10 tests); npx oxfmt --check clean on the three touched files. Translations under docs/readme/ are synced in their own batch and were not touched here.

The warning next to Start setup only helps a reader who got that far. The
README hero and the website quick start still ran an unversioned
npx rea-agents, which inside a source checkout matches the local unbuilt
package and fails before REA starts.

Pin those commands to @latest so they resolve the published release from
any directory, and say why in the hero note.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4b53aa25f1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread README.md
[Quick start](#quick-start) · [How REA works](#how-rea-works) · [What you can analyze](#what-you-can-analyze) · [Showcases](#showcases) · [Build RL environments](#build-rl-environments) · [FAQ](#faq) · [Documentation](#documentation)

<code>npx rea-agents setup</code>
<code>npx rea-agents@latest setup</code>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pin setup in the linked translated READMEs

When a reader chooses any non-English edition linked at README.md:3-4, both its hero and quick-start setup commands remain unversioned (for example docs/readme/README_fr.md:27 and :78), so running them from a REA checkout still selects the unbuilt local package. A repo-wide search at this revision found the command in all 23 docs/readme/README_*.md editions, none of which receives this commit's new checkout guidance; npm 11's exec documentation says an unversioned name “will be matched with whatever version exists in the local project.” Fresh evidence after the earlier public-entry-point fix is this untouched set of linked editions; pin their executable literals to @latest or carry the warning there as well.

AGENTS.md reference: AGENTS.md:L31-L33

Useful? React with 👍 / 👎.

trusted directory outside the target project, with absolute target paths. Managed
trusted directory outside the target project and outside any REA source checkout,
with absolute target paths. Inside a checkout npm treats `rea-agents` as a local
match only for an unversioned request or one naming the checkout's exact version,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include satisfying ranges in the shadowing diagnosis

When an MCP registration uses a semver range satisfied by the checkout's 6.8.0 version (for example rea-agents@^6.8.0), npm still selects the local checkout, but this new only qualifier tells the agent to rule that cause out. npm 11.4.2's implementation explicitly handles a “package requested by version range” by returning the local node when semver.satisfies(...); with the installed npm 11.4.2, an offline run here likewise ended in rea: not found for @^6.8.0 while @latest attempted the registry. This range branch/runtime result is fresh evidence beyond the earlier exact-version thread; include satisfying ranges here and in the matching recovery reference so these closed connections are not misdiagnosed.

AGENTS.md reference: AGENTS.md:L31-L33

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Registrations launched via npx rea-agents@X fail when the client starts inside a REA checkout; 6.8.0 doctor reports them "aligned"

1 participant