refactor: centralize agent executable resolution and startup workspace approvals#210
Merged
DeadWaveWave merged 6 commits intomainfrom Apr 30, 2026
Merged
Conversation
3 tasks
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.
💡 Change Scope
📝 What Does This PR Do?
This PR fixes two related startup/runtime bug classes that were both caused by split ownership across local shell/runtime boundaries:
#174by auto-registering persisted workspace roots during startup and gating local/remote guarded IPC paths until that bootstrap is finished.The result is that GUI-launched environments no longer rely on ad-hoc executable discovery, and restored workspaces no longer lose terminal/agent/file-operation access just because
approved-workspaces.jsonis missing or stale.🏗️ Large Change Spec (Required if "Large Change" is checked)
1. Context & Business Logic
Two recurring problem classes were surfacing in adjacent startup paths:
PATHhydrate, availability checks, model probes, real launch), so the same provider could appear available in one path and unavailable in another.This PR makes both paths owner-based again: persisted settings own executable overrides, the main-side resolver owns local executable resolution, persisted workspace state remains the durable truth for workspace roots, and runtime approval stores bootstrap from that durable state instead of drifting away from it.
2. State Ownership & Invariants
Owner model:
agentExecutablePathOverrideByProvider.Invariants:
PATH, processPATH, and fallback directories.3. Verification Plan & Regression Layer
Lowest meaningful regression layers:
ShellEnvironmentService,ExecutableLocator,AgentExecutableResolver, persisted workspace approval gate, settings state, settings UI/search updates.pnpm pre-commit; the full suite still has unrelated flaky failures, so failing specs were rerun directly to classify them.Verification run:
pnpm checkpnpm test -- --run ...coverage for resolver/locator/shell-env/settings/startup-approval pathstests/unit/contexts/persistedWorkspaceApproval.spec.tstests/contract/ipc/registerIpcHandlers.spec.tstests/contract/ipc/registerRemoteAgentIpcHandlers.spec.tstests/contract/ipc/ipcApprovedWorkspaceGuard.spec.tstests/contract/ipc/ipcApprovedWorkspaceGuard.agent.windows.spec.tspnpm pre-commitearlier on this branch still showed unrelated flaky E2E failures in different specs on different runs, not a deterministic regression tied to this PR's change surface✅ Delivery & Compliance Checklist
pnpm pre-commitis completely green.CLA.md).DEVELOPMENT.mdarchitectural boundaries.📸 Screenshots / Visual Evidence
No screenshot attached in this CLI-created PR yet. The user-visible changes are the new Settings executable override section and the restored-workspace startup fix, which is primarily behavior-level rather than a new visual surface.