Skip to content

fix: keep installed host commands working outside installer PATH - #218

Merged
Birfy merged 2 commits into
mainfrom
fix/installed-host-command
Oct 10, 2026
Merged

Birfy merged 2 commits into
mainfrom
fix/installed-host-command

Conversation

@Birfy

@Birfy Birfy commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Pin machine-local MCP launchers to the installing Python executable plus -m agentdescent.cli, preserving virtualenv identity without relying on the later host's PATH.
  • Apply POSIX/Git Bash quoting to installed session hooks; keep distributable Claude/DSH plugin templates portable.
  • Repair exact stock legacy or previously pinned Codex entries at EOF and stock OpenCode entries on reinstall after a Python environment moves. Preserve customized entries, including inline/nested Codex environment settings, and honor dry-run.
  • Extend the built-wheel CI smoke to launch all four generated configurations with an empty PATH outside the checkout, initialize MCP, list tools and call doctor, and execute both hooks without their best-effort fallback.

Addresses the installer PATH regression identified in #210 (review) and tracked as a release gap in #207. No website, README, install guide, version manifest, engine, security, or credential changes.

Current validation

  • Follow-up head 0a5b6116d1212a543a37348987be28061407e068 repairs the stale pinned interpreter finding in fix: keep installed host commands working outside installer PATH #218 (comment).
  • Exact-head tests and docs both passed across Python 3.9–3.12, including all four built-wheel gates.
  • Regression coverage reinstalls all four hosts under a new Python and preserves custom Codex/OpenCode fields, relative launchers and POSIX/Windows wrappers. Unknown executable basenames are conservatively retained; conventional Python/Pythonw/PyPy names can refresh.
  • Independent final review found no remaining blockers. Native Windows/macOS host sessions were not run.

Evidence

  • Reproduced on unchanged main b787437 with a built wheel and temporary HOME: installation succeeds, but a later clean-PATH process fails to launch the generated bare agentdescent command with FileNotFoundError.
  • Final focused checks: Python 3.12, 110 passed / 4 skipped; Python 3.9, 108 passed / 6 skipped. Missing real host tools and unsupported 3.9 MCP account for skips.
  • Final rebuilt-wheel smoke passes on Python 3.12: stale generated Codex/OpenCode configs are repaired, all four generated configurations establish MCP sessions with empty PATH, and both session hooks run.
  • A real pip --user wheel install under a temporary HOME containing spaces also passes a later clean-PATH MCP initialize/list/doctor session.
  • Independent review: no remaining blockers after fixes for Windows hook quoting, custom Codex nested-table preservation, and Windows smoke HOME isolation. Native Windows/macOS host sessions were not run.
  • Published tree b277bab1bbbfea4957e0ee8951eef06bbed1fcae exactly matches the local reviewed tree. git diff --check passes.
  • Local full-suite iteration: 3,026 passed, 56 skipped, 19 failed. All 19 failing IDs also fail on unchanged exact base b787437 due to sandbox NETLINK_ROUTE restrictions and Chromium PDF execution. Later review fixes were rechecked in the final focused suite; hosted full-matrix CI validates the final head. This is not a local full-suite pass.
  • Local strict docs passed with social cards disabled only in a temporary config; the ordinary local build hit font-cache restrictions. Hosted strict docs passed with the repository configuration unchanged.
  • Conflict-free against current main b08396d. No merge or release action has been taken.

No merge, tag, release, deployment, or paid-model run is requested.

@Birfy
Birfy marked this pull request as ready for review October 10, 2026 08:01
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T09:10:38.783457Z 0a5b611 Draft marked ready
ℹ️ 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.

@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: 1391b1e7b9

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +416 to 418
existing = (current.get("mcp") or {}).get("agentdescent")
if existing and existing != opencode_mcp_entry():
w.lines.append(f"kept {path} (mcp entry already present)")

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 Refresh previously pinned launchers after Python moves

When install is rerun from a different Python environment—for example after replacing or relocating a virtualenv—the existing entry generated by this version contains the old absolute interpreter and therefore differs from the bare legacy opencode_mcp_entry(). This branch misclassifies that installer-generated entry as custom and retains the now-stale executable, so OpenCode can no longer launch MCP even though reinstall succeeds; the marker check in append_unless causes the analogous Codex failure. Recognize uncustomized pinned entries as installer-owned and refresh them to w.launcher while continuing to preserve genuinely custom launchers.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in 0a5b611. Reinstall now refreshes untouched stock pinned Codex/OpenCode launchers after the old Python environment disappears. Recognition stays conservative: customized fields, additional arguments, relative paths and non-Python wrapper executables are preserved. Added all-four-host reinstall/dry-run/idempotence coverage plus POSIX/Windows wrapper controls, and seeded stale pinned configs into the installed-wheel smoke. Focused checks: Python 3.12 110 passed/4 skipped; Python 3.9 108 passed/6 skipped; independent final review clean. The PR is Draft while new exact-head CI runs (38039361138 tests, 38039361131 docs).

@Birfy
Birfy marked this pull request as draft October 10, 2026 08:43
@Birfy
Birfy marked this pull request as ready for review October 10, 2026 09:07

@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: 0a5b6116d1

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +379 to +380
and re.fullmatch(r"(?:pythonw?|pypy)(?:[0-9]+(?:\.[0-9]+)*)?(?:\.exe)?",
ntpath.basename(command[0]), re.IGNORECASE) is not None

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 Recognize free-threaded CPython launchers on reinstall

When installation runs under an official free-threaded CPython, sys.executable may be named python3.13t or python3.13t.exe (Python documentation), but this regex rejects the t suffix. The first install therefore writes a valid pinned launcher, while a reinstall after that environment is moved classifies the exact installer-generated Codex/OpenCode entry as custom and retains the deleted executable. Fresh evidence beyond the earlier fixed report is that the repaired recognizer still excludes this official interpreter name; allow the free-threaded suffix when recognizing stock launchers.

Useful? React with 👍 / 👎.

@Birfy
Birfy merged commit 321ff04 into main Oct 10, 2026
6 checks passed
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.

1 participant