@hunter-harness/workflow-harness 0.2.54 → 0.2.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/harness/bundles/general/claude-code/.harness-build.json +1 -1
- package/harness/bundles/general/claude-code/harness-archive/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-plan/SKILL.md +2 -2
- package/harness/bundles/general/claude-code/harness-plan/checklist.md +2 -1
- package/harness/bundles/general/claude-code/harness-review/SKILL.md +6 -4
- package/harness/bundles/general/claude-code/harness-run/SKILL.md +4 -4
- package/harness/bundles/general/claude-code/harness-run/reference.md +2 -2
- package/harness/bundles/general/claude-code/harness-submit/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-sync/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-test/SKILL.md +5 -3
- package/harness/bundles/general/claude-code/harness-test/reference.md +1 -1
- package/harness/bundles/general/claude-code/scripts/harness_archive.py +46 -7
- package/harness/bundles/general/claude-code/scripts/harness_context.py +71 -22
- package/harness/bundles/general/claude-code/scripts/harness_events.py +40 -1
- package/harness/bundles/general/claude-code/scripts/harness_events_sync.py +93 -14
- package/harness/bundles/general/claude-code/scripts/harness_gate.py +165 -1
- package/harness/bundles/general/claude-code/scripts/harness_ledger.py +2 -0
- package/harness/bundles/general/claude-code/scripts/harness_plan_finalize.py +2 -0
- package/harness/bundles/general/claude-code/scripts/harness_test_guard.py +37 -44
- package/harness/bundles/general/codebuddy/.harness-build.json +1 -1
- package/harness/bundles/general/codebuddy/harness-archive/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-plan/SKILL.md +2 -2
- package/harness/bundles/general/codebuddy/harness-plan/checklist.md +2 -1
- package/harness/bundles/general/codebuddy/harness-review/SKILL.md +6 -4
- package/harness/bundles/general/codebuddy/harness-run/SKILL.md +4 -4
- package/harness/bundles/general/codebuddy/harness-run/reference.md +2 -2
- package/harness/bundles/general/codebuddy/harness-submit/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-sync/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-test/SKILL.md +5 -3
- package/harness/bundles/general/codebuddy/harness-test/reference.md +1 -1
- package/harness/bundles/general/codebuddy/scripts/harness_archive.py +46 -7
- package/harness/bundles/general/codebuddy/scripts/harness_context.py +71 -22
- package/harness/bundles/general/codebuddy/scripts/harness_events.py +40 -1
- package/harness/bundles/general/codebuddy/scripts/harness_events_sync.py +93 -14
- package/harness/bundles/general/codebuddy/scripts/harness_gate.py +165 -1
- package/harness/bundles/general/codebuddy/scripts/harness_ledger.py +2 -0
- package/harness/bundles/general/codebuddy/scripts/harness_plan_finalize.py +2 -0
- package/harness/bundles/general/codebuddy/scripts/harness_test_guard.py +37 -44
- package/harness/bundles/general/codex/.harness-build.json +1 -1
- package/harness/bundles/general/codex/harness-archive/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-plan/SKILL.md +2 -2
- package/harness/bundles/general/codex/harness-plan/checklist.md +2 -1
- package/harness/bundles/general/codex/harness-review/SKILL.md +3 -3
- package/harness/bundles/general/codex/harness-run/SKILL.md +4 -4
- package/harness/bundles/general/codex/harness-run/reference.md +2 -2
- package/harness/bundles/general/codex/harness-submit/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-sync/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-test/SKILL.md +5 -3
- package/harness/bundles/general/codex/harness-test/reference.md +1 -1
- package/harness/bundles/general/codex/scripts/harness_archive.py +46 -7
- package/harness/bundles/general/codex/scripts/harness_context.py +71 -22
- package/harness/bundles/general/codex/scripts/harness_events.py +40 -1
- package/harness/bundles/general/codex/scripts/harness_events_sync.py +93 -14
- package/harness/bundles/general/codex/scripts/harness_gate.py +165 -1
- package/harness/bundles/general/codex/scripts/harness_ledger.py +2 -0
- package/harness/bundles/general/codex/scripts/harness_plan_finalize.py +2 -0
- package/harness/bundles/general/codex/scripts/harness_test_guard.py +37 -44
- package/harness/bundles/general/cursor/.harness-build.json +1 -1
- package/harness/bundles/general/cursor/harness-archive/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-plan/SKILL.md +2 -2
- package/harness/bundles/general/cursor/harness-plan/checklist.md +2 -1
- package/harness/bundles/general/cursor/harness-review/SKILL.md +3 -3
- package/harness/bundles/general/cursor/harness-run/SKILL.md +4 -4
- package/harness/bundles/general/cursor/harness-run/reference.md +2 -2
- package/harness/bundles/general/cursor/harness-submit/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-sync/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-test/SKILL.md +5 -3
- package/harness/bundles/general/cursor/harness-test/reference.md +1 -1
- package/harness/bundles/general/cursor/scripts/harness_archive.py +46 -7
- package/harness/bundles/general/cursor/scripts/harness_context.py +71 -22
- package/harness/bundles/general/cursor/scripts/harness_events.py +40 -1
- package/harness/bundles/general/cursor/scripts/harness_events_sync.py +93 -14
- package/harness/bundles/general/cursor/scripts/harness_gate.py +165 -1
- package/harness/bundles/general/cursor/scripts/harness_ledger.py +2 -0
- package/harness/bundles/general/cursor/scripts/harness_plan_finalize.py +2 -0
- package/harness/bundles/general/cursor/scripts/harness_test_guard.py +37 -44
- package/harness/bundles/java/claude-code/.harness-build.json +1 -1
- package/harness/bundles/java/claude-code/harness-apidoc/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-archive/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-package/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-plan/SKILL.md +2 -2
- package/harness/bundles/java/claude-code/harness-plan/checklist.md +2 -1
- package/harness/bundles/java/claude-code/harness-review/SKILL.md +6 -4
- package/harness/bundles/java/claude-code/harness-run/SKILL.md +4 -4
- package/harness/bundles/java/claude-code/harness-submit/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-sync/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-test/SKILL.md +5 -3
- package/harness/bundles/java/claude-code/scripts/harness_archive.py +46 -7
- package/harness/bundles/java/claude-code/scripts/harness_context.py +71 -22
- package/harness/bundles/java/claude-code/scripts/harness_events.py +40 -1
- package/harness/bundles/java/claude-code/scripts/harness_events_sync.py +93 -14
- package/harness/bundles/java/claude-code/scripts/harness_gate.py +165 -1
- package/harness/bundles/java/claude-code/scripts/harness_ledger.py +2 -0
- package/harness/bundles/java/claude-code/scripts/harness_plan_finalize.py +2 -0
- package/harness/bundles/java/claude-code/scripts/harness_test_guard.py +37 -44
- package/harness/bundles/java/codebuddy/.harness-build.json +1 -1
- package/harness/bundles/java/codebuddy/harness-apidoc/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-archive/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-package/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-plan/SKILL.md +2 -2
- package/harness/bundles/java/codebuddy/harness-plan/checklist.md +2 -1
- package/harness/bundles/java/codebuddy/harness-review/SKILL.md +6 -4
- package/harness/bundles/java/codebuddy/harness-run/SKILL.md +4 -4
- package/harness/bundles/java/codebuddy/harness-submit/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-sync/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-test/SKILL.md +5 -3
- package/harness/bundles/java/codebuddy/scripts/harness_archive.py +46 -7
- package/harness/bundles/java/codebuddy/scripts/harness_context.py +71 -22
- package/harness/bundles/java/codebuddy/scripts/harness_events.py +40 -1
- package/harness/bundles/java/codebuddy/scripts/harness_events_sync.py +93 -14
- package/harness/bundles/java/codebuddy/scripts/harness_gate.py +165 -1
- package/harness/bundles/java/codebuddy/scripts/harness_ledger.py +2 -0
- package/harness/bundles/java/codebuddy/scripts/harness_plan_finalize.py +2 -0
- package/harness/bundles/java/codebuddy/scripts/harness_test_guard.py +37 -44
- package/harness/bundles/java/codex/.harness-build.json +1 -1
- package/harness/bundles/java/codex/harness-apidoc/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-archive/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-package/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-plan/SKILL.md +2 -2
- package/harness/bundles/java/codex/harness-plan/checklist.md +2 -1
- package/harness/bundles/java/codex/harness-review/SKILL.md +3 -3
- package/harness/bundles/java/codex/harness-run/SKILL.md +4 -4
- package/harness/bundles/java/codex/harness-submit/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-sync/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-test/SKILL.md +5 -3
- package/harness/bundles/java/codex/scripts/harness_archive.py +46 -7
- package/harness/bundles/java/codex/scripts/harness_context.py +71 -22
- package/harness/bundles/java/codex/scripts/harness_events.py +40 -1
- package/harness/bundles/java/codex/scripts/harness_events_sync.py +93 -14
- package/harness/bundles/java/codex/scripts/harness_gate.py +165 -1
- package/harness/bundles/java/codex/scripts/harness_ledger.py +2 -0
- package/harness/bundles/java/codex/scripts/harness_plan_finalize.py +2 -0
- package/harness/bundles/java/codex/scripts/harness_test_guard.py +37 -44
- package/harness/bundles/java/cursor/.harness-build.json +1 -1
- package/harness/bundles/java/cursor/harness-apidoc/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-archive/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-package/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-plan/SKILL.md +2 -2
- package/harness/bundles/java/cursor/harness-plan/checklist.md +2 -1
- package/harness/bundles/java/cursor/harness-review/SKILL.md +3 -3
- package/harness/bundles/java/cursor/harness-run/SKILL.md +4 -4
- package/harness/bundles/java/cursor/harness-submit/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-sync/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-test/SKILL.md +5 -3
- package/harness/bundles/java/cursor/scripts/harness_archive.py +46 -7
- package/harness/bundles/java/cursor/scripts/harness_context.py +71 -22
- package/harness/bundles/java/cursor/scripts/harness_events.py +40 -1
- package/harness/bundles/java/cursor/scripts/harness_events_sync.py +93 -14
- package/harness/bundles/java/cursor/scripts/harness_gate.py +165 -1
- package/harness/bundles/java/cursor/scripts/harness_ledger.py +2 -0
- package/harness/bundles/java/cursor/scripts/harness_plan_finalize.py +2 -0
- package/harness/bundles/java/cursor/scripts/harness_test_guard.py +37 -44
- package/harness/manifests/general/claude-code.json +24 -24
- package/harness/manifests/general/codebuddy.json +24 -24
- package/harness/manifests/general/codex.json +24 -24
- package/harness/manifests/general/cursor.json +24 -24
- package/harness/manifests/java/claude-code.json +24 -24
- package/harness/manifests/java/codebuddy.json +24 -24
- package/harness/manifests/java/codex.json +24 -24
- package/harness/manifests/java/cursor.json +24 -24
- package/hunter-workflow-family.json +5 -4
- package/package.json +1 -1
|
@@ -30,6 +30,7 @@ if str(SCRIPTS_DIR) not in sys.path:
|
|
|
30
30
|
sys.path.insert(0, str(SCRIPTS_DIR))
|
|
31
31
|
|
|
32
32
|
import harness_change as hc # noqa: E402
|
|
33
|
+
import harness_context as hctx # noqa: E402
|
|
33
34
|
import harness_events as he # noqa: E402
|
|
34
35
|
import harness_events_sync as hes # noqa: E402
|
|
35
36
|
import harness_ledger as hl # noqa: E402
|
|
@@ -1602,6 +1603,18 @@ def append_phase_event(
|
|
|
1602
1603
|
auto_sealed: list[dict[str, Any]] = []
|
|
1603
1604
|
with he.event_file_lock(lock_path):
|
|
1604
1605
|
existing = he.load_events(events_file)
|
|
1606
|
+
phase_attempts = he.split_phase_attempts(
|
|
1607
|
+
[event for event in existing if event.get("phase") == phase]
|
|
1608
|
+
)
|
|
1609
|
+
latest_attempt = max(
|
|
1610
|
+
(
|
|
1611
|
+
int(item.get("attempt"))
|
|
1612
|
+
for item in phase_attempts
|
|
1613
|
+
if isinstance(item.get("attempt"), int)
|
|
1614
|
+
),
|
|
1615
|
+
default=0,
|
|
1616
|
+
)
|
|
1617
|
+
event_attempt = latest_attempt + 1 if type_ == "phase.start" else latest_attempt or 1
|
|
1605
1618
|
args = argparse.Namespace(
|
|
1606
1619
|
phase=phase,
|
|
1607
1620
|
type=type_,
|
|
@@ -1619,12 +1632,18 @@ def append_phase_event(
|
|
|
1619
1632
|
decision=None,
|
|
1620
1633
|
reason=None,
|
|
1621
1634
|
run_id=run_id,
|
|
1622
|
-
attempt=
|
|
1635
|
+
attempt=event_attempt,
|
|
1623
1636
|
executor_tool=executor_tool,
|
|
1624
1637
|
executor_agent=executor_agent,
|
|
1625
1638
|
executor_model=executor_model,
|
|
1626
1639
|
handoff_from_tool=None,
|
|
1627
1640
|
handoff_reason=None,
|
|
1641
|
+
execution_mode=None,
|
|
1642
|
+
decision_reason_code=None,
|
|
1643
|
+
fallback_reason_code=None,
|
|
1644
|
+
trigger=("fixback" if "fixback" in note.lower() else None),
|
|
1645
|
+
from_phase=("review" if phase == "run" and "fixback" in note.lower() else None),
|
|
1646
|
+
result_status=None,
|
|
1628
1647
|
)
|
|
1629
1648
|
event = he.build_event(args, existing)
|
|
1630
1649
|
if identity:
|
|
@@ -1655,6 +1674,7 @@ def append_phase_event(
|
|
|
1655
1674
|
content = he.render_execution_log(events)
|
|
1656
1675
|
log_path = he.write_execution_log(change_dir, content)
|
|
1657
1676
|
rendered = True
|
|
1677
|
+
he.nudge_remote_sync(change_dir)
|
|
1658
1678
|
return {
|
|
1659
1679
|
"ok": True,
|
|
1660
1680
|
"eventId": event.get("id"),
|
|
@@ -1702,6 +1722,80 @@ def _phase_event_exists(change_dir: Path, phase: str, type_: str, run_id: str) -
|
|
|
1702
1722
|
)
|
|
1703
1723
|
|
|
1704
1724
|
|
|
1725
|
+
def _latest_phase_end(
|
|
1726
|
+
change_dir: Path,
|
|
1727
|
+
phase: str,
|
|
1728
|
+
run_id: str | None = None,
|
|
1729
|
+
) -> dict[str, Any] | None:
|
|
1730
|
+
for event in reversed(he.load_events(he.events_path(change_dir))):
|
|
1731
|
+
if event.get("phase") != phase or event.get("type") != "phase.end":
|
|
1732
|
+
continue
|
|
1733
|
+
if run_id and event.get("run_id") != run_id:
|
|
1734
|
+
continue
|
|
1735
|
+
return event
|
|
1736
|
+
return None
|
|
1737
|
+
|
|
1738
|
+
|
|
1739
|
+
def _terminal_matches_context_session(
|
|
1740
|
+
project: Path,
|
|
1741
|
+
change_id: str,
|
|
1742
|
+
phase: str,
|
|
1743
|
+
terminal: dict[str, Any],
|
|
1744
|
+
) -> bool:
|
|
1745
|
+
view = hctx.context_view(project, change_id)
|
|
1746
|
+
current = view.get("current") if isinstance(view, dict) else None
|
|
1747
|
+
if not isinstance(current, dict) or current.get("phase") != phase:
|
|
1748
|
+
return False
|
|
1749
|
+
prepared_at = he.parse_timestamp(current.get("preparedAt"))
|
|
1750
|
+
terminal_at = he.parse_timestamp(
|
|
1751
|
+
terminal.get("timestamp") or terminal.get("occurred_at")
|
|
1752
|
+
)
|
|
1753
|
+
return (
|
|
1754
|
+
prepared_at is not None
|
|
1755
|
+
and terminal_at is not None
|
|
1756
|
+
and terminal_at >= prepared_at
|
|
1757
|
+
)
|
|
1758
|
+
|
|
1759
|
+
|
|
1760
|
+
def _close_context_handoff(
|
|
1761
|
+
project: Path,
|
|
1762
|
+
change_id: str,
|
|
1763
|
+
args: argparse.Namespace,
|
|
1764
|
+
*,
|
|
1765
|
+
status: str,
|
|
1766
|
+
) -> dict[str, Any] | None:
|
|
1767
|
+
to_phase = getattr(args, "to_phase", None)
|
|
1768
|
+
if not to_phase:
|
|
1769
|
+
return None
|
|
1770
|
+
try:
|
|
1771
|
+
return hctx.close_transition(
|
|
1772
|
+
project,
|
|
1773
|
+
change_id,
|
|
1774
|
+
from_phase=args.phase,
|
|
1775
|
+
to_phase=str(to_phase),
|
|
1776
|
+
executor=getattr(args, "executor", None),
|
|
1777
|
+
artifacts=list(getattr(args, "artifact", None) or []),
|
|
1778
|
+
status=status,
|
|
1779
|
+
)
|
|
1780
|
+
except Exception as exc: # noqa: BLE001 — phase close remains locally durable
|
|
1781
|
+
return {
|
|
1782
|
+
"ok": False,
|
|
1783
|
+
"code": "CONTEXT_HANDOFF_FAILED",
|
|
1784
|
+
"message": str(exc),
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
|
|
1788
|
+
def _sync_after_phase_close(project: Path, change_dir: Path) -> dict[str, Any]:
|
|
1789
|
+
try:
|
|
1790
|
+
return hes.auto_events_sync(project, change_dir)
|
|
1791
|
+
except Exception as exc: # noqa: BLE001 — remote sync is recoverable
|
|
1792
|
+
return {
|
|
1793
|
+
"ok": False,
|
|
1794
|
+
"code": "PLATFORM_EVENTS_SYNC_WARN",
|
|
1795
|
+
"warning": f"events-sync hook failed: {exc}",
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
|
|
1705
1799
|
def _validate_scenario_coverage(change_dir: Path) -> dict[str, Any]:
|
|
1706
1800
|
"""C9: validate all ledger-required scenarios are covered by ledger entries.
|
|
1707
1801
|
|
|
@@ -2266,6 +2360,48 @@ def cmd_close(args: argparse.Namespace) -> int:
|
|
|
2266
2360
|
explicit_run_id = args.run_id or os.environ.get("HUNTER_HARNESS_RUN_ID")
|
|
2267
2361
|
current_lease = hc.inspect_lease(project, resolved["changeId"])
|
|
2268
2362
|
if current_lease is None:
|
|
2363
|
+
terminal = _latest_phase_end(change_dir, args.phase, explicit_run_id)
|
|
2364
|
+
if (
|
|
2365
|
+
getattr(args, "to_phase", None)
|
|
2366
|
+
and terminal is not None
|
|
2367
|
+
and _terminal_matches_context_session(
|
|
2368
|
+
project, str(resolved["changeId"]), args.phase, terminal
|
|
2369
|
+
)
|
|
2370
|
+
):
|
|
2371
|
+
terminal_status = str(terminal.get("status") or args.status)
|
|
2372
|
+
handoff = _close_context_handoff(
|
|
2373
|
+
project,
|
|
2374
|
+
str(resolved["changeId"]),
|
|
2375
|
+
args,
|
|
2376
|
+
status=terminal_status,
|
|
2377
|
+
)
|
|
2378
|
+
monitor = _sync_after_phase_close(project, change_dir)
|
|
2379
|
+
if not isinstance(handoff, dict) or not handoff.get("ok"):
|
|
2380
|
+
return emit_error(
|
|
2381
|
+
"PHASE_HANDOFF_PENDING",
|
|
2382
|
+
"phase gate is closed, but context handoff still needs attention",
|
|
2383
|
+
as_json=as_json,
|
|
2384
|
+
extra={
|
|
2385
|
+
"localCloseComplete": True,
|
|
2386
|
+
"retryable": True,
|
|
2387
|
+
"contextHandoff": handoff,
|
|
2388
|
+
"platformMonitor": monitor,
|
|
2389
|
+
},
|
|
2390
|
+
)
|
|
2391
|
+
emit(
|
|
2392
|
+
{
|
|
2393
|
+
"ok": True,
|
|
2394
|
+
"code": "PHASE_CLOSE_RESUMED",
|
|
2395
|
+
"phase": args.phase,
|
|
2396
|
+
"status": terminal_status,
|
|
2397
|
+
"changeId": resolved["changeId"],
|
|
2398
|
+
"localCloseComplete": True,
|
|
2399
|
+
"contextHandoff": handoff,
|
|
2400
|
+
"platformMonitor": monitor,
|
|
2401
|
+
},
|
|
2402
|
+
as_json=as_json,
|
|
2403
|
+
)
|
|
2404
|
+
return 0
|
|
2269
2405
|
return emit_error("LEASE_ABSENT", "no active lease for phase close", as_json=as_json)
|
|
2270
2406
|
run_id = explicit_run_id or str(current_lease.get("runId") or "")
|
|
2271
2407
|
if str(current_lease.get("runId")) != run_id or str(current_lease.get("phase")) != args.phase:
|
|
@@ -2597,6 +2733,29 @@ def cmd_close(args: argparse.Namespace) -> int:
|
|
|
2597
2733
|
capsule["closeStatus"] = close_status
|
|
2598
2734
|
write_phase_capsule(change_dir, args.phase, run_id, capsule)
|
|
2599
2735
|
|
|
2736
|
+
context_handoff = _close_context_handoff(
|
|
2737
|
+
project,
|
|
2738
|
+
str(resolved["changeId"]),
|
|
2739
|
+
args,
|
|
2740
|
+
status=close_status,
|
|
2741
|
+
)
|
|
2742
|
+
platform_monitor = _sync_after_phase_close(project, change_dir)
|
|
2743
|
+
if isinstance(context_handoff, dict) and not context_handoff.get("ok"):
|
|
2744
|
+
return emit_error(
|
|
2745
|
+
"PHASE_HANDOFF_PENDING",
|
|
2746
|
+
"phase gate closed locally, but context handoff failed; retry the same close command",
|
|
2747
|
+
as_json=as_json,
|
|
2748
|
+
extra={
|
|
2749
|
+
"localCloseComplete": True,
|
|
2750
|
+
"retryable": True,
|
|
2751
|
+
"phase": args.phase,
|
|
2752
|
+
"status": close_status,
|
|
2753
|
+
"changeId": resolved["changeId"],
|
|
2754
|
+
"contextHandoff": context_handoff,
|
|
2755
|
+
"platformMonitor": platform_monitor,
|
|
2756
|
+
},
|
|
2757
|
+
)
|
|
2758
|
+
|
|
2600
2759
|
payload = {
|
|
2601
2760
|
"ok": True,
|
|
2602
2761
|
"code": close_code,
|
|
@@ -2612,6 +2771,8 @@ def cmd_close(args: argparse.Namespace) -> int:
|
|
|
2612
2771
|
"lease": release,
|
|
2613
2772
|
"gateSeverityMode": severity_mode,
|
|
2614
2773
|
"gateWarnings": gate_warnings,
|
|
2774
|
+
"contextHandoff": context_handoff,
|
|
2775
|
+
"platformMonitor": platform_monitor,
|
|
2615
2776
|
}
|
|
2616
2777
|
emit(payload, as_json=as_json)
|
|
2617
2778
|
return 0
|
|
@@ -2806,6 +2967,9 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
2806
2967
|
p_close.add_argument("--run-id", default=None)
|
|
2807
2968
|
p_close.add_argument("--task", type=int, default=None)
|
|
2808
2969
|
p_close.add_argument("--note", default="")
|
|
2970
|
+
p_close.add_argument("--to-phase", default=None)
|
|
2971
|
+
p_close.add_argument("--executor", default=None)
|
|
2972
|
+
p_close.add_argument("--artifact", action="append", default=[])
|
|
2809
2973
|
p_close.set_defaults(func=cmd_close)
|
|
2810
2974
|
|
|
2811
2975
|
p_classify = sub.add_parser("classify", parents=[shared])
|
|
@@ -1160,6 +1160,8 @@ _DYNAMIC_OWN_DIRS = ("events.ndjson", "logs", "evidence", "reports", "runtime",
|
|
|
1160
1160
|
|
|
1161
1161
|
def _matches_ownership_path(rel: str, declared: Any) -> bool:
|
|
1162
1162
|
scope = str(declared).replace("\\", "/").strip("/")
|
|
1163
|
+
if scope.endswith("/**"):
|
|
1164
|
+
scope = scope[:-3].rstrip("/")
|
|
1163
1165
|
if not scope:
|
|
1164
1166
|
return False
|
|
1165
1167
|
normalized = rel.replace("\\", "/").strip("/")
|
|
@@ -1155,6 +1155,7 @@ def finalize_plan(
|
|
|
1155
1155
|
"artifactsHash": validation["artifactsHash"],
|
|
1156
1156
|
"files": validation["files"],
|
|
1157
1157
|
"receiptPath": str(receipt_path),
|
|
1158
|
+
"artifactRef": "meta/plan-finalization.json",
|
|
1158
1159
|
}
|
|
1159
1160
|
|
|
1160
1161
|
lock_path.parent.mkdir(parents=True, exist_ok=True)
|
|
@@ -1253,6 +1254,7 @@ def finalize_plan(
|
|
|
1253
1254
|
"artifactsHash": validation["artifactsHash"],
|
|
1254
1255
|
"files": validation["files"],
|
|
1255
1256
|
"receiptPath": str(receipt_path),
|
|
1257
|
+
"artifactRef": "meta/plan-finalization.json",
|
|
1256
1258
|
"executionLogPath": str(harness_events.execution_log_path(change_dir)),
|
|
1257
1259
|
}
|
|
1258
1260
|
except OSError as exc:
|
|
@@ -1593,18 +1593,15 @@ def close(project: Path | str, change_dir: Path | str) -> dict[str, Any]:
|
|
|
1593
1593
|
[],
|
|
1594
1594
|
error=str(exc),
|
|
1595
1595
|
)
|
|
1596
|
-
|
|
1596
|
+
profile_changed = bool(
|
|
1597
1597
|
isinstance(snapshot.get("profileFingerprint"), str)
|
|
1598
1598
|
and snapshot["profileFingerprint"] != current_profile_fingerprint
|
|
1599
|
-
)
|
|
1600
|
-
return _result(False, action, "PROFILE_CHANGED", [])
|
|
1599
|
+
)
|
|
1601
1600
|
baseline_commit = _snapshot_baseline_commit(
|
|
1602
1601
|
project_root,
|
|
1603
1602
|
change_root,
|
|
1604
1603
|
snapshot,
|
|
1605
1604
|
)
|
|
1606
|
-
profile_changed = False
|
|
1607
|
-
|
|
1608
1605
|
before_entries = snapshot.get("files")
|
|
1609
1606
|
if not isinstance(before_entries, list):
|
|
1610
1607
|
return _result(False, action, "SNAPSHOT_INVALID", [])
|
|
@@ -1682,11 +1679,21 @@ def close(project: Path | str, change_dir: Path | str) -> dict[str, Any]:
|
|
|
1682
1679
|
return result
|
|
1683
1680
|
|
|
1684
1681
|
recorded = [rel for rel, _ in touched]
|
|
1685
|
-
reconciliation =
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1682
|
+
reconciliation = (
|
|
1683
|
+
{
|
|
1684
|
+
"ok": True,
|
|
1685
|
+
"code": "PROFILE_REBASED_MANIFEST_PRESERVED",
|
|
1686
|
+
"removedCurrentTouches": 0,
|
|
1687
|
+
"deletedEntries": 0,
|
|
1688
|
+
"preservedForeignEntries": 0,
|
|
1689
|
+
}
|
|
1690
|
+
if profile_changed
|
|
1691
|
+
else _reconcile_close_manifest(
|
|
1692
|
+
project_root,
|
|
1693
|
+
change_root,
|
|
1694
|
+
set(recorded),
|
|
1695
|
+
baseline_commit,
|
|
1696
|
+
)
|
|
1690
1697
|
)
|
|
1691
1698
|
if not reconciliation.get("ok"):
|
|
1692
1699
|
return _result(
|
|
@@ -1696,40 +1703,26 @@ def close(project: Path | str, change_dir: Path | str) -> dict[str, Any]:
|
|
|
1696
1703
|
list(reconciliation.get("files") or []),
|
|
1697
1704
|
)
|
|
1698
1705
|
|
|
1699
|
-
#
|
|
1700
|
-
#
|
|
1701
|
-
#
|
|
1702
|
-
|
|
1703
|
-
if
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
or f.get("introducedBy") == change_id
|
|
1720
|
-
or change_id in (f.get("touchedBy") or [])
|
|
1721
|
-
)
|
|
1722
|
-
]
|
|
1723
|
-
if active_entries and not recorded:
|
|
1724
|
-
return _result(
|
|
1725
|
-
False,
|
|
1726
|
-
action,
|
|
1727
|
-
"MANIFEST_DIFF_HASH_MISMATCH",
|
|
1728
|
-
[],
|
|
1729
|
-
manifestEntries=len(active_entries),
|
|
1730
|
-
recordedCount=0,
|
|
1731
|
-
detail="manifest has active entries but close computed 0 recorded tests",
|
|
1732
|
-
)
|
|
1706
|
+
# A manifest is change-wide and intentionally survives phase boundaries.
|
|
1707
|
+
# Therefore pre-existing entries with no new diff are consistent and must
|
|
1708
|
+
# not force a test-guard reset. When the build profile changes mid-phase,
|
|
1709
|
+
# retain the diff result and rebaseline the reusable snapshot atomically.
|
|
1710
|
+
if profile_changed:
|
|
1711
|
+
snapshot.update(
|
|
1712
|
+
{
|
|
1713
|
+
"profileFingerprint": current_profile_fingerprint,
|
|
1714
|
+
"capturedAt": time.strftime("%Y-%m-%dT%H:%M:%S"),
|
|
1715
|
+
"files": [
|
|
1716
|
+
{
|
|
1717
|
+
"path": rel,
|
|
1718
|
+
"sha256": digest,
|
|
1719
|
+
"ignored": _is_ignored(project_root, rel),
|
|
1720
|
+
}
|
|
1721
|
+
for rel, digest in sorted(current.items())
|
|
1722
|
+
],
|
|
1723
|
+
}
|
|
1724
|
+
)
|
|
1725
|
+
_write_json(snapshot_path, snapshot)
|
|
1733
1726
|
|
|
1734
1727
|
return _result(
|
|
1735
1728
|
True,
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"schema_version": 2,
|
|
3
3
|
"profile": "general",
|
|
4
4
|
"adapter": "claude-code",
|
|
5
|
-
"bundle_version": "0.2.
|
|
5
|
+
"bundle_version": "0.2.44",
|
|
6
6
|
"requires": {
|
|
7
|
-
"minimumCliVersion": "0.2.
|
|
7
|
+
"minimumCliVersion": "0.2.60",
|
|
8
8
|
"capabilities": [
|
|
9
9
|
"sync@2",
|
|
10
10
|
"rules-sync@1",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"files": [
|
|
24
24
|
{
|
|
25
25
|
"path": ".harness-build.json",
|
|
26
|
-
"sha256": "
|
|
26
|
+
"sha256": "489494066d32ece3ef71e7753f8d006a54463751d95b26903613076185420e12"
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
"path": "agents/harness-evaluator.md",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
},
|
|
96
96
|
{
|
|
97
97
|
"path": "harness-archive/SKILL.md",
|
|
98
|
-
"sha256": "
|
|
98
|
+
"sha256": "8bdecd1b5470e10c0e907caf036bf39efb04cfd1d8792765bab5931292003dc9"
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
101
|
"path": "harness-archive/templates/render-summary.mjs",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
117
|
"path": "harness-codebase-map/SKILL.md",
|
|
118
|
-
"sha256": "
|
|
118
|
+
"sha256": "16009fa030c6e719a23a5f7e1b3fa990683ac5981d61536e6e0cb8600f6af127"
|
|
119
119
|
},
|
|
120
120
|
{
|
|
121
121
|
"path": "harness-codebase-map/templates/ARCHITECTURE.md",
|
|
@@ -155,15 +155,15 @@
|
|
|
155
155
|
},
|
|
156
156
|
{
|
|
157
157
|
"path": "harness-knowledge-ingest/SKILL.md",
|
|
158
|
-
"sha256": "
|
|
158
|
+
"sha256": "74685dc48ba432cf51ba522dda7b588915e58406b1e4796a15d911b7855e6294"
|
|
159
159
|
},
|
|
160
160
|
{
|
|
161
161
|
"path": "harness-knowledge-query/SKILL.md",
|
|
162
|
-
"sha256": "
|
|
162
|
+
"sha256": "69d6700228d3ddbe1f3906dd55d37619471b5e3bf4b7b05b8f9982afc2a55d8c"
|
|
163
163
|
},
|
|
164
164
|
{
|
|
165
165
|
"path": "harness-plan/checklist.md",
|
|
166
|
-
"sha256": "
|
|
166
|
+
"sha256": "03584061a5d51b9c4349f13cbe66e757dd29bfc64ed6a4510f0bd731afd76568"
|
|
167
167
|
},
|
|
168
168
|
{
|
|
169
169
|
"path": "harness-plan/protocols.md",
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
},
|
|
176
176
|
{
|
|
177
177
|
"path": "harness-plan/SKILL.md",
|
|
178
|
-
"sha256": "
|
|
178
|
+
"sha256": "f4b5a1d0fe472fd5b957a3a99af2299fa18f3e8c08c64088980804a781dea3c0"
|
|
179
179
|
},
|
|
180
180
|
{
|
|
181
181
|
"path": "harness-review/checklist.md",
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
},
|
|
192
192
|
{
|
|
193
193
|
"path": "harness-review/SKILL.md",
|
|
194
|
-
"sha256": "
|
|
194
|
+
"sha256": "e66dbec214193999d4697461d241de8629f597ad7916101e8ad986485326fe1c"
|
|
195
195
|
},
|
|
196
196
|
{
|
|
197
197
|
"path": "harness-run/checklist.md",
|
|
@@ -203,11 +203,11 @@
|
|
|
203
203
|
},
|
|
204
204
|
{
|
|
205
205
|
"path": "harness-run/reference.md",
|
|
206
|
-
"sha256": "
|
|
206
|
+
"sha256": "b034bab5f5f8b9a39cebc705bd8e0d3f5d7065dc0a0070f64499dc81f9d7fd67"
|
|
207
207
|
},
|
|
208
208
|
{
|
|
209
209
|
"path": "harness-run/SKILL.md",
|
|
210
|
-
"sha256": "
|
|
210
|
+
"sha256": "8374c2f0d3b298fac04b6d85858b93d385db6de693efd0453d5f8afff87fa139"
|
|
211
211
|
},
|
|
212
212
|
{
|
|
213
213
|
"path": "harness-submit/checklist.md",
|
|
@@ -219,7 +219,7 @@
|
|
|
219
219
|
},
|
|
220
220
|
{
|
|
221
221
|
"path": "harness-submit/SKILL.md",
|
|
222
|
-
"sha256": "
|
|
222
|
+
"sha256": "2630ee53df84f00ac5e6d3871a180affb8c7c976d1185cef9e0f53be74ba0ad7"
|
|
223
223
|
},
|
|
224
224
|
{
|
|
225
225
|
"path": "harness-sync/reference.md",
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
},
|
|
228
228
|
{
|
|
229
229
|
"path": "harness-sync/SKILL.md",
|
|
230
|
-
"sha256": "
|
|
230
|
+
"sha256": "2e38716d9225c19d15245f4bcfb65947da6bbbe254642306f1645e5d37bcf298"
|
|
231
231
|
},
|
|
232
232
|
{
|
|
233
233
|
"path": "harness-test/checklist.md",
|
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
},
|
|
244
244
|
{
|
|
245
245
|
"path": "harness-test/reference.md",
|
|
246
|
-
"sha256": "
|
|
246
|
+
"sha256": "72ca942018df10857c03f0ee23df45633a8aa4f3f2e635a44e731219a9985c2f"
|
|
247
247
|
},
|
|
248
248
|
{
|
|
249
249
|
"path": "harness-test/scripts/runtime-helpers.mjs",
|
|
@@ -251,7 +251,7 @@
|
|
|
251
251
|
},
|
|
252
252
|
{
|
|
253
253
|
"path": "harness-test/SKILL.md",
|
|
254
|
-
"sha256": "
|
|
254
|
+
"sha256": "f278d08e7729097190071ff25563a6c30dbcdc15dbd1a2cf75a9ac6c377cf68f"
|
|
255
255
|
},
|
|
256
256
|
{
|
|
257
257
|
"path": "protocols/archive-report-protocol.md",
|
|
@@ -323,7 +323,7 @@
|
|
|
323
323
|
},
|
|
324
324
|
{
|
|
325
325
|
"path": "scripts/harness_archive.py",
|
|
326
|
-
"sha256": "
|
|
326
|
+
"sha256": "97a4207a24177761af57e308c7b684c0664f866e8b0d618800916d97c580f8e5"
|
|
327
327
|
},
|
|
328
328
|
{
|
|
329
329
|
"path": "scripts/harness_change.py",
|
|
@@ -335,7 +335,7 @@
|
|
|
335
335
|
},
|
|
336
336
|
{
|
|
337
337
|
"path": "scripts/harness_context.py",
|
|
338
|
-
"sha256": "
|
|
338
|
+
"sha256": "fa9557ffffba3866582054305aa74894dd3516eab9c6d088b705146b8e7e8729"
|
|
339
339
|
},
|
|
340
340
|
{
|
|
341
341
|
"path": "scripts/harness_deploy.py",
|
|
@@ -351,11 +351,11 @@
|
|
|
351
351
|
},
|
|
352
352
|
{
|
|
353
353
|
"path": "scripts/harness_events_sync.py",
|
|
354
|
-
"sha256": "
|
|
354
|
+
"sha256": "b5b6438cec03524b2837319d5889ffe5e94de88c98f52baa83fefebbd170e88b"
|
|
355
355
|
},
|
|
356
356
|
{
|
|
357
357
|
"path": "scripts/harness_events.py",
|
|
358
|
-
"sha256": "
|
|
358
|
+
"sha256": "59cccc6ddc24597c15f0542894b2d3a860ba581a5e6ecf277083bac2de94d589"
|
|
359
359
|
},
|
|
360
360
|
{
|
|
361
361
|
"path": "scripts/harness_execution_contracts.py",
|
|
@@ -367,7 +367,7 @@
|
|
|
367
367
|
},
|
|
368
368
|
{
|
|
369
369
|
"path": "scripts/harness_gate.py",
|
|
370
|
-
"sha256": "
|
|
370
|
+
"sha256": "e6bbb9d177e8261d8c77ef55fdf87e9daf164ae9361ce09bb4e294c1c7f091ac"
|
|
371
371
|
},
|
|
372
372
|
{
|
|
373
373
|
"path": "scripts/harness_headless.py",
|
|
@@ -379,7 +379,7 @@
|
|
|
379
379
|
},
|
|
380
380
|
{
|
|
381
381
|
"path": "scripts/harness_ledger.py",
|
|
382
|
-
"sha256": "
|
|
382
|
+
"sha256": "eea0c064f1430e1c98df1401eec5c11f12ac3e2be9476fe94b78b84d85d17fac"
|
|
383
383
|
},
|
|
384
384
|
{
|
|
385
385
|
"path": "scripts/harness_migration_head.py",
|
|
@@ -403,7 +403,7 @@
|
|
|
403
403
|
},
|
|
404
404
|
{
|
|
405
405
|
"path": "scripts/harness_plan_finalize.py",
|
|
406
|
-
"sha256": "
|
|
406
|
+
"sha256": "d415186905d314e9d768b9527b5564063060e524b359ffa5ba459ff1ad2b8fa1"
|
|
407
407
|
},
|
|
408
408
|
{
|
|
409
409
|
"path": "scripts/harness_preflight.py",
|
|
@@ -451,7 +451,7 @@
|
|
|
451
451
|
},
|
|
452
452
|
{
|
|
453
453
|
"path": "scripts/harness_test_guard.py",
|
|
454
|
-
"sha256": "
|
|
454
|
+
"sha256": "a6ef4107e6ee32038753262623d2ff01c86cc640b42183c7117ed0da943c5742"
|
|
455
455
|
},
|
|
456
456
|
{
|
|
457
457
|
"path": "scripts/harness_test_runner.py",
|