Repository navigation
fix(orchestrate): tell the orchestrator why a revived child failed to start - #604
Merged
Merged
Conversation
… start An orchestrator returning to a long-idle child whose worktree had since been removed got a misleading or missing answer. The spawn into the missing directory failed with the OS's "not found", which the provider reported as its binary being missing. The failure folded into the turn that had already been reported, so its callback was deduplicated away while the app kept running. After a restart it did arrive, but it carried that old turn's final message instead of the error, and `status` still said `completed`. `start_session` now refuses a missing working directory by name. A child whose last entry is a failed start reports `failed to start: <error>` in one line, is not deduplicated against the earlier turn, and shows as `failed` with `start_error` in `status`.
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
An orchestrator
sendto a long-idle child whose worktree had been removed:send(child) → {"delivery":"queued"} start_session(cwd = removed worktree) - spawn → ENOENT → "spawning `…/claude`: No such file or directory" + "working directory `…` no longer exists" ProviderStartFailed folds into the already-reported turn deliver_child_callback(Failed) - same turn count → deduplicated, parent hears nothing (app kept running) - after a restart: "<thread> failed." + the old turn's final message + "[orchestrate] thread X (\"title\") failed to start: <error>" status(child) - state: completed, last_output_tail: old message + state: failed, start_error: <error>crates/agent/src/lib.rs:start_sessionrejects a missing cwd before any provider spawns, so all providers report it the same way.crates/runtime/src/app/orchestrate.rs:trailing_start_error(the timeline's last entry is aProviderStartError) drives the one-line callback, bypasses the per-turn dedupe, and sets the state thatstatusreports.Evidence
Found in real use: child
52348392was revived after 3 days. Its cwd~/.tcode/worktrees/native-grokwas gone, the error blamed theclaudebinary (which still existed), and the parent's callback carried the 3-day-old final message.send_to_child_whose_cwd_was_removed_reports_the_start_failurefails.run_untiltimes out after 5s because the parent never receives a callback.After: the test passes. The parent receives exactly
[orchestrate] thread child ("…") failed to start: failed to spawn provider process: working directory…no longer exists, andstatusreportsfailedwithstart_error.cargo fmt --all --check,cargo clippy --workspace --all-targets --locked -- -D warningsandcargo nextest run --workspace --locked(937 passed) were run locally on macOS. Machete and the mobile/Web checks are left to CI.Merge Danger
Door: two-way
Blast Radius: narrow
Two things change. Every provider start now stats its cwd first. The orchestrate callback and
statustext change for a child whose last start failed; ordinary completed/failed callbacks are unchanged. No wire or persisted-format change.