From 8449143e188ac5475633fe5684367f9330d85883 Mon Sep 17 00:00:00 2001
From: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
Date: Sat, 19 Sep 2026 19:28:53 +0800
Subject: [PATCH 1/5] feat(delegation): project authorized routes into agent
context
Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
---
loopx/capabilities/configuration_ui.py | 11 ++
loopx/chat_goal_configuration_api.py | 19 +-
loopx/chat_goal_subagent_api.py | 19 ++
loopx/cli.py | 8 +-
loopx/cli_commands/agent_context.py | 13 +-
loopx/cli_commands/registry_admin.py | 4 +
.../cli_commands/registry_admin_configure.py | 12 ++
loopx/configure_goal.py | 15 ++
loopx/control_plane/agent_context.py | 72 +++++++-
.../collaboration/delegation_context.py | 161 +++++++++++++++++
loopx/control_plane/quota/live_decision.py | 32 ++--
loopx/control_plane/subagent_context.ts | 93 +++++++++-
.../control_plane/turn_driver/host_binding.py | 40 ++++-
loopx/orchestration.py | 38 ++++
.../control_plane/test_delegation_context.py | 162 ++++++++++++++++++
.../test_subagent_model_configuration.py | 65 +++++++
tests/control_plane_ts/agent_context.test.ts | 74 +++++++-
tests/test_turn_managed_executor_binding.py | 23 +++
18 files changed, 832 insertions(+), 29 deletions(-)
create mode 100644 loopx/control_plane/collaboration/delegation_context.py
create mode 100644 tests/control_plane/test_delegation_context.py
diff --git a/loopx/capabilities/configuration_ui.py b/loopx/capabilities/configuration_ui.py
index 923fa6dac2..1dbd956216 100644
--- a/loopx/capabilities/configuration_ui.py
+++ b/loopx/capabilities/configuration_ui.py
@@ -215,6 +215,17 @@ def capability_configuration_editor(
"string_list",
description="One bounded, public-safe domain per line.",
),
+ _field(
+ "execution_config",
+ "Delegation bindings",
+ "text",
+ nullable=True,
+ description=(
+ "Repo-relative ignored JSON under .loopx/config/. It exposes "
+ "only authorized, public-safe route status to planning; it "
+ "does not grant a binding."
+ ),
+ ),
],
},
"peer_task_coordination": {
diff --git a/loopx/chat_goal_configuration_api.py b/loopx/chat_goal_configuration_api.py
index 404a0cd04a..358650a640 100644
--- a/loopx/chat_goal_configuration_api.py
+++ b/loopx/chat_goal_configuration_api.py
@@ -67,8 +67,23 @@ def _subagent_model_options(config: Mapping[str, Any]) -> dict[str, Any]:
def _multi_subagent_options(config: Mapping[str, Any]) -> dict[str, Any]:
model_options = _subagent_model_options(config)
+ execution_options: dict[str, Any] = {}
+ if "execution_config" in config:
+ execution_config = config.get("execution_config")
+ if execution_config is not None and not isinstance(execution_config, str):
+ raise TypeError("multi_subagent.execution_config must be a string")
+ execution_config = str(execution_config or "").strip()
+ execution_options = (
+ {"subagent_execution_config": execution_config}
+ if execution_config
+ else {"clear_subagent_execution_config": True}
+ )
if not _boolean_configuration("multi_subagent", config, "enabled"):
- return {"multi_subagent_feature": "off", **model_options}
+ return {
+ "multi_subagent_feature": "off",
+ **model_options,
+ **execution_options,
+ }
max_children = config.get("max_children", 4)
if not isinstance(max_children, int) or isinstance(max_children, bool):
raise TypeError("multi_subagent.max_children must be an integer")
@@ -82,6 +97,7 @@ def _multi_subagent_options(config: Mapping[str, Any]) -> dict[str, Any]:
"max_children": max_children,
"allowed_domains": domains,
**model_options,
+ **execution_options,
}
@@ -151,6 +167,7 @@ def _goal_capability_options(
"allowed_domains",
"model",
"reasoning_effort",
+ "execution_config",
},
"peer_task_coordination": {"coordinator_agent_id"},
"explore_graph": {"enabled"},
diff --git a/loopx/chat_goal_subagent_api.py b/loopx/chat_goal_subagent_api.py
index 863da53c68..7f8198790a 100644
--- a/loopx/chat_goal_subagent_api.py
+++ b/loopx/chat_goal_subagent_api.py
@@ -71,6 +71,7 @@ def _parse_goal_subagent_configuration(
"max_children",
"allowed_domains",
"model_config",
+ "execution_config",
}
if apply:
allowed.add("preview_id")
@@ -87,6 +88,10 @@ def _parse_goal_subagent_configuration(
if not isinstance(body.get("enabled"), bool):
raise ValueError("enabled must be a boolean")
enabled = body["enabled"]
+ if "execution_config" in body and not isinstance(
+ body.get("execution_config"), str
+ ):
+ raise ValueError("execution_config must be a string")
if enabled:
max_children = body.get("max_children")
@@ -128,6 +133,18 @@ def _parse_goal_subagent_configuration(
"multi_subagent_feature": "enabled" if enabled else "off",
"max_children": max_children,
"allowed_domains": allowed_domains,
+ **(
+ {
+ "subagent_execution_config": str(
+ body.get("execution_config") or ""
+ ).strip()
+ }
+ if "execution_config" in body
+ and str(body.get("execution_config") or "").strip()
+ else {"clear_subagent_execution_config": True}
+ if "execution_config" in body
+ else {}
+ ),
**(
subagent_model_configuration_options(body["model_config"])
if "model_config" in body
@@ -156,6 +173,8 @@ def _goal_subagent_configuration_payload(
"subagent_model",
"subagent_reasoning_effort",
"clear_subagent_model_config",
+ "subagent_execution_config",
+ "clear_subagent_execution_config",
)
if key in values
},
diff --git a/loopx/cli.py b/loopx/cli.py
index 82242be50c..1d4b093589 100644
--- a/loopx/cli.py
+++ b/loopx/cli.py
@@ -775,7 +775,13 @@ def main(argv: list[str] | None = None) -> int:
)
if args.command == "agent-context":
- return handle_agent_context(args, registry_path, print_payload, output_format)
+ return handle_agent_context(
+ args,
+ registry_path,
+ effective_runtime_root(registry_path, args.runtime_root),
+ print_payload,
+ output_format,
+ )
if args.command == "agent-directory":
return handle_agent_directory(
diff --git a/loopx/cli_commands/agent_context.py b/loopx/cli_commands/agent_context.py
index de503f9352..7f52cfb11d 100644
--- a/loopx/cli_commands/agent_context.py
+++ b/loopx/cli_commands/agent_context.py
@@ -1,8 +1,7 @@
"""Read-only lifecycle context for hosts whose native tools bypass LoopX Turn."""
from ..agent_registry import load_goal_from_registry, registered_agent_ids_for_goal
-from ..control_plane.agent_context import project_agent_context
-from ..orchestration import compact_orchestration_policy
+from ..control_plane.agent_context import project_goal_agent_context
def register_agent_context(subparsers, add_format):
@@ -19,7 +18,7 @@ def register_agent_context(subparsers, add_format):
)
-def handle_agent_context(args, registry_path, print_payload, output_format):
+def handle_agent_context(args, registry_path, runtime_root, print_payload, output_format):
goal = load_goal_from_registry(registry_path, args.goal_id)
if goal is None or args.agent_id not in registered_agent_ids_for_goal(goal):
print_payload(
@@ -28,16 +27,18 @@ def handle_agent_context(args, registry_path, print_payload, output_format):
render_agent_context,
)
return 1
- context = project_agent_context(
+ context = project_goal_agent_context(
phase=args.phase,
scope={"goal_id": args.goal_id, "agent_id": args.agent_id, "todo_id": None},
- orchestration=compact_orchestration_policy(goal.get("spawn_policy")),
+ goal=goal,
+ registry_path=registry_path,
+ runtime_root=runtime_root,
)
print_payload(
{
"ok": True,
"agent_context": context,
- "source": "registry.spawn_policy",
+ "source": "registry.spawn_policy+local_delegation",
"read_only": True,
"host_receipts_observed": False,
},
diff --git a/loopx/cli_commands/registry_admin.py b/loopx/cli_commands/registry_admin.py
index cc3f26e166..3054dce377 100644
--- a/loopx/cli_commands/registry_admin.py
+++ b/loopx/cli_commands/registry_admin.py
@@ -490,6 +490,10 @@ def handle_registry_admin_command(
subagent_model=args.subagent_model,
subagent_reasoning_effort=args.subagent_reasoning_effort,
clear_subagent_model_config=args.clear_subagent_model_config,
+ subagent_execution_config=args.subagent_execution_config,
+ clear_subagent_execution_config=bool(
+ args.clear_subagent_execution_config
+ ),
allowed_domains=args.allowed_domain,
clear_allowed_domains=bool(args.clear_allowed_domains),
explore_harness_enabled=args.explore_harness_enabled,
diff --git a/loopx/cli_commands/registry_admin_configure.py b/loopx/cli_commands/registry_admin_configure.py
index 2b64ad168e..f028ba9211 100644
--- a/loopx/cli_commands/registry_admin_configure.py
+++ b/loopx/cli_commands/registry_admin_configure.py
@@ -142,6 +142,18 @@ def register_configure_goal_command(subparsers: argparse._SubParsersAction) -> N
action="store_true",
help="Remove child model and effort preferences together.",
)
+ configure_goal_parser.add_argument(
+ "--subagent-execution-config",
+ help=(
+ "Repo-relative operator binding file under .loopx/config/ used by "
+ "the existing local delegation entrypoint."
+ ),
+ )
+ configure_goal_parser.add_argument(
+ "--clear-subagent-execution-config",
+ action="store_true",
+ help="Remove the Goal's local delegation binding pointer.",
+ )
configure_goal_parser.add_argument(
"--allowed-domain",
action="append",
diff --git a/loopx/configure_goal.py b/loopx/configure_goal.py
index 74cb79d52d..47f7e9dfe1 100644
--- a/loopx/configure_goal.py
+++ b/loopx/configure_goal.py
@@ -449,6 +449,8 @@ def configure_goal(
subagent_model: str | None = None,
subagent_reasoning_effort: str | None = None,
clear_subagent_model_config: bool = False,
+ subagent_execution_config: str | None = None,
+ clear_subagent_execution_config: bool = False,
allowed_domains: list[str] | None = None,
clear_allowed_domains: bool = False,
explore_harness_enabled: bool | None = None,
@@ -614,6 +616,11 @@ def configure_goal(
raise ValueError(
"--clear-subagent-model-config cannot be combined with model settings"
)
+ if clear_subagent_execution_config and subagent_execution_config:
+ raise ValueError(
+ "--clear-subagent-execution-config cannot be combined with "
+ "--subagent-execution-config"
+ )
if explore_harness_profile is not None:
explore_harness_profile = (
str(explore_harness_profile).strip().lower().replace("_", "-")
@@ -671,6 +678,10 @@ def configure_goal(
reward_memory_config,
label="reward memory experiment config",
)
+ subagent_execution_config = _local_private_config_path(
+ subagent_execution_config,
+ label="subagent execution config",
+ )
periodic_report_change = periodic_report_config.normalize_change(
periodic_report_configuration, clear=clear_periodic_report_configuration
)
@@ -923,6 +934,8 @@ def configure_goal(
or subagent_model is not None
or subagent_reasoning_effort is not None
or clear_subagent_model_config
+ or subagent_execution_config is not None
+ or clear_subagent_execution_config
or allowed_domains is not None
or clear_allowed_domains
or explore_harness_enabled is not None
@@ -943,6 +956,8 @@ def configure_goal(
subagent_model=subagent_model,
subagent_reasoning_effort=subagent_reasoning_effort,
clear_subagent_model_config=clear_subagent_model_config,
+ subagent_execution_config=subagent_execution_config,
+ clear_subagent_execution_config=clear_subagent_execution_config,
allowed_domains=allowed_domains,
clear_allowed_domains=clear_allowed_domains,
default_max_children=DEFAULT_MULTI_SUBAGENT_MAX_CHILDREN,
diff --git a/loopx/control_plane/agent_context.py b/loopx/control_plane/agent_context.py
index 4bcd9b345a..da55060605 100644
--- a/loopx/control_plane/agent_context.py
+++ b/loopx/control_plane/agent_context.py
@@ -1,9 +1,11 @@
"""Transport lifecycle inputs to the typed capability context owner."""
from collections.abc import Mapping
+from pathlib import Path
from typing import Any
from .effect_runtime import effect_runtime_result
+from ..orchestration import compact_orchestration_policy
def project_agent_context(
@@ -24,6 +26,70 @@ def project_agent_context(
)
+def project_goal_agent_context(
+ *,
+ phase: str,
+ scope: Mapping[str, Any],
+ goal: Mapping[str, Any],
+ registry_path: Path,
+ runtime_root: Path,
+ observations: Mapping[str, Any] | None = None,
+):
+ """Project the Goal policy plus its public-safe delegated runtime facts."""
+
+ orchestration = compact_orchestration_policy(goal.get("spawn_policy"))
+ projected_observations = dict(observations or {})
+ enabled = (
+ orchestration.get("mode") == "multi_subagent"
+ and orchestration.get("spawn_allowed") is True
+ and int(orchestration.get("max_children") or 0) > 0
+ )
+ if enabled:
+ project = Path(str(goal.get("repo") or ".")).expanduser()
+ # Import lazily: the delegation projection reuses the Turn host owner,
+ # whose package also imports envelope_agent_context for later lifecycle
+ # phases.
+ from .collaboration.delegation_context import project_delegation_context
+
+ projected_observations.setdefault(
+ "delegation_context",
+ project_delegation_context(
+ runtime_root=runtime_root,
+ registry_path=registry_path,
+ goal_id=str(scope.get("goal_id") or ""),
+ agent_id=str(scope.get("agent_id") or ""),
+ project=project,
+ execution_config=(
+ str(orchestration.get("execution_config") or "") or None
+ ),
+ ),
+ )
+ return project_agent_context(
+ phase=phase,
+ scope=scope,
+ orchestration=orchestration,
+ observations=projected_observations,
+ )
+
+
+def _signed_delegation_observation(context: Mapping[str, Any]) -> Mapping[str, Any] | None:
+ contributions = context.get("contributions")
+ if not isinstance(contributions, list):
+ return None
+ for contribution in contributions:
+ if not isinstance(contribution, Mapping):
+ continue
+ if contribution.get("capability_id") != "multi_subagent":
+ continue
+ facts = contribution.get("facts")
+ if not isinstance(facts, Mapping):
+ continue
+ value = facts.get("delegation_context")
+ if isinstance(value, Mapping):
+ return value
+ return None
+
+
def envelope_agent_context(
envelope: Mapping[str, Any],
*,
@@ -35,11 +101,15 @@ def envelope_agent_context(
if not isinstance(context, Mapping):
return None
boundary = envelope.get("boundary") or {}
+ projected_observations = dict(observations or {})
+ signed_delegation = _signed_delegation_observation(context)
+ if signed_delegation is not None:
+ projected_observations.setdefault("delegation_context", signed_delegation)
return project_agent_context(
phase=phase,
scope=context["scope"],
orchestration=boundary.get("orchestration") or {},
- observations=observations,
+ observations=projected_observations,
)
diff --git a/loopx/control_plane/collaboration/delegation_context.py b/loopx/control_plane/collaboration/delegation_context.py
new file mode 100644
index 0000000000..8b0d9de944
--- /dev/null
+++ b/loopx/control_plane/collaboration/delegation_context.py
@@ -0,0 +1,161 @@
+"""Public-safe planning observations for authorized local delegation routes.
+
+The local delegation configuration remains the execution-grant owner. This
+module only turns its requester-scoped directory and existing operation journal
+into a bounded context observation; it never launches, resumes or accepts work.
+"""
+
+from __future__ import annotations
+
+from collections import Counter
+from datetime import datetime, timezone
+from pathlib import Path
+from typing import Any
+
+from ..effect_runtime import EffectRuntimeRemoteError
+from ..operator_provider import operator_provider_environ
+from ..turn_driver.host_binding import managed_executor_binding_from_host_args
+
+
+MAX_PROJECTED_ROUTES = 6
+MAX_OPERATION_RECEIPTS = 10
+
+
+def _observed_at() -> str:
+ return datetime.now(timezone.utc).replace(microsecond=0).isoformat()
+
+
+def _configuration_path(project: Path, config_ref: str) -> Path:
+ root = project.expanduser().resolve()
+ candidate = root / config_ref
+ current = root
+ for part in Path(config_ref).parts:
+ current /= part
+ if current.is_symlink():
+ raise ValueError("delegation configuration must not use symbolic links")
+ path = candidate.resolve()
+ if not path.is_relative_to(root):
+ raise ValueError("delegation configuration escaped the Goal project")
+ if not path.is_file():
+ raise ValueError("delegation configuration is unavailable")
+ return path
+
+
+def _route(binding: dict[str, Any], *, runtime_root: Path) -> dict[str, Any]:
+ executor = managed_executor_binding_from_host_args(
+ binding["host_args"],
+ environ=operator_provider_environ(runtime_root),
+ )
+ available = executor.get("available")
+ readiness = (
+ "ready" if available is True else "blocked" if available is False else "unknown"
+ )
+ row: dict[str, Any] = {
+ "binding_id": binding["id"],
+ "agent_id": binding["agent_id"],
+ "todo_id": binding["todo_id"],
+ "runtime_id": executor.get("executor") or "unknown",
+ "executor_kind": executor.get("executor_kind") or "generic",
+ "readiness": readiness,
+ }
+ profile = str(executor.get("execution_profile") or "").strip()
+ if profile:
+ row["execution_profile"] = profile
+ reason = str(executor.get("unavailable_reason") or "").strip()
+ if reason:
+ row["reason_code"] = reason
+ return row
+
+
+def project_delegation_context(
+ *,
+ runtime_root: Path,
+ registry_path: Path,
+ goal_id: str,
+ agent_id: str,
+ project: Path,
+ execution_config: str | None,
+) -> dict[str, Any]:
+ """Return one bounded requester-scoped route and receipt observation."""
+
+ observed_at = _observed_at()
+ if not execution_config:
+ return {
+ "schema_version": "loopx_delegation_context_v0",
+ "configuration_state": "not_configured",
+ "observed_at": observed_at,
+ "authorized_count": 0,
+ "projected_count": 0,
+ "routes": [],
+ "operation_receipts": {"observed": 0},
+ }
+
+ try:
+ from ...collaboration_mcp import Delegations
+
+ config_path = _configuration_path(project, execution_config)
+ service = Delegations(
+ runtime_root, registry_path, goal_id, agent_id, config_path
+ )
+ directory = service.directory()
+ bindings = directory.get("bindings")
+ if not isinstance(bindings, list):
+ raise ValueError("delegation directory is unavailable")
+ routes = [
+ _route(service.binding(str(row["id"])), runtime_root=runtime_root)
+ for row in bindings[:MAX_PROJECTED_ROUTES]
+ ]
+ inventory = service.operations(limit=MAX_OPERATION_RECEIPTS)
+ items = inventory.get("items") if isinstance(inventory, dict) else []
+ statuses = Counter(
+ str(item.get("status") or "unavailable")
+ for item in items
+ if isinstance(item, dict)
+ )
+ recovery_required = sum(
+ 1
+ for item in items
+ if isinstance(item, dict) and item.get("recovery_required") is True
+ )
+ receipt_summary: dict[str, Any] = {
+ "observed": len(items),
+ **{
+ key: statuses[key]
+ for key in (
+ "prepared",
+ "running",
+ "turn_returned",
+ "accepted",
+ "rejected",
+ "unavailable",
+ )
+ if statuses[key]
+ },
+ }
+ if recovery_required:
+ receipt_summary["recovery_required"] = recovery_required
+ if inventory.get("has_more") is True:
+ receipt_summary["has_more"] = True
+ return {
+ "schema_version": "loopx_delegation_context_v0",
+ "configuration_state": "ready",
+ "observed_at": observed_at,
+ "authorized_count": len(bindings),
+ "projected_count": len(routes),
+ "routes": routes,
+ "operation_receipts": receipt_summary,
+ }
+ except (OSError, ValueError, KeyError, TypeError, EffectRuntimeRemoteError):
+ return {
+ "schema_version": "loopx_delegation_context_v0",
+ "configuration_state": "blocked",
+ "reason_code": "delegation_context_unavailable",
+ "observed_at": observed_at,
+ "authorized_count": 0,
+ "projected_count": 0,
+ "routes": [],
+ "operation_receipts": {"observed": 0},
+ }
+
+
+__all__ = ["project_delegation_context"]
diff --git a/loopx/control_plane/quota/live_decision.py b/loopx/control_plane/quota/live_decision.py
index 62a5a6ef62..d364441f08 100644
--- a/loopx/control_plane/quota/live_decision.py
+++ b/loopx/control_plane/quota/live_decision.py
@@ -7,7 +7,8 @@
from typing import Any
from ...quota import build_quota_should_run
-from ..agent_context import project_agent_context
+from ...agent_registry import load_goal_from_registry
+from ..agent_context import project_agent_context, project_goal_agent_context
from ..capability_hooks import (
InteractionProjectionHookRegistration,
dispatch_interaction_projection_hooks,
@@ -529,15 +530,26 @@ def build_live_quota_should_run_decision(
}
interaction = payload.get("interaction_contract")
if isinstance(interaction, dict) and goal_id and agent_id:
- context = project_agent_context(
- phase="before_plan",
- scope={
- "goal_id": goal_id,
- "agent_id": agent_id,
- "todo_id": (payload.get("selected_todo") or {}).get("todo_id"),
- },
- orchestration=(payload.get("goal_boundary") or {}).get("orchestration") or {},
- )
+ scope = {
+ "goal_id": goal_id,
+ "agent_id": agent_id,
+ "todo_id": (payload.get("selected_todo") or {}).get("todo_id"),
+ }
+ goal = load_goal_from_registry(registry_path, goal_id)
+ if goal is not None:
+ context = project_goal_agent_context(
+ phase="before_plan",
+ scope=scope,
+ goal=goal,
+ registry_path=registry_path,
+ runtime_root=runtime_root,
+ )
+ else:
+ context = project_agent_context(
+ phase="before_plan",
+ scope=scope,
+ orchestration=(payload.get("goal_boundary") or {}).get("orchestration") or {},
+ )
if context is not None:
interaction["agent_context"] = context
bind_scheduler_followup_cli_routes(
diff --git a/loopx/control_plane/subagent_context.ts b/loopx/control_plane/subagent_context.ts
index 90cae15756..5b6ade169b 100644
--- a/loopx/control_plane/subagent_context.ts
+++ b/loopx/control_plane/subagent_context.ts
@@ -4,22 +4,22 @@ import type { JsonObject } from "./effect_program.ts";
import { jsonObject, requireJsonObject } from "./runtime_decode.ts";
export const subagentContextProvider: AgentContextProvider = {
- hookId: "multi_subagent.coordinator", capabilityId: "multi_subagent", revision: "v2",
+ hookId: "multi_subagent.coordinator", capabilityId: "multi_subagent", revision: "v3",
phases: AGENT_CONTEXT_PHASES,
produce(input, config) {
const guidance = {
before_plan: [
- "For read-heavy tasks, prefer parallel delegation of multiple fresh, independent evidence questions, including within one Todo, up to the configured child limit. Actively look for useful splits before keeping the research serial; avoid duplicate reads or concurrency for its own sake.",
- "For native child tools, read loopx agent-context with the current --goal-id and --agent-id at --phase before_delegate and --phase after_delegate_result. These read-only calls do not start turns or spend quota.",
- "Reserve a distinct, decision-relevant evidence question for the coordinator to investigate while children work, when useful independent work exists. Integration and child review do not replace that investigation. Wait only when remaining useful work depends on child results; do not invent busywork.",
+ "Split bounded independent work when useful; avoid duplicate reads. Keep one decision-relevant coordinator question.",
+ "Native child tools can read loopx agent-context at before_delegate and after_delegate_result; these calls do not start Turns or spend quota.",
+ "Authorized routes are observations, not obligations. Use a ready route only when it fits; blocked/unknown routes never block native work. No heartbeat must use every route.",
],
before_delegate: [
- "Give each child a bounded question, sources, read/write limits, expected evidence and stopping condition. Identify the coordinator's concurrent question and dependencies; reuse prior findings and avoid duplicating the children's reads. If no independent work remains, explain the dependency rather than forcing a split.",
- "Explicitly pass the configured model and reasoning effort when the host supports them. Check host availability; never silently substitute. Preferences are not execution receipts.",
+ "Give each child a bounded question, sources, read/write limits, expected evidence and stopping condition; identify dependencies and the coordinator's concurrent question.",
+ "For an authorized route, use its binding entrypoint and recheck the chosen runtime, execution profile and budget. Never silently substitute a runtime/model; record the selection reason and stable operation id. Preferences and readiness observations are not execution receipts.",
],
after_delegate_result: [
- "Check returned sources, omissions and contradictions against the question. Missing or rejected receipts do not establish completed work.",
- "Verify decisive sources and record accept/defer/reject with reasons; link accepted evidence to the plan and deliverable. Revisit uncovered questions using both coordinator and child findings. Waiting on one question need not block other useful research. Run parent validation before writeback; opinions are not independent evidence.",
+ "Check returned sources, omissions and contradictions against the question. Reconcile native child receipts and bound delegation operation receipts; missing, unavailable or rejected receipts do not establish completed work.",
+ "Verify decisive sources and record accept/defer/reject with reasons. Link accepted evidence to the deliverable and run parent validation before writeback; opinions are not independent evidence.",
],
}[input.phase];
const facts: JsonObject = {
@@ -28,6 +28,10 @@ export const subagentContextProvider: AgentContextProvider = {
};
const count = input.observations.child_count;
if (Number.isInteger(count) && Number(count) >= 0) facts.child_count = count;
+ const delegation = boundedDelegationContext(input.observations.delegation_context);
+ if (delegation && input.phase !== "after_delegate_result") {
+ facts.delegation_context = delegation;
+ }
if (input.phase === "after_delegate_result") {
const counts = jsonObject(input.observations.reconciliation_counts);
facts.receipt_observation = counts ? "host_reconciled" : "not_supplied";
@@ -35,6 +39,11 @@ export const subagentContextProvider: AgentContextProvider = {
Object.entries(counts).filter(([key, item]) =>
/^[a-z_]{1,40}$/u.test(key) && Number.isInteger(item) && Number(item) >= 0),
);
+ if (delegation) facts.delegation_receipts = {
+ configuration_state: delegation.configuration_state,
+ observed_at: delegation.observed_at,
+ operation_receipts: delegation.operation_receipts,
+ };
}
return { guidance, facts, source_refs: [
"goal_boundary.orchestration", "docs/integrations/codex-subagent-orchestration.md",
@@ -42,6 +51,74 @@ export const subagentContextProvider: AgentContextProvider = {
},
};
+function boundedDelegationContext(value: unknown): JsonObject | null {
+ const source = jsonObject(value);
+ if (!source || source.schema_version !== "loopx_delegation_context_v0") return null;
+ const configurationState = String(source.configuration_state ?? "");
+ if (!["not_configured", "ready", "blocked"].includes(configurationState)) return null;
+ const observedAt = String(source.observed_at ?? "");
+ if (!/^\d{4}-\d{2}-\d{2}T[^\s]{1,40}$/u.test(observedAt)) return null;
+ const boundedCount = (input: unknown) => Number.isInteger(input) && Number(input) >= 0
+ ? Math.min(Number(input), 10_000) : 0;
+ const identifier = (input: unknown) => typeof input === "string"
+ && /^[A-Za-z0-9][A-Za-z0-9._:/-]{0,159}$/u.test(input) ? input : null;
+ const routes = Array.isArray(source.routes) ? source.routes.slice(0, 6).flatMap(item => {
+ const route = jsonObject(item);
+ if (!route) return [];
+ const bindingId = identifier(route.binding_id), agentId = identifier(route.agent_id);
+ const todoId = identifier(route.todo_id), runtimeId = identifier(route.runtime_id);
+ const readiness = String(route.readiness ?? "");
+ if (!bindingId || !agentId || !todoId || !runtimeId
+ || !["ready", "blocked", "unknown"].includes(readiness)) return [];
+ const compact: JsonObject = {
+ binding_id: bindingId, agent_id: agentId, todo_id: todoId,
+ runtime_id: runtimeId, readiness,
+ };
+ const executorKind = identifier(route.executor_kind);
+ const profile = typeof route.execution_profile === "string"
+ && /^[A-Za-z0-9][A-Za-z0-9._:/@-]{0,199}$/u.test(route.execution_profile)
+ ? route.execution_profile : null;
+ const reason = identifier(route.reason_code);
+ if (executorKind) compact.executor_kind = executorKind;
+ if (profile) compact.execution_profile = profile;
+ if (reason) compact.reason_code = reason;
+ return [compact];
+ }) : [];
+ const rawReceipts = jsonObject(source.operation_receipts) ?? {};
+ const operationReceipts: JsonObject = {};
+ for (const key of ["observed", "prepared", "running", "turn_returned", "accepted",
+ "rejected", "unavailable", "recovery_required"]) {
+ if (Number.isInteger(rawReceipts[key]) && Number(rawReceipts[key]) >= 0) {
+ operationReceipts[key] = Math.min(Number(rawReceipts[key]), 10_000);
+ }
+ }
+ if (rawReceipts.has_more === true) operationReceipts.has_more = true;
+ const result: JsonObject = {
+ schema_version: "loopx_delegation_context_v0",
+ configuration_state: configurationState,
+ observed_at: observedAt,
+ authorized_count: boundedCount(source.authorized_count),
+ projected_count: 0,
+ entrypoint: "loopx delegation",
+ routes: [],
+ operation_receipts: operationReceipts,
+ };
+ const reason = identifier(source.reason_code);
+ if (reason) result.reason_code = reason;
+ const projectedRoutes: JsonObject[] = [];
+ for (const route of routes) {
+ const candidate = { ...result, projected_count: projectedRoutes.length + 1,
+ routes: [...projectedRoutes, route] };
+ if (new TextEncoder().encode(JSON.stringify(candidate)).length > 900) break;
+ projectedRoutes.push(route);
+ }
+ result.projected_count = projectedRoutes.length;
+ result.routes = projectedRoutes;
+ if (boundedCount(source.authorized_count) > projectedRoutes.length
+ || routes.length > projectedRoutes.length) result.routes_truncated = true;
+ return result;
+}
+
export function evaluateSubagentContext(value: unknown): JsonObject | null {
const input = requireJsonObject(value, "subagent context");
const policy = jsonObject(input.orchestration) ?? {};
diff --git a/loopx/control_plane/turn_driver/host_binding.py b/loopx/control_plane/turn_driver/host_binding.py
index 4aa541ec8f..1542333c7e 100644
--- a/loopx/control_plane/turn_driver/host_binding.py
+++ b/loopx/control_plane/turn_driver/host_binding.py
@@ -31,7 +31,7 @@
from __future__ import annotations
import importlib.util
-from collections.abc import Mapping
+from collections.abc import Mapping, Sequence
from typing import Any, Callable
from ..operator_credential import (
@@ -272,6 +272,44 @@ def managed_executor_binding(
}
+def managed_executor_binding_from_host_args(
+ host_args: Sequence[str],
+ *,
+ environ: Mapping[str, str] | None = None,
+ module_probe: Callable[[str], bool] | None = None,
+) -> dict[str, Any]:
+ """Project one trusted Turn argv binding through the existing host owner.
+
+ This is deliberately a read model: it selects no host, executes no probe
+ command and returns none of the raw argv. Optional host-specific profile
+ flags are interpreted here, beside their owning Turn host, so coordinator
+ capabilities can consume one provider-neutral executor projection.
+ """
+
+ args = [str(value) for value in host_args]
+
+ def option(name: str) -> str | None:
+ for index in range(len(args) - 1, -1, -1):
+ value = args[index]
+ if value.startswith(f"{name}="):
+ return value.partition("=")[2].strip() or None
+ if value == name:
+ if index + 1 >= len(args):
+ return None
+ return args[index + 1].strip() or None
+ return None
+
+ host = option("--host") or "unknown"
+ return managed_executor_binding(
+ host,
+ environ=environ,
+ module_probe=module_probe,
+ provider=option("--dsh-provider"),
+ model=option("--dsh-model"),
+ reasoning_effort=option("--dsh-reasoning-effort"),
+ )
+
+
def managed_executor_payload_entry(plan: Mapping[str, Any]) -> dict[str, Any]:
"""Return the execution payload's ``managed_executor`` entry, when planned.
diff --git a/loopx/orchestration.py b/loopx/orchestration.py
index b6ef5d954e..74725808f6 100644
--- a/loopx/orchestration.py
+++ b/loopx/orchestration.py
@@ -1,5 +1,6 @@
from __future__ import annotations
+from pathlib import PurePosixPath
from typing import Any
import re
@@ -50,6 +51,31 @@ def validate_subagent_model_config(value: Any) -> dict[str, str]:
return result
+def normalize_subagent_execution_config(value: Any) -> str:
+ """Normalize the Goal's local-private delegation binding pointer.
+
+ The pointer is safe to persist and project because it is repo-relative;
+ the binding file itself remains ignored local state and is never copied
+ into Goal context.
+ """
+
+ text = str(value or "").strip().replace("\\", "/")
+ path = PurePosixPath(text)
+ if (
+ not text
+ or path.is_absolute()
+ or ".." in path.parts
+ or len(path.parts) < 3
+ or path.parts[:2] != (".loopx", "config")
+ or path.suffix != ".json"
+ ):
+ raise ValueError(
+ "subagent execution config must be a repo-relative JSON path "
+ "under .loopx/config/"
+ )
+ return path.as_posix()
+
+
def subagent_model_configuration_options(value: Any) -> dict[str, Any]:
"""Translate a complete UI preference: null clears, an object replaces."""
if value is None:
@@ -126,6 +152,10 @@ def compact_orchestration_policy(spawn_policy: Any) -> dict[str, Any]:
}
if "model_config" in policy:
compact["model_config"] = validate_subagent_model_config(policy["model_config"])
+ if policy.get("execution_config"):
+ compact["execution_config"] = normalize_subagent_execution_config(
+ policy["execution_config"]
+ )
compact_domains = [str(value) for value in allowed_domains if str(value).strip()]
if compact_domains:
compact["allowed_domains"] = compact_domains
@@ -211,6 +241,8 @@ def update_spawn_execution_policy(
subagent_model: str | None,
subagent_reasoning_effort: str | None,
clear_subagent_model_config: bool,
+ subagent_execution_config: str | None,
+ clear_subagent_execution_config: bool,
allowed_domains: list[str] | None,
clear_allowed_domains: bool,
default_max_children: int,
@@ -222,6 +254,12 @@ def update_spawn_execution_policy(
subagent_reasoning_effort=subagent_reasoning_effort,
clear_subagent_model_config=clear_subagent_model_config,
)
+ if clear_subagent_execution_config:
+ spawn_policy.pop("execution_config", None)
+ elif subagent_execution_config is not None:
+ spawn_policy["execution_config"] = normalize_subagent_execution_config(
+ subagent_execution_config
+ )
if multi_subagent_feature == "enabled":
spawn_policy["mode"] = MULTI_SUBAGENT_ORCHESTRATION_MODE
spawn_policy["allowed"] = True
diff --git a/tests/control_plane/test_delegation_context.py b/tests/control_plane/test_delegation_context.py
new file mode 100644
index 0000000000..948f96ca31
--- /dev/null
+++ b/tests/control_plane/test_delegation_context.py
@@ -0,0 +1,162 @@
+from __future__ import annotations
+
+import json
+from pathlib import Path
+
+from loopx.control_plane.agent_context import project_goal_agent_context
+from loopx.control_plane.collaboration import delegation_context
+
+
+def _fixture(tmp_path: Path) -> tuple[Path, Path, Path]:
+ project = tmp_path / "project"
+ config_dir = project / ".loopx" / "config"
+ config_dir.mkdir(parents=True)
+ registry = tmp_path / "registry.json"
+ registry.write_text(
+ json.dumps(
+ {
+ "schema_version": 1,
+ "goals": [
+ {
+ "id": "goal-a",
+ "repo": str(project),
+ "status": "active",
+ "coordination": {
+ "registered_agents": ["coordinator", "worker"]
+ },
+ }
+ ],
+ }
+ )
+ )
+ config = config_dir / "delegations.json"
+ config.write_text(
+ json.dumps(
+ {
+ "schema_version": "loopx_local_delegation_v0",
+ "bindings": [
+ {
+ "id": "independent-review",
+ "agent_id": "worker",
+ "todo_id": "todo-review",
+ "requesters": ["coordinator"],
+ "workspace": str(tmp_path / "worker"),
+ "host_args": ["--host", "generic-cli"],
+ "timeout_seconds": 60,
+ "output_refs": ["result.json"],
+ }
+ ],
+ }
+ )
+ )
+ return project, registry, tmp_path / "runtime"
+
+
+def test_projects_authorized_route_without_private_binding_material(
+ tmp_path: Path, monkeypatch
+) -> None:
+ project, registry, runtime = _fixture(tmp_path)
+ monkeypatch.setattr(
+ delegation_context,
+ "managed_executor_binding_from_host_args",
+ lambda *_args, **_kwargs: {
+ "executor": "managed-runtime",
+ "executor_kind": "managed",
+ "execution_profile": "model-a@high",
+ "available": True,
+ "unavailable_reason": None,
+ },
+ )
+ packet = delegation_context.project_delegation_context(
+ runtime_root=runtime,
+ registry_path=registry,
+ goal_id="goal-a",
+ agent_id="coordinator",
+ project=project,
+ execution_config=".loopx/config/delegations.json",
+ )
+ assert packet["configuration_state"] == "ready"
+ assert packet["authorized_count"] == packet["projected_count"] == 1
+ assert packet["operation_receipts"] == {"observed": 0}
+ assert packet["routes"] == [
+ {
+ "binding_id": "independent-review",
+ "agent_id": "worker",
+ "todo_id": "todo-review",
+ "runtime_id": "managed-runtime",
+ "executor_kind": "managed",
+ "readiness": "ready",
+ "execution_profile": "model-a@high",
+ }
+ ]
+ encoded = json.dumps(packet)
+ assert str(project) not in encoded
+ assert "host_args" not in encoded
+ assert "output_refs" not in encoded
+
+
+def test_missing_config_is_blocked_observation_not_empty_success(tmp_path: Path) -> None:
+ project, registry, runtime = _fixture(tmp_path)
+ packet = delegation_context.project_delegation_context(
+ runtime_root=runtime,
+ registry_path=registry,
+ goal_id="goal-a",
+ agent_id="coordinator",
+ project=project,
+ execution_config=".loopx/config/missing.json",
+ )
+ assert packet["configuration_state"] == "blocked"
+ assert packet["reason_code"] == "delegation_context_unavailable"
+ assert packet["routes"] == []
+
+
+def test_symlinked_config_is_blocked_even_when_target_is_inside_project(
+ tmp_path: Path,
+) -> None:
+ project, registry, runtime = _fixture(tmp_path)
+ config = project / ".loopx" / "config" / "delegations.json"
+ real_config = config.with_name("delegations-real.json")
+ config.rename(real_config)
+ config.symlink_to(real_config)
+
+ packet = delegation_context.project_delegation_context(
+ runtime_root=runtime,
+ registry_path=registry,
+ goal_id="goal-a",
+ agent_id="coordinator",
+ project=project,
+ execution_config=".loopx/config/delegations.json",
+ )
+
+ assert packet["configuration_state"] == "blocked"
+ assert packet["reason_code"] == "delegation_context_unavailable"
+
+
+def test_disabled_capability_does_not_read_retained_execution_config(
+ tmp_path: Path, monkeypatch
+) -> None:
+ project, registry, runtime = _fixture(tmp_path)
+ monkeypatch.setattr(
+ delegation_context,
+ "project_delegation_context",
+ lambda **_kwargs: (_ for _ in ()).throw(AssertionError("must not read")),
+ )
+
+ context = project_goal_agent_context(
+ phase="before_plan",
+ scope={"goal_id": "goal-a", "agent_id": "coordinator", "todo_id": None},
+ goal={
+ "id": "goal-a",
+ "repo": str(project),
+ "spawn_policy": {
+ "mode": "multi_subagent",
+ "allowed": False,
+ "max_children": 2,
+ "execution_config": ".loopx/config/delegations.json",
+ },
+ },
+ registry_path=registry,
+ runtime_root=runtime,
+ )
+
+ assert context is None
diff --git a/tests/control_plane/test_subagent_model_configuration.py b/tests/control_plane/test_subagent_model_configuration.py
index e04e269c9c..6eedcf9445 100644
--- a/tests/control_plane/test_subagent_model_configuration.py
+++ b/tests/control_plane/test_subagent_model_configuration.py
@@ -111,6 +111,56 @@ def test_incremental_update_off_and_clear_preserve_boundaries(registry: Path) ->
assert cleared["after"]["orchestration"]["max_children"] == 0
+def test_execution_config_is_local_private_pointer_and_survives_disable(
+ registry: Path,
+) -> None:
+ configured = configure_goal(
+ registry_path=registry,
+ goal_id="example",
+ multi_subagent_feature="enabled",
+ max_children=2,
+ subagent_execution_config=".loopx/config/delegations.json",
+ execute=True,
+ )
+ assert configured["after"]["orchestration"]["execution_config"] == (
+ ".loopx/config/delegations.json"
+ )
+ disabled = configure_goal(
+ registry_path=registry,
+ goal_id="example",
+ multi_subagent_feature="off",
+ execute=True,
+ )
+ assert disabled["after"]["orchestration"]["execution_config"] == (
+ ".loopx/config/delegations.json"
+ )
+ cleared = configure_goal(
+ registry_path=registry,
+ goal_id="example",
+ clear_subagent_execution_config=True,
+ execute=True,
+ )
+ assert "execution_config" not in cleared["after"]["orchestration"]
+
+
+@pytest.mark.parametrize(
+ "value",
+ ["delegations.json", "../delegations.json", "/tmp/delegations.json", ".loopx/config/delegations.yml"],
+)
+def test_execution_config_rejects_non_private_pointer(
+ registry: Path, value: str
+) -> None:
+ before = registry.read_bytes()
+ with pytest.raises(ValueError, match="repo-relative JSON path"):
+ configure_goal(
+ registry_path=registry,
+ goal_id="example",
+ subagent_execution_config=value,
+ execute=True,
+ )
+ assert registry.read_bytes() == before
+
+
@pytest.mark.parametrize(
"kwargs",
[
@@ -268,3 +318,18 @@ def _send_error(self, message, **kwargs):
actual = json.loads(registry.read_text())["goals"][0]["spawn_policy"]
assert actual.get("model_config") == expected
assert actual["allowed"] is False
+
+ handler.body = {
+ **base,
+ "execution_config": ".loopx/config/delegations.json",
+ }
+ handler._goal_subagent_configuration(apply=False)
+ assert handler.response["after"]["orchestration"]["execution_config"] == (
+ ".loopx/config/delegations.json"
+ )
+ handler.body["preview_id"] = handler.response["preview_id"]
+ handler._goal_subagent_configuration(apply=True)
+ assert handler.response["status"] == 200
+ assert json.loads(registry.read_text())["goals"][0]["spawn_policy"][
+ "execution_config"
+ ] == ".loopx/config/delegations.json"
diff --git a/tests/control_plane_ts/agent_context.test.ts b/tests/control_plane_ts/agent_context.test.ts
index bc4722ddc1..c24f84f8c6 100644
--- a/tests/control_plane_ts/agent_context.test.ts
+++ b/tests/control_plane_ts/agent_context.test.ts
@@ -103,6 +103,78 @@ test("return phase projects reconciliation counts without copying raw child mate
assert.ok(!JSON.stringify(packet).includes("private original text"));
});
+test("delegation routes and receipts are bounded public-safe lifecycle facts", () => {
+ const delegationContext = {
+ schema_version: "loopx_delegation_context_v0",
+ configuration_state: "ready",
+ observed_at: "2026-09-19T04:20:00+00:00",
+ authorized_count: 8,
+ projected_count: 8,
+ reason_code: "unused-private-reason",
+ routes: [
+ {
+ binding_id: "review-route", agent_id: "reviewer", todo_id: "todo-review",
+ runtime_id: "managed-runtime", executor_kind: "managed", readiness: "ready",
+ entrypoint: "malicious replacement", execution_profile: "model-a@high",
+ host_args: ["--secret", "credential"], workspace: "/private/worktree",
+ },
+ {
+ binding_id: "bad route with spaces", agent_id: "ignored", todo_id: "ignored",
+ runtime_id: "ignored", readiness: "ready",
+ },
+ ],
+ operation_receipts: {
+ observed: 12, accepted: 3, unavailable: 1, recovery_required: 1,
+ private_result: "raw child material",
+ },
+ };
+ const before = evaluateSubagentContext({ phase: "before_plan", scope,
+ orchestration: policy, observations: { delegation_context: delegationContext } })!;
+ const beforeFacts = (before.contributions as any[])[0].facts;
+ assert.equal(beforeFacts.delegation_context.projected_count, 1);
+ assert.equal(beforeFacts.delegation_context.entrypoint, "loopx delegation");
+ assert.equal(beforeFacts.delegation_context.routes[0].execution_profile, "model-a@high");
+ assert.ok(!JSON.stringify(before).includes("credential"));
+ assert.ok(!JSON.stringify(before).includes("/private/worktree"));
+ assert.ok(!JSON.stringify(before).includes("raw child material"));
+
+ const after = evaluateSubagentContext({ phase: "after_delegate_result", scope,
+ orchestration: policy, observations: { delegation_context: delegationContext } })!;
+ const afterFacts = (after.contributions as any[])[0].facts;
+ assert.equal(afterFacts.delegation_context, undefined);
+ assert.deepEqual(afterFacts.delegation_receipts, {
+ configuration_state: "ready",
+ observed_at: "2026-09-19T04:20:00+00:00",
+ operation_receipts: {
+ observed: 12, accepted: 3, unavailable: 1, recovery_required: 1,
+ },
+ });
+ assert.ok(Buffer.byteLength(JSON.stringify(after)) <= 3072);
+});
+
+test("maximum delegation directory stays within provider budget", () => {
+ const routes = Array.from({ length: 6 }, (_, index) => ({
+ binding_id: `review-route-${index}`, agent_id: `reviewer-${index}`,
+ todo_id: `todo-review-${index}`, runtime_id: "managed-runtime",
+ executor_kind: "managed", readiness: "ready",
+ execution_profile: "fixture-provider/fixture-model@max",
+ }));
+ const packet = evaluateSubagentContext({ phase: "before_plan", scope,
+ orchestration: { ...policy, max_children: 6 }, observations: {
+ delegation_context: {
+ schema_version: "loopx_delegation_context_v0", configuration_state: "ready",
+ observed_at: "2026-09-19T04:20:00+00:00", authorized_count: 6,
+ projected_count: 6, routes, operation_receipts: { observed: 10, accepted: 10 },
+ },
+ } })!;
+ assert.deepEqual(packet.failures, []);
+ const delegation = (packet.contributions as any[])[0].facts.delegation_context;
+ assert.ok(delegation.projected_count >= 1 && delegation.projected_count <= 6);
+ assert.equal(delegation.routes.length, delegation.projected_count);
+ assert.equal(delegation.routes_truncated, delegation.projected_count < 6 || undefined);
+ assert.ok(Buffer.byteLength(JSON.stringify(packet.contributions[0])) <= 2048);
+});
+
// Rich model identifiers and the complete participation guidance must survive
// the actual provider budget, not disappear as an isolated provider failure.
test("coordinator participation guidance survives all bounded lifecycle projections", () => {
@@ -113,7 +185,7 @@ test("coordinator participation guidance survives all bounded lifecycle projecti
} })!;
assert.deepEqual(packet.failures, []);
const [contribution] = packet.contributions as Record
{t("drawer.subagentModel")}: {subagentPreview.modelConfig?.model || t("drawer.subagentModelDefault")} · {subagentPreview.modelConfig?.reasoning_effort || t("drawer.subagentModelDefault")}
: null} +{t("drawer.subagentExecutionConfig")}: {subagentPreview.executionConfig || t("drawer.subagentExecutionConfigNone")}
{t("drawer.subagentRemoteReadOnly")}
@@ -793,6 +806,17 @@ export function ContextDrawer({ agents, attentionHistory = [], onSelectAttention{t("drawer.subagentModelHint")}
+ +{t("drawer.subagentExecutionConfigHint")}
{zh ? "复用现有协作执行配置,文件须位于 .loopx/config/。额度包含协调员历史用量;成员沿用各自授权,不随开启扩大。" : "Reuse an existing delegation configuration under .loopx/config/. The allowance includes coordinator history; member grants remain separate."}
-{zh ? "绑定文件由 Goal 子代理设置统一管理;额度包含协调员历史用量,成员授权不会因开启模式而扩大。" : "Manage the binding file in Goal sub-agent settings. The allowance includes coordinator history; enabling this mode does not expand member grants."}
+ : null} {snapshot?.enabled && snapshot.native.tokensUsed !== undefined ?{zh ? "协调员累计用量" : "Coordinator usage"} {snapshot.native.tokensUsed.toLocaleString()} / {snapshot.native.tokenBudget?.toLocaleString() ?? "—"} tokens
: null} {snapshot?.enabled && snapshot.ingress.some(row => row.status !== "delivered") ?{zh ? "待处理消息:" : "Pending messages: "}{snapshot.ingress.filter(row => row.status !== "delivered").map(row => `${row.mode === "loopx_queue" ? "queue" : "inbox"} · ${row.status}`).join(" / ")}
: null} {snapshot?.enabled && snapshot.deliveries.length ?