feat: blueprint-aware policy resolve for multi-instance tenants (T07)

resolve_run_policy returns blueprint for persona prepare; add tenant
onboard helper script. Marks HARNESS-WP-0001-T07 done after binky
onboarding handoff.
This commit is contained in:
tegwick 2026-07-18 11:07:10 +02:00
parent 67f1791491
commit 154e535695
5 changed files with 135 additions and 13 deletions

View file

@ -273,28 +273,28 @@ def resolve_run_policy(
agent_name: str,
*,
default_profile: str = "green-commit-only",
) -> tuple[str, int | None, str | None]:
"""Resolve (tool_profile_name, budget_tokens, lane) for a run.
) -> tuple[str, int | None, str | None, str]:
"""Resolve (tool_profile_name, budget_tokens, lane, blueprint) for a run.
If the repo has no manifest or no entry for *agent_name*, returns the
default profile with no budget. If the entry names an unknown profile,
raises UnknownToolProfileError (refuse to run).
default profile with no budget and blueprint=agent_name. If the entry
names an unknown profile, raises UnknownToolProfileError (refuse to run).
"""
root = Path(project_root)
path = manifest_path(root)
if not path.exists():
get_profile(default_profile) # validate default exists
return default_profile, None, None
return default_profile, None, None, agent_name
manifest = load_manifest(path)
instance = manifest.agent_for(agent_name)
if instance is None or not instance.enabled:
get_profile(default_profile)
return default_profile, None, None
return default_profile, None, None, agent_name
profile_name = instance.tool_profile or default_profile
get_profile(profile_name) # raises if unknown
return profile_name, instance.budget, instance.lane
return profile_name, instance.budget, instance.lane, instance.blueprint_name
def known_profile_names() -> list[str]:

View file

@ -74,7 +74,7 @@ def run_task(
write_metrics: bool = True,
) -> RunResult:
try:
profile_name, budget_tokens, lane = resolve_run_policy(
profile_name, budget_tokens, lane, blueprint = resolve_run_policy(
spec.target_repo, spec.agent
)
profile = get_profile(profile_name)
@ -112,7 +112,7 @@ def run_task(
)
head_before = _git(spec.target_repo, "rev-parse", "HEAD")
persona, persona_source = load_persona_bundle(spec.agent, spec.target_repo)
persona, persona_source = load_persona_bundle(blueprint, spec.target_repo)
prompt = PROMPT_TEMPLATE.format(
persona=persona or "(no persona bundle available for this run)",
title=spec.title,