fix(process): allow whitespace in workspace cwd segments (#410 parity)#674
Open
BlackKeyZ wants to merge 2 commits into
Open
fix(process): allow whitespace in workspace cwd segments (#410 parity)#674BlackKeyZ wants to merge 2 commits into
BlackKeyZ wants to merge 2 commits into
Conversation
The session-port spawn path (aionui-process::prepare_command_cwd) rejected any cwd with a whitespace path segment, so every claude/codex direct-CLI spawn failed instantly for workspaces like iCloud Drive (~/Library/Mobile Documents/...). Upstream removed the same check from the legacy spawn path in #410; the rewritten crate silently reintroduced it and #609 carried it into production (Sentry ELECTRON-3PP: team leaders on claude/codex fail with "Agent runtime failed to start" while aionrs, which spawns no subprocess, works). - drop the whitespace-segment rejection + its ProcessError variant; the guard now checks availability only (non-empty, exists, is-dir), matching #410 semantics and the legacy cli_process guard - pin regression tests (whitespace in any segment / trailing whitespace on an existing dir must pass; empty, missing, non-dir still rejected) - team attach: log the raw TeamError at warn before it is sanitized to the generic public reason - production logs previously carried no trace of the actual cause
…TH-resolve CLI fallback Two follow-ups from the regression-by-rewrite audit round 2 (fix-history x session spawn path), same family as the whitespace-cwd regression: - #410 parity (error class): a missing / non-directory workspace now keeps its dedicated class end-to-end instead of collapsing into an opaque 502: ProcessError::WorkspaceUnavailable (path payload) -> BackendError:: WorkspaceUnavailable via the shared from_spawn mapping at all six conn spawn sites -> AgentError::WorkspacePathRuntimeUnavailable in build_session_instance -> the existing WORKSPACE_PATH_RUNTIME_UNAVAILABLE API error the frontend already renders. Legacy cli_process surfaced this class; the session path degraded it to bad_gateway. - #299 parity (Windows CLI resolution): when resolve_bundled_cli finds no bundled binary, resolve the bare "claude"/"codex" through resolve_command_path (which handles .exe via PATHEXT and npm .cmd/.ps1/.bat shims) instead of handing the bare name to CreateProcess, which cannot resolve npm shims. Nothing-on-PATH still falls back to the bare name so the spawn error stays diagnosable. Tests: prepare_command_cwd classification (aionui-process), from_spawn unit (types.rs), open_session wiring with a workspace-gone spawner (codex_conn).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes Sentry ELECTRON-3PP (AionUi 2.1.40): teams with a claude/codex leader fail with "Agent runtime failed to start" while aionrs leaders work — plus two sibling parity gaps found by auditing every upstream fix on the replaced spawn path against the session rewrite.
Commit 1 — whitespace cwd regression (the P0)
aionui-process::prepare_command_cwdrejected any cwd containing a whitespace path segment. Every claude/codex direct-CLI spawn goes through it (RealSpawner → ManagedProcess::spawn), so workspaces under iCloud Drive (~/Library/Mobile Documents/…) — or any folder with a space — failed instantly (µs-level, before posix_spawn). Non-team claude/codex conversations in such workspaces are equally affected; teams just mask the error hardest.attach_member_runtime(aionui-team): log the rawTeamErroratwarnbeforesanitize_member_runtime_failuregenericizes it — production logs previously carried no trace of the real cause.Commit 2 — two parity follow-ups from the same audit
ProcessError::WorkspaceUnavailable→BackendError::from_spawn(all six conn spawn sites) →AgentError::WorkspacePathRuntimeUnavailable→ the existingWORKSPACE_PATH_RUNTIME_UNAVAILABLEAPI error the frontend already renders.resolve_bundled_clifinds no bundled binary, resolve the bareclaude/codexthroughresolve_command_path(PATHEXT + npm.cmd/.ps1/.batshim lookup) instead of handing a bare name toCreateProcess, which cannot resolve npm shims. Nothing-on-PATH still falls back to the bare name so the spawn error stays diagnosable.Root-cause evidence (commit 1)
cwd=/Users/…/Library/Mobile Documents/com~apple~CloudDocs/…(user logs, pid 2407).approval policy resolvedlog — exactly the pre-spawn cwd guard; bundled CLI resolution succeeded (binaries verified present, +x, runnable in the 2.1.40 artifact).Testing
prepare_command_cwdclassification + whitespace pins (aionui-process),from_spawnunit (types.rs),open_sessionwiring with a workspace-gone spawner (codex_conn)cargo clippy -p aionui-process -p aionui-session -p aionui-ai-agent -p aionui-team -- -D warningsjust pushfull gate ×2 — workspace nextest 7429 passed / 18 skipped