From 2e8cfe819e8ae0ac8896925f8b2702fe19b13736 Mon Sep 17 00:00:00 2001 From: jonahgabriel Date: Mon, 22 Jun 2026 00:27:17 -0400 Subject: [PATCH 1/2] feat(OMN-13407): carry delegation context pack hash --- .../wire/model_delegation_wire_request.py | 14 +++++++++++ .../wire/model_task_delegated_event.py | 7 ++++++ .../wire/test_delegation_wire_models.py | 25 +++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/src/omnibase_core/models/delegation/wire/model_delegation_wire_request.py b/src/omnibase_core/models/delegation/wire/model_delegation_wire_request.py index 956b64ab14..bdbc729179 100644 --- a/src/omnibase_core/models/delegation/wire/model_delegation_wire_request.py +++ b/src/omnibase_core/models/delegation/wire/model_delegation_wire_request.py @@ -96,6 +96,20 @@ class ModelDelegationRequest(BaseModel): default=None, description="File context for the delegation, if any.", ) + context_pack: str = Field( + default="", + description=( + "Optional assembled context injected ahead of the prompt for context " + "ON/OFF experiments. Empty string means no context pack." + ), + ) + context_pack_hash: str = Field( + default="", + description=( + "Stable hash of context_pack for projection readback and ROI " + "measurement. Empty string means no context pack was injected." + ), + ) correlation_id: UUID = Field( ..., description="Unique identifier for tracking through the pipeline.", diff --git a/src/omnibase_core/models/delegation/wire/model_task_delegated_event.py b/src/omnibase_core/models/delegation/wire/model_task_delegated_event.py index f6cead7774..cb832da6cd 100644 --- a/src/omnibase_core/models/delegation/wire/model_task_delegated_event.py +++ b/src/omnibase_core/models/delegation/wire/model_task_delegated_event.py @@ -89,6 +89,13 @@ class ModelTaskDelegatedEvent(BaseModel): default=None, description="Raw response received from the delegated model.", ) + context_pack_hash: str = Field( + default="", + description=( + "Stable hash of the context pack injected into the delegated prompt. " + "Empty string means the OFF arm or no context pack." + ), + ) pricing_manifest_version: int = Field( default=0, ge=0, diff --git a/tests/unit/models/delegation/wire/test_delegation_wire_models.py b/tests/unit/models/delegation/wire/test_delegation_wire_models.py index cdff92abb3..408cfb471a 100644 --- a/tests/unit/models/delegation/wire/test_delegation_wire_models.py +++ b/tests/unit/models/delegation/wire/test_delegation_wire_models.py @@ -75,6 +75,19 @@ def test_basic_construction(self) -> None: r = self._make() assert r.task_type == "test" + def test_context_pack_hash_defaults_to_off_arm(self) -> None: + r = self._make() + assert r.context_pack == "" + assert r.context_pack_hash == "" + + def test_context_pack_hash_is_accepted(self) -> None: + r = self._make( + context_pack="Relevant repo facts.", + context_pack_hash="sha256:abc123", + ) + assert r.context_pack == "Relevant repo facts." + assert r.context_pack_hash == "sha256:abc123" + def test_compliance_budget_required_when_schema_key_set(self) -> None: with pytest.raises(ValueError, match="compliance_budget is required"): self._make(output_schema_key="some_schema") @@ -607,6 +620,18 @@ def test_default_topic(self) -> None: ) assert event.topic == TASK_DELEGATED_TOPIC_V1 assert event.escalation_count == 0 + assert event.context_pack_hash == "" + + def test_carries_context_pack_hash(self) -> None: + event = ModelTaskDelegatedEvent( + timestamp="2026-05-26T00:00:00Z", + correlation_id=uuid.uuid4(), + task_type="test", + delegated_to="local_qwen3", + quality_gate_passed=True, + context_pack_hash="sha256:ctx", + ) + assert event.context_pack_hash == "sha256:ctx" def test_rejects_invalid_topic_and_negative_metrics(self) -> None: with pytest.raises(ValidationError): From 999980a10c4fc4ebffd6c80039f642acffe2de7b Mon Sep 17 00:00:00 2001 From: jonahgabriel Date: Mon, 22 Jun 2026 00:54:48 -0400 Subject: [PATCH 2/2] chore(OMN-13407): refresh receipt metadata