fix: resolve --spawned-by self for depth>0 workers (v0.0.8) - #17
Merged
Conversation
…s (v0.0.8) Cursor workers don't have ORCA_WORKER_NAME in their shell environment, so they fall back to `--spawned-by self` even when running at L2+. This caused ensure_l0_orchestrator to create a ghost L0 entry — the worker appeared as a separate root tree in `orca list` despite having correct depth/spawned_by in state. Two-layer fix: 1. In cmd_spawn, resolve `self` to the existing worker name when the calling pane matches a tracked worker with depth > 0, before the L0 marker check runs. 2. Defense-in-depth in ensure_l0_orchestrator: if the pane already belongs to a depth > 0 worker, return that worker's name instead of creating a new L0 entry. Bump version to 0.0.8. Made-with: Cursor
🧪 Coverage Report
📄 Coverage by file
|
- daemon: return 0 instead of panicking on fork() failure - spawn: compile sh_quote regex once via LazyLock - cli/spawn: consolidate depth_emoji into spawn, remove cli duplicate Made-with: Cursor
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
--spawned-by self(becauseORCA_WORKER_NAMEisn't set in Cursor's shell) would triggerensure_l0_orchestrator, creating a ghost L0 entry. This caused the worker to appear as a separate root tree inorca listeven though its state (depth, spawned_by) was correct.cmd_spawn, before the L0 marker check, resolveselfto the actual worker name when the calling pane matches a tracked worker withdepth > 0. This preventsensure_l0_orchestratorfrom being called at all.ensure_l0_orchestratoritself — if the pane already belongs to adepth > 0worker, return that worker's name instead of creating a new L0 entry.Scenario reproduced
fenwas spawned correctly at depth=2 bycog, but whenfenspawnedashusing--spawned-by self(Cursor env has noORCA_WORKER_NAME),ensure_l0_orchestratorauto-registeredfenas a new L0 orchestrator.Test plan
test_ensure_l0_returns_existing_worker_when_pane_matches_depth_gt0— pane match on depth>0 worker returns existing nametest_ensure_l0_still_creates_l0_when_pane_has_no_worker— genuine L0 case still workstest_ensure_l0_returns_existing_l0_when_pane_matches_depth_0— existing L0 pane match still workstest_resolve_self_to_depth_gt0_worker_by_pane— cmd_spawn resolution logictest_resolve_self_unchanged_when_no_pane_match— genuine L0 fallbacktest_full_chain_self_resolves_correctly_for_l2_worker— full openclaw→cog→fen→ash chainMade with Cursor