fix(headless): explain missing workspace dir on switch failure#682
Open
imskull wants to merge 1 commit into
Open
fix(headless): explain missing workspace dir on switch failure#682imskull wants to merge 1 commit into
imskull wants to merge 1 commit into
Conversation
When switching to a workspace whose directory was moved or deleted, the managed headless launch reaches exec and the OS rejects it with an opaque "The directory name is invalid." error, which surfaces to the Feishu client as a generic switch failure with no explanation. Map that launch failure to an explanatory ErrorInfo (headless_workspace_dir_missing) when the workspace directory no longer exists, telling the user the directory is gone and to reselect/re-import it, while preserving the raw OS error in Details. The success path is untouched.
imskull
added a commit
to imskull/codex-remote-feishu
that referenced
this pull request
Jun 6, 2026
…p budget Bring the fork current with upstream/master (16 commits). Conflict resolutions: - Resume internals (app_surface_resume_state.go, runtime_state.go, surface_resume_state_test.go, service_surface_resume_test.go, service_surface_thread_selection.go): take upstream's StickyFailureCode / recordSurfaceResumeFailureLocked design. The fork's earlier resume fixes (10c42c6/a2af8190/2a5c2bb7) are superseded by upstream's equivalent handling and were dropped. - New feature on top of upstream: a bounded-retry give-up budget that the upstream design still lacked. After surfaceResumeMaxFailedAttempts (3) consecutive same-code failures a headless/vscode surface stops polling and emits one "已停止自动恢复" hand-off notice (use /list or /use), re-armed only when the resume target changes or the daemon restarts. The counter is deduped per tick (LastAttemptAt guard) so the synchronous recovery loop and the async outcome scan sharing one `now` cannot double-count. - app_headless.go: keep upstream's refactored handleManagedHeadlessLaunchFailure and re-apply the missing-workspace-dir explanatory error on the exec-failure path (matches PR kxn#682). - Docs: take upstream's newer state-machine summaries; document the give-up budget in remote-surface-state-machine.md. Tests: new unit tests for the give-up counter dedup and one-time hand-off, plus the existing missing-workspace-dir tests, all pass. Pre-existing setup/onboarding and symlink-privilege test failures on Windows are unrelated.
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.
Problem
When switching to a workspace whose directory was moved or deleted, the managed
headless launch reaches exec and the OS rejects it with an opaque
"The directory name is invalid." error. This surfaces to the Feishu client as a
generic switch failure with no explanation, leaving the user with no idea what
went wrong or how to recover.
Fix
When the launch fails and the workspace directory no longer exists on disk, map
the failure to an explanatory
ErrorInfo(headless_workspace_dir_missing) thattells the user the directory is gone and to reselect / re-import the workspace.
The raw OS error is preserved in
Details. Any other launch failure is returneduntouched, and the success path is unchanged.
Testing
go build ./internal/app/daemon/go test ./internal/app/daemon/ -run TestExplainMissingWorkspaceLaunchError -v(2 new unit tests, both pass)go vet ./internal/app/daemon/clean(Two pre-existing setup/onboarding test failures on
masterare unrelated to this change.)