Add J detach-coordinator-to-top-level in the native Hera view#814
Merged
Conversation
In the native Hera view, `J` on a coordinator could only nest it UNDER
another coordinator (re-parent). There was no inverse — an accidentally
nested coordinator had no escape hatch back to top-level. Add one.
Detach-to-top-level is exactly ReparentCoordinator's BUG-026 teardown
without the recreate: end every live parent-link binding + delete every
distinct parent-link role (all bindings of the coord task on roles other
than the coordinator's own coord role), recreating no link.
- adopt.go: extract the teardown into a single-source `teardownParentLinks`
helper; `ReparentCoordinator` now calls it. Add exported
`DetachCoordinator`/`DetachResult` + `EndReasonDetached`. Detach is
idempotent (already-top-level => clean no-op, LinksRemoved==0). Genericize
`coordRoleOf` wording (now shared).
- heraactions.go: the `J` coordinator picker prepends a pointer-identity
`heraDetachSentinel` row ("— Detach (make top-level) —"); picking it
detaches instead of re-parenting. Reuses `J` — no new keybinding, no
help-modal/README churn. The coordinator picker now always opens (detach
always offered), so the "no eligible target" bail is freelancer-only.
- Tests: detach un-nests; idempotent no-op; dormant-coord resolution;
unknown-orch + no-coord-role guards; re-parent regression intact; UI smoke
tests for detach-through-picker and the updated re-parent row offset.
- OpenSpec change add-hera-detach-coordinator authored, merged into the
hera-view base spec, and archived in the same change.
- gotcha + index updated.
make pre-pr: build/vet/fmt-check/lint-pr(0 issues)/test-cover-gate(89.5%>=88)
all green; vuln finds only stdlib crypto/x509 CVEs (advisory, CI
continue-on-error, not in our code).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Merging this branch will decrease overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
This was referenced Jun 25, 2026
anutron
added a commit
that referenced
this pull request
Jun 26, 2026
…low-up) (#816) #814 added "Detach (make top-level)" to the J coordinator picker, but it could not be triggered on the exact case it was built for: an already-nested sub-coordinator. A nested sub-coordinator renders as a headerless worker "bridge" row in its parent (Role.Kind == worker), so heraCoordReparentTarget returned false for it and heraOpenAdopt fell through to the "select a freelancer or a coordinator" statusbar error. You could NEST a top-level coord (selected as its orch header) but not UN-NEST it. Fix: heraCoordReparentTarget now qualifies a THIRD shape — a non-archived worker row whose Selection.BridgeChildOrchID is non-zero (the SAME field the Ctrl+D cascade already reads). The rail stamps the bridged CHILD orchestrator id there; that worker row IS the child's coordinator, so it routes the existing heraAdoptCoordinator path (detach sentinel + DetachCoordinator, and ReparentCoordinator for symmetry) against the CHILD orch. Only a bridge row qualifies (BridgeChildOrchID != 0) — a plain worker is never misclassified, and cycles are still rejected by ReparentCoordinator. Inert in remote mode. No op-layer change (DetachCoordinator/ReparentCoordinator already resolve everything from the child orch id). No new keybinding; help modal / README unchanged. OpenSpec: fix-detach-nested-bridge (archived in-PR; hera-view delta merged into the base spec). Tests: TestHeraCoordReparentTarget bridge subtests + TestSmoke_HeraDetachNestedBridgeThroughPicker / TestSmoke_HeraReparentNestedBridgeThroughPicker. Gotcha added to hera-view.md. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
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
In the native Hera view,
Jon a coordinator could only nest it UNDER another coordinator (ReparentCoordinator). There was no inverse — a coordinator accidentally nested as a sub-coordinator had no escape hatch back to top-level. This PR adds one.Key insight
A coordinator C nests under parent P via a worker "link role" in P bound to C's coordinator argus TASK (a bridge / multi-binding) — never a parent pointer on C. So detach-to-top-level is exactly
ReparentCoordinator's BUG-026 teardown minus the recreate: end every live parent-link binding, then delete every distinct parent-link role (any binding of C's coord task on a role other than C's own coordinator role) so its bindings cascade. C's own coord role/binding are never touched.Changes
internal/tui/hera/adopt.go— extracted the teardown into a single-sourceteardownParentLinks(taskID, coordRoleID, reason)helper;ReparentCoordinatornow calls it (no duplication). Added exportedDetachCoordinator(childOrchestratorID) (*DetachResult, error)+DetachResult+EndReasonDetached. Detach is idempotent (already-top-level ⇒ clean no-op,LinksRemoved==0, not an error). GenericizedcoordRoleOf's wording (now shared). Logs viauxlog.Log("[hera-view] detach: ...")on success and the no-op skip.internal/tui/heraactions.go— UI approach: reuseJ. The coordinator picker prepends a pointer-identity sentinel row— Detach (make top-level) —; picking it detaches instead of opening a re-parent target. No new keybinding → no help-modal / README keybinding churn. The coordinator picker now always opens (detach always offered), so the "no eligible target" bail is freelancer-only.DetachCoordinatorun-nests a nested coord (link gone, coord role + binding intact, top-level again); idempotent no-op on an already-top-level coord; dormant-coord resolution via latest ended binding; unknown-orch + no-coord-role guards;ReparentCoordinatorBUG-026 regression still holds (shared teardown unbroken); UI smoke tests for detach-through-picker and the updated re-parent row offset.add-hera-detach-coordinatorauthored (proposal +hera-viewdelta + tasks), merged into thehera-viewbase spec, and archived in the same PR per CLAUDE.md.context/knowledge/gotchas/hera-view.md(bridge-binding nesting model; detach = teardown-without-recreate) + index count bumped.Verification —
make pre-printernal/tui/hera91.9%)make vulnfinds only stdlib crypto/x509 CVEs (go1.26.3 → fixed 1.26.4); advisory only — CI runs vuln ascontinue-on-errorand none are in our code.🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com