Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Retire the obsolete governed worktree workflow
rcourtman5991a096cb63
diff --git a/.gitignore b/.gitignoreindex dccf976e20..fecdcf449f 100644--- a/.gitignore+++ b/.gitignore@@ -304,9 +304,6 @@ scripts/release_control/*!scripts/release_control/ssh_host_key_policy_test.py!scripts/release_control/work_claim.py!scripts/release_control/work_claim_test.py-!scripts/release_control/worktree_base.py-!scripts/release_control/worktree_claim.py-!scripts/release_control/worktree_finish.py.agent/# Pulse Pro landing page (private)diff --git a/docs/release-control/internal/CONTROL_PLANE.md b/docs/release-control/internal/CONTROL_PLANE.mdindex 0a80eb1454..3aaa5e5b66 100644--- a/docs/release-control/internal/CONTROL_PLANE.md+++ b/docs/release-control/internal/CONTROL_PLANE.md@@ -134,15 +134,9 @@ model that active and future release profiles reuse.and deciding whether a claim or contract update is required are normallyinternal behaviors. Surface those mechanics only when they materially affectblockers, scope, cross-repo impact, or the user's next decision.-16. Use worktrees when a mutating slice needs physical isolation.- Claims and lookup tools reduce logical overlap, but they do not isolate- hooks, formatters, staged reads, or unrelated dirty state. Use a dedicated- worktree when a slice requires that isolation — a shared checkout is fine- for normal single-session work.- The canonical helper trio is `worktree_base.py` to ensure the clean landing- worktree exists, `worktree_claim.py` to start isolated work, and- `worktree_finish.py` to land a finished isolated slice back onto the clean- base-branch worktree.+16. Checkout isolation and landing follow the repository's current branch policy.+ Use the available Git tools when a slice needs physical isolation.+ Reserve its governed claim in the checkout where the work will run.17. Lane-expansion targets must steer slice selection.When the active target is a lane-expansion or bridge-foundation target and`status_audit.py --pretty` exposes an `available_candidate_lane_queue`,@@ -283,14 +277,8 @@ user language should update the control plane.commands such as `status_audit.py --pretty` and targeted lookup helpers.`status_lookup.py` is the id-scoped helper for candidate lanes, coveragegaps, lanes, assertions, gates, followups, and work claims.- `work_claim.py` is the shared-checkout claim helper for reserving or+ `work_claim.py` is the canonical claim helper for reserving orreleasing exactly one governed slice before mutation.- `worktree_base.py` ensures the canonical clean landing worktree exists for- the base branch.- `worktree_claim.py` is the canonical helper for pairing a mutating claim- with a dedicated worktree when a slice requires physical isolation.- `worktree_finish.py` is the canonical helper for landing an isolated- finished slice back onto the base branch worktree.It should not require agents to ingest raw `status.json` or `registry.json`in full at startup unless the current task genuinely needs to drill intothose surfaces.diff --git a/docs/release-control/v6/README.md b/docs/release-control/v6/README.mdindex f745fac8a7..4213ea25e9 100644--- a/docs/release-control/v6/README.md+++ b/docs/release-control/v6/README.md@@ -84,12 +84,6 @@ Useful helper tools:Omit `--lean` when you explicitly need the full decision, release-gate, and status-summary payload.- `python3 scripts/release_control/work_claim.py --kind <KIND> --id <ID> --summary <SUMMARY> --agent-id <AGENT_ID> --pretty`Reserve or renew exactly one governed slice in a shared checkout before mutation without hand-editing `status.json`.-- `python3 scripts/release_control/worktree_base.py --base-branch <BASE_BRANCH> --pretty`- Ensures the canonical clean landing worktree exists for the base branch before an isolated mutating slice begins.-- `python3 scripts/release_control/worktree_claim.py --kind <KIND> --id <ID> --summary <SUMMARY> --agent-id <AGENT_ID> --pretty`- Reserves a governed mutating slice and creates a dedicated git worktree for it, isolating hooks, staged scope, and dirty state to that slice.-- `python3 scripts/release_control/worktree_finish.py --base-branch <BASE_BRANCH> --pretty`- Lands a finished isolated slice back onto the canonical clean landing worktree for the base branch.For governed runtime changes, the completion guard also requires any stagedcontract update to touch a substantive contract section such as `Purpose`,diff --git a/docs/release-control/v6/internal/CANONICAL_DEVELOPMENT_PROTOCOL.md b/docs/release-control/v6/internal/CANONICAL_DEVELOPMENT_PROTOCOL.mdindex cf7dff8e27..cea91c617c 100644--- a/docs/release-control/v6/internal/CANONICAL_DEVELOPMENT_PROTOCOL.md+++ b/docs/release-control/v6/internal/CANONICAL_DEVELOPMENT_PROTOCOL.md@@ -557,15 +557,11 @@ rather than hand-editing `status.json`.Support-only slices are not exempt from this rule: claim the owning lane orthe narrower governed item they unblock, and say in the claim summary why theplumbing is necessary for that governed surface.-When the slice is mutating and another mutating agent is already active,-prefer `scripts/release_control/worktree_base.py` first so the canonical clean-landing worktree for the base branch exists,-then prefer `scripts/release_control/worktree_claim.py` so the claim is reserved-and the branch/worktree are isolated in one step.-When an isolated mutating slice is finished and the base branch worktree is-clean, prefer `scripts/release_control/worktree_finish.py` to land the scoped-commit(s) back onto the base branch worktree instead of leaving manual merge-cleanup for later.+Checkout isolation and landing follow the repository's current branch policy.+When isolation is needed, use the available Git worktree tools and reserve the+governed slice with the same public work_claim.py command in the checkout+where the work will run. An uncommitted claim in another checkout is not+transferred by Git worktree creation.If you are continuing straight from one governed slice to another, replace the old claim with the new claim in the same `status.json` edit so the live claimset never passes through a temporary unclaimed window.If you are stopping without finishing the lane, record the remaining same-lanediff --git a/docs/release-control/v6/internal/SOURCE_OF_TRUTH.md b/docs/release-control/v6/internal/SOURCE_OF_TRUTH.mdindex e153821319..df9bdf7be8 100644--- a/docs/release-control/v6/internal/SOURCE_OF_TRUTH.md+++ b/docs/release-control/v6/internal/SOURCE_OF_TRUTH.md@@ -422,10 +422,9 @@ Assertion design rules:25. Worktrees are available for isolated mutating slices when explicit isolationis needed.A shared mutable checkout is fine for normal single-session work.- Use `worktree_base.py`, `worktree_claim.py`, and `worktree_finish.py` when- a slice requires its own isolated hooks, staged scope, and dirty state —- for example when a subagent needs to mutate independently and land back- cleanly.+ Use the available Git worktree tools under the repository's branch policy,+ then reserve the slice with the public work_claim.py command in the+ checkout where the work will run.26. User-visible frontend work is incomplete until the current build has beenexercised in-browser through the deepest changed interaction at desktopand narrow widths. The commit must carry a fresh, parent-bound browserdiff --git a/internal/repoctl/canonical_development_protocol_test.go b/internal/repoctl/canonical_development_protocol_test.goindex 5e6b8a9107..75fb22a9ad 100644--- a/internal/repoctl/canonical_development_protocol_test.go+++ b/internal/repoctl/canonical_development_protocol_test.go@@ -558,9 +558,6 @@ func TestReleaseControlPlaneFilesExist(t *testing.T) {"These modernization rules are retrospective as well as forward-looking","Governance routing should be quiet by default","status_lookup.py",- "worktree_base.py",- "worktree_claim.py",- "worktree_finish.py","raw `status.json` or `registry.json`",})diff --git a/scripts/release_control/control_plane.py b/scripts/release_control/control_plane.pyindex 74a2c2062d..a8ef9c0b6c 100644--- a/scripts/release_control/control_plane.py+++ b/scripts/release_control/control_plane.py@@ -375,9 +375,6 @@ def agent_entrypoint(*, staged: bool = False) -> dict[str, Any]:"python3 scripts/release_control/status_lookup.py --work-claim <CLAIM_ID> --pretty","python3 scripts/release_control/work_claim.py --kind <KIND> --id <ID> --summary <SUMMARY> --agent-id <AGENT_ID> --pretty","python3 scripts/release_control/subsystem_lookup.py <path> [<path> ...] --pretty --lean",- "python3 scripts/release_control/worktree_base.py --base-branch <BASE_BRANCH> --pretty",- "python3 scripts/release_control/worktree_claim.py --kind <KIND> --id <ID> --summary <SUMMARY> --agent-id <AGENT_ID> --pretty",- "python3 scripts/release_control/worktree_finish.py --base-branch <BASE_BRANCH> --pretty",])if active_target_id == "v6-product-lane-expansion":@@ -413,9 +410,6 @@ def agent_entrypoint(*, staged: bool = False) -> dict[str, Any]:"subsystem_lookup": "scripts/release_control/subsystem_lookup.py","status_lookup": "scripts/release_control/status_lookup.py","work_claim": "scripts/release_control/work_claim.py",- "worktree_base": "scripts/release_control/worktree_base.py",- "worktree_claim": "scripts/release_control/worktree_claim.py",- "worktree_finish": "scripts/release_control/worktree_finish.py",}diff --git a/scripts/release_control/control_plane_audit_test.py b/scripts/release_control/control_plane_audit_test.pyindex 51bc4d9008..6fb65749e7 100644--- a/scripts/release_control/control_plane_audit_test.py+++ b/scripts/release_control/control_plane_audit_test.py@@ -149,18 +149,6 @@ class ControlPlaneAuditTest(unittest.TestCase):)self.assertIn("reserve exactly one", entrypoint["claim_rule"])self.assertIn("record any remaining same-lane residual", entrypoint["claim_rule"])- self.assertIn(- "python3 scripts/release_control/worktree_base.py --base-branch <BASE_BRANCH> --pretty",- entrypoint["targeted_lookup_commands"],- )- self.assertIn(- "python3 scripts/release_control/worktree_claim.py --kind <KIND> --id <ID> --summary <SUMMARY> --agent-id <AGENT_ID> --pretty",- entrypoint["targeted_lookup_commands"],- )- self.assertIn(- "python3 scripts/release_control/worktree_finish.py --base-branch <BASE_BRANCH> --pretty",- entrypoint["targeted_lookup_commands"],- )self.assertEqual(entrypoint["escalation_files"],[@@ -171,9 +159,6 @@ class ControlPlaneAuditTest(unittest.TestCase):],)self.assertEqual(entrypoint["work_claim"], "scripts/release_control/work_claim.py")- self.assertEqual(entrypoint["worktree_base"], "scripts/release_control/worktree_base.py")- self.assertEqual(entrypoint["worktree_claim"], "scripts/release_control/worktree_claim.py")- self.assertEqual(entrypoint["worktree_finish"], "scripts/release_control/worktree_finish.py")def test_every_advertised_helper_entrypoint_executes(self) -> None:entrypoint = agent_entrypoint()diff --git a/scripts/release_control/internal/work_claim.py b/scripts/release_control/internal/work_claim.pydeleted file mode 100644index e2619804e5..0000000000--- a/scripts/release_control/internal/work_claim.py+++ /dev/null@@ -1,203 +0,0 @@-#!/usr/bin/env python3-"""Create or reserve governed work claims against the active Pulse profile."""--from __future__ import annotations--import argparse-from copy import deepcopy-from datetime import datetime, timedelta, timezone-import json-import re-import sys-from pathlib import Path-from typing import Any--from control_plane import DEFAULT_CONTROL_PLANE-from status_audit import audit_status_payload, load_status_payload, status_schema_contract---STATUS_PATH = Path(DEFAULT_CONTROL_PLANE["status_path"])---def _slug(value: str) -> str:- compact = re.sub(r"[^a-z0-9]+", "-", value.strip().lower())- compact = compact.strip("-")- return compact or "work"---def _claim_sort_key(claim: dict[str, Any]) -> tuple[str, str]:- return (str(claim["claimed_at"]), str(claim["id"]).casefold())---def build_work_claim(- *,- work_kind: str,- work_id: str,- summary: str,- agent_id: str,- target_id: str,- now_utc: datetime,- duration_hours: int,- claim_id: str | None = None,-) -> dict[str, Any]:- claimed_at = now_utc.replace(microsecond=0)- expires_at = claimed_at + timedelta(hours=duration_hours)- claim_id = claim_id or f"claim-{_slug(work_kind)}-{_slug(work_id)}-{claimed_at.strftime('%Y%m%d%H%M%S')}"- timestamp = claimed_at.isoformat().replace("+00:00", "Z")- return {- "id": claim_id,- "agent_id": agent_id,- "summary": summary,- "target_id": target_id,- "claimed_at": timestamp,- "heartbeat_at": timestamp,- "expires_at": expires_at.replace(microsecond=0).isoformat().replace("+00:00", "Z"),- "work_item": {- "kind": work_kind,- "id": work_id,- },- }---def apply_claim(- payload: dict[str, Any],- claim: dict[str, Any],- *,- replace_claim_ids: list[str],-) -> dict[str, Any]:- updated = deepcopy(payload)- raw_claims = list(updated.get("work_claims", []))- raw_claims = [entry for entry in raw_claims if str(entry.get("id", "")) not in set(replace_claim_ids)]- raw_claims.append(claim)- raw_claims.sort(key=_claim_sort_key)- updated["work_claims"] = raw_claims- return updated---def reserve_claim(- *,- payload: dict[str, Any],- work_kind: str,- work_id: str,- summary: str,- agent_id: str,- target_id: str | None,- duration_hours: int,- claim_id: str | None,- replace_claim_ids: list[str],- now_utc: datetime | None = None,-) -> tuple[dict[str, Any], dict[str, Any], list[str]]:- baseline_report = audit_status_payload(payload, schema_contract=status_schema_contract())- baseline_errors = set(str(error) for error in baseline_report.get("errors", []))- now_utc = now_utc or datetime.now(timezone.utc)- target_id = target_id or str(DEFAULT_CONTROL_PLANE["active_target_id"])- claim = build_work_claim(- work_kind=work_kind,- work_id=work_id,- summary=summary,- agent_id=agent_id,- target_id=target_id,- now_utc=now_utc,- duration_hours=duration_hours,- claim_id=claim_id,- )- updated_payload = apply_claim(payload, claim, replace_claim_ids=replace_claim_ids)- updated_report = audit_status_payload(updated_payload, schema_contract=status_schema_contract())- new_errors = [str(error) for error in updated_report.get("errors", []) if str(error) not in baseline_errors]- return claim, updated_payload, new_errors---def write_status_payload(payload: dict[str, Any], *, path: Path = STATUS_PATH) -> None:- path.write_text(json.dumps(payload, indent=2) + "\n", encoding="utf-8")---def parse_args(argv: list[str]) -> argparse.Namespace:- parser = argparse.ArgumentParser(description="Create or reserve a governed work claim.")- parser.add_argument("--kind", required=True, help="Work item kind, such as lane or release-gate.")- parser.add_argument("--id", required=True, help="Work item id, such as L14.")- parser.add_argument("--summary", required=True, help="Short human summary for the claim.")- parser.add_argument("--agent-id", required=True, help="Stable agent identifier recorded in the claim.")- parser.add_argument("--target-id", help="Override the target id; defaults to the active target.")- parser.add_argument("--claim-id", help="Override the generated claim id.")- parser.add_argument(- "--duration-hours",- type=int,- default=2,- help="Claim duration before expiry. Defaults to 2 hours.",- )- parser.add_argument(- "--replace-claim-id",- action="append",- default=[],- help="Existing claim id to replace in the same write.",- )- parser.add_argument(- "--write",- action="store_true",- help="Write the updated work_claims list back to status.json when validation passes.",- )- parser.add_argument(- "--pretty",- action="store_true",- help="Render a concise human summary instead of JSON.",- )- return parser.parse_args(argv)---def render_pretty(claim: dict[str, Any], errors: list[str], *, wrote: bool) -> str:- lines = [- "work_claim:",- f" id={claim['id']}",- f" target={claim['target_id']}",- f" work={claim['work_item']['kind']}:{claim['work_item']['id']}",- f" agent={claim['agent_id']}",- f" expires_at={claim['expires_at']}",- f" wrote={'yes' if wrote else 'no'}",- ]- if errors:- lines.append("errors:")- for error in errors:- lines.append(f" - {error}")- else:- lines.append("status: ready")- return "\n".join(lines)---def main(argv: list[str] | None = None) -> int:- args = parse_args(list(argv or []))- payload = load_status_payload()- claim, updated_payload, errors = reserve_claim(- payload=payload,- work_kind=args.kind,- work_id=args.id,- summary=args.summary,- agent_id=args.agent_id,- target_id=args.target_id,- duration_hours=args.duration_hours,- claim_id=args.claim_id,- replace_claim_ids=list(args.replace_claim_id),- )- wrote = False- if not errors and args.write:- write_status_payload(updated_payload)- wrote = True-- if args.pretty:- print(render_pretty(claim, errors, wrote=wrote))- else:- print(- json.dumps(- {- "claim": claim,- "errors": errors,- "wrote": wrote,- },- indent=2,- sort_keys=True,- )- )- return 1 if errors else 0---if __name__ == "__main__":- raise SystemExit(main(sys.argv[1:]))diff --git a/scripts/release_control/internal/work_claim_test.py b/scripts/release_control/internal/work_claim_test.pydeleted file mode 100644index 4a3df4401e..0000000000--- a/scripts/release_control/internal/work_claim_test.py+++ /dev/null@@ -1,98 +0,0 @@-import unittest-from datetime import datetime, timezone-from unittest.mock import patch--from work_claim import apply_claim, build_work_claim, parse_args, reserve_claim---class WorkClaimTest(unittest.TestCase):- def test_parse_args_accepts_write_and_replace(self) -> None:- args = parse_args(- [- "--kind",- "lane",- "--id",- "L14",- "--summary",- "Tighten trust proof routing.",- "--agent-id",- "codex-gpt5",- "--replace-claim-id",- "claim-old",- "--write",- "--pretty",- ]- )- self.assertEqual(args.kind, "lane")- self.assertEqual(args.id, "L14")- self.assertEqual(args.replace_claim_id, ["claim-old"])- self.assertTrue(args.write)- self.assertTrue(args.pretty)-- def test_build_work_claim_uses_active_target_shape(self) -> None:- claim = build_work_claim(- work_kind="lane",- work_id="L14",- summary="Tighten trust proof routing.",- agent_id="codex-gpt5",- target_id="v6-rc-stabilization",- now_utc=datetime(2026, 3, 13, 18, 0, 0, tzinfo=timezone.utc),- duration_hours=2,- )- self.assertEqual(claim["target_id"], "v6-rc-stabilization")- self.assertEqual(claim["work_item"], {"kind": "lane", "id": "L14"})- self.assertEqual(claim["claimed_at"], "2026-03-13T18:00:00Z")- self.assertEqual(claim["heartbeat_at"], "2026-03-13T18:00:00Z")- self.assertEqual(claim["expires_at"], "2026-03-13T20:00:00Z")-- def test_apply_claim_replaces_and_sorts(self) -> None:- payload = {- "work_claims": [- {- "id": "claim-b",- "claimed_at": "2026-03-13T10:00:00Z",- },- {- "id": "claim-a",- "claimed_at": "2026-03-13T09:00:00Z",- },- ]- }- claim = {- "id": "claim-c",- "claimed_at": "2026-03-13T08:00:00Z",- }- updated = apply_claim(payload, claim, replace_claim_ids=["claim-b"])- self.assertEqual([entry["id"] for entry in updated["work_claims"]], ["claim-c", "claim-a"])-- def test_reserve_claim_reports_new_audit_errors_only(self) -> None:- payload = {"work_claims": [{"id": "claim-existing", "claimed_at": "2026-03-13T17:00:00Z"}]}- baseline_report = {"errors": ["unchanged baseline error"]}- updated_report = {- "errors": [- "unchanged baseline error",- "active work claims ['claim-existing', 'claim-lane-l14-20260313180000'] overlap on lane:L14",- ]- }- with patch("work_claim.audit_status_payload", side_effect=[baseline_report, updated_report]):- claim, _updated, errors = reserve_claim(- payload=payload,- work_kind="lane",- work_id="L14",- summary="Tighten trust proof routing.",- agent_id="codex-gpt5",- target_id="v6-rc-stabilization",- duration_hours=2,- claim_id="claim-lane-l14-20260313180000",- replace_claim_ids=[],- now_utc=datetime(2026, 3, 13, 18, 0, 0, tzinfo=timezone.utc),- )- self.assertEqual(claim["id"], "claim-lane-l14-20260313180000")- self.assertEqual(- errors,- ["active work claims ['claim-existing', 'claim-lane-l14-20260313180000'] overlap on lane:L14"],- )---if __name__ == "__main__":- unittest.main()diff --git a/scripts/release_control/internal/worktree_base.py b/scripts/release_control/internal/worktree_base.pydeleted file mode 100644index c3ebe923a1..0000000000--- a/scripts/release_control/internal/worktree_base.py+++ /dev/null@@ -1,149 +0,0 @@-#!/usr/bin/env python3-"""Ensure the canonical clean landing worktree exists for a base branch."""--from __future__ import annotations--import argparse-import json-from pathlib import Path-import subprocess-import sys--RELEASE_CONTROL_DIR = Path(__file__).resolve().parents[1]-if str(RELEASE_CONTROL_DIR) not in sys.path:- sys.path.append(str(RELEASE_CONTROL_DIR))--from repo_file_io import REPO_ROOT, repo_root_context-from worktree_claim import canonical_worktrees_root, list_worktrees---def git(*args: str, cwd: Path, check: bool = True) -> subprocess.CompletedProcess[str]:- return subprocess.run(- ["git", *args],- cwd=cwd,- check=check,- capture_output=True,- text=True,- )---def base_slug(branch_name: str) -> str:- return "base__" + branch_name.replace("/", "__")---def canonical_base_worktree_path(*, repo_root: Path, branch_name: str) -> Path:- return (- canonical_worktrees_root(repo_root=repo_root)- / repo_root_context(repo_root).repo_id- / base_slug(branch_name)- )---def find_worktree_by_path(*, repo_root: Path, path: Path) -> dict[str, str] | None:- target = path.resolve()- for entry in list_worktrees(repo_root=repo_root):- if Path(entry.get("worktree", "")).resolve() == target:- return entry- return None---def is_clean_worktree(*, repo_root: Path) -> bool:- return not git("status", "--porcelain", cwd=repo_root).stdout.strip()---def create_base_worktree(*, repo_root: Path, branch_name: str, path: Path) -> None:- path.parent.mkdir(parents=True, exist_ok=True)- subprocess.run(- ["git", "worktree", "add", str(path), branch_name],- cwd=repo_root,- check=True,- )---def parse_args(argv: list[str]) -> argparse.Namespace:- parser = argparse.ArgumentParser(- description="Ensure the canonical clean landing worktree exists for a base branch."- )- parser.add_argument(- "--base-branch",- default="pulse/v6",- help="Base branch that should own the canonical landing worktree. Defaults to pulse/v6.",- )- parser.add_argument(- "--write",- action="store_true",- help="Create the canonical landing worktree if it does not exist and validation passes.",- )- parser.add_argument(- "--pretty",- action="store_true",- help="Render a concise human summary instead of JSON.",- )- return parser.parse_args(argv)---def render_pretty(*, branch_name: str, path: Path, existed: bool, clean: bool, errors: list[str], wrote: bool) -> str:- lines = [- "worktree_base:",- f" base_branch={branch_name}",- f" path={path}",- f" existed={'yes' if existed else 'no'}",- f" clean={'yes' if clean else 'no'}",- f" wrote={'yes' if wrote else 'no'}",- ]- if errors:- lines.append("errors:")- for error in errors:- lines.append(f" - {error}")- else:- lines.append("status: ready")- return "\n".join(lines)---def main(argv: list[str] | None = None) -> int:- args = parse_args(list(argv or []))- path = canonical_base_worktree_path(repo_root=REPO_ROOT, branch_name=args.base_branch)- entry = find_worktree_by_path(repo_root=REPO_ROOT, path=path)- errors: list[str] = []- existed = entry is not None- clean = False-- if entry is not None:- branch_ref = entry.get("branch", "")- if branch_ref != f"refs/heads/{args.base_branch}":- errors.append(f"canonical landing worktree is not on {args.base_branch}: {branch_ref or 'detached'}")- clean = is_clean_worktree(repo_root=path)- if not clean:- errors.append(f"canonical landing worktree is dirty: {path}")- elif path.exists():- errors.append(f"canonical landing path exists on disk but is not a registered worktree: {path}")-- wrote = False- if not errors and not existed and args.write:- create_base_worktree(repo_root=REPO_ROOT, branch_name=args.base_branch, path=path)- wrote = True- existed = True- clean = is_clean_worktree(repo_root=path)-- if args.pretty:- print(render_pretty(branch_name=args.base_branch, path=path, existed=existed, clean=clean, errors=errors, wrote=wrote))- else:- print(- json.dumps(- {- "base_branch": args.base_branch,- "path": str(path),- "existed": existed,- "clean": clean,- "errors": errors,- "wrote": wrote,- },- indent=2,- sort_keys=True,- )- )- return 1 if errors else 0---if __name__ == "__main__":- raise SystemExit(main(sys.argv[1:]))diff --git a/scripts/release_control/internal/worktree_base_test.py b/scripts/release_control/internal/worktree_base_test.pydeleted file mode 100644index e5d784a4cc..0000000000--- a/scripts/release_control/internal/worktree_base_test.py+++ /dev/null@@ -1,36 +0,0 @@-import tempfile-import unittest-from pathlib import Path-from types import SimpleNamespace-from unittest.mock import patch--from worktree_base import base_slug, canonical_base_worktree_path, parse_args---class WorktreeBaseTest(unittest.TestCase):- def test_parse_args_accepts_write(self) -> None:- args = parse_args(["--base-branch", "pulse/v6", "--write", "--pretty"])- self.assertEqual(args.base_branch, "pulse/v6")- self.assertTrue(args.write)- self.assertTrue(args.pretty)-- def test_base_slug_replaces_slashes(self) -> None:- self.assertEqual(base_slug("pulse/v6"), "base__pulse__v6")-- def test_canonical_base_worktree_path_uses_workspace_root(self) -> None:- with patch(- "worktree_base.canonical_worktrees_root",- return_value=Path("/Volumes/Development/pulse/worktrees"),- ), patch(- "worktree_base.repo_root_context",- return_value=SimpleNamespace(repo_id="pulse"),- ):- path = canonical_base_worktree_path(- repo_root=Path("/isolated/worktrees/l1/pulse"),- branch_name="pulse/v6",- )- self.assertEqual(path, Path("/Volumes/Development/pulse/worktrees/pulse/base__pulse__v6"))---if __name__ == "__main__":- unittest.main()diff --git a/scripts/release_control/internal/worktree_claim.py b/scripts/release_control/internal/worktree_claim.pydeleted file mode 100644index 466423fff8..0000000000--- a/scripts/release_control/internal/worktree_claim.py+++ /dev/null@@ -1,202 +0,0 @@-#!/usr/bin/env python3-"""Reserve a governed slice and create an isolated git worktree for it."""--from __future__ import annotations--import argparse-import json-from pathlib import Path-import subprocess-import sys-from typing import Any--RELEASE_CONTROL_DIR = Path(__file__).resolve().parents[1]-if str(RELEASE_CONTROL_DIR) not in sys.path:- sys.path.append(str(RELEASE_CONTROL_DIR))--from repo_file_io import REPO_ROOT, repo_root_context-from work_claim import reserve_claim, write_status_payload, _slug---DEFAULT_BASE_BRANCH = "pulse/v6"---def build_branch_name(*, agent_id: str, work_kind: str, work_id: str) -> str:- return f"pulse/{_slug(agent_id)}/{_slug(work_kind)}-{_slug(work_id)}"---def branch_path_slug(branch_name: str) -> str:- if branch_name.startswith("pulse/"):- branch_name = branch_name[len("pulse/") :]- return branch_name.replace("/", "__")---def canonical_worktrees_root(*, repo_root: Path) -> Path:- return repo_root_context(repo_root).workspace_repos_root.parent / "worktrees"---def build_worktree_path(*, repo_root: Path, branch_name: str) -> Path:- context = repo_root_context(repo_root)- return canonical_worktrees_root(repo_root=repo_root) / context.repo_id / branch_path_slug(branch_name)---def parse_worktree_list(output: str) -> list[dict[str, str]]:- entries: list[dict[str, str]] = []- current: dict[str, str] = {}- for line in output.splitlines():- if not line.strip():- if current:- entries.append(current)- current = {}- continue- key, _, value = line.partition(" ")- current[key] = value- if current:- entries.append(current)- return entries---def list_worktrees(*, repo_root: Path = REPO_ROOT) -> list[dict[str, str]]:- result = subprocess.run(- ["git", "worktree", "list", "--porcelain"],- cwd=repo_root,- check=True,- capture_output=True,- text=True,- )- return parse_worktree_list(result.stdout)---def validate_worktree_target(*, repo_root: Path, branch_name: str, path: Path) -> list[str]:- errors: list[str] = []- path = path.resolve()- for entry in list_worktrees(repo_root=repo_root):- existing_path = Path(entry.get("worktree", "")).resolve()- branch_ref = entry.get("branch", "")- if existing_path == path:- errors.append(f"worktree path already exists in git worktree list: {path}")- if branch_ref == f"refs/heads/{branch_name}":- errors.append(f"branch already checked out in another worktree: {branch_name}")- if path.exists():- errors.append(f"worktree path already exists on disk: {path}")- return errors---def create_worktree(*, repo_root: Path, path: Path, branch_name: str, base_branch: str) -> None:- path.parent.mkdir(parents=True, exist_ok=True)- subprocess.run(- ["git", "worktree", "add", "-b", branch_name, str(path), base_branch],- cwd=repo_root,- check=True,- )---def render_pretty(*, claim: dict[str, Any], branch_name: str, path: Path, errors: list[str], wrote: bool) -> str:- lines = [- "worktree_claim:",- f" claim_id={claim['id']}",- f" target={claim['target_id']}",- f" work={claim['work_item']['kind']}:{claim['work_item']['id']}",- f" agent={claim['agent_id']}",- f" branch={branch_name}",- f" path={path}",- f" wrote={'yes' if wrote else 'no'}",- ]- if errors:- lines.append("errors:")- for error in errors:- lines.append(f" - {error}")- else:- lines.append("status: ready")- return "\n".join(lines)---def parse_args(argv: list[str]) -> argparse.Namespace:- parser = argparse.ArgumentParser(- description="Reserve a governed slice and create an isolated git worktree for it."- )- parser.add_argument("--kind", required=True, help="Work item kind, such as lane or release-gate.")- parser.add_argument("--id", required=True, help="Work item id, such as L15.")- parser.add_argument("--summary", required=True, help="Short human summary for the claim.")- parser.add_argument("--agent-id", required=True, help="Stable agent identifier recorded in the claim.")- parser.add_argument("--target-id", help="Override the target id; defaults to the active target.")- parser.add_argument("--claim-id", help="Override the generated claim id.")- parser.add_argument("--branch", help="Override the generated branch name.")- parser.add_argument("--path", help="Override the generated worktree path.")- parser.add_argument("--base-branch", default=DEFAULT_BASE_BRANCH, help="Base branch for the new worktree.")- parser.add_argument(- "--duration-hours",- type=int,- default=2,- help="Claim duration before expiry. Defaults to 2 hours.",- )- parser.add_argument(- "--replace-claim-id",- action="append",- default=[],- help="Existing claim id to replace in the same write.",- )- parser.add_argument(- "--write",- action="store_true",- help="Write the updated work_claims list and create the worktree when validation passes.",- )- parser.add_argument(- "--pretty",- action="store_true",- help="Render a concise human summary instead of JSON.",- )- return parser.parse_args(argv)---def main(argv: list[str] | None = None) -> int:- args = parse_args(list(argv or []))- from status_audit import load_status_payload-- payload = load_status_payload()- claim, updated_payload, errors = reserve_claim(- payload=payload,- work_kind=args.kind,- work_id=args.id,- summary=args.summary,- agent_id=args.agent_id,- target_id=args.target_id,- duration_hours=args.duration_hours,- claim_id=args.claim_id,- replace_claim_ids=list(args.replace_claim_id),- )- branch_name = args.branch or build_branch_name(- agent_id=args.agent_id,- work_kind=args.kind,- work_id=args.id,- )- path = Path(args.path) if args.path else build_worktree_path(repo_root=REPO_ROOT, branch_name=branch_name)- errors.extend(validate_worktree_target(repo_root=REPO_ROOT, branch_name=branch_name, path=path))-- wrote = False- if not errors and args.write:- write_status_payload(updated_payload)- create_worktree(repo_root=REPO_ROOT, path=path, branch_name=branch_name, base_branch=args.base_branch)- wrote = True-- if args.pretty:- print(render_pretty(claim=claim, branch_name=branch_name, path=path, errors=errors, wrote=wrote))- else:- print(- json.dumps(- {- "claim": claim,- "branch": branch_name,- "path": str(path),- "errors": errors,- "wrote": wrote,- },- indent=2,- sort_keys=True,- )- )- return 1 if errors else 0---if __name__ == "__main__":- raise SystemExit(main(sys.argv[1:]))diff --git a/scripts/release_control/internal/worktree_claim_test.py b/scripts/release_control/internal/worktree_claim_test.pydeleted file mode 100644index ae15025f3f..0000000000--- a/scripts/release_control/internal/worktree_claim_test.py+++ /dev/null@@ -1,108 +0,0 @@-import tempfile-import unittest-from pathlib import Path-from types import SimpleNamespace-from unittest.mock import patch--from worktree_claim import (- branch_path_slug,- build_branch_name,- build_worktree_path,- parse_args,- parse_worktree_list,- validate_worktree_target,-)---class WorktreeClaimTest(unittest.TestCase):- def test_parse_args_accepts_write_and_overrides(self) -> None:- args = parse_args(- [- "--kind",- "lane",- "--id",- "L15",- "--summary",- "Tighten storage recovery coherence.",- "--agent-id",- "claude-code",- "--branch",- "pulse/claude-code/lane-l15",- "--path",- "/tmp/pulse-l15",- "--write",- "--pretty",- ]- )- self.assertEqual(args.kind, "lane")- self.assertEqual(args.id, "L15")- self.assertEqual(args.branch, "pulse/claude-code/lane-l15")- self.assertEqual(args.path, "/tmp/pulse-l15")- self.assertTrue(args.write)- self.assertTrue(args.pretty)-- def test_build_branch_name_uses_pulse_prefix(self) -> None:- self.assertEqual(- build_branch_name(agent_id="Claude Code", work_kind="lane", work_id="L15"),- "pulse/claude-code/lane-l15",- )-- def test_build_worktree_path_uses_workspace_root(self) -> None:- with patch(- "worktree_claim.repo_root_context",- return_value=SimpleNamespace(- repo_id="pulse",- workspace_repos_root=Path("/Volumes/Development/pulse/repos"),- ),- ):- path = build_worktree_path(- repo_root=Path("/isolated/worktrees/l15/pulse"),- branch_name="pulse/claude-code/lane-l15",- )- self.assertEqual(- path,- Path("/Volumes/Development/pulse/worktrees/pulse/claude-code__lane-l15"),- )-- def test_branch_path_slug_drops_prefix_and_replaces_slashes(self) -> None:- self.assertEqual(branch_path_slug("pulse/codex-gpt5/lane-l16"), "codex-gpt5__lane-l16")-- def test_parse_worktree_list_reads_porcelain_records(self) -> None:- entries = parse_worktree_list(- "worktree /tmp/pulse-main\nHEAD abc123\nbranch refs/heads/pulse/v6\n\n"- "worktree /tmp/pulse-l15\nHEAD def456\nbranch refs/heads/pulse/claude/lane-l15\n\n"- )- self.assertEqual(len(entries), 2)- self.assertEqual(entries[1]["worktree"], "/tmp/pulse-l15")- self.assertEqual(entries[1]["branch"], "refs/heads/pulse/claude/lane-l15")-- def test_validate_worktree_target_rejects_existing_branch_or_path(self) -> None:- with tempfile.TemporaryDirectory() as tmp:- existing = Path(tmp) / "existing"- existing.mkdir()- with patch(- "worktree_claim.list_worktrees",- return_value=[- {- "worktree": str(existing),- "branch": "refs/heads/pulse/claude-code/lane-l15",- }- ],- ):- errors = validate_worktree_target(- repo_root=Path("/Volumes/Development/pulse/repos/pulse"),- branch_name="pulse/claude-code/lane-l15",- path=existing,- )- self.assertEqual(- errors,- [- f"worktree path already exists in git worktree list: {existing.resolve()}",- "branch already checked out in another worktree: pulse/claude-code/lane-l15",- f"worktree path already exists on disk: {existing.resolve()}",- ],- )---if __name__ == "__main__":- unittest.main()diff --git a/scripts/release_control/internal/worktree_finish.py b/scripts/release_control/internal/worktree_finish.pydeleted file mode 100644index 9b36f78cd0..0000000000--- a/scripts/release_control/internal/worktree_finish.py+++ /dev/null@@ -1,194 +0,0 @@-#!/usr/bin/env python3-"""Land an isolated worktree's finished slice onto the base branch worktree."""--from __future__ import annotations--import argparse-import json-from pathlib import Path-import subprocess-import sys-from typing import Any--RELEASE_CONTROL_DIR = Path(__file__).resolve().parents[1]-if str(RELEASE_CONTROL_DIR) not in sys.path:- sys.path.append(str(RELEASE_CONTROL_DIR))--from repo_file_io import REPO_ROOT-from worktree_base import canonical_base_worktree_path-from worktree_claim import list_worktrees---def git(*args: str, cwd: Path, check: bool = True) -> subprocess.CompletedProcess[str]:- return subprocess.run(- ["git", *args],- cwd=cwd,- check=check,- capture_output=True,- text=True,- )---def current_branch(*, repo_root: Path) -> str:- return git("branch", "--show-current", cwd=repo_root).stdout.strip()---def current_head(*, repo_root: Path) -> str:- return git("rev-parse", "HEAD", cwd=repo_root).stdout.strip()---def is_clean_worktree(*, repo_root: Path) -> bool:- return not git("status", "--porcelain", cwd=repo_root).stdout.strip()---def branch_worktree_path(*, repo_root: Path, branch_name: str, preferred_path: Path | None = None) -> Path | None:- preferred = preferred_path.resolve() if preferred_path is not None else None- fallback: Path | None = None- for entry in list_worktrees(repo_root=repo_root):- if entry.get("branch") != f"refs/heads/{branch_name}":- continue- candidate = Path(entry["worktree"]).resolve()- if preferred is not None and candidate == preferred:- return candidate- if fallback is None:- fallback = candidate- return fallback---def commits_ahead_of_base(*, repo_root: Path, base_branch: str) -> list[str]:- output = git("rev-list", "--reverse", f"{base_branch}..HEAD", cwd=repo_root).stdout.strip()- return [line for line in output.splitlines() if line.strip()]---def cherry_pick_commits(*, base_worktree: Path, commits: list[str]) -> None:- for commit in commits:- subprocess.run(["git", "cherry-pick", commit], cwd=base_worktree, check=True)---def parse_args(argv: list[str]) -> argparse.Namespace:- parser = argparse.ArgumentParser(- description="Land an isolated worktree's finished slice onto the base branch worktree."- )- parser.add_argument(- "--base-branch",- default="pulse/v6",- help="Base branch that receives the finished slice. Defaults to pulse/v6.",- )- parser.add_argument(- "--write",- action="store_true",- help="Cherry-pick the finished commit(s) onto the base branch worktree when validation passes.",- )- parser.add_argument(- "--pretty",- action="store_true",- help="Render a concise human summary instead of JSON.",- )- return parser.parse_args(argv)---def render_pretty(- *,- current_worktree: Path,- current_branch_name: str,- base_branch: str,- base_worktree: Path | None,- commits: list[str],- errors: list[str],- wrote: bool,-) -> str:- lines = [- "worktree_finish:",- f" current_worktree={current_worktree}",- f" current_branch={current_branch_name}",- f" base_branch={base_branch}",- f" base_worktree={base_worktree if base_worktree is not None else 'missing'}",- f" commit_count={len(commits)}",- f" wrote={'yes' if wrote else 'no'}",- ]- if commits:- lines.append("commits:")- for commit in commits:- lines.append(f" - {commit}")- if errors:- lines.append("errors:")- for error in errors:- lines.append(f" - {error}")- else:- lines.append("status: ready")- return "\n".join(lines)---def main(argv: list[str] | None = None) -> int:- args = parse_args(list(argv or []))- errors: list[str] = []- current_worktree = REPO_ROOT.resolve()- current_branch_name = current_branch(repo_root=current_worktree)- preferred_base = canonical_base_worktree_path(repo_root=current_worktree, branch_name=args.base_branch)- base_worktree = branch_worktree_path(- repo_root=current_worktree, branch_name=args.base_branch, preferred_path=preferred_base- )-- if not current_branch_name:- errors.append("current worktree is not on a branch")- if current_branch_name == args.base_branch:- errors.append("current worktree is already on the base branch")- if base_worktree is None:- errors.append(- f"no canonical landing worktree found for base branch {args.base_branch}; run worktree_base.py first"- )- elif base_worktree == current_worktree:- errors.append("base branch worktree resolves to the current worktree")- elif base_worktree != preferred_base.resolve():- errors.append(- f"base branch is checked out at {base_worktree}, not at canonical landing path {preferred_base.resolve()}"- )-- commits: list[str] = []- if not errors:- commits = commits_ahead_of_base(repo_root=current_worktree, base_branch=args.base_branch)- if not commits:- errors.append(f"no commits ahead of {args.base_branch} to land")- if not is_clean_worktree(repo_root=current_worktree):- errors.append("current worktree has uncommitted changes")- if base_worktree is not None and not is_clean_worktree(repo_root=base_worktree):- errors.append(f"base worktree is dirty: {base_worktree}")-- wrote = False- if not errors and args.write and base_worktree is not None:- cherry_pick_commits(base_worktree=base_worktree, commits=commits)- wrote = True-- if args.pretty:- print(- render_pretty(- current_worktree=current_worktree,- current_branch_name=current_branch_name,- base_branch=args.base_branch,- base_worktree=base_worktree,- commits=commits,- errors=errors,- wrote=wrote,- )- )- else:- print(- json.dumps(- {- "current_worktree": str(current_worktree),- "current_branch": current_branch_name,- "base_branch": args.base_branch,- "base_worktree": str(base_worktree) if base_worktree is not None else None,- "commits": commits,- "errors": errors,- "wrote": wrote,- },- indent=2,- sort_keys=True,- )- )- return 1 if errors else 0---if __name__ == "__main__":- raise SystemExit(main(sys.argv[1:]))diff --git a/scripts/release_control/internal/worktree_finish_test.py b/scripts/release_control/internal/worktree_finish_test.pydeleted file mode 100644index 202afda401..0000000000--- a/scripts/release_control/internal/worktree_finish_test.py+++ /dev/null@@ -1,47 +0,0 @@-import tempfile-import unittest-from pathlib import Path-from unittest.mock import patch--from worktree_finish import commits_ahead_of_base, parse_args, render_pretty---class WorktreeFinishTest(unittest.TestCase):- def test_parse_args_accepts_write_and_base_branch(self) -> None:- args = parse_args(["--base-branch", "pulse/v6", "--write", "--pretty"])- self.assertEqual(args.base_branch, "pulse/v6")- self.assertTrue(args.write)- self.assertTrue(args.pretty)-- def test_commits_ahead_of_base_splits_rev_list_output(self) -> None:- with patch(- "worktree_finish.git",- return_value=type("Result", (), {"stdout": "abc123\ndef456\n"})(),- ):- self.assertEqual(- commits_ahead_of_base(- repo_root=Path("/Volumes/Development/pulse/repos/pulse"),- base_branch="pulse/v6",- ),- ["abc123", "def456"],- )-- def test_render_pretty_includes_commit_count_and_errors(self) -> None:- with tempfile.TemporaryDirectory() as tmp:- worktree = Path(tmp) / "source"- base = Path(tmp) / "base"- output = render_pretty(- current_worktree=worktree,- current_branch_name="pulse/claude-code/lane-l15",- base_branch="pulse/v6",- base_worktree=base,- commits=["abc123"],- errors=["base worktree is dirty"],- wrote=False,- )- self.assertIn("commit_count=1", output)- self.assertIn("base worktree is dirty", output)---if __name__ == "__main__":- unittest.main()diff --git a/scripts/release_control/worktree_base.py b/scripts/release_control/worktree_base.pydeleted file mode 100644index 4eca1ea8e1..0000000000--- a/scripts/release_control/worktree_base.py+++ /dev/null@@ -1,22 +0,0 @@-#!/usr/bin/env python3-"""Public entrypoint for the canonical landing-worktree helper."""--from __future__ import annotations--from pathlib import Path-import runpy-import sys---def main(argv: list[str] | None = None) -> int:- internal_dir = Path(__file__).resolve().parent / "internal"- sys.path.insert(0, str(internal_dir))- try:- namespace = runpy.run_path(str(internal_dir / "worktree_base.py"))- return namespace["main"](list(sys.argv[1:] if argv is None else argv))- finally:- sys.path.pop(0)---if __name__ == "__main__":- raise SystemExit(main())diff --git a/scripts/release_control/worktree_claim.py b/scripts/release_control/worktree_claim.pydeleted file mode 100644index 53875ab9b6..0000000000--- a/scripts/release_control/worktree_claim.py+++ /dev/null@@ -1,22 +0,0 @@-#!/usr/bin/env python3-"""Public entrypoint for governed isolated-worktree claims."""--from __future__ import annotations--from pathlib import Path-import runpy-import sys---def main(argv: list[str] | None = None) -> int:- internal_dir = Path(__file__).resolve().parent / "internal"- sys.path.insert(0, str(internal_dir))- try:- namespace = runpy.run_path(str(internal_dir / "worktree_claim.py"))- return namespace["main"](list(sys.argv[1:] if argv is None else argv))- finally:- sys.path.pop(0)---if __name__ == "__main__":- raise SystemExit(main())diff --git a/scripts/release_control/worktree_finish.py b/scripts/release_control/worktree_finish.pydeleted file mode 100644index 1f9af62846..0000000000--- a/scripts/release_control/worktree_finish.py+++ /dev/null@@ -1,22 +0,0 @@-#!/usr/bin/env python3-"""Public entrypoint for landing an isolated worktree slice."""--from __future__ import annotations--from pathlib import Path-import runpy-import sys---def main(argv: list[str] | None = None) -> int:- internal_dir = Path(__file__).resolve().parent / "internal"- sys.path.insert(0, str(internal_dir))- try:- namespace = runpy.run_path(str(internal_dir / "worktree_finish.py"))- return namespace["main"](list(sys.argv[1:] if argv is None else argv))- finally:- sys.path.pop(0)---if __name__ == "__main__":- raise SystemExit(main())