Enforce bounded operation guardrails
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a028de-e2c8-7732-8521-46a7fc5db82f
This commit is contained in:
parent
c384f60530
commit
26934e25b9
51 changed files with 1843 additions and 472 deletions
|
|
@ -9,7 +9,7 @@ from typing import Annotated, Any, Literal, Union
|
|||
from datetime import datetime
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, Field, model_validator
|
||||
|
||||
|
||||
# ── EventEnvelope (T40) ───────────────────────────────────────────────────────
|
||||
|
|
@ -137,12 +137,34 @@ class InstructionDef(BaseModel):
|
|||
model_params: dict[str, Any] = Field(default_factory=dict)
|
||||
prompt: str = Field(description="Prompt template with {field.path} placeholders.")
|
||||
output_schema: str = Field(description="Path to JSON Schema file for output validation.")
|
||||
review_required: bool = Field(default=False)
|
||||
review_advisory: bool = Field(
|
||||
default=False,
|
||||
description="Advisory evidence only; activity-core applies no review gate.",
|
||||
)
|
||||
review_required: bool | None = Field(
|
||||
default=None,
|
||||
exclude=True,
|
||||
repr=False,
|
||||
description="Deprecated input alias for review_advisory.",
|
||||
json_schema_extra={"deprecated": True},
|
||||
)
|
||||
report_sinks: list[dict[str, Any]] = Field(default_factory=list)
|
||||
approach_hint: str | None = Field(default=None)
|
||||
harness_profile_ref: str | None = Field(default=None)
|
||||
execution_refs: dict[str, Any] = Field(default_factory=dict)
|
||||
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def _accept_legacy_review_required(cls, data: Any) -> Any:
|
||||
if not isinstance(data, dict) or "review_required" not in data:
|
||||
return data
|
||||
normalized = dict(data)
|
||||
legacy = bool(normalized["review_required"])
|
||||
if "review_advisory" in normalized and bool(normalized["review_advisory"]) != legacy:
|
||||
raise ValueError("review_required conflicts with review_advisory")
|
||||
normalized["review_advisory"] = legacy
|
||||
return normalized
|
||||
|
||||
|
||||
# ── Context sources ───────────────────────────────────────────────────────────
|
||||
|
||||
|
|
@ -166,9 +188,11 @@ class ContextSource(BaseModel):
|
|||
# ── Task templates (legacy) ───────────────────────────────────────────────────
|
||||
|
||||
class TaskTemplate(BaseModel):
|
||||
"""Legacy task template — ignored when ActivityDefinition.rules is non-empty."""
|
||||
"""Legacy persisted shape; no in-repo task executor consumes it."""
|
||||
|
||||
task_type: str
|
||||
task_type: str = Field(
|
||||
description="Legacy downstream task type metadata; not an executor selector."
|
||||
)
|
||||
condition: str | None = None
|
||||
params_template: dict[str, Any] = Field(default_factory=dict)
|
||||
|
||||
|
|
@ -186,7 +210,7 @@ class ActivityDefinition(BaseModel):
|
|||
# New rule/instruction pipeline (T34)
|
||||
rules: list[RuleDef] = Field(default_factory=list)
|
||||
instructions: list[InstructionDef] = Field(default_factory=list)
|
||||
# Legacy — ignored when rules is non-empty
|
||||
# Legacy persisted/API compatibility; RunActivityWorkflow does not execute it.
|
||||
task_templates: list[TaskTemplate] = Field(default_factory=list)
|
||||
dedupe_key_strategy: Literal["skip", "catchup", "compress"] = Field(
|
||||
default="skip",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue