Skip to content

fix: require explicit spawn lineage for workers - #15

Closed
araa47 wants to merge 4 commits into
mainfrom
fix/explicit-spawn-lineage-v0.0.7
Closed

fix: require explicit spawn lineage for workers#15
araa47 wants to merge 4 commits into
mainfrom
fix/explicit-spawn-lineage-v0.0.7

Conversation

@araa47

@araa47 araa47 commented Mar 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • require --spawned-by on every orca spawn call and normalize root / root:<scope> markers for top-level orchestrator spawns
  • fail closed when lineage is missing so delegated workers cannot silently become root L1 workers with the wrong emoji, wake target, or completion behavior
  • bump Orca to 0.0.7 and update docs/tests for the explicit lineage contract

Test plan

  • cargo fmt
  • cargo test
  • cargo clippy -- -D warnings

Made with Cursor

Fail closed when a spawn omits parent lineage so delegated workers cannot silently become root L1 workers. This keeps depth labels, wake routing, and completion deferral aligned with the real worker tree while documenting the new v0.0.7 contract.

Made-with: Cursor
@github-actions

github-actions Bot commented Mar 20, 2026

Copy link
Copy Markdown

🧪 Coverage Report

Metric Coverage
Lines 91.51% (11869 lines, 1008 missed)
Functions 97.35%
Regions 91.99%
📄 Coverage by file
File Lines Functions Regions
cli.rs 89.50% 96.89% 90.79%
config.rs 94.94% 95.71% 94.35%
daemon.rs 80.05% 92.47% 81.36%
events.rs 99.44% 100.00% 97.63%
main.rs 100.00% 100.00% 100.00%
names.rs 100.00% 100.00% 100.00%
prompts.rs 100.00% 100.00% 100.00%
spawn.rs 96.04% 98.03% 95.56%
state.rs 98.09% 93.33% 96.13%
tmux.rs 97.53% 100.00% 96.69%
wake.rs 98.60% 100.00% 98.93%
worktree.rs 95.25% 100.00% 95.61%

Coverage must not decrease. See CONTRIBUTING.md for policy.

araa47 and others added 3 commits March 21, 2026 01:11
- Stop normalizing `openclaw` to empty string; preserve in spawned_by
- Root spawns (L0→L1) now correctly produce depth=1 instead of depth=0
- resolve_spawn_lineage returns parent.depth+1 for known parents,
  depth=1 for L0 markers (openclaw, self, legacy root)
- Add `--spawned-by self` for L0 cc/cx/cu orchestrators: auto-detects
  or generates L0 pane name from tmux window title
- orca list now shows L0 orchestrator headers (e.g. |-🐋 | L0 openclaw)
- Update validate_spawn_context to allow L0 markers as spawned_by
- Update SKILL.md with L0 cc/cx/cu instructions (self marker)
- Fix 5 broken tests, add 13 new tests (606 total, all passing)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace normalize_spawned_by/resolve_self_l0_name with ensure_l0_orchestrator
  that auto-registers L0 entries (openclaw or cc/cx/cu) in state at depth=0
- Workers spawned by L0 now correctly get depth=1 (🐳 L1) via parent lookup
- print_tree shows L0 orchestrator entries as group headers with backend info
- cmd_kill protects virtual openclaw L0 entries from being killed
- cmd_killall/cmd_gc skip L0 orchestrator entries (bookkeeping, not workers)
- Validate spawn context before L0 registration to avoid side effects on error
- Remove L0 window rename from spawn.rs (now handled by ensure_l0_orchestrator)
- Update integration tests to use depth=1/spawned_by=openclaw for seeded workers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@araa47

araa47 commented Mar 20, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #16, which includes all these changes plus test extraction and the kill-instruction fix.

@araa47 araa47 closed this Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant