agent: add write_prefix param to try_scope_expansion for risk-2 tests
All checks were successful
build / build (push) Successful in 4s

This commit is contained in:
robert
2026-05-11 19:23:07 -03:00
parent 184e70cecb
commit 880d6e4230

View File

@@ -51,10 +51,10 @@ class TestHelperAgent(A2AAgent[TestHelperConfig, NoAuth]):
@skill( @skill(
description=( description=(
"Call ctx.request_scope() with the caller-supplied read patterns " "Call ctx.request_scope() with the caller-supplied args, then "
"+ ttl, then report the platform's response. Lets tests verify " "report the platform's response. Lets tests verify the "
"the orchestrator's scope-negotiation flow end-to-end without " "orchestrator's scope-negotiation flow end-to-end without "
"needing a real workload that happens to need extra files." "needing a real workload that happens to need extra access."
), ),
tags=["e2e", "scope-request"], tags=["e2e", "scope-request"],
allow_scope_expansion=True, allow_scope_expansion=True,
@@ -66,10 +66,12 @@ class TestHelperAgent(A2AAgent[TestHelperConfig, NoAuth]):
read_patterns: list[str] = ["reference/**"], read_patterns: list[str] = ["reference/**"],
ttl_seconds: int = 60, ttl_seconds: int = 60,
mode: str = "read_only", mode: str = "read_only",
write_prefix: str | None = None,
) -> dict: ) -> dict:
original = list(getattr(ctx.workspace, "allow_patterns", ())) original = list(getattr(ctx.workspace, "allow_patterns", ()))
await ctx.emit_progress( await ctx.emit_progress(
f"requesting scope expansion: read={read_patterns} ttl={ttl_seconds}s" f"requesting scope: read={read_patterns} write={write_prefix} "
f"mode={mode} ttl={ttl_seconds}s"
) )
try: try:
grant = await ctx.request_scope( grant = await ctx.request_scope(
@@ -77,6 +79,7 @@ class TestHelperAgent(A2AAgent[TestHelperConfig, NoAuth]):
read=read_patterns, read=read_patterns,
ttl_seconds=ttl_seconds, ttl_seconds=ttl_seconds,
mode=mode, mode=mode,
write_prefix=write_prefix,
) )
except ScopeDenied as exc: except ScopeDenied as exc:
await ctx.emit_progress(f"scope denied: {exc}") await ctx.emit_progress(f"scope denied: {exc}")