Skip to content

Harden agent CLI startup in fragile user environments#424

Merged
baron merged 3 commits into
mainfrom
wt/codex-connect-delay
Jul 8, 2026
Merged

Harden agent CLI startup in fragile user environments#424
baron merged 3 commits into
mainfrom
wt/codex-connect-delay

Conversation

@baron

@baron baron commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Context

This started as an investigation into slow/stuck Codex connection startup, but the root theme is broader: agent CLIs can fail or stall when RepoPrompt is launched from a macOS app environment that does not match the user's terminal PATH, shell aliases, Homebrew/Fish setup, or legacy MCP/CLI symlink state.

This PR hardens that startup boundary without abandoning the legacy path behavior users may already depend on.

Summary

  • make optional Codex app-server memory-mode setup best-effort so it cannot block session readiness
  • move CE user-space CLI links to the no-space ~/RepoPrompt path for newly generated configs/installs
  • grandfather legacy CE Application Support links, older Classic-style CLI names, and existing managed app-bundle destinations as repairable/recognized paths
  • improve OpenCode/Cursor executable discovery diagnostics for app-launched PATH environments by reporting candidates and fallback-env hints
  • add a Claude wrapper fallback for local/alias-only installs at ~/.claude/local/claude
  • add coarse Sentry breadcrumb/metric coverage for CLI path resolution failures without reporting raw filesystem paths

Why this shape

  • Codex was the trigger, but PATH/env fragility is the cross-provider failure mode.
  • The no-space ~/RepoPrompt path improves generated config robustness going forward.
  • Legacy paths remain explicitly supported so existing users are not stranded by a cleaner default.
  • Diagnostics now aim to explain "works in Terminal, fails in app" instead of collapsing everything to "CLI not found."

Validation

  • make dev-test FILTER=OpenCodeACPLaunchResolverTests
  • make dev-test FILTER=CursorACPLaunchResolverTests
  • make dev-test FILTER=CECLINamingAndRoutingTests
  • make dev-test FILTER=CLIPathInstallerTests
  • make dev-test FILTER=DebugCLIInstallerScriptTests
  • make dev-format
  • make dev-lint
  • python3 Scripts/test_suite_optimizer.py verify-ledger --ledger Scripts/Fixtures/test-suite-contract-ledger.tsv
  • .agents/skills/rpce-contribution-check/scripts/preflight.sh commit
  • .agents/skills/rpce-contribution-check/scripts/preflight.sh push

Notes

  • Sentry telemetry records provider kind, shell environment source, and candidate count only; raw paths stay out of telemetry.
  • This does not attempt the larger path-doctor UX or worktree artifact pathing fixes; those remain separate follow-ups.

baron added 2 commits July 8, 2026 13:37
Use non-interactive login shell capture for Codex app-server startup and resolve Codex/startup probe commands from PATH before shell fallback.

Make optional Codex memory-mode disable best effort with bounded foreground attempts and a background retry so it cannot hold startup readiness.

Add regression coverage for PATH-first resolver mode and memory-mode retry behavior.
@baron baron changed the title Fix Codex startup stalls and harden CLI path resolution Make Codex memory setup best-effort and harden CLI paths Jul 8, 2026
@baron baron changed the title Make Codex memory setup best-effort and harden CLI paths Harden agent CLI startup in fragile user environments Jul 8, 2026
@baron baron merged commit 5bc088e into main Jul 8, 2026
12 of 14 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