feat: import governed sandbox commits and enforce native CLI limits
Some checks are pending
Governed runtime contract / contract (push) Waiting to run
Some checks are pending
Governed runtime contract / contract (push) Waiting to run
Assistant: codex Assistant-Model: gpt-5.6-luna Assistant-Session: 01a07ff8-19d0-7820-b4d0-1353833cb7fc
This commit is contained in:
parent
1429db5ad4
commit
c63caf5568
16 changed files with 1236 additions and 7 deletions
|
|
@ -51,6 +51,7 @@ _EVIDENCE_STRING_FIELDS = (
|
|||
_EVIDENCE_NUMBER_FIELDS = (
|
||||
"duration_s",
|
||||
"tokens_spent",
|
||||
"cost_usd",
|
||||
"token_budget",
|
||||
"tool_events_count",
|
||||
)
|
||||
|
|
@ -142,6 +143,7 @@ def execute_profiled_run(
|
|||
request_factory: Callable[..., Any] | None = None,
|
||||
gateway: Callable[[Any], Any] | None = None,
|
||||
cancel: ExecutionCancel | None = None,
|
||||
transaction: Any = None,
|
||||
) -> dict[str, Any]:
|
||||
"""Invoke Glas and return its complete JSON-compatible GatewayResult."""
|
||||
guard = resolve_cancel(cancel)
|
||||
|
|
@ -159,9 +161,14 @@ def execute_profiled_run(
|
|||
request_factory = request_factory or ExecutionRequest
|
||||
gateway = gateway or run_execution
|
||||
|
||||
transfer = None
|
||||
if run.repository_grant is not None:
|
||||
from rein_aharness.repository_artifact import RepositoryArtifactTransfer
|
||||
transfer = RepositoryArtifactTransfer(transaction, run.repository_grant, cancel=guard)
|
||||
|
||||
try:
|
||||
request = request_factory(**_request_kwargs(run, config, report_to_hub))
|
||||
result = gateway(request)
|
||||
result = gateway(request, artifact_capture=transfer.capture) if transfer else gateway(request)
|
||||
raw = result.model_dump(mode="json") if hasattr(result, "model_dump") else result
|
||||
except ExecutionCancelled:
|
||||
raise
|
||||
|
|
@ -178,4 +185,10 @@ def execute_profiled_run(
|
|||
raise GlasExecutionError("Glas gateway returned an invalid GatewayResult")
|
||||
if not isinstance(raw.get("evidence"), dict):
|
||||
raise GlasExecutionError("Glas GatewayResult is missing execution evidence")
|
||||
if transfer is not None and raw["ok"]:
|
||||
evidence = raw["evidence"]
|
||||
if evidence.get("session_cleanup") != "succeeded" or evidence.get("sandbox_destroy") != "succeeded":
|
||||
raise GlasExecutionError("artifact import requires confirmed session cleanup and sandbox teardown")
|
||||
imported = transfer.import_after_teardown(evidence.get("commit_sha"))
|
||||
raw["artifact_import"] = imported
|
||||
return raw
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue